Skip to Content
avatar image
Former Member

java.lang.NullPointerException at CreateEmptyRecord(tableId)

Hi,

I am getting java.lang.NullPointerException when creating an empty record for Record[] variable. Can you advice what is the issue here. I am trying to assign multiple records in Record array, so that i can use CreateRecordsCommand.

//Create Multiple Records

Record[] emptyRecordsProduct = null;

emptyRecordsProduct[0] = RecordFactory.createEmptyRecord(tableId);

Your help is really appreciated.

Thanks

Vijay

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 04, 2010 at 04:45 PM

    Hi Vijay,

    You have not fully initialized the array yet. You are trying to put the new Record object into a spot in the array that doesn't exist, hence the null pointer.

    Instead of this line:

    Record[] emptyRecordsProduct = null;

    Use this:

    Record[] emptyRecordsProduct = new Record[1];

    Add comment
    10|10000 characters needed characters exceeded