gflewis / sndml3

ServiceNow Data Mart Loader: an application to load SQL databases from ServiceNow
MIT License
30 stars 19 forks source link

NullPointerException for sync action using partition and created filter returns no records #4

Closed kilo323 closed 5 years ago

kilo323 commented 6 years ago

When using a configuration for sync and combining a created filter and there are not any results returned from ServiceNow, a null pointer is thrown as started and finished metrics are not being set.

Note that update works fine and sync works if you remove the partition option.

Example config item

threads: 1 metrics: C:/temp/all_tables.metric tables:

Error Stack Trace Exception in thread "main" java.lang.NullPointerException at servicenow.api.WriterMetrics.getElapsedSec(WriterMetrics.java:46) at servicenow.api.WriterMetrics.write(WriterMetrics.java:128) at servicenow.datamart.Loader.writeAllMetrics(Loader.java:109) at servicenow.datamart.Loader.loadTables(Loader.java:101) at servicenow.datamart.Loader.main(Loader.java:61)

Log Entries 12:25:40 INFO [main] LoaderConfig GLOBAL INIT: threads: 1 metrics: C:/temp/all_tables.metric tables:

gflewis commented 6 years ago

Confirmed as a reproducible bug in 3.0.2. Workarounds as identified are (a) use action "update" instead of "sync" or (2) remove the partition.

Will try to fix in 3.0.3. Thanks for identifying this.

kilo323 commented 6 years ago

Thanks! Not really an issue for me, it just so happened that while I was getting this setup I was using a created range to not pull much data. My normal process for sync will not fail but figured I would pass along this finding to you.

Nice program by the way, thanks for putting this together!

gflewis commented 5 years ago

Fixed in 3.0.3