Uploaded image for project: 'CloverETL'
  1. CloverETL
  2. CLO-4428

MongoDBWriter cannot handle null values

    XMLWordPrintable

    Details

    • Branch:
    • QA Testing:
      Graph automated test, JUnit test
    • QA Test Identification:
      MongoDBStatementBuilderTest, MongoDBWriter_null_CLO-4428.grf

      Description

      MongoDBWriter can not handle null value. Say I have data with null value in field 'closedDate', then the following code for property 'New value' fails:

      {
      	firstName : "@{customerId}",
      	lastName : "@{lastName}",
      	street : "@{street}",
      	city : "@{city}",
      	zipCode : "@{zipCode}",
      	state : "@{state}",
      	closedDate : ("@{closedDate}" != "null") ? ISODate("@{closedDate}") : null
      }
      

      The complexity of the code for closedDate is there only to avoid quoting null value. It fails even with simple code that contains closedDate : "@{closedDate}" and also for zipCode (string). This issue prevents from inserting any null values into MongoDB.

      Error:

      22:54:51,761 ERROR [WatchDog_11] Component [MongoDB fields:MONGO_DB_FIELDS] finished with status ERROR. (In0: 1 recs)
       Execution failed
        Unexpected null value: closedDate
      22:54:51,762 ERROR [WatchDog_11] Error details:
      org.jetel.exception.JetelRuntimeException: Component [MongoDB fields:MONGO_DB_FIELDS] finished with status ERROR. (In0: 1 recs)
      	at org.jetel.graph.Node.createNodeException(Node.java:582)
      	at org.jetel.graph.Node.run(Node.java:558)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.jetel.exception.JetelRuntimeException: Execution failed
      	at com.opensys.cloveretl.component.MongoDBWriter.a(Unknown Source)
      	at com.opensys.cloveretl.component.MongoDBWriter.a(Unknown Source)
      	at com.opensys.cloveretl.component.MongoDBWriter.execute(Unknown Source)
      	at org.jetel.graph.Node.run(Node.java:520)
      	... 3 more
      Caused by: java.lang.NullPointerException: Unexpected null value: closedDate
      	at org.jetel.connection.nosql.StatementBuilder.buildStatement(StatementBuilder.java:52)
      	at com.opensys.cloveretl.component.MongoDBWriter.d(Unknown Source)
      	at com.opensys.cloveretl.component.MongoDBWriter.c(Unknown Source)
      	at com.opensys.cloveretl.component.c.a(Unknown Source)
      	... 6 more
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                krivanekm Milan Krivanek
                Reporter:
                harazimj Jiri Harazim (Inactive)
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 4 hours
                  1d 4h