JiBX
  1. JiBX
  2. JIBX-197

Error running binding compiler: Method call on invalid structure

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1.5
    • Fix Version/s: JiBX 1.1.6
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows XP SP2, JDK 1.4.2
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      when using the following binding, a compiletime error occurs:

      <?xml version="1.0" encoding="ISO-8859-2"?>
      <binding>
      <mapping name="Data" class="structure.StructureParentData"
      ordered="false" flexible="true">
      <structure name="structure" field="structureChild"
      type="structure.StructureChildData"/>
      </mapping>

      <!-- this will cause an error during compile time -->
      <mapping ordered="false" class="structure.StructureChildData"
      abstract="true">
      <!-- this works -->
      <!-- <mapping ordered="true" class="structure.StructureChildData"
      abstract="true"> -->
      <!-- this works, too -->
      <!-- <mapping class="structure.StructureChildData" abstract="true">-->
      <value style="text" field="content"/>
      <value style="attribute" field="attribute" name="attribute"/>
      </mapping>
      </binding>

      problem seems to be that ordered is set to "false" but a value tag
      with style="text" exists. when we set ordered="true" or do not specify
      the order parameter, everything works fine.

      the stacktrace is:
      [bind] Generating code for mapping structure.StructureParentData
      [bind] Error running binding compiler
      [bind] org.jibx.runtime.JiBXException: Method call on invalid structure
      [bind] at org.jibx.binding.def.ValueChild.genContentPresentTest(ValueChild.java: 798)
      [bind] at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:234)
      [bind] at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:798)
      [bind] at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:943)
      [bind] at org.jibx.binding.def.PassThroughComponent.genContentUnmarshal(PassThroughComponent.java:111)
      [bind] at org.jibx.binding.def.BaseMappingWrapper.genContentUnmarshal(BaseMappingWrapper.java:73)
      [bind] at org.jibx.binding.def.PassThroughComponent.genContentUnmarshal(PassThroughComponent.java:111)
      [bind] at org.jibx.binding.def.MappingReference.genContentUnmarshal(MappingReference.java:223)
      [bind] at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:190)
      [bind] at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:798)
      [bind] at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:943)
      [bind] at org.jibx.binding.def.ComponentProperty.genContentUnmarshal(ComponentProperty.java:225)
      [bind] at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:314)
      [bind] at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:252)
      [bind] at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:798)
      [bind] at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:943)
      [bind] at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:314)
      [bind] at org.jibx.binding.def.MappingDefinition.generateUnmarshalImplementation(MappingDefinition.java:640)
      [bind] at org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:851)
      [bind] at org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:669)
      [bind] at org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:661)
      [bind] at org.jibx.binding.Compile.compile(Compile.java:305)
      [bind] at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
      [bind] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      [bind] at org.apache.tools.ant.Task.perform(Task.java:364)
      [bind] at org.apache.tools.ant.Target.execute(Target.java:341)
      [bind] at org.apache.tools.ant.Target.performTasks(Target.java:369)
      [bind] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      [bind] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      [bind] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      [bind] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
      [bind] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      [bind] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
      [bind] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

      Junit test and ant build are available in the attached zip file. the JUnit test calls the compiler directly, but the Path

        Activity

        Hide
        GŁnther Wieser added a comment -

        Sorry, last sentence has been cut:

        The JUnit test calls the compiler directly, the zip is an export of an eclipse project.

        Show
        GŁnther Wieser added a comment - Sorry, last sentence has been cut: The JUnit test calls the compiler directly, the zip is an export of an eclipse project.
        Hide
        Dennis Sosnoski added a comment -

        This is really a usage error, since there's no way to make sense of text values inside an unordered grouping. I've added a validation check for this condition, and have also updated the documentation to say that this is prohibited.

        Show
        Dennis Sosnoski added a comment - This is really a usage error, since there's no way to make sense of text values inside an unordered grouping. I've added a validation check for this condition, and have also updated the documentation to say that this is prohibited.
        Dennis Sosnoski made changes -
        Field Original Value New Value
        Assignee Dennis Sosnoski [ dsosnoski ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s JiBX 1.1.6 [ 14068 ]
        Dennis Sosnoski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            GŁnther Wieser
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: