sachinnn99 opened a new pull request, #10779:
URL: https://github.com/apache/gravitino/pull/10779

   ### What changes were proposed in this pull request?
   
   Replace eager static initialization of `Version.INSTANCE` with the 
initialization-on-demand holder idiom. This ensures `parseVersionNumber()` can 
be called without triggering the properties file load.
   
   ### Why are the changes needed?
   
   `TestVersion` fails when tests are run directly (`./gradlew clean 
:common:test -PskipITs`) without first running the `jar` task. The 
`gravitino-build-info.properties` file is only generated inside `jar { doFirst 
}`, not during `processResources`. Since `test` does not depend on `jar`, the 
file is absent, causing `Version`'s static initializer to throw — even though 
all `TestVersion` methods only call `parseVersionNumber()`, which never uses 
`INSTANCE`.
   
   The holder pattern is already established in this codebase by 
`ObjectMapperProvider` and `GravitinoEnv`.
   
   Fix: #10762
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   `./gradlew clean :common:test -PskipITs --tests 
"org.apache.gravitino.TestVersion"` — all 4 tests pass without a prior `jar` 
task.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to