NullPointerException error for dataRecord

I have no idea why I am getting this error for my script, especially since it is running after each pattern application - at which time dataRecord should be in scope :x

Details:
In my script the following first line produces an error:

 flight = dataRecord.get( "FLIGHT" );

The error displayed in the session's log (under the log tab):

[quote]req 3: An error occurred while processing the script: Output Departure Flights
req 3: The error message was: The application script threw an exception: java.lang.NullPointerException BSF info: null at line: 0 column: columnNo[/quote]

The error displayed in the error.log:

[quote]com.screenscraper.scraper.ScriptException: Typed variable declaration : Attempt to invoke method: get() on undefined variable or class name: dataRecord : at Line: 4.[/quote]

Any help in trying to make sense of this is greatly appreciated :?

NullPointerException error for dataRecord

speedster,

I recommend that you isolate it down a bit more by starting your script with this line.

session.log("Number of dataRecords available**" + dataSet.getNumDataRecords() + "**");

If the output is "0" then you need to look further up the chain to, possibly your extractor pattern. That error will occur when a pattern fails to match. And as a safety measure it's a good idea to encapsulate any calls to dataRecord.get within the following conditional statement.

if (dataSet.getNumDataRecords() > 0)
{
    //Access DR values here.
}

This keeps a non-matching extractor pattern from throwing a error in the middle of your session.

I hope this helps.

Thanks,
Scott