Skip to content

Validate Filters map keys and limit #271

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

Merged

Conversation

tcheeric
Copy link
Owner

Summary

  • Simplify filter lookup with getOrDefault
  • Add constant error messages, key null checks, and positive limit validation
  • Cover new validations with unit tests

Testing

  • mvn -q verify (fails: Coverage checks have not been met for nostr-java-encryption)

https://chatgpt.com/codex/tasks/task_b_6898e4fcce9c83318861268b88cb5a19

Copy link
Contributor

@Copilot Copilot AI left a 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 enhances validation and error handling in the Filters class by adding null checks for filter keys, positive limit validation, and constant error messages. The changes improve code robustness and maintainability.

  • Replaced direct map access with getOrDefault for cleaner filter lookup
  • Added validation for null filter keys and positive limit values
  • Introduced constant error messages for consistent exception handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
nostr-java-event/src/main/java/nostr/event/filter/Filters.java Enhanced validation logic with null checks, positive limit validation, and constant error messages
nostr-java-event/src/test/java/nostr/event/unit/FiltersTest.java Added comprehensive unit tests covering new validation scenarios

@tcheeric tcheeric merged commit 6111960 into develop Aug 10, 2025
0 of 2 checks passed
@tcheeric tcheeric deleted the codex/update-filter-implementation-and-validations branch August 10, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant