Skip to content

Conversation

@tcheeric
Copy link
Owner

Summary

  • enforce non-null checks for id, pubkey, and sig before hex validation
  • add unit tests confirming informative exceptions for missing fields

Testing

  • mvn -q verify (fails: Could not find a valid Docker environment for Testcontainers)

Network Access

  • No network requests were made; test failures were due to missing local Docker environment.

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

Copy link
Contributor

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 event validation by adding null checks for required fields before hex validation and includes comprehensive unit tests to verify the behavior.

  • Adds null validation for id, pubkey, and sig fields using Objects.requireNonNull() with descriptive error messages
  • Implements unit tests to verify that NullPointerException is thrown with appropriate messages when required fields are missing
  • Ensures validation fails fast with clear error messages when mandatory fields are null

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/impl/GenericEvent.java Adds null checks with custom error messages before hex validation for id, pubkey, and signature fields
nostr-java-event/src/test/java/nostr/event/impl/GenericEventValidateTest.java Implements comprehensive unit tests to verify null field validation behavior and error messages

@tcheeric tcheeric merged commit b7b5eef into develop Aug 10, 2025
1 check passed
@tcheeric tcheeric deleted the codex/validate-fields-in-genericevent.validate branch August 10, 2025 21:58
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.

2 participants