svn commit: r1380456 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
Author: mrglavas Date: Tue Sep 4 06:31:09 2012 New Revision: 1380456 URL: http://svn.apache.org/viewvc?rev=1380456&view=rev Log: JIRA Issue #1583: https://issues.apache.org/jira/browse/XERCESJ-1583. Fixing an NPE. Before processing the 'inheritable' attribute first check that we're in XML Schema 1.1 mode. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java?rev=1380456&r1=1380455&r2=1380456&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java Tue Sep 4 06:31:09 2012 @@ -140,11 +140,16 @@ class XSDAttributeTraverser extends XSDA attrUse.fDefault.normalizedValue = defaultAtt; } -if (attrDecl.getAttributeNode(SchemaSymbols.ATT_INHERITABLE) != null) { - attrUse.fInheritable = inheritableAtt.booleanValue(); +if (fSchemaHandler.fSchemaVersion >= Constants.SCHEMA_VERSION_1_1) { +if (attrDecl.getAttributeNode(SchemaSymbols.ATT_INHERITABLE) != null) { +attrUse.fInheritable = inheritableAtt.booleanValue(); +} +else { +attrUse.fInheritable = attribute.getInheritable(); +} } else { - attrUse.fInheritable = attribute.getInheritable(); +attrUse.fInheritable = false; } // Get the annotation associated with the local attr decl @@ -386,7 +391,7 @@ class XSDAttributeTraverser extends XSDA boolean inheritable = false; if (inheritableAtt != null) { - inheritable = inheritableAtt.booleanValue(); +inheritable = inheritableAtt.booleanValue(); } attribute.setValues(nameAtt, tnsAtt, attrType, constraintType, scope, - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1380454 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NodeImpl.java
Author: mrglavas Date: Tue Sep 4 05:57:15 2012 New Revision: 1380454 URL: http://svn.apache.org/viewvc?rev=1380454&view=rev Log: JIRA Issue #1582: https://issues.apache.org/jira/browse/XERCESJ-1582. Fixing NPEs which could occur in each of the Node prefix / namespace query methods if the document element is null. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NodeImpl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NodeImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NodeImpl.java?rev=1380454&r1=1380453&r2=1380454&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NodeImpl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NodeImpl.java Tue Sep 4 05:57:15 2012 @@ -25,6 +25,7 @@ import java.util.Hashtable; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; +import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -1421,7 +1422,11 @@ public abstract class NodeImpl return false; } case Node.DOCUMENT_NODE:{ - return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI); +Element docElement = ((Document)this).getDocumentElement(); +if (docElement != null) { +return docElement.isDefaultNamespace(namespaceURI); +} +return false; } case Node.ENTITY_NODE : @@ -1475,7 +1480,11 @@ public abstract class NodeImpl return lookupNamespacePrefix(namespaceURI, (ElementImpl)this); } case Node.DOCUMENT_NODE:{ - return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI); +Element docElement = ((Document)this).getDocumentElement(); +if (docElement != null) { +return docElement.lookupPrefix(namespaceURI); +} +return null; } case Node.ENTITY_NODE : @@ -1559,8 +1568,12 @@ public abstract class NodeImpl } -case Node.DOCUMENT_NODE : { - return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix); +case Node.DOCUMENT_NODE : { +Element docElement = ((Document)this).getDocumentElement(); +if (docElement != null) { +return docElement.lookupNamespaceURI(specifiedPrefix); +} +return null; } case Node.ENTITY_NODE : case Node.NOTATION_NODE: - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1380453 - /xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java
Author: mrglavas Date: Tue Sep 4 05:56:45 2012 New Revision: 1380453 URL: http://svn.apache.org/viewvc?rev=1380453&view=rev Log: JIRA Issue #1582: https://issues.apache.org/jira/browse/XERCESJ-1582. Fixing NPEs which could occur in each of the Node prefix / namespace query methods if the document element is null. Modified: xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java Modified: xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java?rev=1380453&r1=1380452&r2=1380453&view=diff == --- xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java (original) +++ xerces/java/trunk/src/org/apache/xerces/dom/NodeImpl.java Tue Sep 4 05:56:45 2012 @@ -25,6 +25,7 @@ import java.util.Hashtable; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; +import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -1421,7 +1422,11 @@ public abstract class NodeImpl return false; } case Node.DOCUMENT_NODE:{ - return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI); +Element docElement = ((Document)this).getDocumentElement(); +if (docElement != null) { +return docElement.isDefaultNamespace(namespaceURI); +} +return false; } case Node.ENTITY_NODE : @@ -1475,7 +1480,11 @@ public abstract class NodeImpl return lookupNamespacePrefix(namespaceURI, (ElementImpl)this); } case Node.DOCUMENT_NODE:{ - return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI); +Element docElement = ((Document)this).getDocumentElement(); +if (docElement != null) { +return docElement.lookupPrefix(namespaceURI); +} +return null; } case Node.ENTITY_NODE : @@ -1559,8 +1568,12 @@ public abstract class NodeImpl } -case Node.DOCUMENT_NODE : { - return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix); +case Node.DOCUMENT_NODE : { +Element docElement = ((Document)this).getDocumentElement(); +if (docElement != null) { +return docElement.lookupNamespaceURI(specifiedPrefix); +} +return null; } case Node.ENTITY_NODE : case Node.NOTATION_NODE: - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1380447 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dtd/XMLDTDValidator.java validation/ConfigurableValidationState.java validation/ValidationState.java xs/X
Author: mrglavas Date: Tue Sep 4 04:46:01 2012 New Revision: 1380447 URL: http://svn.apache.org/viewvc?rev=1380447&view=rev Log: JIRA Issue #1581: https://issues.apache.org/jira/browse/XERCESJ-1581. Report multiple IDREF errors during DTD and XML Schema validation (in document order). Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java?rev=1380447&r1=1380446&r2=1380447&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java Tue Sep 4 04:46:01 2012 @@ -17,6 +17,8 @@ package org.apache.xerces.impl.dtd; +import java.util.Iterator; + import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.RevalidationHandler; import org.apache.xerces.impl.XMLEntityManager; @@ -2066,12 +2068,14 @@ public class XMLDTDValidator // IDREF and IDREFS attr (V_IDREF0) // if (fPerformValidation) { -String value = fValidationState.checkIDRefID(); -if (value != null) { -fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, -"MSG_ELEMENT_WITH_ID_REQUIRED", -new Object[]{value}, - XMLErrorReporter.SEVERITY_ERROR ); +Iterator invIdRefs = fValidationState.checkIDRefID(); +if (invIdRefs != null) { +while (invIdRefs.hasNext()) { +fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, +"MSG_ELEMENT_WITH_ID_REQUIRED", +new Object[]{invIdRefs.next()}, +XMLErrorReporter.SEVERITY_ERROR ); +} } } return; Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java?rev=1380447&r1=1380446&r2=1380447&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java Tue Sep 4 04:46:01 2012 @@ -17,6 +17,8 @@ package org.apache.xerces.impl.validation; +import java.util.Iterator; + /** * An extension of ValidationState which can be configured to turn * off checking for ID/IDREF errors and unparsed entity errors. @@ -72,7 +74,7 @@ public class ConfigurableValidationState * @return null, if ID/IDREF checking is turned off * otherwise, returns the value of the super implementation */ -public final String checkIDRefID() { +public final Iterator checkIDRefID() { return (fIdIdrefChecking) ? super.checkIDRefID() : null; } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java?rev=1380447&r1=1380446&r2=1380447&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java Tue Sep 4 04:46:01 2012 @@ -18,7 +18,10 @@ package org.apache.xerces.impl.validation; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.Locale; import org.apache.xerces.impl.Constants; @@ -53,7 +56,7 @@ public class ValidationState implements //REVISIT: Should replace with a lighter structure. private final HashMap fIdTable= new HashMap(); -private final HashMap fI
svn commit: r1380445 - in /xerces/java/trunk/src/org/apache/xerces/impl: dtd/XMLDTDValidator.java validation/ConfigurableValidationState.java validation/ValidationState.java xs/XMLSchemaValidator.java
Author: mrglavas Date: Tue Sep 4 04:43:34 2012 New Revision: 1380445 URL: http://svn.apache.org/viewvc?rev=1380445&view=rev Log: JIRA Issue #1581: https://issues.apache.org/jira/browse/XERCESJ-1581. Report multiple IDREF errors during DTD and XML Schema validation. Modified: xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java xerces/java/trunk/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java xerces/java/trunk/src/org/apache/xerces/impl/validation/ValidationState.java xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java?rev=1380445&r1=1380444&r2=1380445&view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java Tue Sep 4 04:43:34 2012 @@ -17,6 +17,8 @@ package org.apache.xerces.impl.dtd; +import java.util.Iterator; + import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.RevalidationHandler; import org.apache.xerces.impl.XMLEntityManager; @@ -2066,12 +2068,14 @@ public class XMLDTDValidator // IDREF and IDREFS attr (V_IDREF0) // if (fPerformValidation) { -String value = fValidationState.checkIDRefID(); -if (value != null) { -fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, -"MSG_ELEMENT_WITH_ID_REQUIRED", -new Object[]{value}, - XMLErrorReporter.SEVERITY_ERROR ); +Iterator invIdRefs = fValidationState.checkIDRefID(); +if (invIdRefs != null) { +while (invIdRefs.hasNext()) { +fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, +"MSG_ELEMENT_WITH_ID_REQUIRED", +new Object[]{invIdRefs.next()}, +XMLErrorReporter.SEVERITY_ERROR ); +} } } return; Modified: xerces/java/trunk/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java?rev=1380445&r1=1380444&r2=1380445&view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java Tue Sep 4 04:43:34 2012 @@ -17,6 +17,8 @@ package org.apache.xerces.impl.validation; +import java.util.Iterator; + /** * An extension of ValidationState which can be configured to turn * off checking for ID/IDREF errors and unparsed entity errors. @@ -72,7 +74,7 @@ public final class ConfigurableValidatio * @return null, if ID/IDREF checking is turned off * otherwise, returns the value of the super implementation */ -public String checkIDRefID() { +public Iterator checkIDRefID() { return (fIdIdrefChecking) ? super.checkIDRefID() : null; } Modified: xerces/java/trunk/src/org/apache/xerces/impl/validation/ValidationState.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/validation/ValidationState.java?rev=1380445&r1=1380444&r2=1380445&view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/validation/ValidationState.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/validation/ValidationState.java Tue Sep 4 04:43:34 2012 @@ -18,6 +18,7 @@ package org.apache.xerces.impl.validation; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Locale; @@ -87,18 +88,23 @@ public class ValidationState implements /** * return null if all IDREF values have a corresponding ID value; - * otherwise return the first IDREF value without a matching ID value. + * otherwise return an iterator for all the IDREF values without + * a matching ID value. */ -public String checkIDRefID () { +public Iterator checkIDRefID() { +HashSet missingIDs = null; Iterator iter = fIdRefTable.keySet().iterator(); String key; while (iter.hasNext()) { key = (String) iter.next(); if (!fIdTable.containsKey(key)) { - return key; +if (missingIDs
svn commit: r1380272 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: mukulg Date: Mon Sep 3 15:23:58 2012 New Revision: 1380272 URL: http://svn.apache.org/viewvc?rev=1380272&view=rev Log: committing a fix for latest issue reported for Jira issue, XERCESJ-1578. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=1380272&r1=1380271&r2=1380272&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Mon Sep 3 15:23:58 2012 @@ -861,7 +861,7 @@ public class XSDHandler { // This method does several things: // It constructs an instance of an XSDocumentInfo object using the -// schemaRoot node. Then, for each , +// schemaRoot node. Then, for each , , // , and children, it attempts to resolve the // requested schema document, initiates a DOM parse, and calls // itself recursively on that document's root. It also records in @@ -1181,7 +1181,6 @@ public class XSDHandler { } // pass the systemId of the current document as the base systemId boolean mustResolve = false; -boolean isOverride = false; refType = XSDDescription.CONTEXT_INCLUDE; if (localName.equals(SchemaSymbols.ELT_REDEFINE)) { mustResolve = nonAnnotationContent(child); @@ -1190,7 +1189,6 @@ public class XSDHandler { else if (localName.equals(SchemaSymbols.ELT_OVERRIDE)){ mustResolve = nonAnnotationContent(child); refType = XSDDescription.CONTEXT_OVERRIDE; -isOverride = true; } fSchemaGrammarDescription.reset(); fSchemaGrammarDescription.setContextType(refType); @@ -1215,30 +1213,35 @@ public class XSDHandler { newSchemaRoot = resolveSchema(schemaSource, fSchemaGrammarDescription, mustResolve, child); schemaNamespace = currSchemaInfo.fTargetNamespace; if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { -if (isOverride && newSchemaRoot != null && isValidTargetUriForOverride(schemaSource, locationHint)) { -final Element transformedSchemaRoot = (Element) fOverrideHandler.transform(schemaId, child, newSchemaRoot); +if (refType == XSDDescription.CONTEXT_OVERRIDE) { +if (newSchemaRoot != null && isValidTargetUriForIncludeOrOverride(schemaSource, locationHint)) { +final Element transformedSchemaRoot = (Element) fOverrideHandler.transform(schemaId, child, newSchemaRoot); + +// Either we had a collision where the transformed +// schema has global components or we hit a +// transformation cycle +if (transformedSchemaRoot == null) { +fLastSchemaWasDuplicate = true; +} +// In case of a collision where the transformed +// schema has no global components, the override +// transformer will return the new transformed +// schema. We need to process that new schema, +// so we set the duplicate schema flag to false -// Either we had a collision where the transformed -// schema has global components or we hit a -// transformation cycle -if (transformedSchemaRoot == null) { -fLastSchemaWasDuplicate = true; -} -// In case of a collision where the transformed -// schema has no global components, the override -// transformer will return the new transformed -// schema. We need to process that new schema, -// so we set the duplicate schema flag to false +else if (fLastSchemaWasDuplicate && transformedSchemaRoot != newSchemaRoot) { +fLastSchemaWasDuplicate = false; +} -else if (fLastSchemaWasDupli