apigee / trireme-jdbc

Other
9 stars 5 forks source link

Select response with empty datetime causes null pointer exception #1

Closed kanaskik closed 9 years ago

kanaskik commented 9 years ago

Response from SOAP UI test using JDBC driver, note the empty ENDTIME element:

<Row rowNumber="3">
            <TRANSACTIONID>14</TRANSACTIONID>
            <PROCESSID>441</PROCESSID>
            <FREQUENCYID>501</FREQUENCYID>
            <TASKID>471</TASKID>
            <TASKNAME>Update Task Test</TASKNAME>
            <TASKNUMBER>1</TASKNUMBER>
            <TASKGROUP>Princeton Blue</TASKGROUP>
            <SCHEDULARID>32938</SCHEDULARID>
            <INSTANCEID>32953</INSTANCEID>
            <TASKSTATUS>Completed</TASKSTATUS>
            <DESCRIPTION>This is a test of update to existing process</DESCRIPTION>
            <EXPECTATIONS>The Expectations are that this creates a task</EXPECTATIONS>
            <COMMENTS>User Comments</COMMENTS>
            <STARTTIME>2014-08-29 03:26:00</STARTTIME>
            <ENDTIME/>
            <TASKOWNER>jamemike</TASKOWNER>
            <ISSLAVIOLATED>0</ISSLAVIOLATED>
            <DEPENDENCY>NA</DEPENDENCY>
            <FREQUENCYTYPE>Ad-Hoc</FREQUENCYTYPE>
            <DEADLINE>5</DEADLINE>
            <OCCURENCETIME>1</OCCURENCETIME>
           <PRCSSTRGGRNF_TRGGRNF_TRGGRD>2804</PRCSSTRGGRNF_TRGGRNF_TRGGRD>
</Row>

Error I'm seeing:

$ NODE_DEBUG=jdbc trireme test.js
JDBC: Getting a connection from the pool
JDBC: Creating a new connection for jdbc:oracle:thin:BPMReports/p3ps1@lctcsd0016.merck.com:25881:SDCORP03
JDBC: Got a connection
Exception in thread "Trireme Async Pool" java.lang.NullPointerException
    at io.apigee.trireme.util.jdbc.ResultProcessor.getValue(ResultProcessor.java:115)
    at io.apigee.trireme.util.jdbc.ResultProcessor.makeRow(ResultProcessor.java:69)
    at io.apigee.trireme.util.jdbc.JdbcConnection.retrieveRows(JdbcConnection.java:334)
    at io.apigee.trireme.util.jdbc.JdbcConnection.access$500(JdbcConnection.java:46)
    at io.apigee.trireme.util.jdbc.JdbcConnection$4.run(JdbcConnection.java:236)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
gbrail commented 9 years ago

Thanks! Looks like a problem with null value handling in Trireme that should be easy to fix -- let me make sure we have a comprehensive-enough test suite and we'll have something to test.

kanaskik commented 9 years ago

I forgot to add that other empty fields seem to be handled without error. However, taskid when empty becomes "taskid":0 and when used with ORDER BY taskid ends up at the bottom of the list.

<Row rowNumber="25">
            <TRANSACTIONID>9</TRANSACTIONID>
            <PROCESSID>430</PROCESSID>
            <FREQUENCYID>489</FREQUENCYID>
            <TASKID/>
            <TASKNAME>WebService2_Build POST API to ETM_2</TASKNAME>
            <TASKNUMBER>2</TASKNUMBER>
            <TASKGROUP>2</TASKGROUP>
            <SCHEDULARID>536909055</SCHEDULARID>
            <INSTANCEID>536909089</INSTANCEID>
            <TASKSTATUS>Assigned</TASKSTATUS>
            <DESCRIPTION>Build the initial inbound API using WSDL mediation</DESCRIPTION>
            <EXPECTATIONS>It will work first time.</EXPECTATIONS>
            <COMMENTS/>
            <STARTTIME>2014-08-27 21:16:57.56</STARTTIME>
            <ENDTIME>1999-12-31 00:00:00</ENDTIME>
            <TASKOWNER>jamemike</TASKOWNER>
            <ISSLAVIOLATED>0</ISSLAVIOLATED>
            <DEPENDENCY>WSDL from Appian team</DEPENDENCY>
            <FREQUENCYTYPE>Ad-Hoc</FREQUENCYTYPE>
            <DEADLINE>15</DEADLINE>
            <OCCURENCETIME>2</OCCURENCETIME>
            <PRCSSTRGGRNF_TRGGRNF_TRGGRD>2775</PRCSSTRGGRNF_TRGGRNF_TRGGRD>
        </Row>
gbrail commented 9 years ago

I fixed the null handling in Trireme and I pushed a new "beta1" release to NPM.

Can you please re-test:

sudo npm update -g trireme

The null handling should work now and you should get no NPEs.

And if you're still having the "order by" issue, do you have any SQL that we can test?

kanaskik commented 9 years ago

Looks good! As for the sort by, I suppose "null" is properly sorted with respect to numbers, sorted by "taskid".

Row: {"taskid":533,"taskname":"Ihor's Process_Expense Comparison_8","starttime":"2014-09-24T21:40:59.290Z","endtime":null} Row: {"taskid":534,"taskname":"Ihor's Process_Misc. Cost and Sals Plugs_9","starttime":"2014-09-24T21:41:00.340Z","endtime":null} Row: {"taskid":535,"taskname":"Ihor's Process_Misc. Expense Plugs_10","starttime":"2014-09-24T21:41:01.250Z","endtime":null} Row: {"taskid":541,"taskname":"Appian POC_Create PPT slides for POC read out_1","starttime":"2014-10-01T13:00:16.320Z","endtime":null} Row: {"taskid":null,"taskname":"New Process Task_New Task Old Process_2","starttime":"2014-08-29T18:16:55.460Z","endtime":"1999-12-31T05:00:00.000Z"} Row: {"taskid":null,"taskname":"WebService2_Build POST API to ETM_2","starttime":"2014-08-28T01:16:57.560Z","endtime":"1999-12-31T05:00:00.000Z"} Row: {"taskid":null,"taskname":"WebService2_WebService2_MSPSTask_2","starttime":"2014-08-27T22:10:15.200Z","endtime":"2014-08-28T00:43:59.410Z"}

gbrail commented 9 years ago

Glad to hear it! This was fixed in Trireme 0.8.3 so I'm closing it now.