Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 152519

Summary: XPATH engine generates error prone JAVA code
Product: z_Archived Reporter: Eric Labadie <labadie>
Component: TPTPAssignee: Harm Sluiman <sluiman>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P1 CC: jkubasta, prafulr, sluiman, zung
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: closed460
Bug Depends on: 162562    
Bug Blocks:    

Description Eric Labadie CLA 2006-08-01 17:22:17 EDT
Use the XPATH engine function to generate JAVA code from an XPATH expression.
The generated code doesn't check if the object exists before calling a method on the object.  This code is throwing JAVA exceptions.

We should change the generated code from:
   obj.getA().getB().getC()....equals("value")
to
   obj!=null && obj.getA()!=null && obj.getA().getB()!=null && obj.getA().getB().getC()!=null ... equals("value")
Comment 1 Eric Labadie CLA 2006-08-01 17:23:49 EDT
This is required for TPTP 4.2.1
Comment 2 Harm Sluiman CLA 2006-08-01 17:30:38 EDT
I think the point is that we need error handling and in this case exception handling.
I don't think the proposed code would performvery well.


Note version is where the defect is found and target is where you request a fix.
Comment 3 Eric Labadie CLA 2006-08-01 17:33:42 EDT
Here is another example:
fastXpath code generation does not add null pointer check in the generated code for complex type element in CBE which may be optional in the event object.

For example.
if (  (( obj.getMsgDataElement().getMsgId() .equals( "SSL0600S") )  || (  (  obj.getMsg().indexOf("SSL0600S") > -1 )  ))  )

The correct java code would be
if (  ((  obj.getMsgDataElement()!= null && obj.getMsgDataElement().getMsgId() != null && obj.getMsgDataElement().getMsgId() .equals( "SSL0600S") )  || (  (  obj.getMsg().indexOf("SSL0600S") > -1 )  ))  )
Comment 4 Eric Labadie CLA 2006-08-02 08:01:20 EDT
Updating the version field to the right value...
Comment 5 Eric Labadie CLA 2006-08-02 09:12:36 EDT
We have done performance measurements using a try/catch block around the generated code and the performance was worst than using the suggested code.   See Praful for the measurements.
Comment 6 Eugene Chan CLA 2006-08-11 10:52:59 EDT
Originator agree to defer to 4.3 release. Lowering the severity from blocking to major.
Comment 7 Eugene Chan CLA 2006-10-19 17:51:29 EDT
mass update:
retarget from 4.3 to 4.4. Cannot be contained in 4.3 due to resource limtation.
Comment 8 Marius Slavescu CLA 2007-01-18 10:32:29 EST
If 162562 will be fixed this could be fixed also, if not I will return it as WONTFIX.

As Harm mentioned, we need to investigate which method is better and probably let the user control this code generation behavior.

Praful please attach the code snippets that you tested the performance on, also the measurements.
Comment 9 jkubasta CLA 2007-05-07 10:30:28 EDT
defer, since consuming product has a work around
Comment 10 Harm Sluiman CLA 2008-01-02 14:59:57 EST
This defect has apparently been acceptable for over 1 year and there are no longer resources in the project to work on this.
Reopne when resources can be commited
Comment 11 Paul Slauenwhite CLA 2009-06-30 13:48:38 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.
Comment 12 Paul Slauenwhite CLA 2009-06-30 13:49:09 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.