Message:

   The following issue has been resolved as FIXED.

   Resolver: Cameron Taggart
       Date: Mon, 19 Apr 2004 1:22 PM

The bug has been fixed.  To test it out, I made some modifications to example1 
(although they don't make much sense logically).

<!-- uses using/label instead of map-as -->
<binding>
  <mapping name="customer" class="example1.Customer">
    <!-- must add these fields within Customer -->
    <structure name="mother" using="example1.Person" field="mother"/>
    <structure name="father" using="examplePerson" field="father"/>
    <value name="street" field="street"/>
    <value name="city" field="city"/>
    <value name="state" field="state"/>
    <value name="zip" field="zip"/>
    <value name="phone" field="phone"/>
  </mapping>
  <mapping name="person" class="example1.Person" label="example1.Person">
    <value name="cust-num" field="customerNumber"/>
    <value name="first-name" field="firstName"/>
    <value name="last-name" field="lastName"/>
  </mapping>
</binding>

Throws this exception, which is what it should do:

org.jibx.runtime.JiBXException: Referenced label "examplePerson" not defined
        at 
org.jibx.binding.def.DefinitionContext.getNamedStructure(DefinitionContext.java:366)
        at 
org.jibx.binding.def.DefinitionContext.getNamedStructure(DefinitionContext.java:369)
        at 
org.jibx.binding.def.DefinitionContext.getNamedStructure(DefinitionContext.java:369)
        at 
org.jibx.binding.def.StructureReference.setLinkages(StructureReference.java:111)
        at org.jibx.binding.def.ElementWrapper.setLinkages(ElementWrapper.java:443)
        at org.jibx.binding.def.NestedStructure.setLinkages(NestedStructure.java:219)
        at 
org.jibx.binding.def.PassThroughComponent.setLinkages(PassThroughComponent.java:140)
        at org.jibx.binding.def.ObjectBinding.setLinkages(ObjectBinding.java:752)
        at org.jibx.binding.def.ElementWrapper.setLinkages(ElementWrapper.java:443)
        at 
org.jibx.binding.def.MappingDefinition.setLinkages(MappingDefinition.java:678)
        at 
org.jibx.binding.def.DefinitionContext.setLinkages(DefinitionContext.java:624)
        at 
org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:524)
        at org.jibx.binding.Compile.compile(Compile.java:283)
        at org.jibx.binding.Compile.main(Compile.java:341)

---------------------------------------------------------------------
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: Resolved
   Priority: Minor
 Resolution: FIXED

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: JiBX
 Components: 
             core
   Fix Fors:
             CVS
   Versions:
             1.0-beta3a

   Assignee: Dennis Sosnoski
   Reporter: Cameron Taggart

    Created: Wed, 14 Apr 2004 12:27 PM
    Updated: Mon, 19 Apr 2004 1:22 PM

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