Skip to content

NPE when statement parameters do not match #119

@natashadsilva

Description

@natashadsilva

I had a tuple with an attribute called USER_AGNT but the prepared statement for the JDBCRun operator was expecting USER_AGENT.

statement: "INSERT INTO DS_RESTAPI_BILL_DSCV_EVNT  (DS_REC_ID, ..USER_AGENT...) " +
					"VALUES (?, ?,?,?,?,?,?,?)"; 
statementParamAttrs: "DS_REC_ID, USER_AGENT...." ;

This caused an error but the logs were not helpful because it just mentioned an NPE but there was no stack trace:

#splapptrc,J[217],P[418],BillEvents_ToDB2,#splapptrc,J[217],P[418],BillEvents_ToDB2,spl_operator M[PEImpl.cpp:handleOperatorFailure:684]  - CDISR5030E: An exception occurred during the execution of the BillEvents_ToDB2 operator. The exception is: java.lang.NullPointerException
11 Feb 2021 22:31:38.793+0000 [95] ERROR spl_metric M[OperatorMetricsImpl.cpp:dumpMetricAtExit:144]  - The Number of tuples submitted (port 0) metric of the DBRecordMakerTimerSignal operator has a value of 2952 at exit.

After I set up the debugger I found the exception was here and the error handling was here

This is a simple typo but it could happen. Could we make the following improvements:

  • if the statement attribute does not have a matching splAttribute it should fail more gracefully and suggest possibly what the problem is
  • The error handling for the processTuple function could be improved, because it only said there was a NPE and not where it occurred, and also in the PEC logs there was this: JDBC connection failed. The exception is {0} with size 56 - the string formatting is not correct.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions