(added to Open Issues section of FAQ)
I couldn't spot if this issue has already been raised.
I tried to AddRow to an empty sheet on a spreadsheet.
This returned an error and did not "post" the data to the sheet:
"AddRow: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference"
Everything worked fine once I had at least the first row with some data in it (even just A1)
(added to Open Issues section of FAQ
@Susan_Lane This seems like it should be a pretty straightforward fix. Please take a look.
This is new to me, a 0-based row number return in filtered Get Rows request reponses.
I encountered this trying to do a simple sample of logging Arrivals and Departures in the same row.
I used my NYC Marathon sample as a framework, with an extra sheet for Arrivals/Departures:
Notice how this bug overwrote the Departure Time heading on column D, and logged Departures one row too high (-1 row) for each update.
Adding Arrival Times is straightforward:
- Add a new row with just the arrival time and other details, departure time 0.
Adding Departure Times is a two phase operation,
- ask for a filtered list from the Arrivals/Departures log for the runner in question
- Take the last row number from the returned row number list.
- Use it to update column 4 (D) of that row number.
Here are the blocks:
The incriminating Do It result for the first occurence, where the column 4 heading got overwritten:
The exported .aia file, if you want to play:
MarathonSheetsWithArrivalDeparture.aia (20.0 KB)
If you have a previous thread where this error was found, please point to it.
I'm not sure how Sheets Component handles headings. Have you worked with column headings before?
Headings are pretty much required, due to the AI2 bug that doesn't let you add rows to an empty sheet. (See FAQ)
But it's not about the heading.
(Headings are not special in Sheets. They are just dead text in row 1.)
It's about using 0 as the base instead of 1 as the base for identifying rows.
I see. So are all the row identifiers off by one, as in its 0-indexed rather than 1-indexed?
For a query that matches rows 4,5,6 the returned row numbers are 3,4,5.
That's indicative of a 0-based row enumeration.
Notice in the attached Do It how the row numbers for a filtered query on 'abg' are 1 off the row numbers in the sheet screen shot.
Yup. This is not how it should work. I'm putting it on my issues to fix.
Greetings, @TIMAI2 If the problem is not fixed, kindly describe the procedures necessary to duplicate it in any video. You can also give me the.aia file, which will make it simpler for me to access it.
Talking about this issue "AddRow: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference"
I believe that this either has been fixed on ucr or there is a pending PR to fix it. We're in the process of updating ai2-test with the next release candidate and will be making an announcement later today for people to help test it.
ohk , thanks for the info
Spreadsheet component, no credentials, google sheet set to anyone with the link
This fails and crashes companion, no error message:
I suppose println is accountable for this problem.
It says println needs a message.
here you can see the logs behind this :
FATAL EXCEPTION: main
Process:edu.mit.appinventor.aicompanion3, PID: 8351
java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at java.lang.reflect.Method.invoke(Native Method)
It is indeed a bug with the component, from the lines #1724 and #1801
Could you send me the project?
Sent via PM