8035310: The line.separator property can be retrieved via public API
Reviewed-by: alexsch, serb
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Thu Feb 20 16:23:45 2014 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Fri Feb 21 15:28:09 2014 +0400
@@ -109,8 +109,7 @@
static {
- newline = java.security.AccessController.doPrivileged(
- new GetPropertyAction("line.separator"));
+ newline = System.lineSeparator();
if (newline == null) {
newline = "\n";
}
--- a/jdk/src/share/classes/javax/swing/text/AbstractWriter.java Thu Feb 20 16:23:45 2014 -0800
+++ b/jdk/src/share/classes/javax/swing/text/AbstractWriter.java Fri Feb 21 15:28:09 2014 +0400
@@ -141,10 +141,7 @@
setLineSeparator((String)docNewline);
}
else {
- String newline = null;
- try {
- newline = System.getProperty("line.separator");
- } catch (SecurityException se) {}
+ String newline = System.lineSeparator();
if (newline == null) {
// Should not get here, but if we do it means we could not
// find a newline string, use \n in this case.
--- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java Thu Feb 20 16:23:45 2014 -0800
+++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java Fri Feb 21 15:28:09 2014 +0400
@@ -317,9 +317,7 @@
int offs = pos;
Object endOfLineProperty = doc.getProperty(EndOfLineStringProperty);
if (endOfLineProperty == null) {
- try {
- endOfLineProperty = System.getProperty("line.separator");
- } catch (SecurityException se) { }
+ endOfLineProperty = System.lineSeparator();
}
String endOfLine;
if (endOfLineProperty instanceof String) {
--- a/jdk/src/share/classes/sun/font/CompositeFont.java Thu Feb 20 16:23:45 2014 -0800
+++ b/jdk/src/share/classes/sun/font/CompositeFont.java Fri Feb 21 15:28:09 2014 +0400
@@ -447,8 +447,7 @@
}
public String toString() {
- String ls = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
+ String ls = System.lineSeparator();
String componentsStr = "";
for (int i=0; i<numSlots; i++) {
componentsStr += " Slot["+i+"]="+getSlotFont(i)+ls;
--- a/jdk/src/solaris/classes/sun/awt/X11/XAWTFormatter.java Thu Feb 20 16:23:45 2014 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTFormatter.java Fri Feb 21 15:28:09 2014 +0400
@@ -43,8 +43,7 @@
// Line separator string. This is the value of the line.separator
// property at the moment that the SimpleFormatter was created.
- private String lineSeparator = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
+ private String lineSeparator = System.lineSeparator();
boolean displayFullRecord = false;
boolean useANSI = false;