aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraefimov <none@none>2016-02-29 15:46:01 +0300
committeraefimov <none@none>2016-02-29 15:46:01 +0300
commit8f61d1ee903c22a867c5d7595d94130388e105ec (patch)
tree3b12f5fae9d55911c068651b32ab1ed891ed3385 /src
parentd6689d54dc07f1549add216c27a9f5a3f52f8468 (diff)
downloadjdk8u_jaxp-8f61d1ee903c22a867c5d7595d94130388e105ec.tar.gz
8149915: enabling validate-annotations feature for xsd schema with annotation causes NPE
Reviewed-by: joehw
Diffstat (limited to 'src')
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XML11DTDScannerImpl.java10
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java3
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java19
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java6
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java21
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java8
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java9
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java8
-rw-r--r--src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java212
-rw-r--r--src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java135
-rw-r--r--src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java6
11 files changed, 194 insertions, 243 deletions
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/XMLDTDScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
index a54234b..896e3de 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.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.
*/
/*
@@ -46,7 +46,6 @@ 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;
/**
* This class is responsible for scanning the declarations found
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 8642832..d0748bf 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -23,7 +23,6 @@ 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. */
@@ -2062,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);
}
@@ -2598,8 +2591,6 @@ public class XMLDocumentFragmentScannerImpl
//
// Driver methods
//
- private boolean fContinueDispatching = true;
- private boolean fScanningForMarkup = true;
/**
* decides the appropriate state of the parser
@@ -3257,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 8348501..1bc5e63 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.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.
*/
/*
@@ -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 = {'-','-'};
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..3a8484b 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 = DEFAULT_XMLDECL_BUFFER_SIZE;
}
return fInputStream.read(b, off, len);
}
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 3574df5..f6d6808 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -25,7 +25,6 @@ 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;
@@ -1470,7 +1469,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/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 a9d807d..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);
}
}
}
@@ -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/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..bdd0750 100644
--- a/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java
+++ b/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java
@@ -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