Creating the codebase for the Xalan-J 2.7.1 release from trunk

git-svn-id: https://svn.apache.org/repos/asf/xalan/java/tags/xalan-j_2_7_1@578285 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/org/apache/xalan/Version.java b/src/org/apache/xalan/Version.java
index 87cb28b..c2d9f2f 100644
--- a/src/org/apache/xalan/Version.java
+++ b/src/org/apache/xalan/Version.java
@@ -119,7 +119,7 @@
    */
   public static int getMaintenanceVersionNum()
   {
-    return 0;
+    return 1;
   }
 
   /**
diff --git a/src/org/apache/xalan/transformer/TransformerIdentityImpl.java b/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
index 18e5e43..a06ef17 100644
--- a/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
+++ b/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
@@ -152,7 +152,7 @@
     m_flushedStartDoc = false;
     m_foundFirstElement = false;
     m_outputStream = null;
-    m_params.clear();
+    clearParameters();
     m_result = null;
     m_resultContentHandler = null;
     m_resultDeclHandler = null;
diff --git a/src/org/apache/xalan/xsltc/compiler/Stylesheet.java b/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
index c07981a..b8e3dd5 100644
--- a/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
+++ b/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
@@ -21,9 +21,6 @@
 
 package org.apache.xalan.xsltc.compiler;
 
-import java.net.URL;
-import java.net.MalformedURLException;
-
 import java.util.Vector;
 import java.util.Enumeration;
 import java.util.Hashtable;
@@ -198,8 +195,9 @@
     
     /**
      * Set to true to enable template inlining optimization.
+     * @see XSLTC#_templateInlining
      */
-    private boolean _templateInlining = true;
+    private boolean _templateInlining = false;
 
     /**
      * A reference to the last xsl:output object found in the styleshet.
@@ -462,11 +460,11 @@
 	    for (int i = 0; i < n; i++) {
 		final Template template = (Template)templates.elementAt(i);
 		if (template.hasParams()) {
-		    _hasLocalParams = new Boolean(true);
+		    _hasLocalParams = Boolean.TRUE;
 		    return true;
 		}
 	    }
-	    _hasLocalParams = new Boolean(false);
+	    _hasLocalParams = Boolean.FALSE;
 	    return false;
 	}
 	else {
diff --git a/src/org/apache/xalan/xsltc/compiler/XSLTC.java b/src/org/apache/xalan/xsltc/compiler/XSLTC.java
index cf49500..2cd314c 100644
--- a/src/org/apache/xalan/xsltc/compiler/XSLTC.java
+++ b/src/org/apache/xalan/xsltc/compiler/XSLTC.java
@@ -238,6 +238,13 @@
     }
 
     /**
+     * Return the state of the template inlining feature.
+     */
+    public boolean getTemplateInlining() {
+        return _templateInlining;
+    }
+
+    /**
      * Set the parameters to use to locate the correct <?xml-stylesheet ...?>
      * processing instruction in the case where the input document to the
      * compiler (and parser) is an XML document.
diff --git a/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java b/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java
index 8982984..8088c7d 100644
--- a/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java
+++ b/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java
@@ -96,7 +96,12 @@
         XSLTC xsltc = new XSLTC();
         if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
             xsltc.setSecureProcessing(true);
-       
+
+        if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING)))
+            xsltc.setTemplateInlining(true);
+        else
+            xsltc.setTemplateInlining(false);
+
         _parser = xsltc.getParser();
     }
 
@@ -186,7 +191,7 @@
             XSLTC xsltc = _parser.getXSLTC();
 
             // Set the translet class name if not already set
-            String transletName = null;
+            String transletName;
             if (_systemId != null) {
                 transletName = Util.baseName(_systemId);
             }
@@ -208,6 +213,11 @@
                 stylesheet.setSystemId(_systemId);
                 stylesheet.setParentStylesheet(null);
 
+                if (xsltc.getTemplateInlining())
+                   stylesheet.setTemplateInlining(true);
+                else
+                   stylesheet.setTemplateInlining(false);
+
                 // Set a document loader (for xsl:include/import) if defined
                 if (_uriResolver != null) {
                     stylesheet.setSourceLoader(this);
diff --git a/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java b/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
index 868dfef..1dbbf38 100644
--- a/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
+++ b/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
@@ -260,6 +260,12 @@
 	else if (name.equals(AUTO_TRANSLET)) {
 	    return new Boolean(_autoTranslet);
 	}
+	else if (name.equals(ENABLE_INLINING)) {
+	    if (_enableInlining)
+	      return Boolean.TRUE;
+	    else
+	      return Boolean.FALSE;
+	}
 
 	// Throw an exception for all other attributes
 	ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
@@ -735,7 +741,10 @@
 	// Create and initialize a stylesheet compiler
 	final XSLTC xsltc = new XSLTC();
 	if (_debug) xsltc.setDebug(true);
-	if (_enableInlining) xsltc.setTemplateInlining(true);
+	if (_enableInlining) 
+		xsltc.setTemplateInlining(true);
+	else
+		xsltc.setTemplateInlining(false);
 	if (_isSecureProcessing) xsltc.setSecureProcessing(true);
 	xsltc.init();
 
diff --git a/src/org/apache/xml/utils/XMLString.java b/src/org/apache/xml/utils/XMLString.java
index 122f80e..fa1bff4 100644
--- a/src/org/apache/xml/utils/XMLString.java
+++ b/src/org/apache/xml/utils/XMLString.java
@@ -125,7 +125,7 @@
   /**
    * Compares this string to the specified object.
    * The result is <code>true</code> if and only if the argument is not
-   * <code>null</code> and is a <code>String</code> object that represents
+   * <code>null</code> and is an <code>XMLString</code> object that represents
    * the same sequence of characters as this object.
    *
    * @param   anObject   the object to compare this <code>String</code>
@@ -137,6 +137,20 @@
    */
   public abstract boolean equals(XMLString anObject);
 
+  /**
+   * Compares this string to the specified <code>String</code>.
+   * The result is <code>true</code> if and only if the argument is not
+   * <code>null</code> and is a <code>String</code> object that represents
+   * the same sequence of characters as this object.
+   *
+   * @param   anotherString   the object to compare this <code>String</code>
+   *                          against.
+   * @return  <code>true</code> if the <code>String</code>s are equal;
+   *          <code>false</code> otherwise.
+   * @see     java.lang.String#compareTo(java.lang.String)
+   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
+   */
+  public abstract boolean equals(String anotherString);
 
   /**
    * Compares this string to the specified object.
diff --git a/src/org/apache/xml/utils/XMLStringDefault.java b/src/org/apache/xml/utils/XMLStringDefault.java
index 3aff888..ac37ffc 100644
--- a/src/org/apache/xml/utils/XMLStringDefault.java
+++ b/src/org/apache/xml/utils/XMLStringDefault.java
@@ -149,7 +149,23 @@
       dst[destIndex++] = m_str.charAt(i);
     }
   }
-                                
+
+  /**
+   * Compares this string to the specified <code>String</code>.
+   * The result is <code>true</code> if and only if the argument is not
+   * <code>null</code> and is a <code>String</code> object that represents
+   * the same sequence of characters as this object.
+   *
+   * @param   obj2   the object to compare this <code>String</code> against.
+   * @return  <code>true</code> if the <code>String</code>s are equal;
+   *          <code>false</code> otherwise.
+   * @see     java.lang.String#compareTo(java.lang.String)
+   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
+   */
+  public boolean equals(String obj2) {
+      return m_str.equals(obj2);
+  }
+
   /**
    * Compares this string to the specified object.
    * The result is <code>true</code> if and only if the argument is not
diff --git a/src/org/apache/xpath/objects/XString.java b/src/org/apache/xpath/objects/XString.java
index 064cfb1..c607066 100644
--- a/src/org/apache/xpath/objects/XString.java
+++ b/src/org/apache/xpath/objects/XString.java
@@ -320,6 +320,22 @@
   }
 
   /**
+   * Compares this string to the specified <code>String</code>.
+   * The result is <code>true</code> if and only if the argument is not
+   * <code>null</code> and is a <code>String</code> object that represents
+   * the same sequence of characters as this object.
+   *
+   * @param   obj2   the object to compare this <code>String</code> against.
+   * @return  <code>true</code> if the <code>String</code>s are equal;
+   *          <code>false</code> otherwise.
+   * @see     java.lang.String#compareTo(java.lang.String)
+   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
+   */
+  public boolean equals(String obj2) {
+    return str().equals(obj2);
+  }
+
+  /**
    * Compares this string to the specified object.
    * The result is <code>true</code> if and only if the argument is not
    * <code>null</code> and is a <code>String</code> object that represents
@@ -334,11 +350,14 @@
    */
   public boolean equals(XMLString obj2)
   {
-
-    if (!obj2.hasString())
-      return obj2.equals(this);
-    else
-      return str().equals(obj2.toString());
+    if (obj2 != null) {
+      if (!obj2.hasString()) {
+        return obj2.equals(str());
+      } else {
+        return str().equals(obj2.toString());
+      }
+    }
+    return false;
   }
 
   /**
diff --git a/xdocs/sources/xalan/readme.xml b/xdocs/sources/xalan/readme.xml
index c8f556d..50381cd 100644
--- a/xdocs/sources/xalan/readme.xml
+++ b/xdocs/sources/xalan/readme.xml
@@ -73,6 +73,7 @@
      <ul>
      <li>XALANJ Jira bug fixes:
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-611">611</jump>,
+       <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-1243">1243</jump>,
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-1324">1324</jump>,
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-1434">1434</jump>,
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-1497">1497</jump>,
@@ -142,7 +143,8 @@
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-2343">2343</jump>,
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-2375">2375</jump>,
        <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-2377">2377</jump>,
-       <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-2384">2384</jump>
+       <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-2384">2384</jump>,
+       <jump href="http://issues.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-2395">2395</jump>
      </li>
      </ul>
    </s2>