You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2021/06/02 12:08:57 UTC
[Bug 65347] New: The equals method from statements generated by the
StatementFacade throws both Illegal Argument Exception and
NullPointerExceptions
https://bz.apache.org/bugzilla/show_bug.cgi?id=65347
Bug ID: 65347
Summary: The equals method from statements generated by the
StatementFacade throws both Illegal Argument Exception
and NullPointerExceptions
Product: Tomcat Modules
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: jdbc-pool
Assignee: dev@tomcat.apache.org
Reporter: pj.stanley@live.co.uk
Target Milestone: ---
Created attachment 37885
--> https://bz.apache.org/bugzilla/attachment.cgi?id=37885&action=edit
Unit test cases for the Statement Facade class
tomcat-jdbc versions: 10.0.6 and 9.0.26
Statement objects created by the StatementFacade will throw exceptions from the
equals method, if the provided comparison object is not a
"java.lang.refelect.Proxy". According to the javadoc for object this method
should never throw and exception, but rather it should return false in those
cases.
This becomes an issue when prepared statements are stored and retrieved from
HashMaps and HashSets.
A proposed fix is to update the embedded StatementProxy.invoke() method with
the following:
if (compare(EQUALS_VAL, method)) {
try {
Object rhs = args[0];
if (rhs instanceof Proxy) {
rhs = Proxy.getInvocationHandler(rhs);
}
return Boolean.valueOf(this.equals(rhs));
} catch (Exception e) {
return Boolean.FALSE;
}
}
Also attached is a unit test.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 65347] The equals method from statements generated by the
StatementFacade throws both Illegal Argument Exception and
NullPointerExceptions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65347
Paul <pj...@live.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pj.stanley@live.co.uk
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org