RFR 8063087: policytool reports error message with prefix of "java.lang.Exception"

Xuelei Fan xuelei.fan at oracle.com
Tue Nov 11 11:03:59 UTC 2014


Looks fine to me.

Xuelei

On 11/11/2014 4:54 PM, Wang Weijun wrote:
> 
>> On Nov 11, 2014, at 15:06, Xuelei Fan <xuelei.fan at oracle.com> wrote:
>>
>> On 11/11/2014 1:31 PM, Wang Weijun wrote:
>>> A subclass of Exception would also return true when using instanceof, where I think the class name is still informational.
>>>
>> Got it.  But Exception is still informational as it means it is not an
>> other exception.
> 
> Well, an Exception is usually thrown inside policytool to mark a user interaction error, while other exception types are about other errors, for example, a keystore cannot be loaded, a principal cannot be constructed etc. Therefore I think it's reasonable to omit the prefix of Exception.
> 
>>
>> I'm not sure it is something we really want to address.  The coding
>> logic does not looks reasonable or friendly.  Or, would you please add
>> some comments about why you want to treat the exception differently?
> 
> OK, I'll add my explanation above. Is that OK?
> 
> Thanks
> Max
> 
>>
>> Thanks,
>> Xuelei
>>
>>> --Max
>>>
>>>> On Nov 11, 2014, at 11:14, Xuelei Fan <xuelei.fan at oracle.com> wrote:
>>>>
>>>> Why not use "instanceof"?
>>>>
>>>> Xuelei
>>>>
>>>> On 11/11/2014 10:58 AM, Wang Weijun wrote:
>>>>> Please review the fix at
>>>>>
>>>>>  http://cr.openjdk.java.net/~weijun/8063087/webrev.00/
>>>>>
>>>>> which is simply
>>>>>
>>>>>    void displayErrorDialog(Window w, Throwable t) {
>>>>>        if (t instanceof NoDisplayException) {
>>>>>            return;
>>>>>        }
>>>>>
>>>>> +        if (t.getClass() == Exception.class) {
>>>>> +            displayErrorDialog(w, t.getLocalizedMessage());
>>>>> +        } else {
>>>>>        displayErrorDialog(w, t.toString());
>>>>> +        }
>>>>>    }
>>>>>
>>>>> Error messages like "java.lang.Exception:No Policy Entry selected" is now "No Policy Entry selected". For other exception types, there will be no change.
>>>>>
>>>>> Thanks
>>>>> Max
>>>>>
>>>>
>>>
>>
> 



More information about the security-dev mailing list