You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mi...@apache.org on 2006/11/16 20:44:00 UTC

svn commit: r475894 - in /xalan/java/trunk/src/org/apache/xml/serializer: ToStream.java dom3/LSSerializerImpl.java

Author: minchau
Date: Thu Nov 16 11:43:59 2006
New Revision: 475894

URL: http://svn.apache.org/viewvc?view=rev&rev=475894
Log:
AccessController fix for getting the "line.separator" 
system property. Applying Michael G.'s patch
from XALANJ-2341

Modified:
    xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java
    xalan/java/trunk/src/org/apache/xml/serializer/dom3/LSSerializerImpl.java

Modified: xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java?view=diff&rev=475894&r1=475893&r2=475894
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java Thu Nov 16 11:43:59 2006
@@ -105,10 +105,13 @@
      * If m_doIndent is false this flag has no impact.
      */
     protected boolean m_isprevtext = false;
-
         
-    private static final char[] s_systemLineSep = 
-        System.getProperty("line.separator").toCharArray();
+    private static final char[] s_systemLineSep;
+    static {
+        SecuritySupport ss = SecuritySupport.getInstance();
+        s_systemLineSep = ss.getSystemProperty("line.separator").toCharArray();
+    }
+    
     /**
      * The system line separator for writing out line breaks.
      * The default value is from the system property,

Modified: xalan/java/trunk/src/org/apache/xml/serializer/dom3/LSSerializerImpl.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/serializer/dom3/LSSerializerImpl.java?view=diff&rev=475894&r1=475893&r2=475894
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/dom3/LSSerializerImpl.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/dom3/LSSerializerImpl.java Thu Nov 16 11:43:59 2006
@@ -29,6 +29,8 @@
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
@@ -70,7 +72,15 @@
     // The default end-of-line character sequence used in serialization.
     private static final String DEFAULT_END_OF_LINE;
     static {
-        String lineSeparator = System.getProperty("line.separator");
+        String lineSeparator = (String) AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                try {
+                    return System.getProperty("line.separator");
+                }
+                catch (SecurityException ex) {}
+                return null;
+            }
+        });
         // The DOM Level 3 Load and Save specification requires that implementations choose a default
         // sequence which matches one allowed by XML 1.0 (or XML 1.1). If the value of "line.separator" 
         // isn't one of the XML 1.0 end-of-line sequences then we select "\n" as the default value.



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org