aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgtags11
-rw-r--r--ASSEMBLY_EXCEPTION24
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java46
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java82
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java7
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java4
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java20
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java14
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java24
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java39
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java75
-rw-r--r--src/com/sun/org/apache/xerces/internal/dom/AbortException.java36
-rw-r--r--src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java20
-rw-r--r--src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java5
-rw-r--r--src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java20
15 files changed, 213 insertions, 214 deletions
diff --git a/.hgtags b/.hgtags
index 50e8a36..11bcc76 100644
--- a/.hgtags
+++ b/.hgtags
@@ -685,3 +685,14 @@ f805dcb18704a7028b9d193e8fe661381d473213 jdk8u121-b09
77c3d617ae4c28c6e29d51411ab2b2c9eb24683f jdk8u121-b11
f9cb265fd35fc60dccd75075614f8e897af92ab3 jdk8u121-b12
b8d4e47240711ff66f9347483d20c84466d75c89 jdk8u121-b13
+2e5a470691f23ebf8d1f0f0dea8ef7de9a70a943 jdk8u122-b00
+cbb8efe139275a4e7c541f9e45eb410c27a5ea61 jdk8u122-b01
+e279f24557d43d8edfe313cb1a53add7ac6ceb2c jdk8u122-b02
+4d0371f160495cc61e3b57ca2d57884c2b9f9068 jdk8u122-b03
+4d0371f160495cc61e3b57ca2d57884c2b9f9068 jdk8u122-b03
+0000000000000000000000000000000000000000 jdk8u122-b03
+0000000000000000000000000000000000000000 jdk8u122-b03
+95728234c69f848fda20c3d107a2a14405e8e8bd jdk8u122-b03
+540ca507f5e33ad46c85750f5df110522454cb2d jdk8u122-b04
+7f6d0e9a119670bb83ab2961503471d73f8a5f7e jdk8u132-b00
+4203c092a35355406709027827e9130f79dd96ca jdk8u152-b00
diff --git a/ASSEMBLY_EXCEPTION b/ASSEMBLY_EXCEPTION
index 8b7ac1d..065b8d9 100644
--- a/ASSEMBLY_EXCEPTION
+++ b/ASSEMBLY_EXCEPTION
@@ -1,27 +1,27 @@
OPENJDK ASSEMBLY EXCEPTION
-The OpenJDK source code made available by Sun at openjdk.java.net and
-openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
-GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
only ("GPL2"), with the following clarification and special exception.
Linking this OpenJDK Code statically or dynamically with other code
is making a combined work based on this library. Thus, the terms
and conditions of GPL2 cover the whole combination.
- As a special exception, Sun gives you permission to link this
- OpenJDK Code with certain code licensed by Sun as indicated at
+ As a special exception, Oracle gives you permission to link this
+ OpenJDK Code with certain code licensed by Oracle as indicated at
http://openjdk.java.net/legal/exception-modules-2007-05-08.html
("Designated Exception Modules") to produce an executable,
regardless of the license terms of the Designated Exception Modules,
and to copy and distribute the resulting executable under GPL2,
provided that the Designated Exception Modules continue to be
- governed by the licenses under which they were offered by Sun.
+ governed by the licenses under which they were offered by Oracle.
-As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
-build an executable that includes those portions of necessary code that Sun
-could not provide under GPL2 (or that Sun has provided under GPL2 with the
-Classpath exception). If you modify or add to the OpenJDK code, that new
-GPL2 code may still be combined with Designated Exception Modules if the
-new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception). If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java
index e136357..c392cbe 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -9,7 +9,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: LiteralElement.java,v 1.2.4.1 2005/09/13 12:38:33 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.compiler;
@@ -58,8 +55,6 @@ final class LiteralElement extends Instruction {
// names are not known at compile time.
private boolean _allAttributesUnique = false;
- private final static String XMLNS_STRING = "xmlns";
-
/**
* Returns the QName for this literal element
*/
@@ -140,8 +135,8 @@ final class LiteralElement extends Instruction {
// Treat default namespace as "" and not null
if (prefix == null)
prefix = Constants.EMPTYSTRING;
- else if (prefix.equals(XMLNS_STRING))
- return(XMLNS_STRING);
+ else if (prefix.equals(XMLNS_PREFIX))
+ return(XMLNS_PREFIX);
// Check if we must translate the prefix
final String alternative = stable.lookupPrefixAlias(prefix);
@@ -266,7 +261,7 @@ final class LiteralElement extends Instruction {
// Ignore special attributes (e.g. xmlns:prefix and xmlns)
final String prefix = qname.getPrefix();
if (prefix != null && prefix.equals(XMLNS_PREFIX) ||
- prefix == null && qname.getLocalPart().equals("xmlns") ||
+ prefix == null && qname.getLocalPart().equals(XMLNS_PREFIX) ||
uri != null && uri.equals(XSLT_URI))
{
continue;
@@ -339,9 +334,9 @@ final class LiteralElement extends Instruction {
il.append(methodGen.startElement());
// The value of an attribute may depend on a (sibling) variable
- int j=0;
+ int j = 0;
while (j < elementCount()) {
- final SyntaxTreeNode item = (SyntaxTreeNode) elementAt(j);
+ final SyntaxTreeNode item = elementAt(j);
if (item instanceof Variable) {
item.translate(classGen, methodGen);
}
@@ -350,35 +345,12 @@ final class LiteralElement extends Instruction {
// Compile code to emit namespace attributes
if (_accessedPrefixes != null) {
- boolean declaresDefaultNS = false;
-
for (Map.Entry<String, String> entry : _accessedPrefixes.entrySet()) {
final String prefix = entry.getKey();
final String uri = entry.getValue();
-
- if (uri != Constants.EMPTYSTRING ||
- prefix != Constants.EMPTYSTRING)
- {
- if (prefix == Constants.EMPTYSTRING) {
- declaresDefaultNS = true;
- }
- il.append(methodGen.loadHandler());
- il.append(new PUSH(cpg,prefix));
- il.append(new PUSH(cpg,uri));
- il.append(methodGen.namespace());
- }
- }
-
- /*
- * If our XslElement parent redeclares the default NS, and this
- * element doesn't, it must be redeclared one more time.
- */
- if (!declaresDefaultNS && (_parent instanceof XslElement)
- && ((XslElement) _parent).declaresDefaultNS())
- {
il.append(methodGen.loadHandler());
- il.append(new PUSH(cpg, Constants.EMPTYSTRING));
- il.append(new PUSH(cpg, Constants.EMPTYSTRING));
+ il.append(new PUSH(cpg, prefix));
+ il.append(new PUSH(cpg, uri));
il.append(methodGen.namespace());
}
}
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
index d15d90e..7088850 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: Parser.java,v 1.2.4.1 2005/09/13 12:14:32 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.compiler;
@@ -37,6 +34,7 @@ import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -44,7 +42,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.Stack;
import java.util.StringTokenizer;
-import java.util.Vector;
import javax.xml.XMLConstants;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
@@ -68,20 +65,20 @@ import org.xml.sax.helpers.AttributesImpl;
*/
public class Parser implements Constants, ContentHandler {
- private static final String XSL = "xsl"; // standard prefix
+ private static final String XSL = "xsl"; // standard prefix
private static final String TRANSLET = "translet"; // extension prefix
private Locator _locator = null;
- private XSLTC _xsltc; // Reference to the compiler object.
- private XPathParser _xpathParser; // Reference to the XPath parser.
- private Vector _errors; // Contains all compilation errors
- private Vector _warnings; // Contains all compilation errors
+ private XSLTC _xsltc; // Reference to the compiler object.
+ private XPathParser _xpathParser; // Reference to the XPath parser.
+ private ArrayList<ErrorMsg> _errors; // Contains all compilation errors
+ private ArrayList<ErrorMsg> _warnings; // Contains all compilation warnings
private Map<String, String> _instructionClasses; // Maps instructions to classes
private Map<String, String[]> _instructionAttrs; // reqd and opt attrs
- private Map<String, QName> _qNames;
- private Map<String, Map> _namespaces;
+ private Map<String, QName> _qNames;
+ private Map<String, Map<String, QName>> _namespaces;
private QName _useAttributeSets;
private QName _excludeResultPrefixes;
private QName _extensionElementPrefixes;
@@ -113,8 +110,8 @@ public class Parser implements Constants, ContentHandler {
_instructionAttrs = new HashMap<>();
_variableScope = new HashMap<>();
_template = null;
- _errors = new Vector();
- _warnings = new Vector();
+ _errors = new ArrayList<>();
+ _warnings = new ArrayList<>();
_symbolTable = new SymbolTable();
_xpathParser = new XPathParser(this);
_currentStylesheet = null;
@@ -139,7 +136,6 @@ public class Parser implements Constants, ContentHandler {
public void setOutput(Output output) {
if (_output != null) {
if (_output.getImportPrecedence() <= output.getImportPrecedence()) {
- String cdata = _output.getCdata();
output.mergeOutput(_output);
_output.disable();
_output = output;
@@ -173,12 +169,13 @@ public class Parser implements Constants, ContentHandler {
Object existing = _variableScope.get(var.getName().getStringRep());
if (existing != null) {
if (existing instanceof Stack) {
- Stack stack = (Stack)existing;
+ @SuppressWarnings("unchecked")
+ Stack<VariableBase> stack = (Stack<VariableBase>)existing;
stack.push(var);
}
else if (existing instanceof VariableBase) {
- Stack stack = new Stack();
- stack.push(existing);
+ Stack<VariableBase> stack = new Stack<>();
+ stack.push((VariableBase)existing);
stack.push(var);
_variableScope.put(var.getName().getStringRep(), stack);
}
@@ -191,7 +188,8 @@ public class Parser implements Constants, ContentHandler {
public void removeVariable(QName name) {
Object existing = _variableScope.get(name.getStringRep());
if (existing instanceof Stack) {
- Stack stack = (Stack)existing;
+ @SuppressWarnings("unchecked")
+ Stack<VariableBase> stack = (Stack<VariableBase>)existing;
if (!stack.isEmpty()) stack.pop();
if (!stack.isEmpty()) return;
}
@@ -201,13 +199,14 @@ public class Parser implements Constants, ContentHandler {
public VariableBase lookupVariable(QName name) {
Object existing = _variableScope.get(name.getStringRep());
if (existing instanceof VariableBase) {
- return((VariableBase)existing);
+ return (VariableBase)existing;
}
else if (existing instanceof Stack) {
- Stack stack = (Stack)existing;
- return((VariableBase)stack.peek());
+ @SuppressWarnings("unchecked")
+ Stack<VariableBase> stack = (Stack<VariableBase>)existing;
+ return stack.peek();
}
- return(null);
+ return null;
}
public void setXSLTC(XSLTC xsltc) {
@@ -397,7 +396,6 @@ public class Parser implements Constants, ContentHandler {
try {
if (stylesheet != null) {
stylesheet.parseContents(this);
- final int precedence = stylesheet.getImportPrecedence();
final Iterator<SyntaxTreeNode> elements = stylesheet.elements();
while (elements.hasNext()) {
SyntaxTreeNode child = elements.next();
@@ -704,8 +702,6 @@ public class Parser implements Constants, ContentHandler {
new String[] {"stylesheet-prefix", "result-prefix"});
}
-
-
/**
* Initialize the _instructionClasses map, which maps XSL element
* names to Java classes in this package.
@@ -779,6 +775,7 @@ public class Parser implements Constants, ContentHandler {
/**
* Add primops and base functions to the symbol table.
*/
+ @SuppressWarnings("unused")
private void initSymbolTable() {
MethodType I_V = new MethodType(Type.Int, Type.Void);
MethodType I_R = new MethodType(Type.Int, Type.Real);
@@ -971,12 +968,12 @@ public class Parser implements Constants, ContentHandler {
String local, Attributes attributes)
{
SyntaxTreeNode node = null;
- QName qname = getQName(uri, prefix, local);
+ QName qname = getQName(uri, prefix, local);
String className = _instructionClasses.get(qname.getStringRep());
if (className != null) {
try {
- final Class clazz = ObjectFactory.findProviderClass(className, true);
+ final Class<?> clazz = ObjectFactory.findProviderClass(className, true);
node = (SyntaxTreeNode)clazz.newInstance();
node.setQName(qname);
node.setParser(this);
@@ -1023,7 +1020,7 @@ public class Parser implements Constants, ContentHandler {
else {
Stylesheet sheet = _xsltc.getStylesheet();
if ((sheet != null) && (sheet.isExtension(uri))) {
- if (sheet != (SyntaxTreeNode)_parentStack.peek()) {
+ if (sheet != _parentStack.peek()) {
node = new UnsupportedElement(uri, prefix, local, true);
UnsupportedElement elem = (UnsupportedElement)node;
ErrorMsg msg =
@@ -1156,7 +1153,6 @@ public class Parser implements Constants, ContentHandler {
node.setParser(this);
node.setParent(parent);
node.setLineNumber(line);
-// System.out.println("e = " + text + " " + node);
return node;
}
}
@@ -1191,7 +1187,7 @@ public class Parser implements Constants, ContentHandler {
if (size > 0) {
System.err.println(new ErrorMsg(ErrorMsg.COMPILER_ERROR_KEY));
for (int i = 0; i < size; i++) {
- System.err.println(" " + _errors.elementAt(i));
+ System.err.println(" " + _errors.get(i));
}
}
}
@@ -1204,7 +1200,7 @@ public class Parser implements Constants, ContentHandler {
if (size > 0) {
System.err.println(new ErrorMsg(ErrorMsg.COMPILER_WARNING_KEY));
for (int i = 0; i < size; i++) {
- System.err.println(" " + _warnings.elementAt(i));
+ System.err.println(" " + _warnings.get(i));
}
}
}
@@ -1217,42 +1213,42 @@ public class Parser implements Constants, ContentHandler {
case Constants.INTERNAL:
// Unexpected internal errors, such as null-ptr exceptions, etc.
// Immediately terminates compilation, no translet produced
- _errors.addElement(error);
+ _errors.add(error);
break;
case Constants.UNSUPPORTED:
// XSLT elements that are not implemented and unsupported ext.
// Immediately terminates compilation, no translet produced
- _errors.addElement(error);
+ _errors.add(error);
break;
case Constants.FATAL:
// Fatal error in the stylesheet input (parsing or content)
// Immediately terminates compilation, no translet produced
- _errors.addElement(error);
+ _errors.add(error);
break;
case Constants.ERROR:
// Other error in the stylesheet input (parsing or content)
// Does not terminate compilation, no translet produced
- _errors.addElement(error);
+ _errors.add(error);
break;
case Constants.WARNING:
// Other error in the stylesheet input (content errors only)
// Does not terminate compilation, a translet is produced
- _warnings.addElement(error);
+ _warnings.add(error);
break;
}
}
- public Vector getErrors() {
+ public ArrayList<ErrorMsg> getErrors() {
return _errors;
}
- public Vector getWarnings() {
+ public ArrayList<ErrorMsg> getWarnings() {
return _warnings;
}
/************************ SAX2 ContentHandler INTERFACE *****************/
- private Stack _parentStack = null;
+ private Stack<SyntaxTreeNode> _parentStack = null;
private Map<String, String> _prefixMapping = null;
/**
@@ -1262,7 +1258,7 @@ public class Parser implements Constants, ContentHandler {
_root = null;
_target = null;
_prefixMapping = null;
- _parentStack = new Stack();
+ _parentStack = new Stack<>();
}
/**
@@ -1318,7 +1314,7 @@ public class Parser implements Constants, ContentHandler {
_root = element;
}
else {
- SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
+ SyntaxTreeNode parent = _parentStack.peek();
parent.addElement(element);
element.setParent(parent);
}
@@ -1349,7 +1345,7 @@ public class Parser implements Constants, ContentHandler {
*/
public void characters(char[] ch, int start, int length) {
String string = new String(ch, start, length);
- SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
+ SyntaxTreeNode parent = _parentStack.peek();
if (string.length() == 0) return;
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java
index 5894996..09061ea 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,6 +31,7 @@ import com.sun.org.apache.bcel.internal.generic.GETFIELD;
import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
+import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
import com.sun.org.apache.bcel.internal.generic.ISTORE;
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
@@ -1252,6 +1253,10 @@ public final class Stylesheet extends SyntaxTreeNode {
classGen.getConstantPool());
transf.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");
+ // call resetPrefixIndex at the beginning of transform
+ final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "resetPrefixIndex", "()V");
+ il.append(new INVOKESTATIC(check));
+
// Define and initialize current with the root node
final LocalVariableGen current =
transf.addLocalVariable("current",
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java
index 1e8ad86..01ef38b 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java
@@ -73,7 +73,7 @@ public abstract class SyntaxTreeNode implements Constants {
protected QName _qname; // The element QName
private int _line; // Source file line number
protected AttributesImpl _attributes = null; // Attributes of this element
- private Map<String, String> _prefixMapping = null; // Namespace declarations
+ private Map<String, String> _prefixMapping = null; // Namespace declarations
// Sentinel - used to denote unrecognised syntaxt tree nodes.
protected static final SyntaxTreeNode Dummy = new AbsolutePathPattern(null);
@@ -829,7 +829,7 @@ public abstract class SyntaxTreeNode implements Constants {
* @param pos The child node's position.
* @return The child node.
*/
- protected final Object elementAt(int pos) {
+ protected final SyntaxTreeNode elementAt(int pos) {
return _contents.get(pos);
}
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
index 3218181..631edbd 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: XSLTC.java,v 1.2.4.1 2005/09/05 09:51:38 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.compiler;
@@ -39,6 +36,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
@@ -283,7 +281,7 @@ public final class XSLTC {
}
/*
- * Function loads an external extension functions.
+ * Function loads an external extension function.
* The filtering of function types (external,internal) takes place in FunctionCall class
*
*/
@@ -598,18 +596,18 @@ public final class XSLTC {
}
/**
- * Get a Vector containing all compile error messages
- * @return A Vector containing all compile error messages
+ * Get a list of all compile error messages
+ * @return A List containing all compile error messages
*/
- public Vector getErrors() {
+ public ArrayList<ErrorMsg> getErrors() {
return _parser.getErrors();
}
/**
- * Get a Vector containing all compile warning messages
- * @return A Vector containing all compile error messages
+ * Get a list of all compile warning messages
+ * @return A List containing all compile error messages
*/
- public Vector getWarnings() {
+ public ArrayList<ErrorMsg> getWarnings() {
return _parser.getWarnings();
}
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java
index e04bab7..e94ebb1 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: XslElement.java,v 1.2.4.1 2005/09/12 11:39:55 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.compiler;
@@ -60,14 +57,6 @@ final class XslElement extends Instruction {
displayContents(indent + IndentIncrement);
}
- /**
- * This method is now deprecated. The new implemation of this class
- * never declares the default NS.
- */
- public boolean declaresDefaultNS() {
- return false;
- }
-
public void parseContents(Parser parser) {
final SymbolTable stable = parser.getSymbolTable();
@@ -210,7 +199,6 @@ final class XslElement extends Instruction {
* on the handler (vii) evaluates the contents (viii) calls endElement().
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
- LocalVariableGen local = null;
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
index dc3a3ce..804b154 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -48,6 +48,7 @@ import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -1530,16 +1531,25 @@ public final class BasisLibrary {
}
/**
- * This function is used in the execution of xsl:element
+ * These functions are used in the execution of xsl:element to generate
+ * and reset namespace prefix index local to current transformation process
*/
- private static int prefixIndex = 0;
-
public static String generatePrefix() {
- synchronized (BasisLibrary.class) {
- return ("ns" + prefixIndex++);
- }
+ return ("ns" + threadLocalPrefixIndex.get().getAndIncrement());
+ }
+
+ public static void resetPrefixIndex() {
+ threadLocalPrefixIndex.get().set(0);
}
+ private static final ThreadLocal<AtomicInteger> threadLocalPrefixIndex =
+ new ThreadLocal<AtomicInteger>() {
+ @Override
+ protected AtomicInteger initialValue() {
+ return new AtomicInteger();
+ }
+ };
+
public static final String RUN_TIME_INTERNAL_ERR =
"RUN_TIME_INTERNAL_ERR";
public static final String RUN_TIME_COPY_ERR =
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
index 8bbc541..bce2c3a 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
@@ -1,13 +1,13 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,18 +17,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: TemplatesHandlerImpl.java,v 1.2.4.1 2005/09/06 12:09:03 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.trax;
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.TemplatesHandler;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser;
@@ -37,15 +28,19 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
-
+import java.util.ArrayList;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.sax.TemplatesHandler;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
-import java.util.Vector;
-
/**
* Implementation of a JAXP1.1 TemplatesHandler
* @author Morten Jorgensen
@@ -268,13 +263,13 @@ public class TemplatesHandlerImpl
}
}
else {
- StringBuffer errorMessage = new StringBuffer();
- Vector errors = _parser.getErrors();
+ StringBuilder errorMessage = new StringBuilder();
+ ArrayList<ErrorMsg> errors = _parser.getErrors();
final int count = errors.size();
for (int i = 0; i < count; i++) {
if (errorMessage.length() > 0)
errorMessage.append('\n');
- errorMessage.append(errors.elementAt(i).toString());
+ errorMessage.append(errors.get(i).toString());
}
throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, new TransformerException(errorMessage.toString()));
}
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
index b37c8f4..e30fffd 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: TransformerFactoryImpl.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.trax;
@@ -48,6 +45,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
@@ -592,7 +590,7 @@ public class TransformerFactoryImpl
}
// Inefficient, but array is small
- for (int i =0; i < features.length; i++) {
+ for (int i = 0; i < features.length; i++) {
if (name.equals(features[i])) {
return true;
}
@@ -799,7 +797,7 @@ public class TransformerFactoryImpl
/**
* Pass warning messages from the compiler to the error listener
*/
- private void passWarningsToListener(Vector messages)
+ private void passWarningsToListener(ArrayList<ErrorMsg> messages)
throws TransformerException
{
if (_errorListener == null || messages == null) {
@@ -808,7 +806,7 @@ public class TransformerFactoryImpl
// Pass messages to listener, one by one
final int count = messages.size();
for (int pos = 0; pos < count; pos++) {
- ErrorMsg msg = (ErrorMsg)messages.elementAt(pos);
+ ErrorMsg msg = messages.get(pos);
// Workaround for the TCK failure ErrorListener.errorTests.error001.
if (msg.isWarningError())
_errorListener.error(
@@ -822,7 +820,7 @@ public class TransformerFactoryImpl
/**
* Pass error messages from the compiler to the error listener
*/
- private void passErrorsToListener(Vector messages) {
+ private void passErrorsToListener(ArrayList<ErrorMsg> messages) {
try {
if (_errorListener == null || messages == null) {
return;
@@ -830,7 +828,7 @@ public class TransformerFactoryImpl
// Pass messages to listener, one by one
final int count = messages.size();
for (int pos = 0; pos < count; pos++) {
- String message = messages.elementAt(pos).toString();
+ String message = messages.get(pos).toString();
_errorListener.error(new TransformerException(message));
}
}
@@ -1004,40 +1002,39 @@ public class TransformerFactoryImpl
}
// Check that the transformation went well before returning
- if (bytecodes == null) {
- Vector errs = xsltc.getErrors();
- ErrorMsg err;
- if (errs != null) {
- err = (ErrorMsg)errs.elementAt(errs.size()-1);
- } else {
- err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
- }
- Throwable cause = err.getCause();
- TransformerConfigurationException exc;
- if (cause != null) {
- exc = new TransformerConfigurationException(cause.getMessage(), cause);
- } else {
- exc = new TransformerConfigurationException(err.toString());
- }
+ if (bytecodes == null) {
+ ArrayList<ErrorMsg> errs = xsltc.getErrors();
+ ErrorMsg err;
+ if (errs != null) {
+ err = errs.get(errs.size() - 1);
+ } else {
+ err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
+ }
+ Throwable cause = err.getCause();
+ TransformerConfigurationException exc;
+ if (cause != null) {
+ exc = new TransformerConfigurationException(cause.getMessage(), cause);
+ } else {
+ exc = new TransformerConfigurationException(err.toString());
+ }
- // Pass compiler errors to the error listener
- if (_errorListener != null) {
- passErrorsToListener(xsltc.getErrors());
+ // Pass compiler errors to the error listener
+ if (_errorListener != null) {
+ passErrorsToListener(xsltc.getErrors());
- // As required by TCK 1.2, send a fatalError to the
- // error listener because compilation of the stylesheet
- // failed and no further processing will be possible.
- try {
- _errorListener.fatalError(exc);
- } catch (TransformerException te) {
- // well, we tried.
+ // As required by TCK 1.2, send a fatalError to the
+ // error listener because compilation of the stylesheet
+ // failed and no further processing will be possible.
+ try {
+ _errorListener.fatalError(exc);
+ } catch (TransformerException te) {
+ // well, we tried.
+ }
+ } else {
+ xsltc.printErrors();
}
+ throw exc;
}
- else {
- xsltc.printErrors();
- }
- throw exc;
- }
return new TemplatesImpl(bytecodes, transletName,
xsltc.getOutputProperties(), _indentNumber, this);
diff --git a/src/com/sun/org/apache/xerces/internal/dom/AbortException.java b/src/com/sun/org/apache/xerces/internal/dom/AbortException.java
new file mode 100644
index 0000000..3e178dd
--- /dev/null
+++ b/src/com/sun/org/apache/xerces/internal/dom/AbortException.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.org.apache.xerces.internal.dom;
+
+public class AbortException extends RuntimeException {
+
+ private static final long serialVersionUID = 2608302175475740417L;
+
+ /**
+ * Constructor AbortException
+ */
+ public AbortException() { super(null, null, false, false); }
+}
diff --git a/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java b/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
index 3758f39..c4268dc 100644
--- a/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
+++ b/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.io.StringReader;
import java.util.Vector;
+import com.sun.org.apache.xerces.internal.dom.AbortException;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.RevalidationHandler;
import com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar;
@@ -158,11 +159,6 @@ public class DOMNormalizer implements XMLDocumentHandler {
// attribute value normalization
final XMLString fNormalizedValue = new XMLString(new char[16], 0, 0);
- /**
- * If the user stops the process, this exception will be thrown.
- */
- public static final RuntimeException abort = new RuntimeException();
-
//DTD validator
private XMLDTDValidator fDTDValidator;
@@ -243,11 +239,10 @@ public class DOMNormalizer implements XMLDocumentHandler {
XMLGrammarDescription.XML_SCHEMA, fValidationHandler);
fValidationHandler = null;
}
- }
- catch (RuntimeException e) {
- if( e==abort )
- return; // processing aborted by the user
- throw e; // otherwise re-throw.
+ } catch (AbortException e) {
+ return;
+ } catch (RuntimeException e) {
+ throw e; // otherwise re-throw.
}
}
@@ -1372,10 +1367,10 @@ public class DOMNormalizer implements XMLDocumentHandler {
error.fRelatedData = locator.fRelatedNode;
if(!errorHandler.handleError(error))
- throw abort;
+ throw new AbortException();
}
if( severity==DOMError.SEVERITY_FATAL_ERROR )
- throw abort;
+ throw new AbortException();
}
protected final void updateQName (Node node, QName qname){
@@ -2044,5 +2039,4 @@ public class DOMNormalizer implements XMLDocumentHandler {
return null;
}
-
} // DOMNormalizer class
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java b/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
index dac7fbf..84543ec 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2671,6 +2671,9 @@ public class XMLGregorianCalendarImpl
customTimezoneId.append(sign);
customTimezoneId.append(hour);
if (minutes != 0) {
+ if (minutes < 10) {
+ customTimezoneId.append('0');
+ }
customTimezoneId.append(minutes);
}
result = TimeZone.getTimeZone(customTimezoneId.toString());
diff --git a/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java b/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java
index d17cf33..8f14d74 100644
--- a/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java
+++ b/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java
@@ -33,6 +33,7 @@ import java.net.URLConnection;
import java.util.StringTokenizer;
import java.util.Vector;
+import com.sun.org.apache.xerces.internal.dom.AbortException;
import com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl;
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl;
import com.sun.org.apache.xerces.internal.dom.DOMLocatorImpl;
@@ -117,7 +118,6 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
private DOMErrorHandler fErrorHandler = null;
private final DOMErrorImpl fError = new DOMErrorImpl();
private final DOMLocatorImpl fLocator = new DOMLocatorImpl();
- private static final RuntimeException abort = new RuntimeException();
/**
* Constructs a new LSSerializer.
@@ -539,11 +539,9 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
} catch (LSException lse) {
// Rethrow LSException.
throw lse;
+ } catch (AbortException e) {
+ return null;
} catch (RuntimeException e) {
- if (e == DOMNormalizer.abort){
- // stopped at user request
- return null;
- }
throw (LSException) new LSException(LSException.SERIALIZE_ERR, e.toString()).initCause(e);
} catch (IOException ioe) {
// REVISIT: A generic IOException doesn't provide enough information
@@ -836,11 +834,9 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
} catch (LSException lse) {
// Rethrow LSException.
throw lse;
+ } catch (AbortException e) {
+ return false;
} catch (RuntimeException e) {
- if (e == DOMNormalizer.abort){
- // stopped at user request
- return false;
- }
throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
} catch (Exception e) {
if (ser.fDOMErrorHandler != null) {
@@ -992,11 +988,9 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
} catch (LSException lse) {
// Rethrow LSException.
throw lse;
+ } catch (AbortException e) {
+ return false;
} catch (RuntimeException e) {
- if (e == DOMNormalizer.abort){
- // stopped at user request
- return false;
- }
throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
} catch (Exception e) {
if (ser.fDOMErrorHandler != null) {