java.lang.NumberFormatException: For input string: "shares"

Issue #115 closed
Former user created an issue

Hello, can you help with this?

I am running the latest version of Paper for 1.17.1.

Thanks in advance!

```[03:42:12 INFO]: [Stocks] [ACF] Enabled Asynchronous Tab Completion Support! [03:42:12 WARN]: java.lang.NumberFormatException: For input string: "shares" [03:42:12 WARN]: at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) [03:42:12 WARN]: at java.base/java.lang.Long.parseLong(Long.java:714) [03:42:12 WARN]: at java.base/java.lang.Long.parseLong(Long.java:839) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.core.storage.CachedYMLStorage.getStocks(CachedYMLStorage.java:393) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.core.storage.CachedYMLStorage.get(CachedYMLStorage.java:75) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.core.storage.CachedYMLStorage.update(CachedYMLStorage.java:272) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.Stocks.onEnable(Stocks.java:155) [03:42:12 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) [03:42:12 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) [03:42:12 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) [03:42:12 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) [03:42:12 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) [03:42:12 WARN]: at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733) [03:42:12 WARN]: at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:317) [03:42:12 WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1220) [03:42:12 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) [03:42:12 WARN]: at java.base/java.lang.Thread.run(Thread.java:831) [03:42:12 INFO]: [Stocks] Disabling Stocks v1.9.3

```

Comments (12)

  1. Trent Christofferson repo owner

    Send me your player-saves.yml file. Somewhere in there, a cooldown is an invalid number. Make sure the cooldown key is actually “cooldown“ and that there aren’t any typos.

  2. Rion Clark

    I found several instances of Cooldown: being equal to something other than 0. Typically, these numbers looked to be a rollover from the Last purchase?

    For example:

    a2eb565f-eac9-4398-bedc-a06dbb376d84:
    name: OdenoftheEast
    AAPL:
    shares: 10.0
    invested: 1230.3
    cooldown: 1606935033552
    last-purchase: 1606934133552

  3. Rion Clark

    Unfortunately, changing all the values of Cooldown: with any number besides 0 to 0, seems to have still resulted in the same error.

  4. Trent Christofferson repo owner

    I think I may have found the bug. I will look into it some more. I will try and update soon.

  5. Trent Christofferson repo owner

    Never mind, I just realized your player-saves.yml file isn’t the correct format. It should look like this:

    version: '1.0'
    player-saves:
      b5a3e507-e849-4f1e-86d6-1b2b5b6f0d78:
        name: tchristofferson
        AAPL:
          cooldown: 0
          '1638737126670':
            shares: 1.0
            price: 0.0
    

    Are there any other errors? Can you upload your log file? What version did you update from? There must have been an issue updating your player-saves.yml file for some reason.

  6. Rion Clark

    My first post contains the only error as far as I can tell. I believe this issue first happened after I updated from Stocks 1.7.4 to 1.8, though I’m not 100% sure, as it’s been a couple months. I’ll use your version of the player-saves, try deleting the cooldowns.yml, and let you know how it goes. Posting my log file next. Thanks again for your help.

  7. Rion Clark

    Mostly everything is working now, after I did everything you suggested and updated the plugin. Unfortunately, for anyone that had existing information in their player-saves, like if they had owned stocks, get an error when attempting to buy or view their portfolio:

    ”Your profile has not been loaded yet!”

    Any recommendations?

  8. Trent Christofferson repo owner

    Is it for everyone or only some? Can you send me a download of your server's files inside of the plugins/stocks folder so I can use your exact files?

  9. Log in to comment