Review request for 7038565, for a findbugs warning for BatchUpdateException
Lance Andersen - Oracle
Lance.Andersen at oracle.com
Mon Apr 25 16:28:55 UTC 2011
As I have had suggestions to consider using Arrays.copyOf over clone(), I have pushed a webrev.02 which uses Arrays.copyOf. The diffs are at http://cr.openjdk.java.net/~lancea/7038565/
If you have any strong preferences, please let me know.
Thank you to those who have provided input.
Best Regards,
Lance
On Apr 23, 2011, at 6:11 AM, David Holmes wrote:
> Rémi Forax said the following on 04/23/11 04:22:
>> On 04/22/2011 06:51 PM, Lance Andersen - Oracle wrote:
>>>>
>>>> You should use clone() instead of Arrays.copyOf.
>>>
>>> Can you explain why you have a preference for clone() in this case?
>> It does the job :)
>> Arrays.copyOf() allows to resize the array.
>
> So? That's not a reason to not use Arrays.copyOf. Look at copyOf as the new improved version of clone.
>
> David
>
>>>> Also updateCounts should be declared final
>>>
>>> I will make updateCounts final.
>>>> and initialized like this:
>>>>
>>>> public BatchUpdateException(String reason, String SQLState, int vendorCode,
>>>> int []updateCounts,Throwable cause) {
>>>> super(reason, SQLState, vendorCode, cause);
>>>> this.updateCounts = (updateCounts == null)? null:updateCounts.clone();
>>>> }
>>>>
>>>
>>> Regards,
>>> lance
>> regards,
>> rémi
Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com
More information about the core-libs-dev
mailing list