Author: mukulg Date: Fri Jan 13 09:58:12 2012 New Revision: 1230970 URL: http://svn.apache.org/viewvc?rev=1230970&view=rev Log: fixing a potential NPE issue.
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=1230970&r1=1230969&r2=1230970&view=diff ============================================================================== --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Fri Jan 13 09:58:12 2012 @@ -487,25 +487,23 @@ abstract class XSDAbstractTraverser { // get 'annotation' Element childNode = DOMUtil.getFirstChildElement(content); XSAnnotationImpl annotation = null; + // first child could be an annotation - if (childNode != null - && DOMUtil.getLocalName(childNode).equals( - SchemaSymbols.ELT_ANNOTATION)) { - annotation = traverseAnnotationDecl(childNode, attrs, - false, schemaDoc); - // now move on to the next child element - childNode = DOMUtil.getNextSiblingElement(childNode); - - if (childNode != null) { - // it's an error to have something after the annotation, in an assertion - reportSchemaError("s4s-elt-invalid-content.1", new Object[]{DOMUtil.getLocalName(content), DOMUtil.getLocalName(childNode)}, childNode); + if (childNode != null) { + if (DOMUtil.getLocalName(childNode).equals(SchemaSymbols.ELT_ANNOTATION)) { + annotation = traverseAnnotationDecl(childNode, attrs, false, schemaDoc); + // now move on to the next child element + childNode = DOMUtil.getNextSiblingElement(childNode); + if (childNode != null) { + // it's an error to have something after the annotation, in an assertion + reportSchemaError("s4s-elt-invalid-content.1", new Object[]{DOMUtil.getLocalName(content), DOMUtil.getLocalName(childNode)}, childNode); + } + } else { + String text = DOMUtil.getSyntheticAnnotation(childNode); + if (text != null) { + annotation = traverseSyntheticAnnotation(childNode, text, attrs, false, schemaDoc); + } } - } else { - String text = DOMUtil.getSyntheticAnnotation(childNode); - if (text != null) { - annotation = traverseSyntheticAnnotation(childNode, - text, attrs, false, schemaDoc); - } } XSObjectList annotations = null; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org