Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
java.lang.NullPointerException
Hi,
I'm trying to implement asyncSearch and searchNextAsync in C#. Please take a look at my code below and tell me what is wrong with it, or why it is causing the Java(?) NullPointerException.
Occurs randomly during one of the iterations of the while loop, on the line: service.searchNextAsync();
Thanks, Sebastian
// starting search procedure AsyncStatusResult result = service.asyncSearch(itemSearch); String jobId = result.jobId; while (service.checkAsyncStatus(jobId).status != AsyncStatusType.finished) //&& service.checkAsyncStatus(jobId).status != AsyncStatusType.failed //&& service.checkAsyncStatus(jobId).status != AsyncStatusType.finishedWithErrors) { Thread.Sleep(1000 * 60); } AsyncSearchResult asr = (AsyncSearchResult)service.getAsyncResult(jobId, 1); while (asr.searchResult.pageIndex <= asr.searchResult.totalPages) { logger.LogString(asr.searchResult.pageIndex + " of " + asr.searchResult.totalPages + " loaded..."); foreach (Record record in asr.searchResult.recordList) { // some code } // foreach service.searchNextAsync(); while (service.checkAsyncStatus(jobId).status != AsyncStatusType.finished) //|| service.checkAsyncStatus(jobId).status != AsyncStatusType.failed //|| service.checkAsyncStatus(jobId).status != AsyncStatusType.finishedWithErrors) { Thread.Sleep(1000 * 60 * 5); } asr = (AsyncSearchResult)service.getAsyncResult(jobId, asr.searchResult.pageIndex + 1); } // while 0