Bug - Cannot Reproduce NPE setting prices in mall

wrldwzrd89

New member
I tried to set the price of one random item I deemed worth selling in the Mall of Loathing, in KoLmafia's mall manager... and got a NullPointerException when I hit Enter to commit the change.

KoLmafia r17225, macOS 10.12, Java 8u102
 

Attachments

  • DEBUG_20160924.txt
    3.8 KB · Views: 47

lostcalpolydude

Developer
I can't reproduce this. The debug log doesn't help me with figuring out what is wrong. So for now, I have no idea where to start with trying to fix it.

(Posting so that you know that it really might just be something very specific about your configuration, unless other people also start posting.)
 

wrldwzrd89

New member
There we go. Reproduced by hitting Enter twice inside a price field, after changing the price (which does nothing), THEN clicking the "save prices" button. The NPE happens at that point.
 

Veracity

Developer
I did this:

- Did a price analysis of an item
- Clicked twice on the price field
--> It becomes an input field
- Entered a price and hit enter
--> The field is colored dark green
- Hit enter again
--> The field is colored light green and the next item in the list is highlighted.

That is exactly what I expected, since it is exactly how it has always behaved for me.

I tried again with various other items. It behaved the same.
I tried with the bottommost item. When I hit enter twice, it moved to the topmost item.
I hit save prices. It changed the prices as I had directed.

I see no bug.

KoLmafia v17.4 r17226, Mac OS X 10.11.6, Java 1.8.0_40
 

wrldwzrd89

New member
I did this:

- Did a price analysis of an item
- Clicked twice on the price field
--> It becomes an input field
- Entered a price and hit enter
--> The field is colored dark green
- Hit enter again
--> The field is colored light green and the next item in the list is highlighted.

That is exactly what I expected, since it is exactly how it has always behaved for me.

I tried again with various other items. It behaved the same.
I tried with the bottommost item. When I hit enter twice, it moved to the topmost item.
I hit save prices. It changed the prices as I had directed.

I see no bug.

KoLmafia v17.4 r17226, Mac OS X 10.11.6, Java 1.8.0_40
Maybe this is a Java bug, then, Veracity? It clearly isn't doing that for me.
 

Bale

Minion
There we go. Reproduced by hitting Enter twice inside a price field, after changing the price (which does nothing), THEN clicking the "save prices" button. The NPE happens at that point.

Tried. Same results as Veracity. I'm marking this issue as "cannot reproduce," but feel free to try again to help us reproduce it.

I'm using Java version 8 Update 101 (build 1.8.0_101-b13) 32-bit
 

heeheehee

Developer
Tried. Same results as Veracity. I'm marking this issue as "cannot reproduce," but feel free to try again to help us reproduce it.

I'm using Java version 8 Update 101 (build 1.8.0_101-b13) 32-bit

Ditto, with OpenJDK 1.8.0_102. Apparently something about your setup causes the table cell value to be null (according to that debug log, anyways). The defensive approach would be to modify swingui/table/IntegerRenderer to check value != null before invoking value.toString(), but that doesn't explain the underlying cause (why's it null in the first place?).
 

wrldwzrd89

New member
I'm beginning to wonder if something specific to 10.12 "Sierra" is causing this. All the other attempts to reproduce the issue were not on Sierra, and failed.
 

wrldwzrd89

New member
Interesting... I tried doing some debugging in Eclipse. What I found is that, for some odd reason I have yet to figure out, IntegerRenderer.getTableCellRendererComponent() is getting called twice: Once with a valid value object, the second time with a null value!

Changing IntegerRenderer in the following way fixes it, though:

Insert new lines 60-65:
Code:
Object realValue = value;
		if ( realValue == null )
		{
			realValue = table.getValueAt( row, column );
		}
Change what is now lines 69-70 to the following:
Code:
int intValue = realValue instanceof Integer ? ( (Integer) realValue ).intValue() : StringUtilities.parseInt(
			realValue.toString() );
The exception doesn't happen now.
 
Top