PAR-321
/find results screen crashes on a shop with null price(s)
/find <item> throws in the results screen and the whole dialog fails:
java.lang.IllegalArgumentException: Cannot format given Object as a Number
at java.text.DecimalFormat.format(...)
at io.paradaux.chestshop.dialogs.FindDialog.buyPart(FindDialog.java:306)
at io.paradaux.chestshop.dialogs.FindDialog.priceSummary(FindDialog.java:297)
at io.paradaux.chestshop.dialogs.FindDialog.shopLabel(FindDialog.java:278)
at io.paradaux.chestshop.dialogs.FindDialog.results(FindDialog.java:219)
Root cause: FoundShop.buyPriceValue()/sellPriceValue() return a boxed Double that is null when the corresponding price is null. DecimalFormat.format(Object) throws "Cannot format given Object as a Number" on null (null instanceof Number is false). FoundShop.shopType() falls through to BUY when both prices are null, so priceSummary calls buyPart → MONEY.format(null) → crash. Any registry row with both prices null kills the results screen.
Fix: made priceSummary presence-based — it formats only the side(s) that actually have a non-null price, renders no price when neither is present, and no longer trusts shopType()'s BUY fallback. dialogs/** is excluded from the coverage gate, so no unit test is required.
Resources
- PR#2 Last major release ParadauxIO/hibernia-economy
- commit40397df Fix /find results crash on shops with null price(s) (PAR-321)ParadauxIO/hibernia-economy
Comments
No comments yet.
Activity
- ParadauxIO linked a pull request — PR #2 open — Last major release
- ParadauxIO linked a pull request — PR #2 open — Last major release
- ParadauxIO linked a pull request — PR #2 open — Last major release
- ParadauxIO linked a pull request — PR #2 open — Last major release
- ParadauxIO linked a pull request — PR #2 open — Last major release
- ParadauxIO linked a pull request — PR #2 open — Last major release
- ParadauxIO linked a pull request — PR #2 open — Last major release
- tesks changed status to Status → Pending Release
- ParadauxIO linked a commit — Commit 40397df — Fix /find results crash on shops with null price(s) (PAR-321)
- tesks created the issue