Skip to content

fix: fail fast on invalid fake-delete config - #875

Merged
TommyLemon merged 2 commits into
APIJSON:masterfrom
henriquejsza:fix/654-fake-delete-npe
Aug 30, 2026
Merged

TommyLemon merged 2 commits into
APIJSON:masterfrom
henriquejsza:fix/654-fake-delete-npe

Conversation

@henriquejsza

Copy link
Copy Markdown
Contributor

Summary

  • eagerly initialize AbstractVerifier.ACCESS_FAKE_DELETE_MAP
  • reject missing, blank, or non-string deletedKey configuration before a fake-delete request can fall back to physical DELETE
  • add database-free regression coverage for initialization, invalid configuration, the valid DELETE-to-PUT path, reads, and disabled fake delete

Behavior

When isFakeDelete() is enabled, a DELETE now either:

  • becomes PUT when the table has a valid fake-delete configuration, or
  • fails with an explicit IllegalArgumentException before returning a physical DELETE configuration

Normal DELETE behavior remains unchanged when fake delete is disabled, and the GET path is unchanged. This follows the maintainer guidance in #654.

Tests

  • javac --release 8: compiled all 69 main sources and 3 test sources
  • mvn -Dtest=AbstractSQLConfigFakeDeleteTest test: 8 tests passed
  • mvn clean verify: 28 tests passed; binary and source JARs built
  • regression check against base c204638b: the new test fails in the 5 scenarios corrected by this PR

Scope

The change is limited to the two core classes and one new JUnit 4 test class. It does not modify apijson-framework, demos, public interfaces, versions, or documentation.

Closes #654

Initialize the fake-delete access map eagerly to prevent null dereferences.
Reject missing or invalid per-table deletedKey values so fake delete cannot
silently fall back to physical deletion.

issue APIJSON#654
@TommyLemon
TommyLemon merged commit c96950f into APIJSON:master Aug 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot invoke "java.util.Map.get(Object)" because "apijson.orm.AbstractVerifier.ACCESS_FAKE_DELETE_MAP" is null

2 participants