[GLASSFISH-16750] IllegalArgumentException when JDBC statement leak detection is enabled for an app-scoped JDBC connection pool Created: 27/May/11  Updated: 02/Aug/11

Status: Open
Project: glassfish
Component/s: None
Affects Version/s: 3.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: arungupta Assignee: Jagadish
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Source File MessageFormatTest.java    
Tags: 3_1_1-next, 3_1_1-scrubbed

 Description   

An app-scoped JDBC connection pool with the following parameters:

connection-leak-timeout-in-seconds="10"
statement-leak-timeout-in-seconds="2"
statement-timeout-in-seconds="6"

should enable JDBC statement leak detection. But it throws the following error in the console:

WARNING: RAR8012: Exception while scheduling timer : Timer already cancelled.
INFO: Recreating Timer and scheduling at fixed rate
SEVERE: Exception in thread "connector-timer-proxy"
SEVERE: java.lang.IllegalArgumentException: can't parse argument number PoolInfo : (name=java:app/myConnectionPool)
at java.text.MessageFormat.makeFormat(MessageFormat.java:1339)
at java.text.MessageFormat.applyPattern(MessageFormat.java:458)
at java.text.MessageFormat.<init>(MessageFormat.java:350)
at com.sun.enterprise.util.i18n.StringManagerBase.getStringWithDefault(StringManagerBase.java:206)
at com.sun.enterprise.resource.pool.ConnectionLeakDetector.printConnectionLeakTrace(ConnectionLeakDetector.java:177)
at com.sun.enterprise.resource.pool.ConnectionLeakDetector.potentialConnectionLeakFound(ConnectionLeakDetector.java:157)
at com.sun.enterprise.resource.pool.ConnectionLeakDetector.access$000(ConnectionLeakDetector.java:60)
at com.sun.enterprise.resource.pool.ConnectionLeakDetector$ConnectionLeakTask.run(ConnectionLeakDetector.java:222)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)

The same parameters work fine if these parameters are used on the pre-created JDBC connection pool of jdbc/__default.



 Comments   
Comment by Jagadish [ 27/May/11 ]

Root cause seems to be due to StringManager not able to handle the string that has "

{" / "}

" in the text.

eg: PoolInfo/ResourceInfo's toString will be of the form :

{ PoolInfo : (name=MY_POOL), (applicationName=MY_APP), (moduleName=MY_MODULE)}

which when used with "LocalStrings.getStringsWithDefault" results in the reported exception.

There should be a way to escape these characters so that they do not affect LocalStrings functionality.

Transferring to Naman for comments.
If there are escape characters that could be used, please transfer the issue to me with a sample.

Comment by naman_mehta [ 02/Aug/11 ]

Attaching test java class for message formatting where string has { } this kind of content...

Comment by naman_mehta [ 02/Aug/11 ]

Assigning to Jagadish for verification and fix the same...

Generated at Tue Apr 28 16:45:00 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.