xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minc...@apache.org
Subject svn commit: r367949 - in /xalan/java/trunk/src/org/apache: xalan/xsltc/compiler/ xml/serializer/ xml/serializer/utils/
Date Wed, 11 Jan 2006 06:34:23 GMT
Author: minchau
Date: Tue Jan 10 22:34:19 2006
New Revision: 367949

URL: http://svn.apache.org/viewcvs?rev=367949&view=rev
Log:
Committing the patch in XALANJ-2220.
This reducest the serializer's knowledge of its own package
by replacing literal strings starting with:
  "org.apache.xml.serializer"
  "org/apache/xml/serializer"
with a constant that is derived from:
  SerializerBase.class.getName()

The patch was reviewed by Yash Talwar (see the Jira issue).

Modified:
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Constants.java
    xalan/java/trunk/src/org/apache/xml/serializer/CharInfo.java
    xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java
    xalan/java/trunk/src/org/apache/xml/serializer/OutputPropertiesFactory.java
    xalan/java/trunk/src/org/apache/xml/serializer/SerializerBase.java
    xalan/java/trunk/src/org/apache/xml/serializer/SerializerConstants.java
    xalan/java/trunk/src/org/apache/xml/serializer/utils/Utils.java

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Constants.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Constants.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Constants.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Constants.java Tue Jan 10 22:34:19
2006
@@ -20,6 +20,7 @@
 package org.apache.xalan.xsltc.compiler;
 
 import org.apache.bcel.generic.InstructionConstants;
+import org.apache.xml.serializer.SerializerBase;
 
 /**
  * @author Jacek Ambroziak
@@ -136,9 +137,9 @@
     public static final String STRING_VALUE_HANDLER_SIG 
 	= "Lorg/apache/xalan/xsltc/runtime/StringValueHandler;";
     public static final String OUTPUT_HANDLER
-	= "org/apache/xml/serializer/SerializationHandler";
+	= SerializerBase.PKG_PATH+"/SerializationHandler";
     public static final String OUTPUT_HANDLER_SIG
-	= "Lorg/apache/xml/serializer/SerializationHandler;";
+	= "L"+SerializerBase.PKG_PATH+"/SerializationHandler;";
     public static final String FILTER_INTERFACE   
 	= "org.apache.xalan.xsltc.dom.Filter";
     public static final String FILTER_INTERFACE_SIG   
@@ -212,7 +213,7 @@
     public static final String UNION_ITERATOR_SIG  
 	= "Lorg/apache/xalan/xsltc/dom/UnionIterator;";
     public static final String TRANSLET_OUTPUT_SIG    
-	= "Lorg/apache/xml/serializer/SerializationHandler;";
+	= "L"+SerializerBase.PKG_PATH+"/SerializationHandler;";
     public static final String MAKE_NODE_SIG       
 	= "(I)Lorg/w3c/dom/Node;";
     public static final String MAKE_NODE_SIG2      
@@ -223,10 +224,10 @@
 	= "(" + NODE_ITERATOR_SIG + ")Lorg/w3c/dom/NodeList;";
     
     public static final String STREAM_XML_OUTPUT
-    = "org.apache.xml.serializer.ToXMLStream";
+    = SerializerBase.PKG_NAME+".ToXMLStream";
     
     public static final String OUTPUT_BASE
-    = "org.apache.xml.serializer.SerializerBase";
+    = SerializerBase.PKG_NAME+".SerializerBase";
     
     public static final String LOAD_DOCUMENT_CLASS
 	= "org.apache.xalan.xsltc.dom.LoadDocument";
@@ -259,7 +260,7 @@
 	= "org.apache.xalan.xsltc.TransletOutputBase";
     // output interface
     public static final String TRANSLET_OUTPUT_INTERFACE
-	= "org.apache.xml.serializer.SerializationHandler";
+	= SerializerBase.PKG_NAME+".SerializationHandler";
     public static final String BASIS_LIBRARY_CLASS 
 	= "org.apache.xalan.xsltc.runtime.BasisLibrary";
     public static final String ATTRIBUTE_LIST_IMPL_CLASS 

Modified: xalan/java/trunk/src/org/apache/xml/serializer/CharInfo.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xml/serializer/CharInfo.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/CharInfo.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/CharInfo.java Tue Jan 10 22:34:19 2006
@@ -57,14 +57,14 @@
      * If specified, the file will be resource loaded with the default class loader.
      */
     public static final String HTML_ENTITIES_RESOURCE = 
-                "org.apache.xml.serializer.HTMLEntities";
+                SerializerBase.PKG_NAME+".HTMLEntities";
 
     /**
      * The name of the XML entities file.
      * If specified, the file will be resource loaded with the default class loader.
      */
     public static final String XML_ENTITIES_RESOURCE = 
-                "org.apache.xml.serializer.XMLEntities";
+                SerializerBase.PKG_NAME+".XMLEntities";
 
     /** The horizontal tab character, which the parser should always normalize. */
     public static final char S_HORIZONAL_TAB = 0x09;

Modified: xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java Tue Jan 10 22:34:19 2006
@@ -48,12 +48,7 @@
     /**
      * Standard filename for properties file with encodings data.
      */
-    private static final String ENCODINGS_FILE = "org/apache/xml/serializer/Encodings.properties";
-
-    /**
-     * Standard filename for properties file with encodings data.
-     */
-    private static final String ENCODINGS_PROP = "org.apache.xalan.serialize.encodings";
+    private static final String ENCODINGS_FILE = SerializerBase.PKG_PATH+"/Encodings.properties";
 
     /**
      * Returns a writer for the specified encoding based on
@@ -294,30 +289,13 @@
      */
     private static EncodingInfo[] loadEncodingInfo()
     {
-        URL url = null;
         try
         {
-            String urlString = null;
-            InputStream is = null;
-
-            try
-            {
-                urlString = System.getProperty(ENCODINGS_PROP, "");
-            }
-            catch (SecurityException e)
-            {
-            }
-
-            if (urlString != null && urlString.length() > 0) {
-                url = new URL(urlString);
-                is = url.openStream();
-            }
-
-            if (is == null) {
-                SecuritySupport ss = SecuritySupport.getInstance();
-                is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
+            final InputStream is; 
+                
+            SecuritySupport ss = SecuritySupport.getInstance();
+            is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
                                             ENCODINGS_FILE);
-            }
 
             Properties props = new Properties();
             if (is != null) {

Modified: xalan/java/trunk/src/org/apache/xml/serializer/OutputPropertiesFactory.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xml/serializer/OutputPropertiesFactory.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/OutputPropertiesFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/OutputPropertiesFactory.java Tue Jan 10
22:34:19 2006
@@ -184,7 +184,7 @@
     private static Integer m_synch_object = new Integer(1);
 
     /** the directory in which the various method property files are located */
-    private static final String PROP_DIR = "org/apache/xml/serializer/";
+    private static final String PROP_DIR = SerializerBase.PKG_PATH+'/';
     /** property file for default XML properties */
     private static final String PROP_FILE_XML = "output_xml.properties";
     /** property file for default TEXT properties */

Modified: xalan/java/trunk/src/org/apache/xml/serializer/SerializerBase.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xml/serializer/SerializerBase.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/SerializerBase.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/SerializerBase.java Tue Jan 10 22:34:19
2006
@@ -44,6 +44,42 @@
     implements SerializationHandler, SerializerConstants
 {
     
+    /**
+     * The name of the package that this class is in.
+     * <p>
+     * Not a public API.
+     */
+    public static final String PKG_NAME;
+
+    /**
+     * The same as the name of the package that this class is in
+     * except that '.' are replaced with '/'.
+     * <p>
+     * Not a public API.
+     */
+    public static final String PKG_PATH;
+
+    static {
+        String fullyQualifiedName = SerializerBase.class.getName();
+        int lastDot = fullyQualifiedName.lastIndexOf('.');
+        if (lastDot < 0) {
+            PKG_NAME = "";
+        } else {
+            PKG_NAME = fullyQualifiedName.substring(0, lastDot);
+        }
+
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < PKG_NAME.length(); i++) {
+            char ch = PKG_NAME.charAt(i);
+            if (ch == '.')
+                sb.append('/');
+            else
+                sb.append(ch);
+        }
+        PKG_PATH = sb.toString();
+    }
+
+    
 
     /**
      * To fire off the end element trace event

Modified: xalan/java/trunk/src/org/apache/xml/serializer/SerializerConstants.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xml/serializer/SerializerConstants.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/SerializerConstants.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/SerializerConstants.java Tue Jan 10 22:34:19
2006
@@ -47,7 +47,7 @@
     static final String XMLNS_PREFIX = "xmlns";
     static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
    
-    public static final String DEFAULT_SAX_SERIALIZER="org.apache.xml.serializer.ToXMLSAXHandler";
+    public static final String DEFAULT_SAX_SERIALIZER=SerializerBase.PKG_NAME+".ToXMLSAXHandler";
     
     /**
      * Define the XML version.

Modified: xalan/java/trunk/src/org/apache/xml/serializer/utils/Utils.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xml/serializer/utils/Utils.java?rev=367949&r1=367948&r2=367949&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/utils/Utils.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/utils/Utils.java Tue Jan 10 22:34:19 2006
@@ -19,6 +19,7 @@
 package org.apache.xml.serializer.utils;
 
 import java.util.Hashtable;
+import org.apache.xml.serializer.SerializerBase;
 
 /**
  * This class contains utilities used by the serializer.
@@ -37,5 +38,5 @@
      */
     public static final org.apache.xml.serializer.utils.Messages messages= 
         new org.apache.xml.serializer.utils.Messages(
-            "org.apache.xml.serializer.utils.SerializerMessages");
+            SerializerBase.PKG_NAME+".utils.SerializerMessages");
 }



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


Mime
View raw message