You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "thswlsqls (via GitHub)" <gi...@apache.org> on 2026/07/12 06:19:59 UTC

[I] StaticMethodAdviceExecutor error logs report java.lang.Class instead of the target class name [shardingsphere]

thswlsqls opened a new issue, #39076:
URL: https://github.com/apache/shardingsphere/issues/39076

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master @ 82d63200491
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   N/A (ShardingSphere-Agent)
   
   ### Expected behavior
   When a static-method plugin advice fails, the SEVERE log should name the target class (e.g. `com.foo.Bar`) so the failing instrumentation can be diagnosed.
   
   ### Actual behavior
   The log always prints `java.lang.Class` as the target class name, regardless of which class was instrumented.
   
   ### Reason analyze (If you can)
   In `StaticMethodAdviceExecutor` the three error handlers `adviceBefore` (line 92), `adviceThrow` (line 108) and `adviceAfter` (line 124) format the `{1}` placeholder with `klass.getClass().getName()`. `klass` is the `@Origin final Class<?>` target class itself, so `klass.getClass()` yields `java.lang.Class` and its name is a constant. The correct call is `klass.getName()`. The sibling `InstanceMethodAdviceExecutor` uses `target.getClass().getName()` because `target` is an instance, confirming the intent is the real target class name.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   Register a static-method advice whose `beforeMethod`/`afterMethod`/`onThrowing` throws; the resulting SEVERE log shows `in class \`java.lang.Class\`` instead of the instrumented class.
   
   ### Example codes for reproduce this issue (such as a github link).
   N/A
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] StaticMethodAdviceExecutor error logs report java.lang.Class instead of the target class name [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #39076: StaticMethodAdviceExecutor error logs report java.lang.Class instead of the target class name
URL: https://github.com/apache/shardingsphere/issues/39076


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org