elian1203 / ezAuctions

A simple, text-based auction plugin based on the Spigot Minecraft server software
https://www.spigotmc.org/resources/ezauctions.42574/
GNU General Public License v3.0
4 stars 4 forks source link

Fix NumberFormatExceptions when starting an auction. #24

Closed silverwolfg11 closed 1 year ago

silverwolfg11 commented 2 years ago

Addressed a number format exception being thrown in AuctionUtil#parseAmount because the amount string was being validated via Double#parseDouble which accepts the string "Infinity", but the actual amount was set via Integer#parseInt which only accepts decimal numbers.

This was fixed by creating a isPositiveInt method that validates via Integer#parseInt and using that in AuctionUtil#parseAmount. The same fix was applied to auction time which should be validated as an integer and not as a double.