RFC: Netx - Fix service exceptions thrown by the proxy

Omair Majid omajid at redhat.com
Tue Jun 16 06:57:28 PDT 2009


Deepak Bhole wrote:
> * Omair Majid <omajid at redhat.com> [2009-06-15 16:39]:
>> Hi,
>>
>> Netx uses dynamic proxies to wrap all calls to the various JNLP services  
>> and run them in privileged mode. If any method called throws an  
>> exception, it is wrapped in a InvocationTargetException. And then in a  
>> PrivilegedActionException. Now a client JNLP program doesnt know (and  
>> shouldnt know!) that we are using proxies. So it gets a totally  
>> unexpected exception and cant deal with the situation properly. [1]  
>> describes the bug in much more detail.
>>
>> The attached patch fixes the problem by throwing the exception that  
>> caused the problem.
>>
> 
> 
> Looks good. Can you change the getCause() in case of ITE to be
> getTargetException instead? From the last line on the link you posted:
> 
> One commenter noted that InvocationTargetException.getTargetException()
> should be used instead of getCause(). The two methods are actually
> equivalent for InvocationTargetException, so using either works.

I was going to use getTargetException() but then I saw this note in the 
  java-docs [1]: "The Throwable.getCause() method is now the preferred 
means of obtaining this information". I have no preference either way; 
what do you think makes more sense?

> 
> After above change, good to commit.
> 
Thanks for the review.

Cheers,
Omair


[1] 
http://java.sun.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html#getTargetException()



More information about the distro-pkg-dev mailing list