Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE when duplicate offer with deleted account #6233

Merged
merged 3 commits into from Jun 9, 2022
Merged

Fix NPE when duplicate offer with deleted account #6233

merged 3 commits into from Jun 9, 2022

Conversation

ghost
Copy link

@ghost ghost commented Jun 1, 2022

Fixes #6232

Description:
When account doesn't exists anymore standard logic from initWithData is used

@ghost
Copy link

ghost commented Jun 1, 2022

The fix is an improvement, however an NPE still happens if no account is available.

Jun-01 08:33:21.197 [JavaFX Application Thread] WARN  b.d.m.p.d.DuplicateOfferDataModel: PaymentAccount not available. Should never get called as in offer view you should not be able to open a create offer view 
Jun-01 08:33:21.209 [JavaFX Application Thread] WARN  b.c.p.price.PriceFeedService: We don't have a currency yet set. That should never happen 
Jun-01 08:33:21.210 [JavaFX Application Thread] WARN  b.c.p.price.PriceFeedService: We don't have a currency yet set. That should never happen 
Jun-01 08:33:21.217 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: Uncaught Exception from thread JavaFX Application Thread 
Jun-01 08:33:21.217 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: throwableMessage= null 
Jun-01 08:33:21.217 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: throwableClass= class java.lang.NullPointerException 
Jun-01 08:33:21.218 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: Stack trace:
java.lang.NullPointerException
    at bisq.desktop.main.offer.bisq_v1.MutableOfferViewModel.maybeShowMakeOfferToUnsignedAccountWarning(MutableOfferViewModel.java:1255)
    at bisq.desktop.main.offer.bisq_v1.MutableOfferViewModel.onFocusOutMinAmountTextField(MutableOfferViewModel.java:790)
    at bisq.desktop.main.offer.bisq_v1.MutableOfferViewModel.triggerFocusOutOnAmountFields(MutableOfferViewModel.java:862)
    at bisq.desktop.main.portfolio.duplicateoffer.DuplicateOfferViewModel.activate(DuplicateOfferViewModel.java:89)
    at bisq.desktop.common.model.ActivatableWithDataModel._activate(ActivatableWithDataModel.java:29)
    at bisq.desktop.common.view.ActivatableViewAndModel.lambda$prepareInitialize$0(ActivatableViewAndModel.java:37)
    at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:80)
    at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102)
    at javafx.scene.Node$ReadOnlyObjectWrapperManualFire.fireSuperValueChangedEvent(Node.java:1060)
    at javafx.scene.Node.invalidatedScenes(Node.java:1131)
    at javafx.scene.Node.setScenes(Node.java:1169)
    at javafx.scene.Parent$2.onChanged(Parent.java:372)

@ghost
Copy link
Author

ghost commented Jun 1, 2022

The fix is an improvement, however an NPE still happens if no account is available.

@jmacxx I fixed it by hiding "duplicate offer" button when no account exists

@ghost
Copy link

ghost commented Jun 2, 2022

Still getting an NPE, I think there is a "hidden" account for BSQ swaps causing trouble. Perhaps if that was excluded from the count everything would work as planned.


No altcoin accounts:

image

Portfolio history with the duplicate icon:

image

Count of non-fiat accounts is in fact 1.

INFO  bisq.core.user.User: hasAnyNonFiatPaymentAccount count=1 

Log:

Jun-01 21:25:58.731 [JavaFX Application Thread] WARN  b.d.m.p.d.DuplicateOfferDataModel: PaymentAccount not available. Should never get called as in offer view you should not be able to open a create offer view 
Jun-01 21:25:58.790 [JavaFX Application Thread] WARN  b.c.p.price.PriceFeedService: We don't have a currency yet set. That should never happen 
Jun-01 21:25:58.794 [JavaFX Application Thread] WARN  b.c.p.price.PriceFeedService: We don't have a currency yet set. That should never happen 
Jun-01 21:25:58.840 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: Uncaught Exception from thread JavaFX Application Thread 
Jun-01 21:25:58.841 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: throwableMessage= null 
Jun-01 21:25:58.841 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: throwableClass= class java.lang.NullPointerException 
Jun-01 21:25:58.843 [JavaFX Application Thread] ERROR bisq.common.setup.CommonSetup: Stack trace:
java.lang.NullPointerException
    at bisq.desktop.main.offer.bisq_v1.MutableOfferViewModel.maybeShowMakeOfferToUnsignedAccountWarning(MutableOfferViewModel.java:1255)
    at bisq.desktop.main.offer.bisq_v1.MutableOfferViewModel.onFocusOutMinAmountTextField(MutableOfferViewModel.java:790)
    at bisq.desktop.main.offer.bisq_v1.MutableOfferViewModel.triggerFocusOutOnAmountFields(MutableOfferViewModel.java:862)
    at bisq.desktop.main.portfolio.duplicateoffer.DuplicateOfferViewModel.activate(DuplicateOfferViewModel.java:89)
    at bisq.desktop.common.model.ActivatableWithDataModel._activate(ActivatableWithDataModel.java:29)

@ghost
Copy link
Author

ghost commented Jun 2, 2022

I created more advanced logic for handling those edge case scenarios. Excluding BSQ Swap account wasn't enough, because it disallowed duplication of BSQ Swap offer when no altcoin account existed

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 😅

@ripcurlx ripcurlx added this to the v1.9.2 milestone Jun 9, 2022
Copy link
Contributor

@ripcurlx ripcurlx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK - based on #6233 (review)

@ripcurlx ripcurlx merged commit 8376799 into bisq-network:master Jun 9, 2022
@ghost ghost mentioned this pull request Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE when duplicating offer if the account does not exist.
1 participant