changeset 23307:5e534f20d09a

8035310: The line.separator property can be retrieved via public API Reviewed-by: alexsch, serb
author malenkov
date Fri, 21 Feb 2014 15:28:09 +0400
parents 679ac7841e8d
children ce9d5a78334f
files jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java jdk/src/share/classes/javax/swing/text/AbstractWriter.java jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java jdk/src/share/classes/sun/font/CompositeFont.java jdk/src/solaris/classes/sun/awt/X11/XAWTFormatter.java
diffstat 5 files changed, 5 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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;