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.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
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