diff options
author | Raluca Sauciuc <ralucas@google.com> | 2016-08-26 09:28:31 -0700 |
---|---|---|
committer | Raluca Sauciuc <ralucas@google.com> | 2016-08-26 09:28:31 -0700 |
commit | 07a190d0f25d6abc8b425751b7b6f2a562c56743 (patch) | |
tree | f29cc5a00df0276fc7c401a5649637c693b8f7c5 /src/com/sun | |
parent | 7c0f138cfd3eae2d1a0c5623bb6917cfe0c14368 (diff) | |
parent | 8d532bedb202c25a6a20f8067e6454a9f4c47109 (diff) | |
download | jdk8u_jaxp-07a190d0f25d6abc8b425751b7b6f2a562c56743.tar.gz |
Merge 'jetbrains-master-mirror' into studio-master-dev
Diffstat (limited to 'src/com/sun')
47 files changed, 732 insertions, 618 deletions
diff --git a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java index 966d0ca..d1a408f 100644 --- a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java +++ b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java @@ -1356,8 +1356,8 @@ public class XSLTErrorResources_de extends ListResourceBundle { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER fully qualified class name of parser liaison]"}, - { "optionE", " [-E (Entit\u00E4tsreferenzen nicht einblenden)]"}, - { "optionV", " [-E (Entit\u00E4tsreferenzen nicht einblenden)]"}, + { "optionE", " [-E (Entityreferenzen nicht einblenden)]"}, + { "optionV", " [-E (Entityreferenzen nicht einblenden)]"}, { "optionQC", " [-QC (Stille Musterkonfliktwarnungen)]"}, { "optionQ", " [-Q (Silent-Modus)]"}, { "optionLF", " [-LF (Nur Zeilenvorsch\u00FCbe bei Ausgabe verwenden {Standard ist CR/LF})]"}, @@ -1381,7 +1381,7 @@ public class XSLTErrorResources_de extends ListResourceBundle { "noParsermsg4", "Wenn Sie nicht \u00FCber den XML-Parser f\u00FCr Java von IBM verf\u00FCgen, k\u00F6nnen Sie ihn hier herunterladen:"}, { "noParsermsg5", "IBMs AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER full class name (URIResolver f\u00FCr die Aufl\u00F6sung von URIs)]"}, - { "optionENTITYRESOLVER", " [-ENTITYRESOLVER full class name (EntityResolver f\u00FCr die Aufl\u00F6sung von Entit\u00E4ten)]"}, + { "optionENTITYRESOLVER", " [-ENTITYRESOLVER full class name (EntityResolver f\u00FCr die Aufl\u00F6sung von Entitys)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER full class name (ContentHandler f\u00FCr die Serialisierung der Ausgabe)]"}, { "optionLINENUMBERS", " [-L use line numbers for source document]"}, { "optionSECUREPROCESSING", " [-SECURE (Feature f\u00FCr die sichere Verarbeitung auf \"true\" setzen.)]"}, diff --git a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java index cdb3cab..fe292ee 100644 --- a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java +++ b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java @@ -588,7 +588,7 @@ public class XSLTErrorResources_ko extends ListResourceBundle "\uC2A4\uD0C0\uC77C\uC2DC\uD2B8 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}"}, { ER_IOEXCEPTION, - "\uC2A4\uD0C0\uC77C\uC2DC\uD2B8 \uD30C\uC77C\uC5D0 IO \uC608\uC678 \uC0AC\uD56D \uBC1C\uC0DD: {0}"}, + "\uC2A4\uD0C0\uC77C\uC2DC\uD2B8 \uD30C\uC77C\uC5D0 IO \uC608\uC678\uC0AC\uD56D \uBC1C\uC0DD: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) {0}\uC5D0 \uB300\uD55C href \uC18D\uC131\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}, @@ -714,7 +714,7 @@ public class XSLTErrorResources_ko extends ListResourceBundle "processStylesheet\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4!"}, { ER_SAX_EXCEPTION, - "SAX \uC608\uC678 \uC0AC\uD56D"}, + "SAX \uC608\uC678\uC0AC\uD56D"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, @@ -1322,7 +1322,7 @@ public class XSLTErrorResources_ko extends ListResourceBundle { "help_language", "ko" }, { "language", "ko" }, { "BAD_CODE", "createMessage\uC5D0 \uB300\uD55C \uB9E4\uAC1C\uBCC0\uC218\uAC00 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4."}, - { "FORMAT_FAILED", "messageFormat \uD638\uCD9C \uC911 \uC608\uC678 \uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, + { "FORMAT_FAILED", "messageFormat \uD638\uCD9C \uC911 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, { "version", ">>>>>>> Xalan \uBC84\uC804 "}, { "version2", "<<<<<<<"}, { "yes", "\uC608"}, diff --git a/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java b/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java index 0701bb1..d11c50b 100644 --- a/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java +++ b/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java @@ -26,6 +26,8 @@ package com.sun.org.apache.xalan.internal.utils; import com.sun.org.apache.xalan.internal.XalanConstants; +import java.util.concurrent.CopyOnWriteArrayList; +import org.xml.sax.SAXException; /** @@ -415,6 +417,23 @@ public final class XMLSecurityManager { } + // Array list to store printed warnings for each SAX parser used + private static final CopyOnWriteArrayList<String> printedWarnings = new CopyOnWriteArrayList<>(); + + /** + * Prints out warnings if a parser does not support the specified feature/property. + * + * @param parserClassName the name of the parser class + * @param propertyName the property name + * @param exception the exception thrown by the parser + */ + public static void printWarning(String parserClassName, String propertyName, SAXException exception) { + String key = parserClassName+":"+propertyName; + if (printedWarnings.addIfAbsent(key)) { + System.err.println( "Warning: "+parserClassName+": "+exception.getMessage()); + } + } + /** * Read from system properties, or those in jaxp.properties * diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/DOM.java b/src/com/sun/org/apache/xalan/internal/xsltc/DOM.java index bf6fbf1..25ce372 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/DOM.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/DOM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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: DOM.java,v 1.2.4.1 2005/08/31 10:18:49 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc; @@ -102,4 +99,5 @@ public interface DOM { public int getDocument(); public String getUnparsedEntityURI(String name); public Map<String, Integer> getElementsWithIDs(); + public void release(); } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java index 174a1d1..d7bc1ca 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.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: ApplyTemplates.java,v 1.2.4.1 2005/09/12 09:59:21 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; @@ -120,12 +117,10 @@ final class ApplyTemplates extends Instruction { final int current = methodGen.getLocalIndex("current"); // check if sorting nodes is required - final Vector sortObjects = new Vector(); - final Iterator<SyntaxTreeNode> children = elements(); - while (children.hasNext()) { - final SyntaxTreeNode child = children.next(); + final Vector<Sort> sortObjects = new Vector<>(); + for (final SyntaxTreeNode child : getContents()) { if (child instanceof Sort) { - sortObjects.addElement(child); + sortObjects.addElement((Sort)child); } } @@ -191,6 +186,13 @@ final class ApplyTemplates extends Instruction { applyTemplatesSig); il.append(new INVOKEVIRTUAL(applyTemplates)); + // unmap parameters to release temporary result trees + for (final SyntaxTreeNode child : getContents()) { + if (child instanceof WithParam) { + ((WithParam)child).releaseResultTree(classGen, methodGen); + } + } + // Pop parameter frame if (stylesheet.hasLocalParams() || hasContents()) { il.append(classGen.loadTranslet()); diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/CallTemplate.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/CallTemplate.java index caace08..2e2ca14 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/CallTemplate.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/CallTemplate.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright 2001-2004 The Apache Software Foundation. @@ -17,18 +16,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: CallTemplate.java,v 1.2.4.1 2005/09/12 10:02:41 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; -import com.sun.org.apache.bcel.internal.generic.ALOAD; -import com.sun.org.apache.bcel.internal.generic.ASTORE; import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; import com.sun.org.apache.bcel.internal.generic.InstructionList; -import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; @@ -56,7 +49,7 @@ final class CallTemplate extends Instruction { * this array can be either a WithParam or a Param if no WithParam * exists for a particular parameter. */ - private Object[] _parameters = null; + private SyntaxTreeNode[] _parameters = null; /** * The corresponding template which this CallTemplate calls. @@ -147,11 +140,10 @@ final class CallTemplate extends Instruction { // If calling a simply named template, push actual arguments if (_calleeTemplate != null) { - Vector calleeParams = _calleeTemplate.getParameters(); int numParams = _parameters.length; for (int i = 0; i < numParams; i++) { - SyntaxTreeNode node = (SyntaxTreeNode)_parameters[i]; + SyntaxTreeNode node = _parameters[i]; methodSig.append(OBJECT_SIG); // append Object to signature // Push 'null' if Param to indicate no actual parameter specified @@ -170,6 +162,15 @@ final class CallTemplate extends Instruction { methodName, methodSig.toString()))); + // release temporary result trees + if (_parameters != null) { + for (int i = 0; i < _parameters.length; i++) { + if (_parameters[i] instanceof WithParam) { + ((WithParam)_parameters[i]).releaseResultTree(classGen, methodGen); + } + } + } + // Do not need to call Translet.popParamFrame() if we are // calling a simple named template. if (_calleeTemplate == null && (stylesheet.hasLocalParams() || hasContents())) { @@ -203,9 +204,9 @@ final class CallTemplate extends Instruction { private void buildParameterList() { // Put the parameters from the called template into the array first. // This is to ensure the order of the parameters. - Vector defaultParams = _calleeTemplate.getParameters(); + Vector<Param> defaultParams = _calleeTemplate.getParameters(); int numParams = defaultParams.size(); - _parameters = new Object[numParams]; + _parameters = new SyntaxTreeNode[numParams]; for (int i = 0; i < numParams; i++) { _parameters[i] = defaultParams.elementAt(i); } @@ -222,15 +223,15 @@ final class CallTemplate extends Instruction { // Search for a Param with the same name for (int k = 0; k < numParams; k++) { - Object object = _parameters[k]; - if (object instanceof Param - && ((Param)object).getName().equals(name)) { + SyntaxTreeNode parm = _parameters[k]; + if (parm instanceof Param + && ((Param)parm).getName().equals(name)) { withParam.setDoParameterOptimization(true); _parameters[k] = withParam; break; } - else if (object instanceof WithParam - && ((WithParam)object).getName().equals(name)) { + else if (parm instanceof WithParam + && ((WithParam)parm).getName().equals(name)) { withParam.setDoParameterOptimization(true); _parameters[k] = withParam; break; 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 5e8e742..e136357 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 @@ -36,6 +36,7 @@ import com.sun.org.apache.xml.internal.serializer.ElemDesc; import com.sun.org.apache.xml.internal.serializer.ToHTMLStream; import java.util.ArrayList; import java.util.HashMap; +import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; @@ -104,9 +105,9 @@ final class LiteralElement extends Instruction { } } - // Check if we have any declared namesaces + // Check if we have any declared namespaces if (_accessedPrefixes == null) { - _accessedPrefixes = new HashMap<>(); + _accessedPrefixes = new Hashtable<>(); } else { if (!declared) { 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 2584f43..d15d90e 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 @@ -489,18 +489,20 @@ public class Parser implements Constants, ContentHandler { } final XMLReader reader = parser.getXMLReader(); + String lastProperty = ""; try { XMLSecurityManager securityManager = (XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER); for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { - reader.setProperty(limit.apiProperty(), securityManager.getLimitValueAsString(limit)); + lastProperty = limit.apiProperty(); + reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit)); } if (securityManager.printEntityCountInfo()) { + lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO; parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); } } catch (SAXException se) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + se.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se); } return(parse(reader, input)); diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java index d8264a2..f7309e5 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright 2001-2005 The Apache Software Foundation. @@ -17,32 +16,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: Sort.java,v 1.2.4.1 2005/09/12 11:08:12 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; -import java.text.Collator; import java.util.ArrayList; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; import java.util.Vector; import com.sun.org.apache.bcel.internal.classfile.Field; -import com.sun.org.apache.bcel.internal.classfile.Method; import com.sun.org.apache.bcel.internal.generic.ALOAD; import com.sun.org.apache.bcel.internal.generic.ANEWARRAY; import com.sun.org.apache.bcel.internal.generic.ASTORE; import com.sun.org.apache.bcel.internal.generic.CHECKCAST; import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.GETFIELD; -import com.sun.org.apache.bcel.internal.generic.ICONST; import com.sun.org.apache.bcel.internal.generic.ILOAD; 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.InstructionHandle; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; @@ -76,13 +65,10 @@ final class Sort extends Instruction implements Closure { private AttributeValue _order; private AttributeValue _caseOrder; private AttributeValue _dataType; - private String _lang; // bug! see 26869 - - private String _data = null; - + private String _lang; // bug! see 26869 private String _className = null; - private ArrayList _closureVars = null; + private ArrayList<VariableRefBase> _closureVars = null; private boolean _needsSortRecordFactory = false; // -- Begin Closure interface -------------------- @@ -115,7 +101,7 @@ final class Sort extends Instruction implements Closure { */ public void addVariable(VariableRefBase variableRef) { if (_closureVars == null) { - _closureVars = new ArrayList(); + _closureVars = new ArrayList<>(); } // Only one reference per variable @@ -246,7 +232,7 @@ final class Sort extends Instruction implements Closure { public static void translateSortIterator(ClassGenerator classGen, MethodGenerator methodGen, Expression nodeSet, - Vector sortObjects) + Vector<Sort> sortObjects) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); @@ -312,7 +298,7 @@ final class Sort extends Instruction implements Closure { * Compiles code that instantiates a NodeSortRecordFactory object which * will produce NodeSortRecord objects of a specific type. */ - public static void compileSortRecordFactory(Vector sortObjects, + public static void compileSortRecordFactory(Vector<Sort> sortObjects, ClassGenerator classGen, MethodGenerator methodGen) { String sortRecordClass = @@ -321,7 +307,7 @@ final class Sort extends Instruction implements Closure { boolean needsSortRecordFactory = false; final int nsorts = sortObjects.size(); for (int i = 0; i < nsorts; i++) { - final Sort sort = (Sort) sortObjects.elementAt(i); + final Sort sort = sortObjects.elementAt(i); needsSortRecordFactory |= sort._needsSortRecordFactory; } @@ -429,7 +415,7 @@ final class Sort extends Instruction implements Closure { + "[" + STRING_SIG + ")V"))); // Initialize closure variables in sortRecordFactory - final ArrayList dups = new ArrayList(); + final ArrayList<VariableRefBase> dups = new ArrayList<>(); for (int j = 0; j < nsorts; j++) { final Sort sort = (Sort) sortObjects.get(j); @@ -437,7 +423,7 @@ final class Sort extends Instruction implements Closure { sort._closureVars.size(); for (int i = 0; i < length; i++) { - VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i); + VariableRefBase varRef = sort._closureVars.get(i); // Discard duplicate variable references if (dups.contains(varRef)) continue; @@ -455,11 +441,11 @@ final class Sort extends Instruction implements Closure { } } - public static String compileSortRecordFactory(Vector sortObjects, + public static String compileSortRecordFactory(Vector<Sort> sortObjects, ClassGenerator classGen, MethodGenerator methodGen, String sortRecordClass) { - final XSLTC xsltc = ((Sort)sortObjects.firstElement()).getXSLTC(); + final XSLTC xsltc = (sortObjects.firstElement()).getXSLTC(); final String className = xsltc.getHelperClassName(); final NodeSortRecordFactGenerator sortRecordFactory = @@ -474,15 +460,15 @@ final class Sort extends Instruction implements Closure { // Add a new instance variable for each var in closure final int nsorts = sortObjects.size(); - final ArrayList dups = new ArrayList(); + final ArrayList<VariableRefBase> dups = new ArrayList<>(); for (int j = 0; j < nsorts; j++) { - final Sort sort = (Sort) sortObjects.get(j); + final Sort sort = sortObjects.get(j); final int length = (sort._closureVars == null) ? 0 : sort._closureVars.size(); for (int i = 0; i < length; i++) { - final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i); + final VariableRefBase varRef = sort._closureVars.get(i); // Discard duplicate variable references if (dups.contains(varRef)) continue; @@ -600,10 +586,10 @@ final class Sort extends Instruction implements Closure { /** * Create a new auxillary class extending NodeSortRecord. */ - private static String compileSortRecord(Vector sortObjects, + private static String compileSortRecord(Vector<Sort> sortObjects, ClassGenerator classGen, MethodGenerator methodGen) { - final XSLTC xsltc = ((Sort)sortObjects.firstElement()).getXSLTC(); + final XSLTC xsltc = sortObjects.firstElement().getXSLTC(); final String className = xsltc.getHelperClassName(); // This generates a new class for handling this specific sort @@ -619,10 +605,10 @@ final class Sort extends Instruction implements Closure { // Add a new instance variable for each var in closure final int nsorts = sortObjects.size(); - final ArrayList dups = new ArrayList(); + final ArrayList<VariableRefBase> dups = new ArrayList<>(); for (int j = 0; j < nsorts; j++) { - final Sort sort = (Sort) sortObjects.get(j); + final Sort sort = sortObjects.get(j); // Set the name of the inner class in this sort object sort.setInnerClassName(className); @@ -644,8 +630,7 @@ final class Sort extends Instruction implements Closure { } } - MethodGenerator init = compileInit(sortObjects, sortRecord, - cpg, className); + MethodGenerator init = compileInit(sortRecord, cpg, className); MethodGenerator extract = compileExtract(sortObjects, sortRecord, cpg, className); sortRecord.addMethod(init); @@ -660,8 +645,7 @@ final class Sort extends Instruction implements Closure { * collator in the super calls only when the stylesheet specifies a new * language in xsl:sort. */ - private static MethodGenerator compileInit(Vector sortObjects, - NodeSortRecordGenerator sortRecord, + private static MethodGenerator compileInit(NodeSortRecordGenerator sortRecord, ConstantPoolGen cpg, String className) { @@ -688,7 +672,7 @@ final class Sort extends Instruction implements Closure { /** * Compiles a method that overloads NodeSortRecord.extractValueFromDOM() */ - private static MethodGenerator compileExtract(Vector sortObjects, + private static MethodGenerator compileExtract(Vector<Sort> sortObjects, NodeSortRecordGenerator sortRecord, ConstantPoolGen cpg, String className) { @@ -730,7 +714,7 @@ final class Sort extends Instruction implements Closure { // Append all the cases for the switch statment for (int level = 0; level < levels; level++) { match[level] = level; - final Sort sort = (Sort)sortObjects.elementAt(level); + final Sort sort = sortObjects.elementAt(level); target[level] = il.append(NOP); sort.translateSelect(sortRecord, extractMethod); il.append(ARETURN); 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 e9020cf..1e8ad86 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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: SyntaxTreeNode.java,v 1.6 2006/06/06 22:34:33 spericas Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; @@ -519,9 +516,9 @@ public abstract class SyntaxTreeNode implements Constants { // references falling out-of-scope inside the for-each element. // (the cause of which being 'lazy' register allocation for references) for (int i = 0; i < n; i++) { - if( _contents.get(i) instanceof VariableBase) { + if ( _contents.get(i) instanceof VariableBase) { final VariableBase var = (VariableBase)_contents.get(i); - var.unmapRegister(methodGen); + var.unmapRegister(classGen, methodGen); } } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Template.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Template.java index b4d8228..c683744 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Template.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Template.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: Template.java,v 1.2.4.1 2005/09/12 11:30:11 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; @@ -61,7 +58,7 @@ public final class Template extends TopLevelElement { // The list of parameters in this template. This is only used // for simple named templates. - private Vector _parameters = new Vector(); + private Vector<Param> _parameters = new Vector<>(); public boolean hasParams() { return _parameters.size() > 0; @@ -83,7 +80,7 @@ public final class Template extends TopLevelElement { _parameters.addElement(param); } - public Vector getParameters() { + public Vector<Param> getParameters() { return _parameters; } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableBase.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableBase.java index 7ef4c1c..02e1a5f 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableBase.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableBase.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright 2001-2004 The Apache Software Foundation. @@ -17,18 +16,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: VariableBase.java,v 1.5 2005/09/28 13:48:18 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; import java.util.Vector; +import com.sun.org.apache.bcel.internal.generic.CHECKCAST; import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.Instruction; import com.sun.org.apache.bcel.internal.generic.InstructionList; +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.INVOKEVIRTUAL; import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; import com.sun.org.apache.bcel.internal.generic.NEW; import com.sun.org.apache.bcel.internal.generic.PUSH; @@ -36,6 +35,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSetType; +import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; import com.sun.org.apache.xml.internal.utils.XML11Char; @@ -49,21 +49,18 @@ import com.sun.org.apache.xml.internal.utils.XML11Char; */ class VariableBase extends TopLevelElement { - protected QName _name; // The name of the variable. - protected String _escapedName; // The escaped qname of the variable. - protected Type _type; // The type of this variable. - protected boolean _isLocal; // True if the variable is local. - protected LocalVariableGen _local; // Reference to JVM variable - protected Instruction _loadInstruction; // Instruction to load JVM variable + protected QName _name; // The name of the variable. + protected String _escapedName; // The escaped qname of the variable. + protected Type _type; // The type of this variable. + protected boolean _isLocal; // True if the variable is local. + protected LocalVariableGen _local; // Reference to JVM variable + protected Instruction _loadInstruction; // Instruction to load JVM variable protected Instruction _storeInstruction; // Instruction to load JVM variable - protected Expression _select; // Reference to variable expression - protected String select; // Textual repr. of variable expr. + protected Expression _select; // Reference to variable expression + protected String select; // Textual repr. of variable expr. // References to this variable (when local) - protected Vector _refs = new Vector(2); - - // Dependencies to other variables/parameters (for globals only) - protected Vector _dependencies = null; + protected Vector<VariableRefBase> _refs = new Vector<>(2); // Used to make sure parameter field is not added twice protected boolean _ignore = false; @@ -92,7 +89,7 @@ class VariableBase extends TopLevelElement { public void copyReferences(VariableBase var) { final int size = _refs.size(); for (int i = 0; i < size; i++) { - var.addReference((VariableRefBase) _refs.get(i)); + var.addReference(_refs.get(i)); } } @@ -112,8 +109,24 @@ class VariableBase extends TopLevelElement { * Remove the mapping of this variable to a register. * Called when we leave the AST scope of the variable's declaration */ - public void unmapRegister(MethodGenerator methodGen) { + public void unmapRegister(ClassGenerator classGen, MethodGenerator methodGen) { if (_local != null) { + if (_type instanceof ResultTreeType) { + final ConstantPoolGen cpg = classGen.getConstantPool(); + final InstructionList il = methodGen.getInstructionList(); + if (classGen.getStylesheet().callsNodeset() && classGen.getDOMClass().equals(MULTI_DOM_CLASS)) { + final int removeDA = cpg.addMethodref(MULTI_DOM_CLASS, "removeDOMAdapter", "(" + DOM_ADAPTER_SIG + ")V"); + il.append(methodGen.loadDOM()); + il.append(new CHECKCAST(cpg.addClass(MULTI_DOM_CLASS))); + il.append(loadInstruction()); + il.append(new CHECKCAST(cpg.addClass(DOM_ADAPTER_CLASS))); + il.append(new INVOKEVIRTUAL(removeDA)); + } + final int release = cpg.addInterfaceMethodref(DOM_IMPL_CLASS, "release", "()V"); + il.append(loadInstruction()); + il.append(new INVOKEINTERFACE(release, 1)); + } + _local.setEnd(methodGen.getInstructionList().getEnd()); methodGen.removeLocalVariable(_local); _refs = null; @@ -126,7 +139,6 @@ class VariableBase extends TopLevelElement { * the JVM stack. */ public Instruction loadInstruction() { - final Instruction instr = _loadInstruction; if (_loadInstruction == null) { _loadInstruction = _type.LOAD(_local.getIndex()); } @@ -138,7 +150,6 @@ class VariableBase extends TopLevelElement { * into this variable. */ public Instruction storeInstruction() { - final Instruction instr = _storeInstruction; if (_storeInstruction == null) { _storeInstruction = _type.STORE(_local.getIndex()); } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/WithParam.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/WithParam.java index 3a87d59..fc2b202 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/WithParam.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/WithParam.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright 2001-2004 The Apache Software Foundation. @@ -17,15 +16,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: WithParam.java,v 1.2.4.1 2005/09/12 11:38:01 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.compiler; +import com.sun.org.apache.bcel.internal.generic.ALOAD; +import com.sun.org.apache.bcel.internal.generic.ASTORE; +import com.sun.org.apache.bcel.internal.generic.CHECKCAST; import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; +import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE; import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; import com.sun.org.apache.bcel.internal.generic.InstructionList; +import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; import com.sun.org.apache.bcel.internal.generic.PUSH; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; @@ -60,6 +61,11 @@ final class WithParam extends Instruction { private Expression _select; /** + * Reference to JVM variable holding temporary result tree. + */ + private LocalVariableGen _domAdapter; + + /** * %OPT% This is set to true when the WithParam is used in a CallTemplate * for a simple named template. If this is true, the parameters are * passed to the named template through method arguments rather than @@ -164,8 +170,13 @@ final class WithParam extends Instruction { _select.startIterator(classGen, methodGen); } // If not, compile result tree from parameter body if present. + // Store result tree into local variable for releasing it later else if (hasContents()) { + final InstructionList il = methodGen.getInstructionList(); compileResultTree(classGen, methodGen); + _domAdapter = methodGen.addLocalVariable2("@" + _escapedName, Type.ResultTree.toJCType(), il.getEnd()); + il.append(DUP); + il.append(new ASTORE(_domAdapter.getIndex())); } // If neither are present then store empty string in parameter slot else { @@ -208,4 +219,26 @@ final class WithParam extends Instruction { ADD_PARAMETER_SIG))); il.append(POP); // cleanup stack } + + /** + * Release the compiled result tree. + */ + public void releaseResultTree(ClassGenerator classGen, MethodGenerator methodGen) { + if (_domAdapter != null) { + final ConstantPoolGen cpg = classGen.getConstantPool(); + final InstructionList il = methodGen.getInstructionList(); + if (classGen.getStylesheet().callsNodeset() && classGen.getDOMClass().equals(MULTI_DOM_CLASS)) { + final int removeDA = cpg.addMethodref(MULTI_DOM_CLASS, "removeDOMAdapter", "(" + DOM_ADAPTER_SIG + ")V"); + il.append(methodGen.loadDOM()); + il.append(new CHECKCAST(cpg.addClass(MULTI_DOM_CLASS))); + il.append(new ALOAD(_domAdapter.getIndex())); + il.append(new CHECKCAST(cpg.addClass(DOM_ADAPTER_CLASS))); + il.append(new INVOKEVIRTUAL(removeDA)); + } + final int release = cpg.addInterfaceMethodref(DOM_IMPL_CLASS, "release", "()V"); + il.append(new ALOAD(_domAdapter.getIndex())); + il.append(new INVOKEINTERFACE(release, 1)); + _domAdapter = null; + } + } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java index b3cd007..e0f0ef6 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java @@ -300,7 +300,7 @@ public class ErrorMessages_ko extends ListResourceBundle { * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, - "\uC774\uC9C4 \uD45C\uD604\uC2DD\uC5D0 \uB300\uD574 \uC54C \uC218 \uC5C6\uB294 \uC5F0\uC0B0\uC790\uC785\uB2C8\uB2E4."}, + "\uBC14\uC774\uB108\uB9AC \uD45C\uD604\uC2DD\uC5D0 \uB300\uD574 \uC54C \uC218 \uC5C6\uB294 \uC5F0\uC0B0\uC790\uC785\uB2C8\uB2E4."}, /* * Note to translators: This message is produced if a reference to a diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java index fc1b1d9..cb50cf5 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.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,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: AdaptiveResultTreeImpl.java,v 1.2.4.1 2005/09/06 05:52:18 pvedula Exp $ - */ + package com.sun.org.apache.xalan.internal.xsltc.dom; import com.sun.org.apache.xalan.internal.xsltc.DOM; @@ -1338,4 +1336,11 @@ public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl } } + public void release() { + if (_dom != null) { + _dom.release(); + _dom = null; + } + super.release(); + } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter.java b/src/com/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter.java index a12d9e4..4f44ae1 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter.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: DOMAdapter.java,v 1.2.4.1 2005/09/06 06:07:28 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.dom; @@ -56,8 +53,6 @@ public final class DOMAdapter implements DOM { private short[] _NSmapping = null; private short[] _NSreverse = null; - private StripFilter _filter = null; - private int _multiDOMMask; public DOMAdapter(DOM dom, @@ -165,9 +160,7 @@ public final class DOMAdapter implements DOM { } } - public void setFilter(StripFilter filter) { - _filter = filter; - } + public void setFilter(StripFilter filter) {} public DTMAxisIterator getTypedChildren(final int type) { final int[] reverse = getReverse(); @@ -464,4 +457,8 @@ public final class DOMAdapter implements DOM { public Map<String, Integer> getElementsWithIDs() { return _dom.getElementsWithIDs(); } + + public void release() { + _dom.release(); + } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java b/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java index 66dfdc4..92eca91 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.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 @@ -670,4 +670,51 @@ public final class MultiDOM implements DOM { public Map<String, Integer> getElementsWithIDs() { return _main.getElementsWithIDs(); } + + public void release() { + _main.release(); + } + + private boolean isMatchingAdapterEntry(DOM entry, DOMAdapter adapter) { + DOM dom = adapter.getDOMImpl(); + + return (entry == adapter) || ( + /* + * Method addDOMAdapter overwrites for AdaptiveResultTreeImpl + * objects the usual entry with an adapter to the nested + * DOM, so we must check this here. See last 'if' statement + * of addDOMAdapter. + */ + (dom instanceof AdaptiveResultTreeImpl) && + (entry instanceof DOMAdapter) && + (((AdaptiveResultTreeImpl)dom).getNestedDOM() == ((DOMAdapter)entry).getDOMImpl()) + ); + } + + public void removeDOMAdapter(DOMAdapter adapter) { + _documents.remove(adapter.getDocumentURI(0)); + DOM dom = adapter.getDOMImpl(); + + if (dom instanceof DTMDefaultBase) { + SuballocatedIntVector ids = ((DTMDefaultBase) dom).getDTMIDs(); + int idsSize = ids.size(); + for (int i = 0; i < idsSize; i++) { + _adapters[ids.elementAt(i) >>> DTMManager.IDENT_DTM_NODE_BITS] = null; + } + } else { + int id = dom.getDocument() >>> DTMManager.IDENT_DTM_NODE_BITS; + if ((id > 0) && (id < _adapters.length) && isMatchingAdapterEntry(_adapters[id], adapter)) { + _adapters[id] = null; + } else { + boolean found = false; + for (int i = 0; i < _adapters.length; i++) { + if (isMatchingAdapterEntry(_adapters[id], adapter)) { + _adapters[i] = null; + found = true; + break; + } + } + } + } + } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java index 77c56e5..2919b9b 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.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: SAXImpl.java,v 1.5 2005/09/28 13:48:37 pvedula Exp $ - */ package com.sun.org.apache.xalan.internal.xsltc.dom; @@ -82,7 +79,7 @@ public final class SAXImpl extends SAX2DTM2 // Namespace prefix-to-uri mapping stuff private int _uriCount = 0; - private int _prefixCount = 0; + // private int _prefixCount = 0; // Stack used to keep track of what whitespace text nodes are protected // by xml:space="preserve" attributes and which nodes that are not. @@ -90,11 +87,11 @@ public final class SAXImpl extends SAX2DTM2 private int _idx = 1; private boolean _preserve = false; - private static final String XML_STRING = "xml:"; + // private static final String XML_STRING = "xml:"; private static final String XML_PREFIX = "xml"; private static final String XMLSPACE_STRING = "xml:space"; private static final String PRESERVE_STRING = "preserve"; - private static final String XMLNS_PREFIX = "xmlns"; + // private static final String XMLNS_PREFIX = "xmlns"; private static final String XML_URI = "http://www.w3.org/XML/1998/namespace"; private boolean _escaping = true; @@ -123,7 +120,7 @@ public final class SAXImpl extends SAX2DTM2 private BitArray _dontEscape = null; // The URI to this document - private String _documentURI = null; + // private String _documentURI = null; static private int _documentURIIndex = 0; // The owner Document when the input source is DOMSource. @@ -143,8 +140,7 @@ public final class SAXImpl extends SAX2DTM2 // Support for access/navigation through org.w3c.dom API private Node[] _nodes; private NodeList[] _nodeLists; - private final static String XML_LANG_ATTRIBUTE = - "http://www.w3.org/XML/1998/namespace:@lang"; + // private final static String XML_LANG_ATTRIBUTE = "http://www.w3.org/XML/1998/namespace:@lang"; /** * Define the origin of the document from which the tree was built @@ -491,6 +487,7 @@ public final class SAXImpl extends SAX2DTM2 /** * Sets up a translet-to-dom type mapping table */ + /* private int[] setupMapping(String[] names, String[] uris, int[] types, int nNames) { // Padding with number of names, because they // may need to be added, i.e for RTFs. See copy03 @@ -502,6 +499,7 @@ public final class SAXImpl extends SAX2DTM2 } return result; } + */ /** * Returns the internal type associated with an expanded QName @@ -1230,9 +1228,6 @@ public final class SAXImpl extends SAX2DTM2 */ public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns) { - - DTMAxisIterator iterator = null; - if (ns == NO_TYPE) { return EMPTYITERATOR; } @@ -1546,7 +1541,6 @@ public final class SAXImpl extends SAX2DTM2 */ public DTMAxisIterator getNthDescendant(int type, int n, boolean includeself) { - DTMAxisIterator source = (DTMAxisIterator) new TypedDescendantIterator(type); return new NthDescendantIterator(n); } @@ -1882,4 +1876,7 @@ public final class SAXImpl extends SAX2DTM2 } } + public void release() { + _dtmManager.release(this, true); + } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/dom/SimpleResultTreeImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/dom/SimpleResultTreeImpl.java index 9d5d07b..3d71c6d 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/SimpleResultTreeImpl.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/SimpleResultTreeImpl.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 @@ -1013,4 +1013,12 @@ public class SimpleResultTreeImpl extends EmptySerializer implements DOM, DTM public void migrateTo(DTMManager manager) { } + + public void release() + { + if (_documentID != 0) { + _dtmManager.release(this, true); + _documentID = 0; + } + } } diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java index 4c6e029..bd3284d 100644 --- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java +++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java @@ -29,7 +29,6 @@ import java.io.Reader; import javax.xml.XMLConstants; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.stream.XMLEventReader; @@ -39,7 +38,6 @@ import javax.xml.transform.Source; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXResult; import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; @@ -111,8 +109,8 @@ public final class Util { reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, xsltc.isSecureProcessing()); } catch (SAXNotRecognizedException e) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + e.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), + XMLConstants.FEATURE_SECURE_PROCESSING, e); } } catch (Exception e ) { try { @@ -149,25 +147,27 @@ public final class Util { reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD)); } catch (SAXNotRecognizedException e) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + e.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), + XMLConstants.ACCESS_EXTERNAL_DTD, e); } + String lastProperty = ""; try { XMLSecurityManager securityManager = (XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER); if (securityManager != null) { for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { - reader.setProperty(limit.apiProperty(), + lastProperty = limit.apiProperty(); + reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit)); } if (securityManager.printEntityCountInfo()) { + lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO; reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); } } } catch (SAXException se) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + se.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se); } xsltc.setXMLReader(reader); }catch (SAXNotRecognizedException snre ) { diff --git a/src/com/sun/org/apache/xerces/internal/impl/XML11DTDScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XML11DTDScannerImpl.java index e3336e3..d6648b7 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XML11DTDScannerImpl.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XML11DTDScannerImpl.java @@ -97,19 +97,9 @@ import com.sun.org.apache.xerces.internal.xni.XNIException; public class XML11DTDScannerImpl extends XMLDTDScannerImpl { - /** Array of 3 strings. */ - private String[] fStrings = new String[3]; - - /** String. */ - private XMLString fString = new XMLString(); - /** String buffer. */ private XMLStringBuffer fStringBuffer = new XMLStringBuffer(); - /** String buffer. */ - private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer(); - private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer(); - // // Constructors // diff --git a/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java b/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java index 028f6a7..bf72247 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. + * 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 * - * 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 - * - * 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, @@ -24,7 +25,6 @@ import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.util.XML11Char; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; -import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xni.XMLString; @@ -816,7 +816,7 @@ public class XML11EntityScanner load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); + invokeListeners(1); fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; load(1, false, false); fCurrentEntity.position = 0; @@ -961,7 +961,7 @@ public class XML11EntityScanner load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); + invokeListeners(1); fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; load(1, false, false); fCurrentEntity.startPosition = 0; @@ -1398,7 +1398,7 @@ public class XML11EntityScanner fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); + invokeListeners(1); fCurrentEntity.ch[0] = (char)c; entityChanged = load(1, true, false); if (!entityChanged) { @@ -1447,8 +1447,9 @@ public class XML11EntityScanner fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { + invokeListeners(1); fCurrentEntity.ch[0] = (char)c; - entityChanged = load(1, true, true); + entityChanged = load(1, true, false); if (!entityChanged) { // the load change the position to be 1, // need to restore it when entity not changed diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java index a54234b..8ea89de 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. + * 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 * - * 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 - * - * 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, @@ -19,17 +20,17 @@ */ package com.sun.org.apache.xerces.internal.impl; -import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar; -import java.io.EOFException; -import java.io.IOException; +import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; - +import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; +import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; - +import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; @@ -41,12 +42,9 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.Augmentations; -import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; -import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; -import com.sun.org.apache.xerces.internal.impl.Constants; -import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; -import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; -import com.sun.xml.internal.stream.Entity; +import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar; +import java.io.EOFException; +import java.io.IOException; /** * This class is responsible for scanning the declarations found @@ -389,15 +387,25 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { */ @Override public boolean skipDTD(boolean supportDTD) throws IOException { - if (!supportDTD) { - fStringBuffer.clear(); - if (!fEntityScanner.scanData("]", fStringBuffer)) { - fEntityScanner.fCurrentEntity.position--; + if (supportDTD) + return false; + + fStringBuffer.clear(); + while (fEntityScanner.scanData("]", fStringBuffer)) { + int c = fEntityScanner.peekChar(); + if (c != -1) { + if (XMLChar.isHighSurrogate(c)) { + scanSurrogates(fStringBuffer); + } + if (isInvalidLiteral(c)) { + reportFatalError("InvalidCharInDTD", + new Object[] { Integer.toHexString(c) }); + fEntityScanner.scanChar(); + } } - - return true; } - return false; + fEntityScanner.fCurrentEntity.position--; + return true; } // diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java index e8a2d43..529e38b 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. + * 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 * - * 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 - * - * 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, @@ -18,12 +19,10 @@ * limitations under the License. */ - package com.sun.org.apache.xerces.internal.impl; import com.sun.xml.internal.stream.XMLBufferListener; import com.sun.xml.internal.stream.XMLEntityStorage; -import com.sun.xml.internal.stream.XMLInputFactoryImpl; import com.sun.xml.internal.stream.dtd.DTDGrammarUtil; import java.io.EOFException; @@ -50,17 +49,11 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; -import com.sun.org.apache.xerces.internal.util.NamespaceSupport; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; -import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.State; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; -import com.sun.org.apache.xerces.internal.xni.NamespaceContext; -import javax.xml.XMLConstants; import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.events.XMLEvent; /** * @@ -211,12 +204,12 @@ public class XMLDocumentFragmentScannerImpl null, null, null, - EXTERNAL_ACCESS_DEFAULT + null }; private static final char [] cdata = {'[','C','D','A','T','A','['}; static final char [] xmlDecl = {'<','?','x','m','l'}; - private static final char [] endTag = {'<','/'}; + // private static final char [] endTag = {'<','/'}; // debugging /** Debug scanner state. */ @@ -1393,7 +1386,12 @@ public class XMLDocumentFragmentScannerImpl fEmptyElement = true; return true; } else if (!isValidNameStartChar(c) || !sawSpace) { - reportFatalError("ElementUnterminated", new Object[]{fElementQName.rawname}); + // Second chance. Check if this character is a high + // surrogate of a valid name start character. + if (!isValidNameStartHighSurrogate(c) || !sawSpace) { + reportFatalError("ElementUnterminated", + new Object[]{fElementQName.rawname}); + } } return false; @@ -2057,7 +2055,7 @@ public class XMLDocumentFragmentScannerImpl */ String checkAccess(String systemId, String allowedProtocols) throws IOException { String baseSystemId = fEntityScanner.getBaseSystemId(); - String expandedSystemId = fEntityManager.expandSystemId(systemId, baseSystemId,fStrictURI); + String expandedSystemId = XMLEntityManager.expandSystemId(systemId, baseSystemId, fStrictURI); return SecuritySupport.checkAccess(expandedSystemId, allowedProtocols, Constants.ACCESS_EXTERNAL_ALL); } @@ -2593,8 +2591,6 @@ public class XMLDocumentFragmentScannerImpl // // Driver methods // - private boolean fContinueDispatching = true; - private boolean fScanningForMarkup = true; /** * decides the appropriate state of the parser @@ -2602,40 +2598,38 @@ public class XMLDocumentFragmentScannerImpl private void startOfMarkup() throws IOException { fMarkupDepth++; final int ch = fEntityScanner.peekChar(); - - switch(ch){ - case '?' :{ - setScannerState(SCANNER_STATE_PI); - fEntityScanner.skipChar(ch); - break; - } - case '!' :{ - fEntityScanner.skipChar(ch); - if (fEntityScanner.skipChar('-')) { - if (!fEntityScanner.skipChar('-')) { - reportFatalError("InvalidCommentStart", + if (isValidNameStartChar(ch) || isValidNameStartHighSurrogate(ch)) { + setScannerState(SCANNER_STATE_START_ELEMENT_TAG); + } else { + switch(ch){ + case '?' :{ + setScannerState(SCANNER_STATE_PI); + fEntityScanner.skipChar(ch); + break; + } + case '!' :{ + fEntityScanner.skipChar(ch); + if (fEntityScanner.skipChar('-')) { + if (!fEntityScanner.skipChar('-')) { + reportFatalError("InvalidCommentStart", + null); + } + setScannerState(SCANNER_STATE_COMMENT); + } else if (fEntityScanner.skipString(cdata)) { + setScannerState(SCANNER_STATE_CDATA ); + } else if (!scanForDoctypeHook()) { + reportFatalError("MarkupNotRecognizedInContent", null); } - setScannerState(SCANNER_STATE_COMMENT); - } else if (fEntityScanner.skipString(cdata)) { - setScannerState(SCANNER_STATE_CDATA ); - } else if (!scanForDoctypeHook()) { - reportFatalError("MarkupNotRecognizedInContent", - null); + break; } - break; - } - case '/' :{ - setScannerState(SCANNER_STATE_END_ELEMENT_TAG); - fEntityScanner.skipChar(ch); - break; - } - default :{ - if (isValidNameStartChar(ch)) { - setScannerState(SCANNER_STATE_START_ELEMENT_TAG); - } else { - reportFatalError("MarkupNotRecognizedInContent", - null); + case '/' :{ + setScannerState(SCANNER_STATE_END_ELEMENT_TAG); + fEntityScanner.skipChar(ch); + break; + } + default :{ + reportFatalError("MarkupNotRecognizedInContent", null); } } } @@ -3254,7 +3248,7 @@ public class XMLDocumentFragmentScannerImpl protected XMLString getString(){ if(fAttributeCacheUsedCount < initialCacheCount || fAttributeCacheUsedCount < attributeValueCache.size()){ - return (XMLString)attributeValueCache.get(fAttributeCacheUsedCount++); + return attributeValueCache.get(fAttributeCacheUsedCount++); } else{ XMLString str = new XMLString(); fAttributeCacheUsedCount++; diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java index 27689e7..97e9d29 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. + * 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 * - * 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 - * - * 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, @@ -20,7 +21,6 @@ package com.sun.org.apache.xerces.internal.impl; - import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDDescription; import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; import com.sun.org.apache.xerces.internal.util.NamespaceSupport; @@ -31,7 +31,6 @@ import com.sun.org.apache.xerces.internal.utils.SecuritySupport; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; -import com.sun.org.apache.xerces.internal.xni.XMLString; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; @@ -225,9 +224,6 @@ public class XMLDocumentScannerImpl /** A DTD Description. */ private final XMLDTDDescription fDTDDescription = new XMLDTDDescription(null, null, null, null, null); - /** String. */ - private XMLString fString = new XMLString(); - private static final char [] DOCTYPE = {'D','O','C','T','Y','P','E'}; private static final char [] COMMENTSTRING = {'-','-'}; @@ -848,9 +844,12 @@ public class XMLDocumentScannerImpl case SCANNER_STATE_START_OF_MARKUP: { fMarkupDepth++; - - if (fEntityScanner.skipChar('?')) { - setScannerState(SCANNER_STATE_PI); + if (isValidNameStartChar(fEntityScanner.peekChar()) || + isValidNameStartHighSurrogate(fEntityScanner.peekChar())) { + setScannerState(SCANNER_STATE_ROOT_ELEMENT); + setDriver(fContentDriver); + //from now onwards this would be handled by fContentDriver,in the same next() call + return fContentDriver.next(); } else if (fEntityScanner.skipChar('!')) { if (fEntityScanner.skipChar('-')) { if (!fEntityScanner.skipChar('-')) { @@ -873,12 +872,8 @@ public class XMLDocumentScannerImpl reportFatalError("MarkupNotRecognizedInProlog", null); } - } else if (XMLChar.isNameStart(fEntityScanner.peekChar())) { - setScannerState(SCANNER_STATE_ROOT_ELEMENT); - setDriver(fContentDriver); - //from now onwards this would be handled by fContentDriver,in the same next() call - return fContentDriver.next(); - + } else if (fEntityScanner.skipChar('?')) { + setScannerState(SCANNER_STATE_PI); } else { reportFatalError("MarkupNotRecognizedInProlog", null); @@ -1112,8 +1107,7 @@ public class XMLDocumentScannerImpl if (!moreToScan) { // end doctype declaration if (!fEntityScanner.skipChar(']')) { - reportFatalError("EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET", - null); + reportFatalError("DoctypedeclNotClosed", new Object[]{fDoctypeName}); } fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('>')) { @@ -1396,7 +1390,8 @@ public class XMLDocumentScannerImpl } else if (fEntityScanner.skipChar('/')) { reportFatalError("MarkupNotRecognizedInMisc", null); - } else if (XMLChar.isNameStart(fEntityScanner.peekChar())) { + } else if (isValidNameStartChar(fEntityScanner.peekChar()) || + isValidNameStartHighSurrogate(fEntityScanner.peekChar())) { reportFatalError("MarkupNotRecognizedInMisc", null); scanStartElement(); diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java index bf3adc2..570e2a6 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -368,7 +368,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { protected Map<String, Entity> fEntities = new HashMap<>(); /** Entity stack. */ - protected Stack fEntityStack = new Stack(); + protected Stack<Entity> fEntityStack = new Stack<>(); /** Current entity. */ protected Entity.ScannedEntity fCurrentEntity = null; @@ -631,10 +631,10 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { final HTTPInputSource httpInputSource = (HTTPInputSource) xmlInputSource; // set request properties - Iterator propIter = httpInputSource.getHTTPRequestProperties(); + Iterator<Map.Entry<String, String>> propIter = httpInputSource.getHTTPRequestProperties(); while (propIter.hasNext()) { - Map.Entry entry = (Map.Entry) propIter.next(); - urlConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue()); + Map.Entry<String, String> entry = propIter.next(); + urlConnection.setRequestProperty(entry.getKey(), entry.getValue()); } // set preference for redirection @@ -1053,7 +1053,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { String literalSystemId = resourceIdentifier.getLiteralSystemId(); String baseSystemId = resourceIdentifier.getBaseSystemId(); String expandedSystemId = resourceIdentifier.getExpandedSystemId(); - String namespace = resourceIdentifier.getNamespace(); // if no base systemId given, assume that it's relative // to the systemId of the current scanned entity @@ -2008,14 +2007,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { // system id has to be a valid URI if (strict) { - - - // check if there is a system id before - // trying to expand it. - if (systemId == null) { - return null; - } - try { // if it's already an absolute one, return it new URI(systemId); @@ -2923,7 +2914,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { if (!fCurrentEntity.xmlDeclChunkRead) { fCurrentEntity.xmlDeclChunkRead = true; - len = fCurrentEntity.DEFAULT_XMLDECL_BUFFER_SIZE; + len = Entity.ScannedEntity.DEFAULT_XMLDECL_BUFFER_SIZE; } return fInputStream.read(b, off, len); } diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java index 1c0eca6..b792231 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. + * 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 * - * 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 - * - * 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, @@ -20,8 +21,6 @@ package com.sun.org.apache.xerces.internal.impl; - - import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader; import com.sun.org.apache.xerces.internal.impl.io.UCSReader; import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader; @@ -44,8 +43,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.util.ArrayList; import java.util.Locale; -import java.util.Vector; /** * Implements the entity scanner methods. @@ -58,11 +57,10 @@ import java.util.Vector; */ public class XMLEntityScanner implements XMLLocator { - - protected Entity.ScannedEntity fCurrentEntity = null ; + protected Entity.ScannedEntity fCurrentEntity = null; protected int fBufferSize = XMLEntityManager.DEFAULT_BUFFER_SIZE; - protected XMLEntityManager fEntityManager ; + protected XMLEntityManager fEntityManager; /** Security manager. */ protected XMLSecurityManager fSecurityManager = null; @@ -72,8 +70,9 @@ public class XMLEntityScanner implements XMLLocator { /** Debug switching readers for encodings. */ private static final boolean DEBUG_ENCODINGS = false; + /** Listeners which should know when load is being called */ - private Vector listeners = new Vector(); + private ArrayList<XMLBufferListener> listeners = new ArrayList<>(); private static final boolean [] VALID_NAMES = new boolean[127]; @@ -140,9 +139,11 @@ public class XMLEntityScanner implements XMLLocator { VALID_NAMES[58]=true; VALID_NAMES[95]=true; } - // SAPJVM: Remember, that the XML version has explicitly been set, + + // Remember, that the XML version has explicitly been set, // so that XMLStreamReader.getVersion() can find that out. - boolean xmlVersionSetExplicitly = false; + protected boolean xmlVersionSetExplicitly = false; + // // Constructors // @@ -257,7 +258,7 @@ public class XMLEntityScanner implements XMLLocator { * @param xmlVersion the XML version of the current entity */ public final void setXMLVersion(String xmlVersion) { - xmlVersionSetExplicitly = true; // SAPJVM + xmlVersionSetExplicitly = true; fCurrentEntity.xmlVersion = xmlVersion; } // setXMLVersion(String) @@ -546,8 +547,7 @@ public class XMLEntityScanner implements XMLLocator { // scan character int c = fCurrentEntity.ch[fCurrentEntity.position++]; - if (c == '\n' || - (c == '\r' && isExternal)) { + if (c == '\n' || (c == '\r' && isExternal)) { fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { @@ -953,7 +953,7 @@ public class XMLEntityScanner implements XMLLocator { if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); + invokeListeners(1); fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; load(1, false, false); fCurrentEntity.position = 0; @@ -1105,7 +1105,7 @@ public class XMLEntityScanner implements XMLLocator { if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); + invokeListeners(1); fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; load(1, false, false); fCurrentEntity.position = 0; @@ -1256,8 +1256,8 @@ public class XMLEntityScanner implements XMLLocator { * <p> * <strong>Note:</strong> The characters are consumed. * <p> - * <strong>Note:</strong> This assumes that the length of the delimiter - * and that the delimiter contains at least one character. + * <strong>Note:</strong> This assumes that the delimiter contains at + * least one character. * <p> * <strong>Note:</strong> This method does not guarantee to return * the longest run of character data. This method may return before @@ -1436,7 +1436,7 @@ public class XMLEntityScanner implements XMLLocator { } while (!done); return !done; - } // scanData(String,XMLString) + } // scanData(String, XMLStringBuffer) /** * Skips a character appearing immediately on the input. @@ -1558,7 +1558,7 @@ public class XMLEntityScanner implements XMLLocator { fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); + invokeListeners(1); fCurrentEntity.ch[0] = (char)c; entityChanged = load(1, true, false); if (!entityChanged){ @@ -1727,8 +1727,7 @@ public class XMLEntityScanner implements XMLLocator { final int length = s.length; //first make sure that required capacity is avaible if(arrangeCapacity(length, false)){ - int beforeSkip = fCurrentEntity.position ; - int afterSkip = fCurrentEntity.position + length ; + int beforeSkip = fCurrentEntity.position; if(DEBUG_SKIP_STRING){ System.out.println("skipString,length = " + new String(s) + "," + length); @@ -2107,8 +2106,9 @@ public class XMLEntityScanner implements XMLLocator { * is being changed. */ public void registerListener(XMLBufferListener listener) { - if(!listeners.contains(listener)) + if (!listeners.contains(listener)) { listeners.add(listener); + } } /** @@ -2116,9 +2116,8 @@ public class XMLEntityScanner implements XMLLocator { * @param loadPos Starting position from which new data is being loaded into scanner buffer. */ public void invokeListeners(int loadPos){ - for(int i=0;i<listeners.size();i++){ - XMLBufferListener listener =(XMLBufferListener) listeners.get(i); - listener.refresh(loadPos); + for (int i=0; i<listeners.size(); i++) { + listeners.get(i).refresh(loadPos); } } diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java index 7853357..cbc93b8 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* @@ -25,8 +25,6 @@ import com.sun.org.apache.xerces.internal.xni.XMLString; import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidatorFilter; import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; -import com.sun.org.apache.xerces.internal.util.XMLAttributesIteratorImpl; -import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.QName; @@ -34,13 +32,9 @@ import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; -import com.sun.org.apache.xerces.internal.xni.XMLAttributes; import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; -import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.events.XMLEvent; /** diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java index fc46488..d926d78 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. + * 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 * - * 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 - * - * 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, @@ -20,12 +21,10 @@ package com.sun.org.apache.xerces.internal.impl; - import com.sun.org.apache.xerces.internal.util.Status; import com.sun.xml.internal.stream.XMLEntityStorage; import java.io.IOException; import java.util.ArrayList; -import java.util.HashMap; import javax.xml.stream.events.XMLEvent; import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.util.SymbolTable; @@ -121,8 +120,8 @@ public abstract class XMLScanner //we should have a feature when set to true computes this value private boolean fNeedNonNormalizedValue = false; - protected ArrayList attributeValueCache = new ArrayList(); - protected ArrayList stringBufferCache = new ArrayList(); + protected ArrayList<XMLString> attributeValueCache = new ArrayList<>(); + protected ArrayList<XMLStringBuffer> stringBufferCache = new ArrayList<>(); protected int fStringBufferIndex = 0; protected boolean fAttributeCacheInitDone = false; protected int fAttributeCacheUsedCount = 0; @@ -785,7 +784,7 @@ public abstract class XMLScanner if (XMLChar.isHighSurrogate(c)) { scanSurrogates(text); } - if (isInvalidLiteral(c)) { + else if (isInvalidLiteral(c)) { reportFatalError("InvalidCharInComment", new Object[] { Integer.toHexString(c) }); fEntityScanner.scanChar(); @@ -975,6 +974,7 @@ public abstract class XMLScanner fStringBuffer2.append('\n'); } } else if (c != -1 && XMLChar.isHighSurrogate(c)) { + fStringBuffer3.clear(); if (scanSurrogates(fStringBuffer3)) { stringBuffer.append(fStringBuffer3); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { @@ -1385,6 +1385,14 @@ public abstract class XMLScanner return (XMLChar.isNameStart(value)); } // isValidNameStartChar(int): boolean + // returns true if the given character is + // a valid high surrogate for a nameStartChar + // with respect to the version of XML understood + // by this scanner. + protected boolean isValidNameStartHighSurrogate(int value) { + return false; + } // isValidNameStartHighSurrogate(int): boolean + protected boolean versionSupported(String version ) { return version.equals("1.0") || version.equals("1.1"); } // version Supported @@ -1462,7 +1470,7 @@ public abstract class XMLScanner XMLStringBuffer getStringBuffer(){ if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){ - return (XMLStringBuffer)stringBufferCache.get(fStringBufferIndex++); + return stringBufferCache.get(fStringBufferIndex++); }else{ XMLStringBuffer tmpObj = new XMLStringBuffer(); fStringBufferIndex++; diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties index 7108439..8125537 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties @@ -42,7 +42,7 @@ unsupported-encoding = Codierung {0} wird nicht unterst\u00FCtzt. #Error codes used in DOM Normalizer InvalidXMLCharInDOM = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde bei der Normalisierung im DOM gefunden. -UndeclaredEntRefInAttrValue = Attribut "{0}" Wert "{1}" referenzierte eine nicht deklarierte Entit\u00E4t. +UndeclaredEntRefInAttrValue = Attribut "{0}" Wert "{1}" referenzierte eine nicht deklarierte Entity. NullLocalElementName = Lokaler Nullname wurde bei der Namespace-Normalisierung von Element {0} gefunden. NullLocalAttrName = Lokaler Nullname wurde bei der Namespace-Normalisierung von Attribut {0} gefunden. diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties index 2a3f7d7..a4ada7f 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties @@ -17,14 +17,14 @@ TextResourceError = Include-Vorgang nicht erfolgreich. Zur\u00FCck zu Fallback. NO_XPointerSchema = Schema f\u00FCr "{0}" wird standardm\u00E4\u00DFig nicht unterst\u00FCtzt. Definieren Sie Ihr eigenes Schema f\u00FCr {0}. Siehe http://apache.org/xml/properties/xpointer-schema NO_SubResourceIdentified = Keine Subressource von XPointer-Prozessor f\u00FCr Zeiger {0} identifiziert. NonDuplicateNotation = Mehrere Notationen mit dem Namen "{0}" wurden verwendet, die aber nicht als Duplikate ermittelt wurden. -NonDuplicateUnparsedEntity = Mehrere nicht geparste Entit\u00E4ten mit dem Namen "{0}" wurden verwendet, die aber nicht als Duplikate ermittelt wurden. +NonDuplicateUnparsedEntity = Mehrere nicht geparste Entitys mit dem Namen "{0}" wurden verwendet, die aber nicht als Duplikate ermittelt wurden. XpointerMissing = xpointer-Attribut muss vorhanden sein, wenn href-Attribut fehlt. AcceptMalformed = Zeichen au\u00DFerhalb des Bereichs #x20 bis #x7E sind im Wert des "accept"-Attributs eines "include"-Elements nicht zul\u00E4ssig. AcceptLanguageMalformed = Zeichen au\u00DFerhalb des Bereichs #x20 bis #x7E sind im Wert des "accept-language"-Attributs eines "include"-Elements nicht zul\u00E4ssig. RootElementRequired = F\u00FCr ein ordnungsgem\u00E4\u00DF formatiertes Dokument ist ein Root-Element erforderlich. MultipleRootElements = Ein ordnungsgem\u00E4\u00DF formatiertes Dokument darf nicht mehrere Root-Elemente enthalten. ContentIllegalAtTopLevel = Der Ersatz eines "include"-Elements, das als Dokumentelement im Quell-Infoset der obersten Ebene angezeigt wird, darf keine Zeichen enthalten. -UnexpandedEntityReferenceIllegal = Der Ersatz eines "include"-Elements, das als Dokumentelement im Quell-Infoset der obersten Ebene angezeigt wird, darf keine nicht erweiterten Entit\u00E4tsreferenzen enthalten. +UnexpandedEntityReferenceIllegal = Der Ersatz eines "include"-Elements, das als Dokumentelement im Quell-Infoset der obersten Ebene angezeigt wird, darf keine nicht erweiterten Entityreferenzen enthalten. HrefFragmentIdentifierIllegal = Fragment-IDs d\u00FCrfen nicht verwendet werden. Der "href"-Attributwert "{0}" ist nicht zul\u00E4ssig. HrefSyntacticallyInvalid = "href"-Attributwert "{0}" hat eine ung\u00FCltige Syntax. Nach Anwenden der Escape-Regeln ist der Wert kein syntaktisch korrekter URI oder IRI. XPointerStreamability = Es wurde ein xpointer angegeben, der auf eine Stelle im Quell-Infoset verweist. Auf diese Stelle kann aufgrund des Streamingcharakters des Prozessors nicht zugegriffen werden. diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties index e3cbc5f..46caccb 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties @@ -145,6 +145,7 @@ MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = White space is required after \"<!DOCTYPE\" in the document type declaration. MSG_ROOT_ELEMENT_TYPE_REQUIRED = The root element type must appear after \"<!DOCTYPE\" in the document type declaration. DoctypedeclUnterminated = The document type declaration for root element type \"{0}\" must end with ''>''. + DoctypedeclNotClosed = The document type declaration for root element type \"{0}\" must be closed with '']''. PEReferenceWithinMarkup = The parameter entity reference \"%{0};\" cannot occur within markup in the internal subset of the DTD. MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = The markup declarations contained or pointed to by the document type declaration must be well-formed. # 2.10 White Space Handling diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties index efb5115..9575319 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties @@ -62,9 +62,9 @@ # 4.1 Character and Entity References ReferenceUnterminated = Referenz muss mit einem ";"-Begrenzungszeichen beendet werden. # 4.3.2 Well-Formed Parsed Entities - ReferenceNotInOneEntity = Referenz muss vollst\u00E4ndig in derselben geparsten Entit\u00E4t enthalten sein. - ElementEntityMismatch = Element "{0}" muss innerhalb derselben Entit\u00E4t beginnen und enden. - MarkupEntityMismatch=XML-Dokumentstrukturen m\u00FCssen innerhalb derselben Entit\u00E4t beginnen und enden. + ReferenceNotInOneEntity = Referenz muss vollst\u00E4ndig in derselben geparsten Entity enthalten sein. + ElementEntityMismatch = Element "{0}" muss innerhalb derselben Entity beginnen und enden. + MarkupEntityMismatch=XML-Dokumentstrukturen m\u00FCssen innerhalb derselben Entity beginnen und enden. # Messages common to Document and DTD # 2.2 Characters @@ -81,27 +81,27 @@ InvalidCommentStart = Kommentar muss mit "<!--" beginnen. DashDashInComment = Zeichenfolge "--" ist in Kommentaren nicht zul\u00E4ssig. CommentUnterminated = Kommentar muss mit "-->" enden. - COMMENT_NOT_IN_ONE_ENTITY = Kommentar ist nicht in derselben Entit\u00E4t enthalten. + COMMENT_NOT_IN_ONE_ENTITY = Kommentar ist nicht in derselben Entity enthalten. # 2.6 Processing Instructions PITargetRequired = Verarbeitungsanweisung muss mit dem Namen des Ziels beginnen. SpaceRequiredInPI = Leerstelle ist zwischen dem Ziel der Verarbeitungsanweisung und den Daten erforderlich. PIUnterminated = Verarbeitungsanweisung muss mit "?>" enden. ReservedPITarget = Verarbeitungsanweisungsziel, das "[xX][mM][lL]" entspricht, ist nicht zul\u00E4ssig. - PI_NOT_IN_ONE_ENTITY = Verarbeitungsanweisung ist nicht in derselben Entit\u00E4t enthalten. + PI_NOT_IN_ONE_ENTITY = Verarbeitungsanweisung ist nicht in derselben Entity enthalten. # 2.8 Prolog and Document Type Declaration VersionInfoInvalid = Ung\u00FCltige Version "{0}". VersionNotSupported = XML-Version "{0}" wird nicht unterst\u00FCtzt. Nur XML 1.0 wird unterst\u00FCtzt. VersionNotSupported11 = XML-Version "{0}" wird nicht unterst\u00FCtzt. Nur XML 1.0 und XML 1.1 werden unterst\u00FCtzt. - VersionMismatch= Eine Entit\u00E4t kann keine andere Entit\u00E4t einer sp\u00E4teren Version enthalten. + VersionMismatch= Eine Entity kann keine andere Entity einer sp\u00E4teren Version enthalten. # 4.1 Character and Entity References DigitRequiredInCharRef = Auf "&#" in einer Zeichenreferenz muss umgehend eine Dezimaldarstellung folgen. HexdigitRequiredInCharRef = Auf "&#x" in einer Zeichenreferenz muss umgehend eine hexadezimale Darstellung folgen. SemicolonRequiredInCharRef = Zeichenreferenz muss mit dem Begrenzungszeichen ";" enden. InvalidCharRef = Zeichenreferenz "&#{0}" ist ein ung\u00FCltiges XML-Zeichen. - NameRequiredInReference = Auf "&" in der Entit\u00E4tsreferenz muss umgehend der Entit\u00E4tsname folgen. - SemicolonRequiredInReference = Referenz zu Entit\u00E4t "{0}" muss mit dem Begrenzungszeichen ";" enden. + NameRequiredInReference = Auf "&" in der Entityreferenz muss umgehend der Entityname folgen. + SemicolonRequiredInReference = Referenz zu Entity "{0}" muss mit dem Begrenzungszeichen ";" enden. # 4.3.1 The Text Declaration - TextDeclMustBeFirst = Textdeklaration darf nur ganz am Anfang der externen geparsten Entit\u00E4t enthalten sein. + TextDeclMustBeFirst = Textdeklaration darf nur ganz am Anfang der externen geparsten Entity enthalten sein. EqRequiredInTextDecl = Zeichen " = " muss auf "{0}" in der Textdeklaration folgen. QuoteRequiredInTextDecl = Der Wert nach "{0}" in der Textdeklaration muss eine Zeichenfolge in Anf\u00FChrungszeichen sein. CloseQuoteMissingInTextDecl = Schlie\u00DFendes Anf\u00FChrungszeichen im Wert nach "{0}" in der Textdeklaration fehlt. @@ -113,8 +113,8 @@ MorePseudoAttributes = Es werden weitere Pseudoattribute erwartet. PseudoAttrNameExpected = Pseudoattributname wird erwartet. # 4.3.2 Well-Formed Parsed Entities - CommentNotInOneEntity = Kommentar muss vollst\u00E4ndig in derselben geparsten Entit\u00E4t enthalten sein. - PINotInOneEntity = Verarbeitungsanweisung muss vollst\u00E4ndig in derselben geparsten Entit\u00E4t enthalten sein. + CommentNotInOneEntity = Kommentar muss vollst\u00E4ndig in derselben geparsten Entity enthalten sein. + PINotInOneEntity = Verarbeitungsanweisung muss vollst\u00E4ndig in derselben geparsten Entity enthalten sein. # 4.3.3 Character Encoding in Entities EncodingDeclInvalid = Ung\u00FCltiger Codierungsname "{0}". EncodingByteOrderUnsupported = Angegebene Bytereihenfolge f\u00FCr die Codierung von "{0}" wird nicht unterst\u00FCtzt. @@ -123,11 +123,11 @@ InvalidHighSurrogate = High-Surrogate-Bits in UTF-8-Sequenz d\u00FCrfen 0x10 nicht \u00FCberschreiten, gefunden wurde aber 0x{0}. OperationNotSupported = Vorgang "{0}" nicht unterst\u00FCtzt von {1}-Reader. InvalidASCII = Byte "{0}" geh\u00F6rt nicht zum (7-Bit) ASCII-Zeichensatz. - CharConversionFailure = Eine Entit\u00E4t, f\u00FCr die eine bestimmte Codierung ermittelt wurde, darf keine Sequenzen enthalten, die in dieser Codierung ung\u00FCltig sind. + CharConversionFailure = Eine Entity, f\u00FCr die eine bestimmte Codierung ermittelt wurde, darf keine Sequenzen enthalten, die in dieser Codierung ung\u00FCltig sind. # DTD Messages # 2.2 Characters - InvalidCharInEntityValue = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde im literalen Entit\u00E4tswert gefunden. + InvalidCharInEntityValue = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde im literalen Entitywert gefunden. InvalidCharInExternalSubset = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde in der externen Teilmenge der DTD gefunden. InvalidCharInIgnoreSect = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde im ausgeschlossenen Bedingungsabschnitt gefunden. InvalidCharInPublicID = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde in der \u00F6ffentlichen ID gefunden. @@ -145,7 +145,8 @@ MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Leerstelle nach "<!DOCTYPE" in der Dokumenttypdeklaration erforderlich. MSG_ROOT_ELEMENT_TYPE_REQUIRED = Root-Elementtyp muss nach "<!DOCTYPE" in der Dokumenttypdeklaration enthalten sein. DoctypedeclUnterminated = Dokumenttypdeklaration f\u00FCr Root-Elementtyp "{0}" muss mit ">" enden. - PEReferenceWithinMarkup = Parameterentit\u00E4tsreferenz "%{0};" darf nicht in Markup in der internen Teilmenge der DTD vorkommen. + DoctypedeclNotClosed = Dokumenttypdeklaration f\u00FCr Root-Elementtyp "{0}" muss mit "]" abgeschlossen werden. + PEReferenceWithinMarkup = Parameterentityreferenz "%{0};" darf nicht in Markup in der internen Teilmenge der DTD vorkommen. MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Die Markup-Deklarationen, die in der Dokumenttypdeklaration enthalten sind bzw. auf die von der Dokumenttypdeklaration verwiesen wird, m\u00FCssen ordnungsgem\u00E4\u00DF formatiert sein. # 2.10 White Space Handling MSG_XML_SPACE_DECLARATION_ILLEGAL = Attributdeklaration f\u00FCr "xml:space" muss als aufgez\u00E4hlter Typ angegeben werden, dessen einzigen m\u00F6glichen Werte "default" und "preserve" sind. @@ -186,21 +187,21 @@ IncludeSectUnterminated = Der eingeschlossene Bedingungsabschnitt muss mit "]]>" enden. IgnoreSectUnterminated = Der ausgeschlossene Bedingungsabschnitt muss mit "]]>" enden. # 4.1 Character and Entity References - NameRequiredInPEReference = Auf "%" in der Parameterentit\u00E4tsreferenz muss umgehend der Entit\u00E4tsname folgen. - SemicolonRequiredInPEReference = Parameterentit\u00E4tsreferenz "%{0};" muss mit dem Begrenzungszeichen ";" enden. + NameRequiredInPEReference = Auf "%" in der Parameterentityreferenz muss umgehend der Entityname folgen. + SemicolonRequiredInPEReference = Parameterentityreferenz "%{0};" muss mit dem Begrenzungszeichen ";" enden. # 4.2 Entity Declarations - MSG_SPACE_REQUIRED_BEFORE_ENTITY_NAME_IN_ENTITYDECL = Leerstelle nach "<!ENTITY" in der Entit\u00E4tsdeklaration erforderlich. - MSG_SPACE_REQUIRED_BEFORE_PERCENT_IN_PEDECL = Leerstelle zwischen "<!ENTITY" und dem Zeichen "%" in der Parameterentit\u00E4tsdeklaration erforderlich. - MSG_SPACE_REQUIRED_BEFORE_ENTITY_NAME_IN_PEDECL = Leerstelle zwischen "%" und dem Entit\u00E4tsnamen in der Parameterentit\u00E4tsdeklaration erforderlich. - MSG_ENTITY_NAME_REQUIRED_IN_ENTITYDECL = Name der Entit\u00E4t ist in der Entit\u00E4tsdeklaration erforderlich. - MSG_SPACE_REQUIRED_AFTER_ENTITY_NAME_IN_ENTITYDECL = Leerstelle zwischen dem Entit\u00E4tsnamen "{0}" und der Definition in der Entit\u00E4tsdeklaration erforderlich. - MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_UNPARSED_ENTITYDECL = Leerstelle zwischen "NDATA" und dem Notationsnamen in der Deklaration f\u00FCr die Entit\u00E4t "{0} erforderlich. - MSG_SPACE_REQUIRED_BEFORE_NDATA_IN_UNPARSED_ENTITYDECL = Leerstelle vor "NDATA" in der Deklaration f\u00FCr die Entit\u00E4t "{0} erforderlich. - MSG_NOTATION_NAME_REQUIRED_FOR_UNPARSED_ENTITYDECL = Notationsname ist nach "NDATA" in der Deklaration f\u00FCr die Entit\u00E4t "{0} erforderlich. - EntityDeclUnterminated = Deklaration f\u00FCr Entit\u00E4t "{0}" muss mit ">" enden. - MSG_DUPLICATE_ENTITY_DEFINITION = Entit\u00E4t "{0}" wurde mehrmals deklariert. + MSG_SPACE_REQUIRED_BEFORE_ENTITY_NAME_IN_ENTITYDECL = Leerstelle nach "<!ENTITY" in der Entitydeklaration erforderlich. + MSG_SPACE_REQUIRED_BEFORE_PERCENT_IN_PEDECL = Leerstelle zwischen "<!ENTITY" und dem Zeichen "%" in der Parameterentitydeklaration erforderlich. + MSG_SPACE_REQUIRED_BEFORE_ENTITY_NAME_IN_PEDECL = Leerstelle zwischen "%" und dem Entitynamen in der Parameterentitydeklaration erforderlich. + MSG_ENTITY_NAME_REQUIRED_IN_ENTITYDECL = Name der Entity ist in der Entitydeklaration erforderlich. + MSG_SPACE_REQUIRED_AFTER_ENTITY_NAME_IN_ENTITYDECL = Leerstelle zwischen dem Entitynamen "{0}" und der Definition in der Entitydeklaration erforderlich. + MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_UNPARSED_ENTITYDECL = Leerstelle zwischen "NDATA" und dem Notationsnamen in der Deklaration f\u00FCr die Entity "{0} erforderlich. + MSG_SPACE_REQUIRED_BEFORE_NDATA_IN_UNPARSED_ENTITYDECL = Leerstelle vor "NDATA" in der Deklaration f\u00FCr die Entity "{0} erforderlich. + MSG_NOTATION_NAME_REQUIRED_FOR_UNPARSED_ENTITYDECL = Notationsname ist nach "NDATA" in der Deklaration f\u00FCr die Entity "{0} erforderlich. + EntityDeclUnterminated = Deklaration f\u00FCr Entity "{0}" muss mit ">" enden. + MSG_DUPLICATE_ENTITY_DEFINITION = Entity "{0}" wurde mehrmals deklariert. # 4.2.2 External Entities - ExternalIDRequired = Externe Entit\u00E4tsdeklaration muss mit "SYSTEM" oder "PUBLIC" beginnen. + ExternalIDRequired = Externe Entitydeklaration muss mit "SYSTEM" oder "PUBLIC" beginnen. MSG_SPACE_REQUIRED_BEFORE_PUBIDLITERAL_IN_EXTERNALID = Leerstelle zwischen "PUBLIC" und der \u00F6ffentlichen ID erforderlich. MSG_SPACE_REQUIRED_AFTER_PUBIDLITERAL_IN_EXTERNALID = Leerstelle zwischen der \u00F6ffentlichen ID und der System-ID erforderlich. MSG_SPACE_REQUIRED_BEFORE_SYSTEMLITERAL_IN_EXTERNALID = Leerstelle zwischen "SYSTEM" und der System-ID erforderlich. @@ -214,8 +215,8 @@ # Validation messages DuplicateTypeInMixedContent = Elementtyp "{1}" wurde bereits im Contentmodell der Elementdeklaration"{0}" angegeben. - ENTITIESInvalid = Attributwert "{1}" mit dem Typ ENTITIES muss aus den Namen von mindestens einer geparsten Entit\u00E4t bestehen. - ENTITYInvalid = Attributwert "{1}" mit dem Typ ENTITY muss aus dem Namen einer geparsten Entit\u00E4t bestehen. + ENTITIESInvalid = Attributwert "{1}" mit dem Typ ENTITIES muss aus den Namen von mindestens einer geparsten Entity bestehen. + ENTITYInvalid = Attributwert "{1}" mit dem Typ ENTITY muss aus dem Namen einer geparsten Entity bestehen. IDDefaultTypeInvalid = ID-Attribut "{0}" muss den deklarierten Standardwert "#IMPLIED" oder "#REQUIRED" haben. IDInvalid = Attributwert "{0}" mit dem Typ ID muss ein Name sein. IDInvalidWithNamespaces = Attributwert "{0}" mit dem Typ ID muss ein NCName sein, wenn Namespaces aktiviert sind. @@ -223,10 +224,10 @@ IDREFInvalid = Attributwert "{0}" mit dem Typ IDREF muss ein Name sein. IDREFInvalidWithNamespaces = Attributwert "{0}" mit dem Typ IDREF muss ein NCName sein, wenn Namespaces aktiviert sind. IDREFSInvalid = Attributwert "{0}" mit dem Typ IDREFS muss mindestens ein Name sein. - ILL_FORMED_PARAMETER_ENTITY_WHEN_USED_IN_DECL = Ersatztext der Parameterentit\u00E4t "{0}" muss ordnungsgem\u00E4\u00DF verschachtelte Deklarationen enthalten, wenn die Entit\u00E4tsreferenz als vollst\u00E4ndige Deklaration verwendet wird. - ImproperDeclarationNesting = Ersatztext der Parameterentit\u00E4t "{0}" muss ordnungsgem\u00E4\u00DF verschachtelte Deklarationen enthalten. - ImproperGroupNesting = Ersatztext der Parameterentit\u00E4t "{0}" muss ordnungsgem\u00E4\u00DF verschachtelte Klammernpaare enthalten. - INVALID_PE_IN_CONDITIONAL = Ersatztext der Parameterentit\u00E4t "{0}" muss den gesamten Bedingungsabschnitt oder nur INCLUDE oder IGNORE enthalten. + ILL_FORMED_PARAMETER_ENTITY_WHEN_USED_IN_DECL = Ersatztext der Parameterentity "{0}" muss ordnungsgem\u00E4\u00DF verschachtelte Deklarationen enthalten, wenn die Entityreferenz als vollst\u00E4ndige Deklaration verwendet wird. + ImproperDeclarationNesting = Ersatztext der Parameterentity "{0}" muss ordnungsgem\u00E4\u00DF verschachtelte Deklarationen enthalten. + ImproperGroupNesting = Ersatztext der Parameterentity "{0}" muss ordnungsgem\u00E4\u00DF verschachtelte Klammernpaare enthalten. + INVALID_PE_IN_CONDITIONAL = Ersatztext der Parameterentity "{0}" muss den gesamten Bedingungsabschnitt oder nur INCLUDE oder IGNORE enthalten. MSG_ATTRIBUTE_NOT_DECLARED = Attribut "{1}" muss f\u00FCr Elementtyp "{0}" deklariert werden. MSG_ATTRIBUTE_VALUE_NOT_IN_LIST = Attribut "{0}" mit Wert "{1}" muss einen Wert aus der Liste "{2}" haben. MSG_ATTVALUE_CHANGED_DURING_NORMALIZATION_WHEN_STANDALONE = Der Wert "{1}" des Attributs "{0}" darf nicht von der Normalisierung (zu "{2}") in einem Standalone-Dokument ge\u00E4ndert werden. @@ -239,15 +240,15 @@ MSG_ELEMENT_NOT_DECLARED = Elementtyp "{0}" muss deklariert werden. MSG_GRAMMAR_NOT_FOUND = Dokument ist ung\u00FCltig. Keine Grammatik gefunden. MSG_ELEMENT_WITH_ID_REQUIRED = Element mit "{0}" ist im Dokument erforderlich. - MSG_EXTERNAL_ENTITY_NOT_PERMITTED = Referenz zur externen Entit\u00E4t "{0}" ist in einem Standalone-Dokument nicht zul\u00E4ssig. + MSG_EXTERNAL_ENTITY_NOT_PERMITTED = Referenz zur externen Entity "{0}" ist in einem Standalone-Dokument nicht zul\u00E4ssig. MSG_FIXED_ATTVALUE_INVALID = Attribut "{1}" mit Wert "{2}" muss den Wert"{3}" haben. MSG_MORE_THAN_ONE_ID_ATTRIBUTE = Elementtyp "{0}" hat bereits ein Attribut "{1}" mit dem Typ ID. Ein zweites Attribut "{2}" mit dem Typ ID ist nicht zul\u00E4ssig. MSG_MORE_THAN_ONE_NOTATION_ATTRIBUTE = Elementtyp "{0}" hat bereits ein Attribut "{1}" mit dem Typ NOTATION. Ein zweites Attribut "{2}" mit dem Typ NOTATION ist nicht zul\u00E4ssig. MSG_NOTATION_NOT_DECLARED_FOR_NOTATIONTYPE_ATTRIBUTE = Notation "{1}" muss deklariert werden, wenn sie in der Notationstypliste f\u00FCr Attribut "{0}" referenziert wird. - MSG_NOTATION_NOT_DECLARED_FOR_UNPARSED_ENTITYDECL = Notation "{1}" muss deklariert werden, wenn sie in der Deklaration der nicht geparsten Entit\u00E4t f\u00FCr "{0}" referenziert wird. - MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE = Referenz zur Entit\u00E4t "{0}", die in einer externen geparsten Entit\u00E4t deklariert wird, ist in einem Standalone-Dokument nicht zul\u00E4ssig. + MSG_NOTATION_NOT_DECLARED_FOR_UNPARSED_ENTITYDECL = Notation "{1}" muss deklariert werden, wenn sie in der Deklaration der nicht geparsten Entity f\u00FCr "{0}" referenziert wird. + MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE = Referenz zur Entity "{0}", die in einer externen geparsten Entity deklariert wird, ist in einem Standalone-Dokument nicht zul\u00E4ssig. MSG_REQUIRED_ATTRIBUTE_NOT_SPECIFIED = Attribut "{1}" ist erforderlich und muss f\u00FCr Elementtyp "{0}" angegeben werden. - MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE = Es d\u00FCrfen keine Leerstellen zwischen Elementen in einem Standalone-Dokument vorkommen, die in einer externen geparsten Entit\u00E4t mit Elementcontent deklariert sind. + MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE = Es d\u00FCrfen keine Leerstellen zwischen Elementen in einem Standalone-Dokument vorkommen, die in einer externen geparsten Entity mit Elementcontent deklariert sind. NMTOKENInvalid = Attributwert "{0}" mit dem Typ NMTOKEN muss ein Namenstoken sein. NMTOKENSInvalid = Attributwert "{0}" mit dem Typ NMTOKENS muss mindestens ein Namenstoken sein. NoNotationOnEmptyElement = Elementtyp "{0}", der als EMPTY deklariert wurde, kann nicht das Attribut "{1}" mit dem Typ NOTATION deklarieren. @@ -261,19 +262,19 @@ # Entity related messages # 3.1 Start-Tags, End-Tags, and Empty-Element Tags - ReferenceToExternalEntity = Externe Entit\u00E4tsreferenz "&{0};" ist in einem Attributwert nicht zul\u00E4ssig. + ReferenceToExternalEntity = Externe Entityreferenz "&{0};" ist in einem Attributwert nicht zul\u00E4ssig. AccessExternalDTD = Externe DTD: Lesen von externer DTD "{0}" nicht erfolgreich, da "{1}"-Zugriff wegen der von der Eigenschaft "accessExternalDTD" festgelegten Einschr\u00E4nkung nicht zul\u00E4ssig ist. - AccessExternalEntity = Externe Entit\u00E4t: Lesen des externen Dokuments "{0}" nicht erfolgreich, da "{1}"-Zugriff wegen der von der Eigenschaft "accessExternalDTD" festgelegten Einschr\u00E4nkung nicht zul\u00E4ssig ist. + AccessExternalEntity = Externe Entity: Lesen des externen Dokuments "{0}" nicht erfolgreich, da "{1}"-Zugriff wegen der von der Eigenschaft "accessExternalDTD" festgelegten Einschr\u00E4nkung nicht zul\u00E4ssig ist. # 4.1 Character and Entity References - EntityNotDeclared = Entit\u00E4t "{0}" wurde referenziert aber nicht deklariert. - ReferenceToUnparsedEntity = Nicht geparste Entit\u00E4tsreferenz "&{0};" ist nicht zul\u00E4ssig. - RecursiveReference = Rekursive Entit\u00E4tsreferenz "{0}". (Referenzpfad: {1}), - RecursiveGeneralReference = Rekursive allgemeine Entit\u00E4tsreferenz "&{0};". (Referenzpfad: {1}), - RecursivePEReference = Rekursive Parameterentit\u00E4tsreferenz "%{0};". (Referenzpfad: {1}), + EntityNotDeclared = Entity "{0}" wurde referenziert aber nicht deklariert. + ReferenceToUnparsedEntity = Nicht geparste Entityreferenz "&{0};" ist nicht zul\u00E4ssig. + RecursiveReference = Rekursive Entityreferenz "{0}". (Referenzpfad: {1}), + RecursiveGeneralReference = Rekursive allgemeine Entityreferenz "&{0};". (Referenzpfad: {1}), + RecursivePEReference = Rekursive Parameterentityreferenz "%{0};". (Referenzpfad: {1}), # 4.3.3 Character Encoding in Entities EncodingNotSupported = Codierung "{0}" wird nicht unterst\u00FCtzt. - EncodingRequired = Eine nicht in UTF-8 oder UTF-16 codierte geparste Entit\u00E4t muss eine Codierungsdeklaration enthalten. + EncodingRequired = Eine nicht in UTF-8 oder UTF-16 codierte geparste Entity muss eine Codierungsdeklaration enthalten. # Namespaces support # 4. Using Qualified Names @@ -294,9 +295,9 @@ # Implementation limits - EntityExpansionLimit=JAXP00010001: Der Parser hat mehr als {0} Entit\u00E4tserweiterungen in diesem Dokument gefunden. Dies ist der von JDK vorgeschriebene Grenzwert. + EntityExpansionLimit=JAXP00010001: Der Parser hat mehr als {0} Entityerweiterungen in diesem Dokument gefunden. Dies ist der von JDK vorgeschriebene Grenzwert. ElementAttributeLimit=JAXP00010002: Element "{0}" hat mehr als {1} Attribute. "{1}" ist der von JDK vorgeschriebene Grenzwert. - MaxEntitySizeLimit=JAXP00010003: Die L\u00E4nge von Entit\u00E4t "{0}" ist "{1}" und \u00FCberschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. + MaxEntitySizeLimit=JAXP00010003: Die L\u00E4nge von Entity "{0}" ist "{1}" und \u00FCberschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. TotalEntitySizeLimit=JAXP00010004: Die akkumulierte Gr\u00F6\u00DFe von Entitys ist "{1}" und \u00FCberschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. MaxXMLNameLimit=JAXP00010005: Die L\u00E4nge von Entity "{0}" ist "{1}" und \u00FCberschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. MaxElementDepthLimit=JAXP00010006: Die Tiefe von Element "{0}" ist "{1}" und \u00FCberschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties index d784122..80b1d61 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties @@ -145,6 +145,7 @@ MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Es necesario un espacio en blanco despu\u00E9s de "<!DOCTYPE" en la declaraci\u00F3n de tipo de documento. MSG_ROOT_ELEMENT_TYPE_REQUIRED = El tipo de elemento ra\u00EDz debe aparecer despu\u00E9s de "<!DOCTYPE" en la declaraci\u00F3n de tipo de documento. DoctypedeclUnterminated = La declaraci\u00F3n de tipo de documento para el tipo de elemento ra\u00EDz "{0}" debe finalizar en ''>''. + DoctypedeclNotClosed = La declaraci\u00F3n de tipo de documento para el tipo de elemento ra\u00EDz "{0}" debe cerrar en '']''. PEReferenceWithinMarkup = La referencia de entidad del par\u00E1metro "%{0};" no puede producirse en el marcador en el subconjunto interno del DTD. MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Las declaraciones de marcador que se incluyen o a las que apunta la declaraci\u00F3n de tipo de documento deben tener el formato correcto. # 2.10 White Space Handling diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties index c409487..f536437 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties @@ -145,6 +145,7 @@ MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Un espace est obligatoire apr\u00E8s "<!DOCTYPE" dans la d\u00E9claration de type de document. MSG_ROOT_ELEMENT_TYPE_REQUIRED = Le type d'\u00E9l\u00E9ment racine doit figurer apr\u00E8s "<!DOCTYPE" dans la d\u00E9claration de type de document. DoctypedeclUnterminated = La d\u00E9claration de type de document pour le type d''\u00E9l\u00E9ment racine "{0}" doit se terminer par ''>''. + DoctypedeclNotClosed = La d\u00E9claration de type de document pour le type d''\u00E9l\u00E9ment racine "{0}" doit se conclure par '']''. PEReferenceWithinMarkup = La r\u00E9f\u00E9rence d''entit\u00E9 de param\u00E8tre "%{0};" ne peut pas survenir dans le balisage du sous-ensemble interne de la DTD. MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Les d\u00E9clarations de balisage contenues dans la d\u00E9claration de type de document ou sur lesquelles pointe cette derni\u00E8re doivent avoir un format correct. # 2.10 White Space Handling diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties index b2ed881..7a68939 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties @@ -145,6 +145,7 @@ MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \u00C8 richiesto uno spazio dopo "<!DOCTYPE" nella dichiarazione del tipo di documento. MSG_ROOT_ELEMENT_TYPE_REQUIRED = Il tipo di elemento radice deve comparire dopo "<!DOCTYPE" nella dichiarazione del tipo di documento. DoctypedeclUnterminated = La dichiarazione del tipo di documento per il tipo di elemento radice "{0}" deve terminare con ''>''. + DoctypedeclNotClosed = La dichiarazione del tipo di documento per il tipo di elemento radice "{0}" deve chiudere con '']''. PEReferenceWithinMarkup = Il riferimento di entit\u00E0 di parametro "%{0};" non pu\u00F2 essere presente nel markup del set secondario interno del DTD. MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Le dichiarazioni di markup contenute o indicate dalla dichiarazione del tipo di documento devono avere un formato corretto. # 2.10 White Space Handling diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties index 33a72a3..a0d2c6d 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties @@ -287,5 +287,5 @@ SchemaLocation = SchemaLocation: schemaLocation-Wert = ''{0}'' muss eine gerade Anzahl an URIs haben. TargetNamespace.1 = TargetNamespace.1: Namespace ''{0}'' wird erwartet, aber der Ziel-Namespace des Schemadokuments ist ''{1}''. TargetNamespace.2 = TargetNamespace.2: Kein Namespace wird erwartet, aber das Schemadokument hat den Ziel-Namespace ''{1}''. - UndeclaredEntity = UndeclaredEntity: Entit\u00E4t ''{0}'' ist nicht deklariert. + UndeclaredEntity = UndeclaredEntity: Entity ''{0}'' ist nicht deklariert. UndeclaredPrefix = UndeclaredPrefix: ''{0}'' kann nicht als QName aufgel\u00F6st werden: Pr\u00E4fix ''{1}'' ist nicht deklariert. diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java index 92a3a83..5677971 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java +++ b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.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 @@ -1172,7 +1172,7 @@ public class XSAttributeChecker { if (max != SchemaSymbols.OCCURRENCE_UNBOUNDED) { // maxOccurLimit is only check in secure mode - if (fSchemaHandler.fSecureProcessing != null) { + if (fSchemaHandler.fSecurityManager != null) { String localName = element.getLocalName(); // The maxOccurs restriction no longer applies to elements @@ -1191,8 +1191,8 @@ public class XSAttributeChecker { if (!optimize) { //Revisit :: IMO this is not right place to check // maxOccurNodeLimit. - int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT); - if (max > maxOccurNodeLimit && !fSchemaHandler.fSecureProcessing.isNoLimit(maxOccurNodeLimit)) { + int maxOccurNodeLimit = fSchemaHandler.fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT); + if (max > maxOccurNodeLimit && !fSchemaHandler.fSecurityManager.isNoLimit(maxOccurNodeLimit)) { reportSchemaFatalError("MaxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element); // reset max values in case processing continues on error diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java index 825e792..e29554d 100644 --- a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java +++ b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.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 @@ -195,6 +195,7 @@ public class XSDHandler { /** Property identifier: entity resolver. */ public static final String ENTITY_RESOLVER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY; + /** Property identifier: entity manager. */ protected static final String ENTITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY; @@ -215,16 +216,13 @@ public class XSDHandler { protected static final String SECURITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; - private static final String SECURE_PROCESSING = - Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; - /** Property identifier: locale. */ protected static final String LOCALE = Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY; - /** Property identifier: Security property manager. */ + /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + Constants.XML_SECURITY_PROPERTY_MANAGER; protected static final boolean DEBUG_NODE_POOL = false; @@ -244,17 +242,12 @@ public class XSDHandler { // as unlikely as possible to cause collisions. public final static String REDEF_IDENTIFIER = "_fn3dktizrknc9pi"; - // - //protected data that can be accessable by any traverser + //protected data that can be accessible by any traverser protected XSDeclarationPool fDeclPool = null; - /** - * <p>Security manager in effect.</p> - * - * <p>Protected to allow access by any traverser.</p> - */ - protected XMLSecurityManager fSecureProcessing = null; + // the Security manager in effect. + protected XMLSecurityManager fSecurityManager = null; private String fAccessExternalSchema; private String fAccessExternalDTD; @@ -267,27 +260,28 @@ public class XSDHandler { // XSDocumentInfoRegistry we can easily get the corresponding // XSDocumentInfo object. private boolean registryEmpty = true; - private Map<String, Element> fUnparsedAttributeRegistry = new HashMap(); - private Map<String, Element> fUnparsedAttributeGroupRegistry = new HashMap(); - private Map<String, Element> fUnparsedElementRegistry = new HashMap(); - private Map<String, Element> fUnparsedGroupRegistry = new HashMap(); - private Map<String, Element> fUnparsedIdentityConstraintRegistry = new HashMap(); - private Map<String, Element> fUnparsedNotationRegistry = new HashMap(); - private Map<String, Element> fUnparsedTypeRegistry = new HashMap(); + private Map<String, Element> fUnparsedAttributeRegistry = new HashMap<>(); + private Map<String, Element> fUnparsedAttributeGroupRegistry = new HashMap<>(); + private Map<String, Element> fUnparsedElementRegistry = new HashMap<>(); + private Map<String, Element> fUnparsedGroupRegistry = new HashMap<>(); + private Map<String, Element> fUnparsedIdentityConstraintRegistry = new HashMap<>(); + private Map<String, Element> fUnparsedNotationRegistry = new HashMap<>(); + private Map<String, Element> fUnparsedTypeRegistry = new HashMap<>(); // Compensation for the above maps to locate XSDocumentInfo, // Since we may take Schema Element directly, so can not get the // corresponding XSDocumentInfo object just using above maps. - private Map<String, XSDocumentInfo> fUnparsedAttributeRegistrySub = new HashMap(); - private Map<String, XSDocumentInfo> fUnparsedAttributeGroupRegistrySub = new HashMap(); - private Map<String, XSDocumentInfo> fUnparsedElementRegistrySub = new HashMap(); - private Map<String, XSDocumentInfo> fUnparsedGroupRegistrySub = new HashMap(); - private Map<String, XSDocumentInfo> fUnparsedIdentityConstraintRegistrySub = new HashMap(); - private Map<String, XSDocumentInfo> fUnparsedNotationRegistrySub = new HashMap(); - private Map<String, XSDocumentInfo> fUnparsedTypeRegistrySub = new HashMap(); + private Map<String, XSDocumentInfo> fUnparsedAttributeRegistrySub = new HashMap<>(); + private Map<String, XSDocumentInfo> fUnparsedAttributeGroupRegistrySub = new HashMap<>(); + private Map<String, XSDocumentInfo> fUnparsedElementRegistrySub = new HashMap<>(); + private Map<String, XSDocumentInfo> fUnparsedGroupRegistrySub = new HashMap<>(); + private Map<String, XSDocumentInfo> fUnparsedIdentityConstraintRegistrySub = new HashMap<>(); + private Map<String, XSDocumentInfo> fUnparsedNotationRegistrySub = new HashMap<>(); + private Map<String, XSDocumentInfo> fUnparsedTypeRegistrySub = new HashMap<>(); // Stores XSDocumentInfo (keyed by component name), to check for duplicate // components declared within the same xsd document - private Map fUnparsedRegistriesExt[] = new HashMap[] { + @SuppressWarnings("unchecked") + private Map<String, XSDocumentInfo> fUnparsedRegistriesExt[] = new HashMap[] { null, null, // ATTRIBUTE_TYPE null, // ATTRIBUTEGROUP_TYPE @@ -301,17 +295,19 @@ public class XSDHandler { // this map is keyed on by XSDocumentInfo objects. Its values // are Vectors containing the XSDocumentInfo objects <include>d, // <import>ed or <redefine>d by the key XSDocumentInfo. - private Map<XSDocumentInfo, Vector> fDependencyMap = new HashMap(); + private Map<XSDocumentInfo, Vector<XSDocumentInfo>> fDependencyMap = new HashMap<>(); // this map is keyed on by a target namespace. Its values // are Vectors containing namespaces imported by schema documents // with the key target namespace. - // if an imprted schema has absent namespace, the value "null" is stored. - private Map<String, Vector> fImportMap = new HashMap(); + // if an imported schema has absent namespace, the value "null" is stored. + private Map<String, Vector> fImportMap = new HashMap<> (); + // all namespaces that imports other namespaces // if the importing schema has absent namespace, empty string is stored. // (because the key of a map can't be null.) - private Vector fAllTNSs = new Vector(); + private Vector<String> fAllTNSs = new Vector<>(); + // stores instance document mappings between namespaces and schema hints private Map<String, XMLSchemaLoader.LocationArray> fLocationPairs = null; @@ -334,7 +330,7 @@ public class XSDHandler { if(ele.getOwnerDocument() instanceof com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOM){ documentURI = ((com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOM) ele.getOwnerDocument()).getDocumentURI(); } - return documentURI != null ? documentURI : (String) fDoc2SystemId.get(ele); + return documentURI != null ? documentURI : fDoc2SystemId.get(ele); } // This vector stores strings which are combinations of the @@ -342,11 +338,11 @@ public class XSDHandler { // schema document. This combination is used so that the user's // EntityResolver can provide a consistent way of identifying a // schema document that is included in multiple other schemas. - private Map fTraversed = new HashMap(); + private Map<XSDKey, Element> fTraversed = new HashMap<>(); // this map contains a mapping from Schema Element to its systemId // this is useful to resolve a uri relative to the referring document - private Map fDoc2SystemId = new HashMap(); + private Map<Element, String> fDoc2SystemId = new HashMap<>(); // the primary XSDocumentInfo we were called to parse private XSDocumentInfo fRoot = null; @@ -388,7 +384,15 @@ public class XSDHandler { // the XMLErrorReporter private XMLErrorReporter fErrorReporter; - private XMLEntityResolver fEntityResolver; + + // the XMLErrorHandler + private XMLErrorHandler fErrorHandler; + + // the Locale + private Locale fLocale; + + // the XMLEntityManager + private XMLEntityResolver fEntityManager; // the XSAttributeChecker private XSAttributeChecker fAttributeChecker; @@ -405,6 +409,9 @@ public class XSDHandler { // the Grammar Pool private XMLGrammarPool fGrammarPool; + // the security property manager + private XMLSecurityPropertyManager fSecurityPropertyMgr = null; + //************ Traversers ********** XSDAttributeGroupTraverser fAttributeGroupTraverser; XSDAttributeTraverser fAttributeTraverser; @@ -639,7 +646,7 @@ public class XSDHandler { // for all grammars with <import>s for (int i = fAllTNSs.size() - 1; i >= 0; i--) { // get its target namespace - String tns = (String)fAllTNSs.elementAt(i); + String tns = fAllTNSs.elementAt(i); // get all namespaces it imports Vector ins = (Vector)fImportMap.get(tns); // get the grammar @@ -697,12 +704,13 @@ public class XSDHandler { fAnnotationValidator.setFeature(VALIDATION, true); fAnnotationValidator.setFeature(XMLSCHEMA_VALIDATION, true); fAnnotationValidator.setProperty(XMLGRAMMAR_POOL, fGrammarBucketAdapter); + /** set security manager and XML Security Property Manager **/ + fAnnotationValidator.setProperty(SECURITY_MANAGER, (fSecurityManager != null) ? fSecurityManager : new XMLSecurityManager(true)); + fAnnotationValidator.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); /** Set error handler. **/ - XMLErrorHandler errorHandler = fErrorReporter.getErrorHandler(); - fAnnotationValidator.setProperty(ERROR_HANDLER, (errorHandler != null) ? errorHandler : new DefaultErrorHandler()); + fAnnotationValidator.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler()); /** Set locale. **/ - Locale locale = fErrorReporter.getLocale(); - fAnnotationValidator.setProperty(LOCALE, locale); + fAnnotationValidator.setProperty(LOCALE, fLocale); } /** @@ -881,10 +889,10 @@ public class XSDHandler { // store the document and its location // REVISIT: don't expose the DOM tree - sg.addDocument(null, (String)fDoc2SystemId.get(currSchemaInfo.fSchemaElement)); + sg.addDocument(null, fDoc2SystemId.get(currSchemaInfo.fSchemaElement)); fDoc2XSDocumentMap.put(schemaRoot, currSchemaInfo); - Vector dependencies = new Vector(); + Vector<XSDocumentInfo> dependencies = new Vector<>(); Element rootNode = schemaRoot; Element newSchemaRoot = null; @@ -1335,9 +1343,9 @@ public class XSDHandler { } // end for // now we're done with this one! - DOMUtil.setHidden(currDoc, fHiddenNodes); + DOMUtil.setHidden(currDoc, fHiddenNodes); // now add the schemas this guy depends on - Vector currSchemaDepends = (Vector)fDependencyMap.get(currSchemaDoc); + Vector<XSDocumentInfo> currSchemaDepends = fDependencyMap.get(currSchemaDoc); for (int i = 0; i < currSchemaDepends.size(); i++) { schemasToProcess.push(currSchemaDepends.elementAt(i)); } @@ -1467,7 +1475,7 @@ public class XSDHandler { DOMUtil.setHidden(currDoc, fHiddenNodes); // now add the schemas this guy depends on - Vector currSchemaDepends = (Vector)fDependencyMap.get(currSchemaDoc); + Vector<XSDocumentInfo> currSchemaDepends = fDependencyMap.get(currSchemaDoc); for (int i = 0; i < currSchemaDepends.size(); i++) { schemasToProcess.push(currSchemaDepends.elementAt(i)); } @@ -1916,7 +1924,7 @@ public class XSDHandler { } public String schemaDocument2SystemId(XSDocumentInfo schemaDoc) { - return (String)fDoc2SystemId.get(schemaDoc.fSchemaElement); + return fDoc2SystemId.get(schemaDoc.fSchemaElement); } // This method determines whether there is a group @@ -2045,7 +2053,7 @@ public class XSDHandler { XMLInputSource schemaSource = null; try { Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap(); - schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver); + schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager); } catch (IOException ex) { if (mustResolve) { @@ -2098,7 +2106,7 @@ public class XSDHandler { XMLInputSource schemaSource = null; try { Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap(); - schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver); + schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager); } catch (IOException ex) { if (mustResolve) { @@ -2153,7 +2161,7 @@ public class XSDHandler { if (referType != XSDDescription.CONTEXT_PREPARSE){ schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false); key = new XSDKey(schemaId, referType, schemaNamespace); - if((schemaElement = (Element)fTraversed.get(key)) != null) { + if((schemaElement = fTraversed.get(key)) != null) { fLastSchemaWasDuplicate = true; return schemaElement; } @@ -2212,7 +2220,7 @@ public class XSDHandler { if (referType != XSDDescription.CONTEXT_PREPARSE) { schemaId = XMLEntityManager.expandSystemId(inputSource.getSystemId(), schemaSource.getBaseSystemId(), false); key = new XSDKey(schemaId, referType, schemaNamespace); - if ((schemaElement = (Element) fTraversed.get(key)) != null) { + if ((schemaElement = fTraversed.get(key)) != null) { fLastSchemaWasDuplicate = true; return schemaElement; } @@ -2239,9 +2247,8 @@ public class XSDHandler { namespacePrefixes = true; // If this is a Xerces SAX parser set the security manager if there is one if (parser instanceof SAXParser) { - Object securityManager = fSchemaParser.getProperty(SECURITY_MANAGER); - if (securityManager != null) { - parser.setProperty(SECURITY_MANAGER, securityManager); + if (fSecurityManager != null) { + parser.setProperty(SECURITY_MANAGER, fSecurityManager); } } } @@ -2250,8 +2257,8 @@ public class XSDHandler { try { parser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, fAccessExternalDTD); } catch (SAXNotRecognizedException exc) { - System.err.println("Warning: " + parser.getClass().getName() + ": " + - exc.getMessage()); + XMLSecurityManager.printWarning(parser.getClass().getName(), + XMLConstants.ACCESS_EXTERNAL_DTD, exc); } } // If XML names and Namespace URIs are already internalized we @@ -2348,7 +2355,7 @@ public class XSDHandler { } if (isDocument) { key = new XSDKey(schemaId, referType, schemaNamespace); - if ((schemaElement = (Element) fTraversed.get(key)) != null) { + if ((schemaElement = fTraversed.get(key)) != null) { fLastSchemaWasDuplicate = true; return schemaElement; } @@ -2403,7 +2410,7 @@ public class XSDHandler { } if (isDocument) { key = new XSDKey(schemaId, referType, schemaNamespace); - if ((schemaElement = (Element) fTraversed.get(key)) != null) { + if ((schemaElement = fTraversed.get(key)) != null) { fLastSchemaWasDuplicate = true; return schemaElement; } @@ -3503,97 +3510,88 @@ public class XSDHandler { // set symbol table fSymbolTable = (SymbolTable) componentManager.getProperty(SYMBOL_TABLE); - fSecureProcessing = null; - if( componentManager!=null ) { - fSecureProcessing = (XMLSecurityManager) componentManager.getProperty(SECURE_PROCESSING, null); - } + // set security manager + fSecurityManager = (XMLSecurityManager) componentManager.getProperty(SECURITY_MANAGER, null); + + //set entity manager + fEntityManager = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER); //set entity resolver - fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER); XMLEntityResolver er = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER); if (er != null) fSchemaParser.setEntityResolver(er); // set error reporter - fErrorReporter = - (XMLErrorReporter) componentManager.getProperty(ERROR_REPORTER); + fErrorReporter = (XMLErrorReporter) componentManager.getProperty(ERROR_REPORTER); + fErrorHandler = fErrorReporter.getErrorHandler(); + fLocale = fErrorReporter.getLocale(); + + fValidateAnnotations = componentManager.getFeature(VALIDATE_ANNOTATIONS, false); + fHonourAllSchemaLocations = componentManager.getFeature(HONOUR_ALL_SCHEMALOCATIONS, false); + fNamespaceGrowth = componentManager.getFeature(NAMESPACE_GROWTH, false); + fTolerateDuplicates = componentManager.getFeature(TOLERATE_DUPLICATES, false); + try { - XMLErrorHandler currErrorHandler = fErrorReporter.getErrorHandler(); // Setting a parser property can be much more expensive // than checking its value. Don't set the ERROR_HANDLER // or LOCALE properties unless they've actually changed. - if (currErrorHandler != fSchemaParser.getProperty(ERROR_HANDLER)) { - fSchemaParser.setProperty(ERROR_HANDLER, (currErrorHandler != null) ? currErrorHandler : new DefaultErrorHandler()); + if (fErrorHandler != fSchemaParser.getProperty(ERROR_HANDLER)) { + fSchemaParser.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler()); if (fAnnotationValidator != null) { - fAnnotationValidator.setProperty(ERROR_HANDLER, (currErrorHandler != null) ? currErrorHandler : new DefaultErrorHandler()); + fAnnotationValidator.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler()); } } - Locale currentLocale = fErrorReporter.getLocale(); - if (currentLocale != fSchemaParser.getProperty(LOCALE)) { - fSchemaParser.setProperty(LOCALE, currentLocale); + if (fLocale != fSchemaParser.getProperty(LOCALE)) { + fSchemaParser.setProperty(LOCALE, fLocale); if (fAnnotationValidator != null) { - fAnnotationValidator.setProperty(LOCALE, currentLocale); + fAnnotationValidator.setProperty(LOCALE, fLocale); } } } catch (XMLConfigurationException e) {} - fValidateAnnotations = componentManager.getFeature(VALIDATE_ANNOTATIONS, false); - fHonourAllSchemaLocations = componentManager.getFeature(HONOUR_ALL_SCHEMALOCATIONS, false); - fNamespaceGrowth = componentManager.getFeature(NAMESPACE_GROWTH, false); - fTolerateDuplicates = componentManager.getFeature(TOLERATE_DUPLICATES, false); - try { - fSchemaParser.setFeature( - CONTINUE_AFTER_FATAL_ERROR, - fErrorReporter.getFeature(CONTINUE_AFTER_FATAL_ERROR)); - } catch (XMLConfigurationException e) { - } + fSchemaParser.setFeature(CONTINUE_AFTER_FATAL_ERROR, fErrorReporter.getFeature(CONTINUE_AFTER_FATAL_ERROR)); + } catch (XMLConfigurationException e) {} try { if (componentManager.getFeature(ALLOW_JAVA_ENCODINGS, false)) { fSchemaParser.setFeature(ALLOW_JAVA_ENCODINGS, true); } - } catch (XMLConfigurationException e) { - } + } catch (XMLConfigurationException e) {} + try { if (componentManager.getFeature(STANDARD_URI_CONFORMANT_FEATURE, false)) { fSchemaParser.setFeature(STANDARD_URI_CONFORMANT_FEATURE, true); } - } catch (XMLConfigurationException e) { - } + } catch (XMLConfigurationException e) {} try { - fGrammarPool = - (XMLGrammarPool) componentManager.getProperty(XMLGRAMMAR_POOL); + fGrammarPool = (XMLGrammarPool) componentManager.getProperty(XMLGRAMMAR_POOL); } catch (XMLConfigurationException e) { fGrammarPool = null; } + // security features try { if (componentManager.getFeature(DISALLOW_DOCTYPE, false)) { fSchemaParser.setFeature(DISALLOW_DOCTYPE, true); } - } catch (XMLConfigurationException e) { - } + } catch (XMLConfigurationException e) {} + try { - Object security = componentManager.getProperty(SECURITY_MANAGER, null); - if (security != null){ - fSchemaParser.setProperty(SECURITY_MANAGER, security); + if (fSecurityManager != null) { + fSchemaParser.setProperty(SECURITY_MANAGER, fSecurityManager); } - } catch (XMLConfigurationException e) { - } + } catch (XMLConfigurationException e) {} - XMLSecurityPropertyManager securityPropertyMgr = (XMLSecurityPropertyManager) - componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); - //Passing on the setting to the parser - fSchemaParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, securityPropertyMgr); + fSecurityPropertyMgr = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); - fAccessExternalDTD = securityPropertyMgr.getValue( - XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); + //Passing on the setting to the parser + fSchemaParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); - fAccessExternalSchema = securityPropertyMgr.getValue( - XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); + fAccessExternalDTD = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); + fAccessExternalSchema = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); } // reset(XMLComponentManager) @@ -4052,7 +4050,7 @@ public class XSDHandler { so long as there's some include/import/redefine path amongst them. If they rver reverse this decision the code's right here though... - neilg // now look in fDependencyMap to see if this is reachable - if(((Vector)fDependencyMap.get(currSchema)).contains(declDocInfo)) { + if((fDependencyMap.get(currSchema)).contains(declDocInfo)) { return declDocInfo; } // obviously the requesting doc didn't include, redefine or @@ -4073,9 +4071,9 @@ public class XSDHandler { if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) { // make it visible DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes); - Vector dependingSchemas = (Vector)fDependencyMap.get(startSchema); + Vector<XSDocumentInfo> dependingSchemas = fDependencyMap.get(startSchema); for (int i = 0; i < dependingSchemas.size(); i++) { - setSchemasVisible((XSDocumentInfo)dependingSchemas.elementAt(i)); + setSchemasVisible(dependingSchemas.elementAt(i)); } } // if it's visible already than so must be its children @@ -4108,7 +4106,7 @@ public class XSDHandler { ElementImpl ele = (ElementImpl)e; // get system id from document object Document doc = ele.getOwnerDocument(); - String sid = (String)fDoc2SystemId.get(DOMUtil.getRoot(doc)); + String sid = fDoc2SystemId.get(DOMUtil.getRoot(doc)); // line/column numbers are stored in the element node int line = ele.getLineNumber(); int column = ele.getColumnNumber(); diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java b/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java index fc652af..2a62405 100644 --- a/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java +++ b/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java @@ -698,8 +698,8 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD)); } catch (SAXException exc) { - System.err.println("Warning: " + reader.getClass().getName() + ": " + - exc.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), + XMLConstants.ACCESS_EXTERNAL_DTD, exc); } } } catch( Exception e ) { diff --git a/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java index bbcbcee..ac84e1e 100644 --- a/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java +++ b/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java @@ -52,7 +52,6 @@ import com.sun.org.apache.xerces.internal.util.FeatureState; import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; import com.sun.org.apache.xerces.internal.util.PropertyState; import com.sun.org.apache.xerces.internal.util.SymbolTable; -import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; @@ -167,45 +166,41 @@ public class XML11Configuration extends ParserConfigurationSettings protected static final String USE_GRAMMAR_POOL_ONLY = Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE; - // feature identifiers - - /** Feature identifier: validation. */ - protected static final String VALIDATION = - Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE; - - /** Feature identifier: namespaces. */ - protected static final String NAMESPACES = - Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE; + // feature identifiers - /** Feature identifier: external general entities. */ - protected static final String EXTERNAL_GENERAL_ENTITIES = - Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE; + /** Feature identifier: validation. */ + protected static final String VALIDATION = + Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE; - /** Feature identifier: external parameter entities. */ - protected static final String EXTERNAL_PARAMETER_ENTITIES = - Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE; + /** Feature identifier: namespaces. */ + protected static final String NAMESPACES = + Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE; + /** Feature identifier: external general entities. */ + protected static final String EXTERNAL_GENERAL_ENTITIES = + Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE; + /** Feature identifier: external parameter entities. */ + protected static final String EXTERNAL_PARAMETER_ENTITIES = + Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE; // property identifiers + /** Property identifier: xml string. */ + protected static final String XML_STRING = + Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY; - /** Property identifier: xml string. */ - protected static final String XML_STRING = - Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY; - - /** Property identifier: symbol table. */ - protected static final String SYMBOL_TABLE = - Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY; + /** Property identifier: symbol table. */ + protected static final String SYMBOL_TABLE = + Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY; - /** Property identifier: error handler. */ - protected static final String ERROR_HANDLER = - Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY; - - /** Property identifier: entity resolver. */ - protected static final String ENTITY_RESOLVER = - Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY; + /** Property identifier: error handler. */ + protected static final String ERROR_HANDLER = + Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY; + /** Property identifier: entity resolver. */ + protected static final String ENTITY_RESOLVER = + Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY; /** Property identifier: XML Schema validator. */ protected static final String SCHEMA_VALIDATOR = @@ -219,8 +214,6 @@ public class XML11Configuration extends ParserConfigurationSettings protected static final String SCHEMA_NONS_LOCATION = Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_NONS_LOCATION; - // property identifiers - /** Property identifier: error reporter. */ protected static final String ERROR_REPORTER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY; @@ -292,33 +285,33 @@ public class XML11Configuration extends ParserConfigurationSettings // Data // - protected SymbolTable fSymbolTable; + protected SymbolTable fSymbolTable; protected XMLInputSource fInputSource; protected ValidationManager fValidationManager; - protected XMLVersionDetector fVersionDetector; + protected XMLVersionDetector fVersionDetector; protected XMLLocator fLocator; - protected Locale fLocale; + protected Locale fLocale; - /** XML 1.0 Components. */ - protected ArrayList fComponents; + /** XML 1.0 Components. */ + protected ArrayList<XMLComponent> fComponents; - /** XML 1.1. Components. */ - protected ArrayList fXML11Components = null; + /** XML 1.1. Components. */ + protected ArrayList<XMLComponent> fXML11Components = null; - /** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */ - protected ArrayList fCommonComponents = null; + /** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */ + protected ArrayList<XMLComponent> fCommonComponents = null; - /** The document handler. */ - protected XMLDocumentHandler fDocumentHandler; + /** The document handler. */ + protected XMLDocumentHandler fDocumentHandler; - /** The DTD handler. */ - protected XMLDTDHandler fDTDHandler; + /** The DTD handler. */ + protected XMLDTDHandler fDTDHandler; - /** The DTD content model handler. */ - protected XMLDTDContentModelHandler fDTDContentModelHandler; + /** The DTD content model handler. */ + protected XMLDTDContentModelHandler fDTDContentModelHandler; - /** Last component in the document pipeline */ - protected XMLDocumentSource fLastComponent; + /** Last component in the document pipeline */ + protected XMLDocumentSource fLastComponent; /** * True if a parse is in progress. This state is needed because @@ -456,15 +449,15 @@ public class XML11Configuration extends ParserConfigurationSettings // create a vector to hold all the components in use // XML 1.0 specialized components - fComponents = new ArrayList(); + fComponents = new ArrayList<>(); // XML 1.1 specialized components - fXML11Components = new ArrayList(); + fXML11Components = new ArrayList<>(); // Common components for XML 1.1. and XML 1.0 - fCommonComponents = new ArrayList(); + fCommonComponents = new ArrayList<>(); // create table for features and properties - fFeatures = new HashMap(); - fProperties = new HashMap(); + fFeatures = new HashMap<>(); + fProperties = new HashMap<>(); // add default recognized features final String[] recognizedFeatures = @@ -551,35 +544,35 @@ public class XML11Configuration extends ParserConfigurationSettings } fEntityManager = new XMLEntityManager(); - fProperties.put(ENTITY_MANAGER, fEntityManager); + fProperties.put(ENTITY_MANAGER, fEntityManager); addCommonComponent(fEntityManager); fErrorReporter = new XMLErrorReporter(); fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); - fProperties.put(ERROR_REPORTER, fErrorReporter); + fProperties.put(ERROR_REPORTER, fErrorReporter); addCommonComponent(fErrorReporter); fNamespaceScanner = new XMLNSDocumentScannerImpl(); - fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner); + fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner); addComponent((XMLComponent) fNamespaceScanner); fDTDScanner = new XMLDTDScannerImpl(); - fProperties.put(DTD_SCANNER, fDTDScanner); + fProperties.put(DTD_SCANNER, fDTDScanner); addComponent((XMLComponent) fDTDScanner); fDTDProcessor = new XMLDTDProcessor(); - fProperties.put(DTD_PROCESSOR, fDTDProcessor); + fProperties.put(DTD_PROCESSOR, fDTDProcessor); addComponent((XMLComponent) fDTDProcessor); fDTDValidator = new XMLNSDTDValidator(); - fProperties.put(DTD_VALIDATOR, fDTDValidator); + fProperties.put(DTD_VALIDATOR, fDTDValidator); addComponent(fDTDValidator); fDatatypeValidatorFactory = DTDDVFactory.getInstance(); - fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory); + fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory); fValidationManager = new ValidationManager(); - fProperties.put(VALIDATION_MANAGER, fValidationManager); + fProperties.put(VALIDATION_MANAGER, fValidationManager); fVersionDetector = new XMLVersionDetector(); @@ -907,20 +900,20 @@ public class XML11Configuration extends ParserConfigurationSettings // forward to every XML 1.0 component int count = fComponents.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fComponents.get(i); + XMLComponent c = fComponents.get(i); c.setFeature(featureId, state); } // forward it to common components count = fCommonComponents.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fCommonComponents.get(i); + XMLComponent c = fCommonComponents.get(i); c.setFeature(featureId, state); } // forward to every XML 1.1 component count = fXML11Components.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fXML11Components.get(i); + XMLComponent c = fXML11Components.get(i); try{ c.setFeature(featureId, state); } @@ -968,19 +961,19 @@ public class XML11Configuration extends ParserConfigurationSettings // forward to every XML 1.0 component int count = fComponents.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fComponents.get(i); + XMLComponent c = fComponents.get(i); c.setProperty(propertyId, value); } // forward it to every common Component count = fCommonComponents.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fCommonComponents.get(i); + XMLComponent c = fCommonComponents.get(i); c.setProperty(propertyId, value); } // forward it to every XML 1.1 component count = fXML11Components.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fXML11Components.get(i); + XMLComponent c = fXML11Components.get(i); try{ c.setProperty(propertyId, value); } @@ -1006,7 +999,7 @@ public class XML11Configuration extends ParserConfigurationSettings protected void reset() throws XNIException { int count = fComponents.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fComponents.get(i); + XMLComponent c = fComponents.get(i); c.reset(this); } @@ -1019,7 +1012,7 @@ public class XML11Configuration extends ParserConfigurationSettings // reset common components int count = fCommonComponents.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fCommonComponents.get(i); + XMLComponent c = fCommonComponents.get(i); c.reset(this); } @@ -1033,7 +1026,7 @@ public class XML11Configuration extends ParserConfigurationSettings // reset every component int count = fXML11Components.size(); for (int i = 0; i < count; i++) { - XMLComponent c = (XMLComponent) fXML11Components.get(i); + XMLComponent c = fXML11Components.get(i); c.reset(this); } diff --git a/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java b/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java index f4e29a3..c9bbed9 100644 --- a/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java +++ b/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java @@ -1,15 +1,16 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. */ + /* - * Copyright 2004,2005 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 + * 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,18 +18,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.sun.org.apache.xerces.internal.util; +import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; +import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import java.io.InputStream; import java.io.Reader; - import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; -import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; - /** * This class represents an input source for an XML resource * retrievable over HTTP. In addition to the properties @@ -51,7 +51,7 @@ public final class HTTPInputSource extends XMLInputSource { protected boolean fFollowRedirects = true; /** HTTP request properties. **/ - protected Map fHTTPRequestProperties = new HashMap(); + protected Map<String, String> fHTTPRequestProperties = new HashMap<>(); // // Constructors @@ -159,7 +159,7 @@ public final class HTTPInputSource extends XMLInputSource { * been set */ public String getHTTPRequestProperty(String key) { - return (String) fHTTPRequestProperties.get(key); + return fHTTPRequestProperties.get(key); } // getHTTPRequestProperty(String):String /** @@ -172,7 +172,7 @@ public final class HTTPInputSource extends XMLInputSource { * @return an iterator for the request properties this * input source contains */ - public Iterator getHTTPRequestProperties() { + public Iterator<Map.Entry<String, String>> getHTTPRequestProperties() { return fHTTPRequestProperties.entrySet().iterator(); } // getHTTPRequestProperties():Iterator diff --git a/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java b/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java index 7ae6df9..0673db9 100644 --- a/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java +++ b/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java @@ -27,6 +27,8 @@ package com.sun.org.apache.xerces.internal.utils; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.util.SecurityManager; +import java.util.concurrent.CopyOnWriteArrayList; +import org.xml.sax.SAXException; /** * This class manages standard and implementation-specific limitations. @@ -496,6 +498,23 @@ public final class XMLSecurityManager { } + // Array list to store printed warnings for each SAX parser used + private static final CopyOnWriteArrayList<String> printedWarnings = new CopyOnWriteArrayList<>(); + + /** + * Prints out warnings if a parser does not support the specified feature/property. + * + * @param parserClassName the name of the parser class + * @param propertyName the property name + * @param exception the exception thrown by the parser + */ + public static void printWarning(String parserClassName, String propertyName, SAXException exception) { + String key = parserClassName+":"+propertyName; + if (printedWarnings.addIfAbsent(key)) { + System.err.println( "Warning: "+parserClassName+": "+exception.getMessage()); + } + } + /** * Read from system properties, or those in jaxp.properties * diff --git a/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java b/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java index fe9e2fb..4936488 100644 --- a/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java +++ b/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java @@ -251,7 +251,7 @@ public class XMLErrorResources_ko extends ListResourceBundle "\uAD6C\uBB38 \uBD84\uC11D\uAE30\uB97C \uCD08\uAE30\uD654\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}, { ER_EXCEPTION_CREATING_POOL, - "\uD480\uC5D0 \uB300\uD55C \uC0C8 \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC608\uC678 \uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, + "\uD480\uC5D0 \uB300\uD55C \uC0C8 \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\uACBD\uB85C\uC5D0 \uBD80\uC801\uD569\uD55C \uC774\uC2A4\uCF00\uC774\uD504 \uC2DC\uD000\uC2A4\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4."}, @@ -374,7 +374,7 @@ public class XMLErrorResources_ko extends ListResourceBundle "\uC774\uB984\uC740 \uCF5C\uB860\uC73C\uB85C \uC2DC\uC791\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}, { "BAD_CODE", "createMessage\uC5D0 \uB300\uD55C \uB9E4\uAC1C\uBCC0\uC218\uAC00 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4."}, - { "FORMAT_FAILED", "messageFormat \uD638\uCD9C \uC911 \uC608\uC678 \uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, + { "FORMAT_FAILED", "messageFormat \uD638\uCD9C \uC911 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, { "line", "\uD589 \uBC88\uD638"}, { "column","\uC5F4 \uBC88\uD638"}, diff --git a/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java index a9c9aab..09cd04c 100644 --- a/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java +++ b/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java @@ -128,8 +128,8 @@ public class XMLReaderManager { try { reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _secureProcessing); } catch (SAXNotRecognizedException e) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + e.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), + XMLConstants.FEATURE_SECURE_PROCESSING, e); } } catch (Exception e) { try { @@ -172,23 +172,25 @@ public class XMLReaderManager { //reader is cached, but this property might have been reset reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD); } catch (SAXException se) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + se.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), + XMLConstants.ACCESS_EXTERNAL_DTD, se); } + String lastProperty = ""; try { if (_xmlSecurityManager != null) { for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { - reader.setProperty(limit.apiProperty(), + lastProperty = limit.apiProperty(); + reader.setProperty(lastProperty, _xmlSecurityManager.getLimitValueAsString(limit)); } if (_xmlSecurityManager.printEntityCountInfo()) { + lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO; reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); } } } catch (SAXException se) { - System.err.println("Warning: " + reader.getClass().getName() + ": " - + se.getMessage()); + XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se); } return reader; diff --git a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java index 94ea0da..9c8a7df 100644 --- a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java +++ b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java @@ -867,7 +867,7 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { "help_language", "ko"}, { "language", "ko"}, { "BAD_CODE", "createMessage\uC5D0 \uB300\uD55C \uB9E4\uAC1C\uBCC0\uC218\uAC00 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4."}, - { "FORMAT_FAILED", "messageFormat \uD638\uCD9C \uC911 \uC608\uC678 \uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, + { "FORMAT_FAILED", "messageFormat \uD638\uCD9C \uC911 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."}, { "version", ">>>>>>> Xalan \uBC84\uC804 "}, { "version2", "<<<<<<<"}, { "yes", "\uC608"}, diff --git a/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java b/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java index 8262111..f3b9b50 100644 --- a/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java +++ b/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -1346,6 +1346,15 @@ public final class XMLStreamWriterImpl extends AbstractMap implements XMLStreamW } /** + * Writes character reference in hex format. + */ + private void writeCharRef(int codePoint) throws IOException { + fWriter.write( "&#x" ); + fWriter.write( Integer.toHexString(codePoint) ); + fWriter.write( ';' ); + } + + /** * Writes XML content to underlying writer. Escapes characters unless * escaping character feature is turned off. */ @@ -1368,10 +1377,14 @@ public final class XMLStreamWriterImpl extends AbstractMap implements XMLStreamW if (fEncoder != null && !fEncoder.canEncode(ch)){ fWriter.write(content, startWritePos, index - startWritePos ); - // Escape this char as underlying encoder cannot handle it - fWriter.write( "&#x" ); - fWriter.write(Integer.toHexString(ch)); - fWriter.write( ';' ); + // Check if current and next characters forms a surrogate pair + // and escape it to avoid generation of invalid xml content + if ( index != end - 1 && Character.isSurrogatePair(ch, content[index+1])) { + writeCharRef(Character.toCodePoint(ch, content[index+1])); + index++; + } else { + writeCharRef(ch); + } startWritePos = index + 1; continue; } @@ -1439,10 +1452,15 @@ public final class XMLStreamWriterImpl extends AbstractMap implements XMLStreamW if (fEncoder != null && !fEncoder.canEncode(ch)){ fWriter.write(content, startWritePos, index - startWritePos ); - // Escape this char as underlying encoder cannot handle it - fWriter.write( "&#x" ); - fWriter.write(Integer.toHexString(ch)); - fWriter.write( ';' ); + // Check if current and next characters forms a surrogate pair + // and escape it to avoid generation of invalid xml content + if ( index != end - 1 && Character.isSurrogatePair(ch, content.charAt(index+1))) { + writeCharRef(Character.toCodePoint(ch, content.charAt(index+1))); + index++; + } else { + writeCharRef(ch); + } + startWritePos = index + 1; continue; } |