-
Notifications
You must be signed in to change notification settings - Fork 27
refactor: remove redundant rethrow and reuse HttpClient; build: bump to 0.3.0 #430
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
Conversation
…field extraction - Updated deserializer classes to use a while loop for extracting field values instead of forEachRemaining. This change improves readability and consistency across the deserialization logic.
…ckage - Changed the import statement for StringEscapeUtils from org.apache.commons.lang3 to org.apache.commons.text to align with the latest library updates and improve compatibility.
- Updated the parent version to 0.3.0 for the project. - Added commons-text as a new dependency for text manipulation utilities.
- Ensure both `name` and `currency` fields are validated correctly. - Throw an assertion error with a clear message if either field is missing.
…tion - Simplified the error handling logic for merchant entity validation. - Consolidated checks for null or empty `id` field into a single block. - Improved readability and maintainability of the code.
- Refactored nip05 validation logic to enhance readability and maintainability. - Improved error messages for invalid local-part and domain syntax. - Streamlined HTTP client usage by introducing a default HttpClientProvider.
- Changed the retryable annotation to include IOException instead of just value. This improves the flexibility of the retry mechanism for handling IO exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the codebase to remove redundant error handling patterns, improve performance through HttpClient reuse, update deprecated API usage, and bump the project version to 0.3.0. The changes address static analysis findings and modernize the code to use current best practices.
Key changes include:
- Elimination of redundant catch-and-rethrow blocks in event validation classes
- Migration from per-call HttpClient creation to a reusable instance pattern in Nip05Validator
- Update of deprecated Jackson and Spring Retry API usage to modern alternatives
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Version bump to 0.3.0 and addition of commons-text dependency property |
| nostr-java-util/src/main/java/nostr/util/validator/Nip05Validator.java | Major refactor to use HttpClientProvider pattern and improve validation logic |
| nostr-java-event/src/main/java/nostr/event/json/serializer/AbstractTagSerializer.java | Replace deprecated fields() with fieldNames() iteration |
| nostr-java-event/src/main/java/nostr/event/json/deserializer/*Deserializer.java | Replace deprecated fields() with fieldNames() iteration across multiple deserializers |
| nostr-java-event/src/main/java/nostr/event/impl/*.java | Remove redundant catch blocks and fix extra closing braces |
| nostr-java-client/src/main/java/nostr/client/springwebsocket/NostrRetryable.java | Replace deprecated value with include parameter |
| nostr-java-api/src/main/java/nostr/api/*.java | Switch from deprecated commons-lang3 to commons-text StringEscapeUtils |
| */pom.xml | Update module versions to 0.3.0 |
| @Builder.Default @JsonIgnore | ||
| private final HttpClientProvider httpClientProvider = new DefaultHttpClientProvider(); |
Copilot
AI
Aug 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code references HttpClientProvider and DefaultHttpClientProvider classes that are not visible in the imports or defined in this file. These classes appear to be missing from the codebase, which would cause compilation errors.
| @Builder.Default @JsonIgnore private final Duration connectTimeout = Duration.ofSeconds(5); | ||
| @Builder.Default @JsonIgnore private final Duration requestTimeout = Duration.ofSeconds(5); |
Copilot
AI
Aug 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Duration and @JsonIgnore imports are missing. Add import java.time.Duration; and import com.fasterxml.jackson.annotation.JsonIgnore; to the imports section.
Qodana Community for JVM166 new problems were found
☁️ View the detailed Qodana report Contact Qodana teamContact us at qodana-support@jetbrains.com
|
Summary
Changes
catch (AssertionError e) { throw e; }; preserve wrapping of non-assertion exceptions.catch (AssertionError e) { throw e; }; preserve wrapping of non-assertion exceptions.HttpClientandclient()accessor; replace per-callHttpClient.newHttpClient()with reuse.org.apache.commons.text.StringEscapeUtils.org.apache.commons.text.StringEscapeUtils.include = IOException.classinstead of deprecatedvalue.fieldNames()+get(name)instead of deprecatedfields().fieldNames()+get(name)instead of deprecatedfields().commons-text.versionproperty.org.apache.commons:commons-textdependency.Testing
mvn -q -DskipITs=false verifyscsibug/nostr-rs-relay:latestcontainers successfully.Network Access
Notes
Protocol Compliance