Bug Depositing too much meat via relay browser causes debug log

Zaranthos

Member
If you deposit 9999999999 meat to your closet from the relay browser KoL automatically assumes you meant all of it but it causes KoLmafia to dump a debug log. I always use the browsers auto-fill text box history to select the excessive value so I don't have to type out the actual max amount. So hitting 9 and then clicking the biggest string of 9's causes debug logs. I know, I'm lazy. ^_^
 

slyz

Developer
For info, here is the debug log:
Code:
Unexpected error, debug log printed.
class java.lang.NumberFormatException: For input string: "9999999999"
java.lang.NumberFormatException: For input string: "9999999999"
	at java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.lang.Integer.parseInt(Unknown Source)
	at java.lang.Integer.parseInt(Unknown Source)
	at net.sourceforge.kolmafia.utilities.StringUtilities.parseIntInternal1(StringUtilities.java:737)
	at net.sourceforge.kolmafia.utilities.StringUtilities.parseInt(StringUtilities.java:707)
	at net.sourceforge.kolmafia.request.TransferItemRequest.transferredMeat(TransferItemRequest.java:651)

It looks like Integer.parseInt() doesn't handle "9999999999" very well.

EDIT: "999999999" works, however.
 
Last edited:

Theraze

Active member
Well, parseInt can't do more than ints, which is (when signed) in the range of 2 billion. Just keep yourself down to 9 of those 9s, and you should be fine.
 

roippi

Developer
There is some history here with mafia's handling of very large numbers. see [1] for an example.

On that precedent, I'd normally mark this "will not fix," but perhaps we should gracefully handle the NumberFormatException?
 

slyz

Developer
I guess the regex in TransferItemRequest.transferredMeat() could be tweaked to keep only the last 9 numbers?
 
Top