Bug - Fixed Visiting PvP Archives: "Unexpected error, debug log printed."

Bale

Minion
I get "Unexpected error, debug log printed." whenever I visit the PvP Archives (peevpee.php?place=logs).

Here it is.

Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
         KoLmafia v15.1 r10956, Windows XP, Java 1.6.0_26
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Wed May 02 22:57:53 EDT 2012
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.request.PeeVPeeRequest.registerRequest(PeeVPeeRequest.java:84)
	at net.sourceforge.kolmafia.RequestLogger.doRegister(RequestLogger.java:970)
	at net.sourceforge.kolmafia.RequestLogger.registerRequest(RequestLogger.java:471)
	at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1339)
	at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1281)
	at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:1913)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:221)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:184)
	at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:480)
	at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:159)
	at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:132)
 
If you don't mind me asking for a short lesson in Java...

Code:
if ( ( place != null && place.equals( "shop" ) ) ||
   ( action != null && action.equals( "buy" ) ) )

A value of null does not exclude it's value being "shop" or "buy"? Obviously I am confused so please resolve that for me.
 
"place" can be null.
If it is NOT null, we can call .equals() on it and see if it is "shop".
If it IS null, we don't want to call equals() on it, since we will get an NPE.

The two clauses in the if statement say 'if place is NOT null, see if it is "shop"' and 'if action is NOT null, see if it is "buy"'.
Either of those conditions will suffice.

Just as in ASH, "&&" is a "McCarthy AND" - a "short-circuiting AND" - which only evaluates the second condition if the first condition was true.
 
OH! Got it now. Calling equals on a value of null causes an NPE instead of simply resolving as false. That was my ignorance.

Thank you.
 
Back
Top