Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Catch a rare timing crash. #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion library/src/org/onepf/oms/appstore/GooglePlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public void onServiceConnected(ComponentName name, IBinder service) {
Log.e(TAG, "isBillingAvailable() RemoteException while setting up in-app billing", e);
} finally {
latch.countDown();
context.unbindService(this);
try {
context.unbindService(this);
} catch (Exception ignore) {
Copy link

Choose a reason for hiding this comment

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

handle your exceptions.

What happens if the unbinding fails? What reasons could it fail for?

Throw a more specific exception?

Copy link
Author

Choose a reason for hiding this comment

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

Since their was absolutely no interest from the openIAB team to work on all the bugs and PR I do not maintain anymore my PRs.

Anyway as explained in the description, this is a very rare collision where the service is already unbinded by the timeout so will fail for this second unbind.
There's nothing to handle, do or rethrow. You can eventually be more specific on the Exception catch if you want but in all cases there's no possible recovery on any error on this.

}
}
}

Expand Down