Details
Description
I think this mainly has to do with the using/label stuff which you are reworking. I was trying to troubleshoot a couple of issues with the xsd2jibx servlet example, but the NullPointerException that the JiBX binding compiler was throwing wasn't very helpful.
DefinitionContent.java can be modified like so:
From:
public IComponent getNamedStructure(String name) throws JiBXException {
// check for named component defined at this level
if (m_namedStructureMap == null)
else
{ return (IComponent)m_namedStructureMap.get(name); }}
To:
public IComponent getNamedStructure(String name) throws JiBXException {
IComponent icomponent = null;
// check for named component defined at this level
if (m_namedStructureMap == null)
else
{ icomponent = (IComponent)m_namedStructureMap.get(name); }if( icomponent == null )
{ throw new JiBXException( "Unable to get structure named: " + name ); } return icomponent;
}
Actually knowing what "using" reference was causing the problem helped me track down an xsd2jibx bug and is usefull when troubleshooting the binding compiler.
Yes, the code was definitely bad. I've changed it to check when it reaches the outermost context and throw an exception in this case. Let me know if you get a chance to confirm that this now works properly.