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 2013/01/09 21:51:23 UTC
[Bug 54395] New: JdbcInterceptor config parameter parsing errors
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
Bug ID: 54395
Summary: JdbcInterceptor config parameter parsing errors
Product: Tomcat Modules
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: jdbc-pool
Assignee: dev@tomcat.apache.org
Reporter: inetdevboy@gmail.com
Classification: Unclassified
The parameter value for a JdbcInterceptor config is parsed incorrectly if there
is any white-space following the closing parentheses (it includes the closing
paren in the parameter value).
I will be attaching two items momentarily:
* a patch to resolve the issue
* a unit test that fails in TRUNK but passes post-patch.
The parser can behave unpredictably in several other boundary cases (extra
white-space, spurious semicolons, empty parm lists, etc.) so I have attempted
to document the current behavior in the unit test for clarity. It may be worth
considering a more uniform response to incorrect config(s), but I skipped that
here to keep it simple. I may submit an enhancement request later (with some
suggestions as a patch).
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
--- Comment #2 from Glen Taylor <in...@gmail.com> ---
Created attachment 29835
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29835&action=edit
New unit test for parser
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
FWIW, test cases using the following idiom:
caught = null;
try {
props.getJdbcInterceptorsAsArray();
} catch (Exception e) {
caught = e;
}
assertNull(caught);
can be written somewhat more simply like this:
try {
props.getJdbcInterceptorsAsArray();
} catch (Exception e) {
assertFail("Didn't expect exception");
}
Likewise:
caught = null;
try {
props.getJdbcInterceptorsAsArray();
} catch (Exception e) {
caught = e;
}
assertNotNull(caught);
can be written like this:
try {
props.getJdbcInterceptorsAsArray();
assertFail("Expected Exception");
} catch (Exception e) {
// Expected
}
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
--- Comment #6 from Christopher Schultz <ch...@christopherschultz.net> ---
Sorry, yes, I meant "fail()".
As for "throws Exception" doesn't that change a failure into an "error" when
JUnit runs?
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
Glen Taylor <in...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #29836|application/octet-stream |text/plain
mime type| |
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
--- Comment #5 from Konstantin Kolinko <kn...@gmail.com> ---
(In reply to comment #3)
> FWIW, test cases using the following idiom:
> (..)
> can be written somewhat more simply like this:
>
> try {
> props.getJdbcInterceptorsAsArray();
> } catch (Exception e) {
> assertFail("Didn't expect exception");
> }
1. Just add "throws Exception" to the test method. JUnit notices the thrown
exception and the test does not pass.
2. It is the first time I am seeing "assertFail". A typo? The method that I
know about is called fail(message) (Assert.fail(..)).
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
Filip Hanik <fh...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Filip Hanik <fh...@apache.org> ---
Love nothing more than receiving tests
The assertions are backwards (parameters swapped), other than that looks great.
org.junit.ComparisonFailure:
Expected :value2 )
Actual :value2
Thanks for the report
Fixed in r1616599
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
Glen Taylor <in...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #29835|0 |1
is obsolete| |
--- Comment #4 from Glen Taylor <in...@gmail.com> ---
Created attachment 29836
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29836&action=edit
Updated unit test per comments
Well, the JUnit 3.8.1 pulled in by Maven doesn't have an "assertFail(String)"
method, but I think the "fail(String)" alternative is there in spirit.
Point(s) taken, unit test attachment updated.
I had been doing more with the Exception in case 1, and didn't refactor far
enough when that changed, and case 2 was copy/paste laziness (blah,blah).
Thanks for the good suggestions.
--
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 54395] JdbcInterceptor config parameter parsing errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395
--- Comment #1 from Glen Taylor <in...@gmail.com> ---
Created attachment 29833
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29833&action=edit
Patch for PoolProperties.java
--
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