Code review request for 6985460: PlatformLogger throws ArrayStoreException

David Holmes David.Holmes at oracle.com
Thu Oct 21 13:37:09 PDT 2010


Okay I'm confused by this one. The AWT code passes an XIConSize[] where 
a Object[] is expected. Something strikes me as wrong that this "works" 
but I guess that's just the way arrays are. And its okay as long as the 
array is read-only.

What is really wrong in this case is that the doLog method mutates the 
array that is passed in to it! It has no business doing that. Someone 
seems to have assumed that the varargs array is always one created by 
the compiler, but it need not be. In which case allocating a new 
String[] to fill in is definitely the right thing to do.

David

Mandy Chung said the following on 10/22/10 05:25:
>  Hi Dan,
> 
> Can you review a simple fix for:
>     6985460: PlatformLogger throws ArrayStoreException when j.u.logging 
> is initialized
> 
> Webrev at:
>    http://cr.openjdk.java.net/~mchung/6985460/webrev.00/
> 
> ArrayStoreException was thrown when it attempts to write a String object 
> into a non-String type.
> 
> Thanks
> Mandy


More information about the serviceability-dev mailing list