Skip to content

[#9082] fix(core): validate job run id parsing to avoid SIOOBE#9302

Closed
HaJunYoo wants to merge 1 commit intoapache:mainfrom
HaJunYoo:issue-9082-job-id-parse
Closed

[#9082] fix(core): validate job run id parsing to avoid SIOOBE#9302
HaJunYoo wants to merge 1 commit intoapache:mainfrom
HaJunYoo:issue-9082-job-id-parse

Conversation

@HaJunYoo
Copy link
Contributor

What changes were proposed in this pull request?

  • Route job ID parsing in JobMetaService#getJobByIdentifier/deleteJob through parseJobRunId so malformed IDs throw NoSuchEntityException instead of runtime errors.
  • Fix the missing-job error message to include the actual identifier (ident.toString()).
  • Keep DB-backed tests as @TestTemplate so BackendTestExtension can inject the relational backend per invocation (required for H2/MySQL/PostgreSQL runs).

Why are the changes needed?

  • Prevents StringIndexOutOfBoundsException/NumberFormatException from malformed job IDs and ensures callers get a consistent NoSuchEntityException.
  • The backend-injection extension only runs with @TestTemplate; using plain @Test would bypass it and leave the backend uninitialized.

Fix: #9082

Does this PR introduce any user-facing change?

  • No API or behavior changes. Malformed job IDs now consistently return NoSuchEntityException instead of unexpected runtime errors, improving error consistency.

How was this patch tested?

  • Added unit tests:
    • TestJobMetaService#testGetJobWithMalformedIdentifierThrowsNoSuchEntityException
    • TestJobMetaService#testDeleteJobWithMalformedIdentifierThrowsNoSuchEntityException
  • Formatting: ./gradlew :core:spotlessJavaCheck
  • Unit: ./gradlew :core:test --tests "org.apache.gravitino.storage.relational.service.TestJobMetaService"

@HaJunYoo HaJunYoo closed this Nov 28, 2025
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.

[Improvement] Fix potential StringIndexOutOfBoundsException exception in JobMetaService.java getJobByIdentifier()/deleteJob()

1 participant