Community
Participate
Working Groups
When a schema in the JAXB project library is unresolved (such as when a workspace file is deleted or renamed) the following errors/exceptions occur in the log: java.lang.NullPointerException at org.eclipse.jpt.jaxb.core.internal.SchemaLibraryImpl.addSchema(SchemaLibraryImpl.java:73) at org.eclipse.jpt.jaxb.core.internal.SchemaLibraryImpl.getSchema(SchemaLibraryImpl.java:63) at org.eclipse.jpt.jaxb.core.internal.context.GenericPackage.getXsdSchema(GenericPackage.java:118) at org.eclipse.jpt.jaxb.core.internal.context.java.AbstractJavaPersistentType.validateXmlType(AbstractJavaPersistentType.java:375) ... JAXB Validator finished validating: file:/C:/dev/workspaces/jpt/TestGenericJaxb21/src/test/GlobalType2.java org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Resource '/TestXml/schema/nons.xsd' does not exist. at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:222) at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:452) at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:350) at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:344) at org.eclipse.jpt.jaxb.core.xsd.XsdUtil.buildXSDModel(XsdUtil.java:126) at org.eclipse.jpt.jaxb.core.internal.SchemaLibraryImpl.addSchema(SchemaLibraryImpl.java:72) at org.eclipse.jpt.jaxb.core.internal.SchemaLibraryImpl.getSchema(SchemaLibraryImpl.java:63) at org.eclipse.jpt.jaxb.core.internal.context.GenericPackage.getXsdSchema(GenericPackage.java:118) at org.eclipse.jpt.jaxb.core.internal.context.java.AbstractJavaPersistentType.validateXmlType(AbstractJavaPersistentType.java:375) ... Validation does not complete. Need better handling (and probably validation) for unresolved schemas.
Created attachment 196245 [details] proposed patch Added exception handling for attempting to load schema resources from bad URI's and validation for projects with such URI's.
Patch is working well in my testing so far.
Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. Upon renaming/moving an XML schema that is referred to by our Schema Library the user will loose all validation and content assist for their JAXB classes. This results in NPE's in the log. Is there a work-around? If so, why do you believe the work-around is insufficient? Workaround is to go to the Schema repository and edit the schema file reference in our properties UI. The problem is that the user may not realize this is what they need to do. How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? The fix has been tested by Paul and myself. Give a brief technical overview. Who has reviewed this fix? See comment 1. I have reviewed the fix. What is the risk associated with this fix? Risk is low. This fix is isolated and straightforward.
committed for rc3
looks good