LuciferYang opened a new pull request, #7724:
URL: https://github.com/apache/kyuubi/pull/7724

   ### Why are the changes needed?
   
   Closes #7723.
   
   `ReflectUtils.isClassLoadable` wrapped its `DynClasses` probe in 
`scala.util.Try`, which catches only `NonFatal`. The probe resolves the name 
with `Class.forName(className, true, loader)`, so a class that is present but 
fails to link or initialize raises a `LinkageError` (`NoClassDefFoundError`, 
`ExceptionInInitializerError`) rather than a `ClassNotFoundException`. 
`LinkageError` is not `NonFatal`, so it escaped the probe and crashed the 
caller instead of answering `false`.
   
   This replaces the `Try` with an explicit `try`/`catch` that answers `false` 
on `ClassNotFoundException` and `LinkageError`. The two call sites (`Logging` 
probing the SLF4J bridge, `JDBCMetadataStore` probing the MySQL driver) read 
the result as a boolean and are only made safer. 
`OutOfMemoryError`/`StackOverflowError` are `VirtualMachineError`, not 
`LinkageError`, so they stay fatal exactly as they did under `Try`.
   
   ### How was this patch tested?
   
   Added a `ReflectUtilsSuite` case that probes a top-level object whose static 
initializer throws, by its binary name, and asserts `isClassLoadable` returns 
`false`. Reverting the production change makes the suite abort as the 
`ExceptionInInitializerError` escapes, which pins the regression.
   
   ```
   build/mvn test -pl kyuubi-util-scala -am
   build/mvn scalastyle:check spotless:check -pl kyuubi-util-scala -am
   ```
   
   Module green on Zulu 17.0.18 (22/22), scalastyle 0 errors, spotless clean.
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: Claude Opus 4.8
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to