Recently, I use "context:load-time-weaver/" config to support @Configurable annotation in my project.I found serious problems below when I trace the errors in my project.
1.XXX.class.getPackage() returns null
2.XXX.class.getProtectionDomain().getCodeSource().getLocation() returns null
These problems disappear when I don't use "context:load-time-weaver/".
The code "XXX.class.getPackage()" is used in many dependencies such as the static method in com.mysql.jdbc.Util:
This is also why we do not rely on Class.getPackage() within our own codebase. It's arguably a bug that MySQL relies on that method to deliver a non-null result; instead, it should extract the package name from the fully-qualified class name which is the only safe option there.
As for our own load-time weaving exposing the package and protection domain there, that's worth considering as an improvement.
I did create a bug for Mysql :http://bugs.mysql.com/bug.php?id=83052
And, I hope this improvement could be released soon, best in next version. Haaa!
Cause we can't expect all the dependencies won't rely on the non-null result of
jasperMin opened SPR-14736 and commented
Recently, I use "context:load-time-weaver/" config to support
@Configurable
annotation in my project.I found serious problems below when I trace the errors in my project.1.XXX.class.getPackage() returns null
2.XXX.class.getProtectionDomain().getCodeSource().getLocation() returns null
These problems disappear when I don't use "context:load-time-weaver/".
The code "XXX.class.getPackage()" is used in many dependencies such as the static method in com.mysql.jdbc.Util:
packageName = MultiHostConnectionProxy.class.getPackage().getName();
The null result of Class.getPackage() causes NullPointerException.
No further details from SPR-14736
The text was updated successfully, but these errors were encountered: