Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337309

Summary: Null Pointer Exception when running the XSD Examples
Product: [Modeling] EMF Reporter: Yves.Grenier
Component: XSDAssignee: Ed Merks <Ed.Merks>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: marcelop, Yves.Grenier
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Yves.Grenier CLA 2011-02-16 08:37:40 EST
Build Identifier: 20100917-0705

java.lang.NullPointerException
 at org.eclipse.xsd.example.XSDGenerateHTML.loadAndPrint(XSDGenerateHTML.java:780)
 at org.eclipse.xsd.example.XSDGenerateHTML.run(XSDGenerateHTML.java:698)
 at org.eclipse.xsd.example.XSDGenerateHTML.start(XSDGenerateHTML.java:660)
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
 at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
 at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


The line it refers to is:
XSDElementDeclaration specialElementDeclaration = 
(XSDElementDeclaration)((XSDModelGroup)((XSDModelGroup)((XSDParticle)(xsdComplexTypeDefinition.getContentType())).getTerm()).getParticles().get(1).getTerm()).getParticles().get(j).getTerm();

Reproducible: Always

Steps to Reproduce:
1. Simply run the XSDGenerateHTML
Note: The other part, XSDMainExample runs fine
Comment 1 Ed Merks CLA 2011-04-11 10:48:59 EDT
Marcelo,

I actually have no idea what this is supposed to produce.  When applied to Library.xsd, it doesn't appear to do anything useful.
Comment 2 Marcelo Paternostro CLA 2011-04-13 09:53:41 EDT
I am afraid this is a legacy, long forgotten code. And I really don't think I've created it. Looking at the CVS history, I see it was located in a xsd.test bundle that, back in 2005, had examples instead of tests. I did wrote the HTML exporter example, though.

Ed, if you want I can try to figure out what is going on here although, as you know, the XSD code is not my strength. Actually, it is probably a "Ed-only strength" ;-)

That said, can "org.eclipse.emf.test.xml.xsd.XSDFeatureTypeTest" be used as an example of how to drive the XSD API? If it can, I would suggest dropping "org.eclipse.xsd.example", as it seems to be old and not really maintained. If it can't, I wouldn't mind writing such a test instead of spending time on XSDGenerateHTML as the test will be at least exercised during builds.