[Bug] Inconsistent /bank error messages

Discussion in 'Help & Support / Errors & Bugs' started by 314, Jul 24, 2018.

  1. 314

    314 Irratioπal President, former ServerAdmin
    President ⛰️⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    6,963
    Trophy Points:
    87,660
    EcoDollars:
    $27,000,000
    Ratings:
    +4,866
    Minecraft Username:
    314
    (Honestly, who else would file such a ridiculously thorough bug report for something minor like this?)

    Brief Description:
    /bank (deposit|withdraw) commands usually return "Please provide a valid amount." error messages when you provide invalid values. Some values (see the list below) either don't return any message at all (/bank withdraw) or show the "/bank <deposit|withdraw|balance> <amount>" help message (/bank deposit).

    Instructions:
    Code:
    Malformed string input:
        /bank withdraw abcde
        /bank withdraw 1e2e3
        /bank withdraw null
        /bank withdraw infinity (note the lowercase 'i')
        /bank deposit abcde
        /bank deposit 1e2e3
        /bank deposit null
        /bank deposit infinity (Again, lowercase 'i')
    Strings that return Infinity:
        /bank withdraw 1e314 (Double.MAX_VALUE is somewhere around 1.8e308, so any higher exponent returns Infinity.)
        /bank withdraw Infinity (note the uppercase 'I')
        /bank deposit 1e314 (See explanation above)
        /bank deposit Infinity (note the uppercase 'I')
    Strings that return NaN:
        /bank withdraw NaN
        /bank deposit NaN
    
    (Color coding: Error message, no error message, syntax help¹)

    As you can see, whenever the provided parameter returns NaN or Infinity, the deposit command will show the syntax help¹ while the withdraw command will simply do nothing at all.

    How many times did you recreate this?:
    2 tries per listed command; reproduced 100% of the time.

    Result:
    • Commands marked in red do not reply with "Please provide a valid amount", there is simply no reply at all.
    • Commands marked in blue reply with the syntax help¹.

    Expected Result:
    • Commands marked in red should reply with "Please provide a valid amount", just like the commands in green already do.
    • Commands marked in blue could remain that way because the syntax is invalid, but IMO it would be better to show the "Please provide a valid amount" error message as well (and limit the syntax help to cases where the value parameter is omitted completely).

    Evidence:
    N/A. Easy to reproduce, but it's difficult to show a screenshot of "nothing happens".

    Additional Information:
    I blame Double.parseDouble(String) and java.lang.Double's Infinity/NaN edge cases.


    Yes, I created a bug report based on the Java API Specification.


    ¹ "syntax help" refers to
    Code:
    /bank <deposit|withdraw|balance> <amount>
    
    instead of showing an actual
    Code:
    Please provide a valid amount.
    
    error message.
     
    • Like Like x 2
    • Winner Winner x 1
    • List
    #1 314, Jul 24, 2018
    Last edited: Jul 24, 2018
  2. JamieSinn

    JamieSinn Retired Lead Administrator/Developer
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Jun 4, 2011
    Messages:
    5,517
    Trophy Points:
    78,090
    Gender:
    Male
    Ratings:
    +4,588
    Gotta love my new debug system.

    Just pushed a change that'll be live when we upgrade to 1.13

    Thanks 314.
     
    • Like Like x 3
    • Friendly Friendly x 1
    • List