Code review request for 6985460: PlatformLogger throws ArrayStoreException

Mandy Chung mandy.chung at oracle.com
Thu Oct 21 16:19:29 PDT 2010


  Hi David,

Looking closer at the java.util.logging.LogRecord and Formatter 
implementation, I don't think the conversion from Object[] to String[] 
is needed at all (I confess that I couldn't recall why it was added in 
the first place).   java.util.logging.Logger.log(Level, String, 
Object[]) takes the Object[] parameter. The 
java.text.MessageFormat.format() method will print the formatted text.   
So I can simply pass the params argument to LoggingSupport.log method.  
I also spot another bug that didn't filter the frame from 
LoggingProxyImpl class (a regression caused when LoggingProxy was added 
in the fix for 6876135).

The new webrev is at:
    http://cr.openjdk.java.net/~mchung/6985460/webrev.01/

Thanks
Mandy

On 10/21/10 13:37, David Holmes wrote:
> 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