/hg/icedtea-web: Removed redeclared line.separator
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Tue Jun 16 08:49:30 UTC 2015
changeset e2583f1178ce in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=e2583f1178ce
author: Jiri Vanek <jvanek at redhat.com>
date: Tue Jun 16 10:49:03 2015 +0200
Removed redeclared line.separator
* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java: newline constructed using PlainTextFormatter.getLineSeparator()
* netx/net/sourceforge/jnlp/security/policyeditor/PolicyFileModel.java: same for append call
* net/sourceforge/jnlp/util/logging/TeeOutputStream.java: same for lineSeparator
* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorParsingTest.java: same for LINEBREAK
* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java: constant of LINE_SEPARATOR removed, (getLineSeparator) now returns line.separator property, obtained via doPrivlidged block. (getNewLine) adapted
diffstat:
ChangeLog | 15 ++++++++++
netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java | 3 +-
netx/net/sourceforge/jnlp/security/policyeditor/PolicyFileModel.java | 4 +-
netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java | 7 ++--
netx/net/sourceforge/jnlp/util/logging/TeeOutputStream.java | 10 +++---
tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorParsingTest.java | 3 +-
6 files changed, 29 insertions(+), 13 deletions(-)
diffs (168 lines):
diff -r f79e6b8cde0c -r e2583f1178ce ChangeLog
--- a/ChangeLog Tue Jun 16 10:37:09 2015 +0200
+++ b/ChangeLog Tue Jun 16 10:49:03 2015 +0200
@@ -1,3 +1,18 @@
+2015-06-16 Jiri Vanek <jvanek at redhat.com>
+
+ Removed redeclared line.separator
+ * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java:
+ newline constructed using PlainTextFormatter.getLineSeparator()
+ * netx/net/sourceforge/jnlp/security/policyeditor/PolicyFileModel.java:
+ same for append call
+ * net/sourceforge/jnlp/util/logging/TeeOutputStream.java:
+ same for lineSeparator
+ * tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorParsingTest.java:
+ same for LINEBREAK
+ * netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java:
+ constant of LINE_SEPARATOR removed, (getLineSeparator) now returns line.separator
+ property, obtained via doPrivlidged block. (getNewLine) adapted
+
2015-06-16 Jiri Vanek <jvanek at redhat.com>
Improved security package javadoc description
diff -r f79e6b8cde0c -r e2583f1178ce netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java Tue Jun 16 10:37:09 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java Tue Jun 16 10:49:03 2015 +0200
@@ -43,6 +43,7 @@
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.PlainTextFormatter;
/**
* This class represents a codebase entry in a policy file. This is defined as a policy entry block
@@ -169,7 +170,7 @@
if (codebase.isEmpty() && permissions.isEmpty() && customPermissions.isEmpty()) {
return "";
}
- final String newline = System.getProperty("line.separator");
+ final String newline = PlainTextFormatter.getLineSeparator();
final StringBuilder result = new StringBuilder();
result.append(newline);
diff -r f79e6b8cde0c -r e2583f1178ce netx/net/sourceforge/jnlp/security/policyeditor/PolicyFileModel.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyFileModel.java Tue Jun 16 10:37:09 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyFileModel.java Tue Jun 16 10:49:03 2015 +0200
@@ -44,7 +44,6 @@
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -55,6 +54,7 @@
import net.sourceforge.jnlp.util.FileUtils;
import net.sourceforge.jnlp.util.MD5SumWatcher;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.PlainTextFormatter;
import net.sourceforge.jnlp.util.logging.OutputController;
public class PolicyFileModel {
@@ -168,7 +168,7 @@
sb.append(AUTOGENERATED_NOTICE);
final String currentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
sb.append("\n/* Generated by PolicyEditor at ").append(currentDate).append(" */");
- sb.append(System.getProperty("line.separator"));
+ sb.append(PlainTextFormatter.getLineSeparator());
FileLock fileLock = null;
try {
fileLock = FileUtils.getFileLock(file.getAbsolutePath(), false, true);
diff -r f79e6b8cde0c -r e2583f1178ce netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java
--- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java Tue Jun 16 10:37:09 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java Tue Jun 16 10:49:03 2015 +0200
@@ -46,15 +46,14 @@
public class PlainTextFormatter extends ReplacingTextFormatter {
- private static final String LINE_SEPARATOR = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
private final Map<String, Integer> LongestKeys = new TreeMap<>();
private String currentSection = "none";
public static final String SUFFIX = "txt";
public static String getLineSeparator() {
- return LINE_SEPARATOR;
+ return java.security.AccessController.doPrivileged(
+ new sun.security.action.GetPropertyAction("line.separator"));
}
private final String pargraohIndentation;
@@ -98,7 +97,7 @@
@Override
public String getNewLine() {
- return LINE_SEPARATOR;
+ return getLineSeparator();
}
@Override
diff -r f79e6b8cde0c -r e2583f1178ce netx/net/sourceforge/jnlp/util/logging/TeeOutputStream.java
--- a/netx/net/sourceforge/jnlp/util/logging/TeeOutputStream.java Tue Jun 16 10:37:09 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/TeeOutputStream.java Tue Jun 16 10:49:03 2015 +0200
@@ -41,6 +41,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.PlainTextFormatter;
import net.sourceforge.jnlp.util.logging.OutputController.Level;
import net.sourceforge.jnlp.util.logging.headers.Header;
@@ -53,11 +54,9 @@
public final class TeeOutputStream extends PrintStream implements SingleStreamLogger{
// Everthing written to TeeOutputStream is written to our log too
-
private final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
private final boolean isError;
- private final String lineSeparator = System.getProperty("line.separator");
-
+
public TeeOutputStream(PrintStream stdStream, boolean isError) {
super(stdStream);
this.isError = isError;
@@ -116,7 +115,7 @@
private void appendByte(int b) {
byteArrayOutputStream.write(b);
String s = byteArrayOutputStream.toString();
- if (s.endsWith(lineSeparator)) {
+ if (s.endsWith(PlainTextFormatter.getLineSeparator())) {
flushLog();
}
}
@@ -124,7 +123,7 @@
private void appendByteArray(byte[] b, int off, int len) {
byteArrayOutputStream.write(b, off, len);
String s = new String(b, off, len);
- if (s.endsWith(lineSeparator)) {
+ if (s.endsWith(PlainTextFormatter.getLineSeparator())) {
flushLog();
}
}
@@ -143,4 +142,5 @@
copy.write(this.byteArrayOutputStream.toByteArray());
return copy;
}
+
}
diff -r f79e6b8cde0c -r e2583f1178ce tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorParsingTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorParsingTest.java Tue Jun 16 10:37:09 2015 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorParsingTest.java Tue Jun 16 10:49:03 2015 +0200
@@ -39,6 +39,7 @@
import java.util.Map;
import net.sourceforge.jnlp.annotations.KnownToFail;
import net.sourceforge.jnlp.util.FileUtils;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.PlainTextFormatter;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
@@ -50,7 +51,7 @@
private PolicyFileModel policyFileModel = new PolicyFileModel();
private Map<PolicyEditorPermissions, Boolean> permissions;
- private static final String LINEBREAK = System.getProperty("line.separator");
+ private static final String LINEBREAK = PlainTextFormatter.getLineSeparator();
private static final String READ_PERMISSION = "permission java.io.FilePermission \"${user.home}\", \"read\";";
private static final String WRITE_PERMISSION = "permission java.io.FilePermission \"${user.home}\", \"write\";";
More information about the distro-pkg-dev
mailing list