Uploaded image for project: 'Fuse Tooling'
  1. Fuse Tooling
  2. FUSETOOLS-1387

NPE changing a variable value

    XMLWordPrintable

    Details

    • Sprint:
      Sprint 2, Fuse 6.2.1 / JBDSIS 8.0.4

      Description

      John - can you file an issue for this NPE issue? I was just able to verify it locally. I didn’t see this when I recorded my latest screencast, so I’m guessing it might only happen when you open an existing transformation config and then try to change a variable value. The impact of this is pretty significant - users can only use variables where the name and value match (since they can’t change the value after creation).

      Here’s the stack trace:

      java.lang.NullPointerException
      at org.jboss.tools.fuse.transformation.editor.internal.MappingViewer.variableValueUpdated(MappingViewer.java:224)
      at org.jboss.tools.fuse.transformation.editor.internal.MappingDetailViewer.configEvent(MappingDetailViewer.java:140)
      at org.jboss.tools.fuse.transformation.editor.internal.MappingDetailViewer$1.propertyChange(MappingDetailViewer.java:100)
      at org.jboss.tools.fuse.transformation.editor.internal.util.TransformationConfig.fireEvent(TransformationConfig.java:172)
      at org.jboss.tools.fuse.transformation.editor.internal.util.TransformationConfig.setValue(TransformationConfig.java:502)
      at org.jboss.tools.fuse.transformation.editor.internal.VariablesViewer$3.setValue(VariablesViewer.java:157)
      at org.eclipse.jface.viewers.EditingSupport.saveCellEditorValue(EditingSupport.java:113)
      at org.eclipse.jface.viewers.ColumnViewerEditor.saveEditorValue(ColumnViewerEditor.java:463)
      at org.eclipse.jface.viewers.ColumnViewerEditor.applyEditorValue(ColumnViewerEditor.java:319)
      at org.eclipse.jface.viewers.ColumnViewerEditor$2.applyEditorValue(ColumnViewerEditor.java:158)
      at org.eclipse.jface.viewers.CellEditor$1.run(CellEditor.java:336)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)

      thanks,
      keith

      Begin forwarded message:

      From: Nandan Joshi <njoshi@redhat.com>
      Subject: Re: Testing the new Fuse mapper
      Date: June 13, 2015 at 10:39:06 AM EDT
      To: Keith Babo <kbabo@redhat.com>
      Cc: John Verhaeg <verhaeg@icloud.com>

      In Eclipse Luna, when I try to change the value of a variable (such as ORIGIN), I get an NPE (reproducible). When I click okay, Eclipse hangs and I have to do a force quit.

      Nandan

      ----- Original Message -----
      From: "Nandan Joshi" <njoshi@redhat.com>
      To: "Keith Babo" <kbabo@redhat.com>
      Cc: "John Verhaeg" <verhaeg@icloud.com>
      Sent: Friday, June 12, 2015 11:46:52 AM
      Subject: Re: Testing the new Fuse mapper

      Works for me as well. I started with a brand new workspace and imported your project into it.

      Not sure what was being cached in Eclipse when I working in the original workspace, but I had confirmed that I was running the right transformation test by the output and I picked the right camel-context.xml in the selector.

      Thanks,

      Nandan Joshi

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com>
      To: "Nandan Joshi" <njoshi@redhat.com>
      Cc: "John Verhaeg" <verhaeg@icloud.com>
      Sent: Friday, June 12, 2015 9:56:36 AM
      Subject: Re: Testing the new Fuse mapper

      Worked fine for me. I’m not sure how you could get the same results as last time since you are transforming to a different object. I would check your Camel config and confirm you are invoking the right endpoint and running the correct test case. Also keep in mind that XyZOrder does not override toString() so you need to either override that method or pull out fields using the simple language if you plan to use ${body} in your route.

      Working project based on yours attached …

      On Jun 12, 2015, at 12:07 PM, Nandan Joshi <njoshi@redhat.com> wrote:

      Changed target to Xyzorder and see the same results in TransformationTest. transformation.xml looks like it is setup correctly.

      Nandan

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com>>
      Cc: "John Verhaeg" <verhaeg@icloud.com <verhaeg@icloud.com>>
      Sent: Friday, June 12, 2015 8:25:52 AM
      Subject: Re: Testing the new Fuse mapper

      Did you close the transformation editor before you created the new transformation endpoint and clobbered the existing transformation.xml?

      On Jun 12, 2015, at 11:23 AM, Nandan Joshi <njoshi@redhat.com> wrote:

      Also, if you remove a Data Transformation task, add another one overwriting the existing transformation.xml, it holds on to entries in the previous transformation.xml and when I select xyzorder class it shows ABCOrder as the target class in the UI.

      Nandan

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>>>, "John Verhaeg" <verhaeg@icloud.com <verhaeg@icloud.com><verhaeg@icloud.com <verhaeg@icloud.com>>>
      Sent: Friday, June 12, 2015 7:51:52 AM
      Subject: Fwd: Testing the new Fuse mapper

      Looks to be a bug with determining nested mappings when the source and target models are identical. If you look at the transformation.xml, you’ll notice that the top-level mapping (ABCOrder -> ABCOrder) has no field mappings inside, which is why nothing gets mapped at runtime even though the child fields are mapped via other mapping definitions.

      In terms of this example, there’s not much point in mapping ABCOrder to ABCOrder since the unmarshalling phase has already turned the original XML version of <ABCOrder> into ABCOrder. Since this is just for training, I would recommend using the XYZOrder class as your target or defining a completely different target Object. That will keep you out of the way of this bug for now.

      John - this is a bug in the common logic which determines which class mapping to use for a field mapping. I will debug a bit and file a JIRA.

      ~keith

      Begin forwarded message:

      From: Nandan Joshi <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>>>
      Subject: Re: Testing the new Fuse mapper
      Date: June 12, 2015 at 10:25:54 AM EDT
      To: Keith Babo <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>>>

      Attached.

      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>>>
      Sent: Friday, June 12, 2015 6:31:21 AM
      Subject: Re: Testing the new Fuse mapper

      You are seeing XML because Camel has a built-in type converter that serializes JAXB-annotated objects as XML. Why the elements are not populated with data is a question I can’t answer without seeing the project.

      On Jun 12, 2015, at 9:21 AM, Nandan Joshi <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>> <njoshi@redhat.com <njoshi@redhat.com><njoshi@redhat.com <njoshi@redhat.com>>>> wrote:

      specified the .java file (under src/main/java/abcorder/ABCOrder.java) for the XML->Java transformation, created the mappings, created a New Transformation Test, and ran the transform() method. The .xml is being read correctly but I am not seeing the Java instance correctly serialized.

      main] route2 INFO After transformation:
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <ABCOrder/>

      I still see references to json in the features.xml (not sure if that matters).

      Perhaps I need to modify the TransformationTest.java to correctly serialize the object.

      from("direct:xml2java-test-input")
      .log("Before transformation:\n ${body}")
      .to("ref:xml2java")
      .log("After transformation:\n ${body}")
      .to("mock:xml2java-test-output");

      Suggestions?

      Nandan

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>> <kbabo@redhat.com <kbabo@redhat.com><kbabo@redhat.com <kbabo@redhat.com>>>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>> <njoshi@redhat.com <njoshi@redhat.com><njoshi@redhat.com <njoshi@redhat.com>>>>
      Sent: Wednesday, June 10, 2015 6:42:41 PM
      Subject: Re: Testing the new Fuse mapper

      You need to specify the Java class you are mapping to. Click the “…” and provide the name of the class.

      On Jun 10, 2015, at 7:36 PM, Nandan Joshi <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>> <njoshi@redhat.com <njoshi@redhat.com><njoshi@redhat.com <njoshi@redhat.com>>>> wrote:

      Modifying your xml-to-json project to do xml-to-java. What is expected in this dialog?

      Worked fine for me. I’m not sure how you could get the same results as last time since you are transforming to a different object. I would check your Camel config and confirm you are invoking the right endpoint and running the correct test case. Also keep in mind that XyZOrder does not override toString() so you need to either override that method or pull out fields using the simple language if you plan to use ${body} in your route.

      Working project based on yours attached …

      On Jun 12, 2015, at 12:07 PM, Nandan Joshi <njoshi@redhat.com> wrote:

      Changed target to Xyzorder and see the same results in TransformationTest. transformation.xml looks like it is setup correctly.

      Nandan

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com>>
      Cc: "John Verhaeg" <verhaeg@icloud.com <verhaeg@icloud.com>>
      Sent: Friday, June 12, 2015 8:25:52 AM
      Subject: Re: Testing the new Fuse mapper

      Did you close the transformation editor before you created the new transformation endpoint and clobbered the existing transformation.xml?

      On Jun 12, 2015, at 11:23 AM, Nandan Joshi <njoshi@redhat.com> wrote:

      Also, if you remove a Data Transformation task, add another one overwriting the existing transformation.xml, it holds on to entries in the previous transformation.xml and when I select xyzorder class it shows ABCOrder as the target class in the UI.

      Nandan

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>>>, "John Verhaeg" <verhaeg@icloud.com <verhaeg@icloud.com><verhaeg@icloud.com <verhaeg@icloud.com>>>
      Sent: Friday, June 12, 2015 7:51:52 AM
      Subject: Fwd: Testing the new Fuse mapper

      Looks to be a bug with determining nested mappings when the source and target models are identical. If you look at the transformation.xml, you’ll notice that the top-level mapping (ABCOrder -> ABCOrder) has no field mappings inside, which is why nothing gets mapped at runtime even though the child fields are mapped via other mapping definitions.

      In terms of this example, there’s not much point in mapping ABCOrder to ABCOrder since the unmarshalling phase has already turned the original XML version of <ABCOrder> into ABCOrder. Since this is just for training, I would recommend using the XYZOrder class as your target or defining a completely different target Object. That will keep you out of the way of this bug for now.

      John - this is a bug in the common logic which determines which class mapping to use for a field mapping. I will debug a bit and file a JIRA.

      ~keith

      Begin forwarded message:

      From: Nandan Joshi <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>>>
      Subject: Re: Testing the new Fuse mapper
      Date: June 12, 2015 at 10:25:54 AM EDT
      To: Keith Babo <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>>>

      Attached.

      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>>>
      Sent: Friday, June 12, 2015 6:31:21 AM
      Subject: Re: Testing the new Fuse mapper

      You are seeing XML because Camel has a built-in type converter that serializes JAXB-annotated objects as XML. Why the elements are not populated with data is a question I can’t answer without seeing the project.

      On Jun 12, 2015, at 9:21 AM, Nandan Joshi <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>> <njoshi@redhat.com <njoshi@redhat.com><njoshi@redhat.com <njoshi@redhat.com>>>> wrote:

      specified the .java file (under src/main/java/abcorder/ABCOrder.java) for the XML->Java transformation, created the mappings, created a New Transformation Test, and ran the transform() method. The .xml is being read correctly but I am not seeing the Java instance correctly serialized.

      main] route2 INFO After transformation:
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <ABCOrder/>

      I still see references to json in the features.xml (not sure if that matters).

      Perhaps I need to modify the TransformationTest.java to correctly serialize the object.

      from("direct:xml2java-test-input")
      .log("Before transformation:\n ${body}")
      .to("ref:xml2java")
      .log("After transformation:\n ${body}")
      .to("mock:xml2java-test-output");

      Suggestions?

      Nandan

      ----- Original Message -----
      From: "Keith Babo" <kbabo@redhat.com <kbabo@redhat.com> <kbabo@redhat.com <kbabo@redhat.com>> <kbabo@redhat.com <kbabo@redhat.com><kbabo@redhat.com <kbabo@redhat.com>>>>
      To: "Nandan Joshi" <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>> <njoshi@redhat.com <njoshi@redhat.com><njoshi@redhat.com <njoshi@redhat.com>>>>
      Sent: Wednesday, June 10, 2015 6:42:41 PM
      Subject: Re: Testing the new Fuse mapper

      You need to specify the Java class you are mapping to. Click the “…” and provide the name of the class.

      On Jun 10, 2015, at 7:36 PM, Nandan Joshi <njoshi@redhat.com <njoshi@redhat.com> <njoshi@redhat.com <njoshi@redhat.com>> <njoshi@redhat.com <njoshi@redhat.com><njoshi@redhat.com <njoshi@redhat.com>>>> wrote:

      Modifying your xml-to-json project to do xml-to-java. What is expected in this dialog?

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jpav John Verhaeg
                Reporter:
                jpav John Verhaeg
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: