The following comment has been added to this issue:

     Author: Dennis Sosnoski
    Created: Mon, 19 Apr 2004 2:35 AM
       Body:
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.
---------------------------------------------------------------------
View this comment:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JIBX-11&page=comments#action_18798

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JIBX-11

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JIBX-11
    Summary: getNamedStructure returns null instead of throwing exception
       Type: Bug

     Status: Open
   Priority: Minor

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: JiBX
 Components: 
             core
   Versions:
             1.0-beta3a

   Assignee: Dennis Sosnoski
   Reporter: Cameron Taggart

    Created: Wed, 14 Apr 2004 12:27 PM
    Updated: Mon, 19 Apr 2004 2:35 AM

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) {
            return m_context.getNamedStructure(name);
        } 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) {
          icomponent = m_context.getNamedStructure(name);
        } 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.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
jibx-devs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to