Bug #72006 Unnecessary creation of a character array in PreparedStatement$ParseInfo.
Submitted: 11 Mar 2014 10:39 Modified: 3 Apr 2014 22:46
Reporter: Andrej Golovnin (OCA) Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S5 (Performance)
Version:5.1.29 OS:Any
Assigned to: Filipe Silva CPU Architecture:Any
Tags: jdbc, PreparedStatement

[11 Mar 2014 10:39] Andrej Golovnin
In the line 393 in PreparedStatement$ParseInfo a character array is created from a String object. It is used later in lines 402 and 419 to create a String objects, which are just subs-strings of the original String object. When encoding is null, the array is not used at all. And when we have a SingleByteCharsetConverter, then the array is also not used.

How to repeat:
Review code of the constructor of PreparedStatement$ParseInfo.

Suggested fix:
See the attached patch.
[11 Mar 2014 10:39] Andrej Golovnin
Patch for this issue.

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: PreparedStatement.patch (application/octet-stream, text), 1.39 KiB.

[14 Mar 2014 11:15] Filipe Silva
Hi Andrej,

Thank you for this bug report and contribution.
Verified as described, contribution accepted.
[3 Apr 2014 22:46] Daniel So
Added the following entry into the Connector/J 5.1.31 changelog:

"In the method PreparedStatement.ParseInfo, a character array was created unnecessarily out of a string object. This fix removed the unnecessary instantiation of the array."