Enforce KeyLock API constraints and synchronize READMEs#25
Conversation
- Added input validation for `lockKey` (non-blank, max length 1000) and `expirationSeconds` (> 0) to `SimpleKeyLock.tryLock`. - Added null-safety check for `lockHandle` in `SimpleKeyLock.unlock`. - Updated corresponding Javadoc in `KeyLock`. - Added unit tests for new validation logic in `LocalKeyLockTest`. - Synchronized main and sub-module READMEs with actual API constraints. Co-authored-by: pmalirz <19637300+pmalirz@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
dlock-core/src/main/java/io/github/pmalirz/dlock/core/SimpleKeyLock.java
Outdated
Show resolved
Hide resolved
- Extracted the magic number `1000` for lock key length into `KeyLock.MAX_LOCK_KEY_LENGTH`. - Updated `SimpleKeyLock` input validation to use the new constant. - Updated `LocalKeyLockTest` to dynamically generate strings exceeding the maximum length using the constant instead of a hardcoded value. Co-authored-by: pmalirz <19637300+pmalirz@users.noreply.github.com>
dlock-api/src/main/java/io/github/pmalirz/dlock/api/KeyLock.java
Outdated
Show resolved
Hide resolved
- Added missing Javadoc explaining that the length limit ensures compatibility with the underlying database schema. Co-authored-by: pmalirz <19637300+pmalirz@users.noreply.github.com>
- Replaced the hardcoded '1000' character limit in the `KeyLock` Javadoc with `{@value #MAX_LOCK_KEY_LENGTH}`.
- Replaced the hardcoded '1000' string with references to `KeyLock.MAX_LOCK_KEY_LENGTH` in the main `README.md`, `dlock-core/README.md`, and `dlock-api/README.md`.
Co-authored-by: pmalirz <19637300+pmalirz@users.noreply.github.com>
This submission implements strict input validation for the
tryLockmethod insideSimpleKeyLockto guarantee safe database operations and enforce documented API constraints. The changes reject empty/null/oversized lock keys and invalid expiration times, while properly handlingnullreferences duringunlock. It includes unit test coverage for these edge cases. Additionally, documentation across the mainREADME.md,dlock-core/README.md, anddlock-apiinterface Javadocs has been fully updated to explicitly outline these constraints, fulfilling the requirement for a clean, secure API and aligned documentation.PR created automatically by Jules for task 6709944941719295175 started by @pmalirz