8233686: XML transformer uses excessive amount of memory
authorjoehw
Thu, 14 Nov 2019 18:41:04 +0000
changeset 59091 1c071f73949a
parent 59089 de56632f796d
child 59092 625262261ef2
8233686: XML transformer uses excessive amount of memory Summary: remove unnecessary object creation and also update xalan.md file Reviewed-by: lancea
src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/DOM2TO.java
src/java.xml/share/legal/xalan.md
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/DOM2TO.java	Thu Nov 14 09:06:43 2019 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/DOM2TO.java	Thu Nov 14 18:41:04 2019 +0000
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -42,6 +41,7 @@
 /**
  * @author Santiago Pericas-Geertsen
  * @author Sunitha Reddy
+ * @LastModified: Nov 2019
  */
 public class DOM2TO implements XMLReader, Locator2 {
 
@@ -171,7 +171,7 @@
             }
 
             // Process all non-namespace attributes next
-            NamespaceMappings nm = new NamespaceMappings();
+            NamespaceMappings nm = null;
             for (int i = 0; i < length; i++) {
                 final Node attr = map.item(i);
                 final String qnameAttr = attr.getNodeName();
@@ -187,6 +187,7 @@
                         // For attributes not given an prefix explictly
                         // but having a namespace uri we need
                         // to explicitly generate the prefix
+                        if (nm == null) nm = new NamespaceMappings();
                         String newPrefix = nm.lookupPrefix(uriAttr);
                         if (newPrefix == null)
                             newPrefix = nm.generateNextPrefix();
--- a/src/java.xml/share/legal/xalan.md	Thu Nov 14 09:06:43 2019 -0800
+++ b/src/java.xml/share/legal/xalan.md	Thu Nov 14 18:41:04 2019 +0000
@@ -231,4 +231,25 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 
+
+JLEX COPYRIGHT NOTICE, LICENSE AND DISCLAIMER.
+Copyright 1996-2003 by Elliot Joel Berk and C. Scott Ananian
+Permission to use, copy, modify, and distribute this software and 
+its documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that 
+both the copyright notice and this permission notice and warranty 
+disclaimer appear in supporting documentation, and that the name of 
+the authors or their employers not be used in advertising or publicity 
+pertaining to distribution of the software without specific, written 
+prior permission.
+The authors and their employers disclaim all warranties with regard to 
+this software, including all implied warranties of merchantability and 
+fitness. In no event shall the authors or their employers be liable for 
+any special, indirect or consequential damages or any damages whatsoever 
+resulting from loss of use, data or profits, whether in an action of 
+contract, negligence or other tortious action, arising out of or in 
+connection with the use or performance of this software.The portions of 
+JLex output which are hard-coded into the JLex source code are (naturally) 
+covered by this same license.
+
 </pre>