[ http://issues.apache.org/jira/browse/XMLBEANS-236?page=all ]

Lawrence Jones updated XMLBEANS-236:
------------------------------------

    Attachment: xmlBeans236.patch

What was happening was that when scomp analyzed the child elements of the 
prohibited attribute it attempted to look up the parent (i.e. the prohibited 
attribute itself). The code did not store prohibited attributes and so you got 
the NPE described. Having child elements of attributes with use="prohibited" is 
odd, but as far as I can see, not illegal.

This issue seems to have a fairly simple patch (see attached file). But need to 
think about it more before this patch is applied. What the patch does is update 
StscComplexTypeResolver so that it now puts attributes into the local maps (and 
hence into the xsb's) even if they have use="prohibited" whereas the code used 
to explicitly exclude them if they were use="prohibited". But this will mean 
xsb files will have those attributes in them whereas it was excluding them 
before. Not sure why it was excluding them and if that was important for 
something else.


> NPE when running scomp on this schema
> -------------------------------------
>
>          Key: XMLBEANS-236
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-236
>      Project: XMLBeans
>         Type: Bug
>   Components: Compiler
>     Versions: Version 2.1
>  Environment: Windows
>     Reporter: Lawrence Jones
>     Assignee: Lawrence Jones
>      Fix For: TBD
>  Attachments: Untitled5.xsd, data-model.xsd, xmlBeans236.patch
>
> Please see the attached schema. If you run the following scomp on it you get 
> the NPE below:
> scomp -d classes -src src -javasource 1.5 -mx 500m schema
> NPE:
> Exception in thread "main" java.lang.NullPointerException
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeImpl.getIndexForLocalAttribute(SchemaTypeImpl.java:690)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.writeTypeData(SchemaTypeSystemImpl.java:2698)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveType(SchemaTypeSystemImpl.java:1439)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveTypesRecursively(SchemaTypeSystemImpl.java:1316)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveTypesRecursively(SchemaTypeSystemImpl.java:1317)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveTypesRecursively(SchemaTypeSystemImpl.java:1317)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveTypesRecursively(SchemaTypeSystemImpl.java:1317)
>         at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.save(SchemaTypeSystemImpl.java:1291)
>         at 
> org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:1098)
>         at 
> org.apache.xmlbeans.impl.tool.SchemaCompiler.main(SchemaCompiler.java:368)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to