# HG changeset patch # User omajid # Date 1445632866 14400 # Node ID 5b5e5ea9c8dd9e4ad6e06fc8bd61df249ae57ffd # Parent 8905368e9402357ba192cbef8968814adcf2044b OPENJDK6-64: Backport hashtable to map changes from jaxp Reviewed-by: andrew diff -r 8905368e9402 -r 5b5e5ea9c8dd drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Thu Jul 30 20:29:33 2015 +0100 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Fri Oct 23 16:41:06 2015 -0400 @@ -65,6 +65,8 @@ import com.sun.org.apache.xerces.internal.xs.StringList; import com.sun.org.apache.xerces.internal.xs.XSLoader; import com.sun.org.apache.xerces.internal.xs.XSModel; +import java.util.HashMap; +import java.util.Map; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; @@ -236,7 +238,7 @@ private CMBuilder fCMBuilder; private XSDDescription fXSDDescription = new XSDDescription(); - private Hashtable fJAXPCache; + private Map fJAXPCache; private Locale fLocale = Locale.getDefault(); // XSLoader attributes @@ -323,8 +325,10 @@ } fCMBuilder = builder; fSchemaHandler = new XSDHandler(fGrammarBucket); - fDeclPool = new XSDeclarationPool(); - fJAXPCache = new Hashtable(); + if (fDeclPool != null) { + fDeclPool.reset(); + } + fJAXPCache = new HashMap(); fSettingsChanged = true; } @@ -522,7 +526,7 @@ desc.setBaseSystemId(source.getBaseSystemId()); desc.setLiteralSystemId( source.getSystemId()); // none of the other fields make sense for preparsing - Hashtable locationPairs = new Hashtable(); + Map locationPairs = new HashMap(); // Process external schema location properties. // We don't call tokenizeSchemaLocationStr here, because we also want // to check whether the values are valid URI. @@ -554,7 +558,7 @@ */ SchemaGrammar loadSchema(XSDDescription desc, XMLInputSource source, - Hashtable locationPairs) throws IOException, XNIException { + Map locationPairs) throws IOException, XNIException { // this should only be done once per invocation of this object; // unless application alters JAXPSource in the mean time. @@ -578,7 +582,7 @@ * @return * @throws IOException */ - public static XMLInputSource resolveDocument(XSDDescription desc, Hashtable locationPairs, + public static XMLInputSource resolveDocument(XSDDescription desc, Map locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import @@ -609,7 +613,7 @@ // add external schema locations to the location pairs public static void processExternalHints(String sl, String nsl, - Hashtable locations, + Map locations, XMLErrorReporter er) { if (sl != null) { try { @@ -660,9 +664,9 @@ // otherwise, true is returned. In either case, locations // is augmented to include as many tokens as possible. // @param schemaStr The schemaLocation string to tokenize - // @param locations Hashtable mapping namespaces to LocationArray objects holding lists of locaitons + // @param locations HashMap mapping namespaces to LocationArray objects holding lists of locaitons // @return true if no problems; false if string could not be tokenized - public static boolean tokenizeSchemaLocationStr(String schemaStr, Hashtable locations) { + public static boolean tokenizeSchemaLocationStr(String schemaStr, Map locations) { if (schemaStr!= null) { StringTokenizer t = new StringTokenizer(schemaStr, " \n\t\r"); String namespace, location; @@ -681,7 +685,7 @@ } } return true; - } // tokenizeSchemaLocation(String, Hashtable): boolean + } // tokenizeSchemaLocation(String, HashMap): boolean /** * Translate the various JAXP SchemaSource property types to XNI @@ -693,7 +697,7 @@ * Note: all JAXP schema files will be checked for full-schema validity if the feature was set up * */ - private void processJAXPSchemaSource(Hashtable locationPairs) throws IOException { + private void processJAXPSchemaSource(Map locationPairs) throws IOException { fJAXPProcessed = true; if (fJAXPSource == null) { return; @@ -966,7 +970,12 @@ } if (!psvi) { - fDeclPool.reset(); + if (fDeclPool != null) { + fDeclPool.reset(); + } + else { + fDeclPool = new XSDeclarationPool(); + } fCMBuilder.setDeclPool(fDeclPool); fSchemaHandler.setDeclPool(fDeclPool); } else { diff -r 8905368e9402 -r 5b5e5ea9c8dd drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java Thu Jul 30 20:29:33 2015 +0100 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java Fri Oct 23 16:41:06 2015 -0400 @@ -78,8 +78,6 @@ import com.sun.org.apache.xerces.internal.xs.XSConstants; import com.sun.org.apache.xerces.internal.xs.XSObjectList; import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; import com.sun.org.apache.xerces.internal.parsers.XMLParser; /** diff -r 8905368e9402 -r 5b5e5ea9c8dd drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XSGrammarBucket.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XSGrammarBucket.java Thu Jul 30 20:29:33 2015 +0100 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XSGrammarBucket.java Fri Oct 23 16:41:06 2015 -0400 @@ -20,8 +20,9 @@ package com.sun.org.apache.xerces.internal.impl.xs; -import java.util.Hashtable; import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; import java.util.Vector; /** @@ -38,7 +39,7 @@ /** * Hashtable that maps between Namespace and a Grammar */ - Hashtable fGrammarRegistry = new Hashtable(); + Map fGrammarRegistry = new HashMap(); SchemaGrammar fNoNSGrammar = null; /** @@ -145,10 +146,11 @@ int count = fGrammarRegistry.size() + (fNoNSGrammar==null ? 0 : 1); SchemaGrammar[] grammars = new SchemaGrammar[count]; // get grammars with target namespace - Enumeration schemas = fGrammarRegistry.elements(); int i = 0; - while (schemas.hasMoreElements()) - grammars[i++] = (SchemaGrammar)schemas.nextElement(); + for(Map.Entry entry : fGrammarRegistry.entrySet()){ + grammars[i++] = entry.getValue(); + } + // add the grammar without target namespace, if any if (fNoNSGrammar != null) grammars[count-1] = fNoNSGrammar; diff -r 8905368e9402 -r 5b5e5ea9c8dd drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java Thu Jul 30 20:29:33 2015 +0100 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java Fri Oct 23 16:41:06 2015 -0400 @@ -20,11 +20,6 @@ package com.sun.org.apache.xerces.internal.impl.xs.traversers; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; -import java.util.Vector; - import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType; import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar; @@ -41,6 +36,12 @@ import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xs.XSConstants; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -144,9 +145,9 @@ // used to store the map from element name to attribute list // for 14 global elements - private static final Hashtable fEleAttrsMapG = new Hashtable(29); + private static final Map fEleAttrsMapG = new HashMap(29); // for 39 local elememnts - private static final Hashtable fEleAttrsMapL = new Hashtable(79); + private static final Map fEleAttrsMapL = new HashMap(79); // used to initialize fEleAttrsMap // step 1: all possible data types @@ -967,7 +968,7 @@ protected SymbolTable fSymbolTable = null; // used to store the mapping from processed element to attributes - protected Hashtable fNonSchemaAttrs = new Hashtable(); + protected Map> fNonSchemaAttrs = new HashMap(); // temprory vector, used to hold the namespace list protected Vector fNamespaceList = new Vector(); @@ -1033,7 +1034,7 @@ reportSchemaError("s4s-elt-schema-ns", new Object[] {elName}, element); } - Hashtable eleAttrsMap = fEleAttrsMapG; + Map eleAttrsMap = fEleAttrsMapG; String lookupName = elName; // REVISIT: only local element and attribute are different from others. @@ -1633,11 +1634,10 @@ // REVISIT: pass the proper element node to reportSchemaError public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) { // for all attributes - Enumeration keys = fNonSchemaAttrs.keys(); XSAttributeDecl attrDecl; - while (keys.hasMoreElements()) { + for (Map.Entry> entry : fNonSchemaAttrs.entrySet()) { // get name, uri, localpart - String attrRName = (String)keys.nextElement(); + String attrRName = entry.getKey(); String attrURI = attrRName.substring(0,attrRName.indexOf(',')); String attrLocal = attrRName.substring(attrRName.indexOf(',')+1); // find associated grammar @@ -1653,7 +1653,7 @@ continue; // get all values appeared with this attribute name - Vector values = (Vector)fNonSchemaAttrs.get(attrRName); + Vector values = entry.getValue(); String elName, attrVal; String attrName = (String)values.elementAt(0); // for each of the values @@ -1881,9 +1881,9 @@ } class LargeContainer extends Container { - Hashtable items; + Map items; LargeContainer(int size) { - items = new Hashtable(size*2+1); + items = new HashMap(size*2+1); values = new OneAttr[size]; } void put(String key, OneAttr value) { diff -r 8905368e9402 -r 5b5e5ea9c8dd drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Thu Jul 30 20:29:33 2015 +0100 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Fri Oct 23 16:41:06 2015 -0400 @@ -200,8 +200,6 @@ // //protected data that can be accessable by any traverser - // stores decl - protected Hashtable fNotationRegistry = new Hashtable(); protected XSDeclarationPool fDeclPool = null; @@ -220,48 +218,41 @@ // By asking the node for its ownerDocument and looking in // XSDocumentInfoRegistry we can easily get the corresponding // XSDocumentInfo object. - private Hashtable fUnparsedAttributeRegistry = new Hashtable(); - private Hashtable fUnparsedAttributeGroupRegistry = new Hashtable(); - private Hashtable fUnparsedElementRegistry = new Hashtable(); - private Hashtable fUnparsedGroupRegistry = new Hashtable(); - private Hashtable fUnparsedIdentityConstraintRegistry = new Hashtable(); - private Hashtable fUnparsedNotationRegistry = new Hashtable(); - private Hashtable fUnparsedTypeRegistry = new Hashtable(); - // Compensation for the above hashtables to locate XSDocumentInfo, + private boolean registryEmpty = true; + private Map fUnparsedAttributeRegistry = new HashMap(); + private Map fUnparsedAttributeGroupRegistry = new HashMap(); + private Map fUnparsedElementRegistry = new HashMap(); + private Map fUnparsedGroupRegistry = new HashMap(); + private Map fUnparsedIdentityConstraintRegistry = new HashMap(); + private Map fUnparsedNotationRegistry = new HashMap(); + private Map fUnparsedTypeRegistry = new HashMap(); + // Compensation for the above map to locate XSDocumentInfo, // Since we may take Schema Element directly, so can not get the - // corresponding XSDocumentInfo object just using above hashtables. - private Hashtable fUnparsedAttributeRegistrySub = new Hashtable(); - private Hashtable fUnparsedAttributeGroupRegistrySub = new Hashtable(); - private Hashtable fUnparsedElementRegistrySub = new Hashtable(); - private Hashtable fUnparsedGroupRegistrySub = new Hashtable(); - private Hashtable fUnparsedIdentityConstraintRegistrySub = new Hashtable(); - private Hashtable fUnparsedNotationRegistrySub = new Hashtable(); - private Hashtable fUnparsedTypeRegistrySub = new Hashtable(); + // corresponding XSDocumentInfo object just using above maps. + private Map fUnparsedAttributeRegistrySub = new HashMap(); + private Map fUnparsedAttributeGroupRegistrySub = new HashMap(); + private Map fUnparsedElementRegistrySub = new HashMap(); + private Map fUnparsedGroupRegistrySub = new HashMap(); + private Map fUnparsedIdentityConstraintRegistrySub = new HashMap(); + private Map fUnparsedNotationRegistrySub = new HashMap(); + private Map fUnparsedTypeRegistrySub = new HashMap(); - // this is keyed with a documentNode (or the schemaRoot nodes - // contained in the XSDocumentInfo objects) and its value is the - // XSDocumentInfo object corresponding to that document. - // Basically, the function of this registry is to be a link - // between the nodes we fetch from calls to the fUnparsed* - // arrays and the XSDocumentInfos they live in. - private Hashtable fXSDocumentInfoRegistry = new Hashtable(); - - // this hashtable is keyed on by XSDocumentInfo objects. Its values + // this map is keyed on by XSDocumentInfo objects. Its values // are Vectors containing the XSDocumentInfo objects d, // ed or d by the key XSDocumentInfo. - private Hashtable fDependencyMap = new Hashtable(); + private Map fDependencyMap = new HashMap(); - // this hashtable is keyed on by a target namespace. Its values + // 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 Hashtable fImportMap = new Hashtable(); + private Map 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 hashtable can't be null.) private Vector fAllTNSs = new Vector(); // stores instance document mappings between namespaces and schema hints - private Hashtable fLocationPairs = null; + private Map fLocationPairs = null; //this hashtable is keyded on by DOM node objects. //The table stores the hidden nodes @@ -291,33 +282,33 @@ // 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 Hashtable fTraversed = new Hashtable(); + private Map fTraversed = new HashMap(); - // this hashtable contains a mapping from Schema Element to its systemId + // this map contains a mapping from Schema Element to its systemId // this is useful to resolve a uri relative to the referring document - private Hashtable fDoc2SystemId = new Hashtable(); + private Map fDoc2SystemId = new HashMap(); // the primary XSDocumentInfo we were called to parse private XSDocumentInfo fRoot = null; - // This hashtable's job is to act as a link between the Schema Element and its + // This map's job is to act as a link between the Schema Element and its // XSDocumentInfo object. - private Hashtable fDoc2XSDocumentMap = new Hashtable(); + private Map fDoc2XSDocumentMap = new HashMap(); // map between elements and the XSDocumentInfo // objects that correspond to the documents being redefined. - private Hashtable fRedefine2XSDMap = new Hashtable(); + private Map fRedefine2XSDMap = null; // map between elements and the namespace support - private Hashtable fRedefine2NSSupport = new Hashtable(); + private Map fRedefine2NSSupport = null; // these objects store a mapping between the names of redefining // groups/attributeGroups and the groups/AttributeGroups which // they redefine by restriction (implicitly). It is up to the // Group and AttributeGroup traversers to check these restrictions for // validity. - private Hashtable fRedefinedRestrictedAttributeGroupRegistry = new Hashtable(); - private Hashtable fRedefinedRestrictedGroupRegistry = new Hashtable(); + private Map fRedefinedRestrictedAttributeGroupRegistry = new HashMap(); + private Map fRedefinedRestrictedGroupRegistry = new HashMap(); // a variable storing whether the last schema document // processed (by getSchema) was a duplicate. @@ -428,7 +419,7 @@ * @throws IOException */ public SchemaGrammar parseSchema(XMLInputSource is, XSDDescription desc, - Hashtable locationPairs) + Map locationPairs) throws IOException { fLocationPairs = locationPairs; fSchemaParser.resetNodePool(); @@ -929,6 +920,7 @@ schemaHint = (String)includeAttrs[XSAttributeChecker.ATTIDX_SCHEMALOCATION]; // store the namespace decls of the redefine element if (localName.equals(SchemaSymbols.ELT_REDEFINE)) { + if (fRedefine2NSSupport == null) fRedefine2NSSupport = new HashMap(); fRedefine2NSSupport.put(child, new SchemaNamespaceSupport(currSchemaInfo.fNamespaceSupport)); } @@ -1018,6 +1010,7 @@ newSchemaInfo != null) { // must record which schema we're redefining so that we can // rename the right things later! + if (fRedefine2XSDMap == null) fRedefine2XSDMap = new HashMap(); fRedefine2XSDMap.put(child, newSchemaInfo); } if (newSchemaRoot != null) { @@ -1052,7 +1045,7 @@ // that implicit redefinitions of groups and attributeGroups can be handled). protected void buildGlobalNameRegistries() { - + registryEmpty = false; // Starting with fRoot, we examine each child of the schema // element. Skipping all imports and includes, we record the names // of all other global components (and children of ). We @@ -1228,7 +1221,7 @@ // includes and imports will not show up here! if (DOMUtil.getLocalName(globalComp).equals(SchemaSymbols.ELT_REDEFINE)) { // use the namespace decls for the redefine, instead of for the parent - currSchemaDoc.backupNSSupport((SchemaNamespaceSupport)fRedefine2NSSupport.get(globalComp)); + currSchemaDoc.backupNSSupport((fRedefine2NSSupport!=null)?(SchemaNamespaceSupport)fRedefine2NSSupport.get(globalComp):null); for (Element redefinedComp = DOMUtil.getFirstVisibleChildElement(globalComp, fHiddenNodes); redefinedComp != null; redefinedComp = DOMUtil.getNextVisibleSiblingElement(redefinedComp, fHiddenNodes)) { @@ -1448,32 +1441,32 @@ declToTraverse.uri+","+declToTraverse.localpart; switch (declType) { case ATTRIBUTE_TYPE : - decl = (Element)fUnparsedAttributeRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedAttributeRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedAttributeRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedAttributeRegistrySub, declKey); break; case ATTRIBUTEGROUP_TYPE : - decl = (Element)fUnparsedAttributeGroupRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedAttributeGroupRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedAttributeGroupRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedAttributeGroupRegistrySub, declKey); break; case ELEMENT_TYPE : - decl = (Element)fUnparsedElementRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedElementRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedElementRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedElementRegistrySub, declKey); break; case GROUP_TYPE : - decl = (Element)fUnparsedGroupRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedGroupRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedGroupRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedGroupRegistrySub, declKey); break; case IDENTITYCONSTRAINT_TYPE : - decl = (Element)fUnparsedIdentityConstraintRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedIdentityConstraintRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedIdentityConstraintRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedIdentityConstraintRegistrySub, declKey); break; case NOTATION_TYPE : - decl = (Element)fUnparsedNotationRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedNotationRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedNotationRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedNotationRegistrySub, declKey); break; case TYPEDECL_TYPE : - decl = (Element)fUnparsedTypeRegistry.get(declKey); - declDoc = (XSDocumentInfo)fUnparsedTypeRegistrySub.get(declKey); + decl = getElementFromMap(fUnparsedTypeRegistry, declKey); + declDoc = getDocInfoFromMap(fUnparsedTypeRegistrySub, declKey); break; default: reportSchemaError("Internal-Error", new Object [] {"XSDHandler asked to locate component of type " + declType + "; it does not recognize this type!"}, elmNode); @@ -1514,7 +1507,7 @@ // if the parent is use the namespace delcs for it. Element parent = DOMUtil.getParent(decl); if (DOMUtil.getLocalName(parent).equals(SchemaSymbols.ELT_REDEFINE)) - nsSupport = (SchemaNamespaceSupport)fRedefine2NSSupport.get(parent); + nsSupport = (fRedefine2NSSupport!=null)?(SchemaNamespaceSupport)fRedefine2NSSupport.get(parent):null; // back up the current SchemaNamespaceSupport, because we need to provide // a fresh one to the traverseGlobal methods. schemaWithDecl.backupNSSupport(nsSupport); @@ -1621,11 +1614,11 @@ // an accessor method. Just makes sure callers // who want the Identity constraint registry vaguely know what they're about. - protected Hashtable getIDRegistry() { + protected Map getIDRegistry() { return fUnparsedIdentityConstraintRegistry; } // an accessor method. - protected Hashtable getIDRegistry_sub() { + protected Map getIDRegistry_sub() { return fUnparsedIdentityConstraintRegistrySub; } @@ -1886,6 +1879,7 @@ // before traversing a schema's parse tree, need to reset all traversers and // clear all registries void prepareForTraverse() { + if (!registryEmpty) { fUnparsedAttributeRegistry.clear(); fUnparsedAttributeGroupRegistry.clear(); fUnparsedElementRegistry.clear(); @@ -1901,12 +1895,12 @@ fUnparsedIdentityConstraintRegistrySub.clear(); fUnparsedNotationRegistrySub.clear(); fUnparsedTypeRegistrySub.clear(); + } - fXSDocumentInfoRegistry.clear(); fDependencyMap.clear(); fDoc2XSDocumentMap.clear(); - fRedefine2XSDMap.clear(); - fRedefine2NSSupport.clear(); + if (fRedefine2XSDMap != null) fRedefine2XSDMap.clear(); + if (fRedefine2NSSupport != null) fRedefine2NSSupport.clear(); fAllTNSs.removeAllElements(); fImportMap.clear(); fRoot = null; @@ -2151,7 +2145,7 @@ * or because we've found the thing we're redefining. */ void checkForDuplicateNames(String qName, - Hashtable registry, Hashtable registry_sub, Element currComp, + Map registry, Map registry_sub, Element currComp, XSDocumentInfo currSchema) { Object objElem = null; // REVISIT: when we add derivation checking, we'll have to make @@ -2172,7 +2166,7 @@ // (the parent of the colliding element is a redefine) boolean collidedWithRedefine = true; if ((DOMUtil.getLocalName((elemParent = DOMUtil.getParent(collidingElem))).equals(SchemaSymbols.ELT_REDEFINE))) { - redefinedSchema = (XSDocumentInfo)(fRedefine2XSDMap.get(elemParent)); + redefinedSchema = (fRedefine2XSDMap != null)?(XSDocumentInfo) (fRedefine2XSDMap.get(elemParent)): null; // case where we're a redefining element. } else if ((DOMUtil.getLocalName(DOMUtil.getParent(currComp)).equals(SchemaSymbols.ELT_REDEFINE))) { @@ -2223,7 +2217,7 @@ reportSchemaError("sch-props-correct.2", new Object []{qName}, currComp); } } - } // checkForDuplicateNames(String, Hashtable, Element, XSDocumentInfo):void + } // checkForDuplicateNames(String, Map, Element, XSDocumentInfo):void // the purpose of this method is to take the component of the // specified type and rename references to itself so that they @@ -2540,7 +2534,22 @@ } return false; } - + + private Element getElementFromMap(Map registry, String declKey) { + if (registry == null) return null; + return registry.get(declKey); + } + + private XSDocumentInfo getDocInfoFromMap(Map registry, String declKey) { + if (registry == null) return null; + return registry.get(declKey); + } + + private Object getFromMap(Map registry, String key) { + if (registry == null) return null; + return registry.get(key); + } + void reportSchemaFatalError(String key, Object[] args, Element ele) { reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_FATAL_ERROR); }