[bisq-network/bisq] Fix resync BSQ blocks from resources (PR #5900)
Steven Barclay
notifications at github.com
Tue Dec 7 15:31:22 CET 2021
<!--
- make yourself familiar with the CONTRIBUTING.md if you have not already (https://github.com/bisq-network/bisq/blob/master/CONTRIBUTING.md)
- make sure you follow our [coding style guidelines][https://github.com/bisq-network/style/issues)
- pick a descriptive title
- provide some meaningful PR description below
- create the PR
- in case you receive a "Change request" and/or a NACK, please react within 30 days. If not, we will close your PR and it can not be up for compensation.
- After addressing the change request, __please re-request a review!__ Otherwise we might miss your PR as we tend to only look at pull requests tagged with a "review required".
-->
Prevent a _"URI is not hierarchical"_ IllegalArgumentException from the expression, `new File(dirUrl.toURI())`, which occurs on Linux & Windows when listing the resource directory of BSQ blocks. Adapt a solution from StackOverflow (together with the earlier `java.nio.file.FileSystem`-based approach in #5898), which uses two separate code paths depending on the environment, into the new method `FileUtil::listResourceDirectory`.
The issue is caused by the resource URL taking one of the two forms:
1. file:/Users/[USER]/Java/bisq/bisq/p2p/out/production/resources/BsqBlocks_BTC_MAINNET
2. jar:file:...p2p.jar!/BsqBlocks_BTC_MAINNET
depending on whether the system is OSX or not.
--
I tested the PR on Linux & Windows, but have not been able to test the absence of a regression on OSX (though I don't expect this, as it should use a similar code path to the original).
You can view, comment on, or merge this pull request online at:
https://github.com/bisq-network/bisq/pull/5900
-- Commit Summary --
* Fix BSQ blocks resync from resources on Windows & Linux
* Avoid enumerating every jar entry in FileUtil::listResourceDirectory
-- File Changes --
M common/src/main/java/bisq/common/file/FileUtil.java (38)
M core/src/main/java/bisq/core/dao/state/storage/BsqBlocksStorageService.java (23)
-- Patch Links --
https://github.com/bisq-network/bisq/pull/5900.patch
https://github.com/bisq-network/bisq/pull/5900.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211207/05cca55e/attachment.htm>
More information about the bisq-github
mailing list