[ 
https://issues.apache.org/jira/browse/OLINGO-471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Amend reassigned OLINGO-471:
--------------------------------------

    Assignee: Christian Amend

> Generated proxies do not handle ODataServerErrorException correctly resulting 
> in a UndeclaredThrowableException
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: OLINGO-471
>                 URL: https://issues.apache.org/jira/browse/OLINGO-471
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: V4 4.0.0-beta-01
>            Reporter: Mark Sztainbok
>            Assignee: Christian Amend
>             Fix For: (Java) V4 4.0.0-beta-02
>
>
> When a server side exception occurs, the Olingo code throws a 
> ODataServerErrorException (in ODataResponseErrorChecker).
> However the proxy classes are not generated with a throws clause for this 
> method resulting in an UndeclaredThrowableException e.g.
> testAddAndRemoveLicenseForUser(com.saasure.application.office365.msgraphapi.MsGraphApiClientTest)
>   Time elapsed: 0.985 sec  <<< ERROR!
> java.lang.reflect.UndeclaredThrowableException: null
>       at 
> org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker.checkResponse(ODataErrorResponseChecker.java:73)
>       at 
> org.apache.olingo.client.core.communication.request.AbstractRequest.checkResponse(AbstractRequest.java:53)
>       at 
> org.apache.olingo.client.core.communication.request.AbstractODataRequest.doExecute(AbstractODataRequest.java:324)
>       at 
> org.apache.olingo.client.core.communication.request.invoke.AbstractODataInvokeRequest.execute(AbstractODataInvokeRequest.java:173)
>       at 
> org.apache.olingo.client.core.communication.request.invoke.AbstractODataInvokeRequest.execute(AbstractODataInvokeRequest.java:55)
>       at 
> org.apache.olingo.ext.proxy.commons.InvokerInvocationHandler.execute(InvokerInvocationHandler.java:122)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.apache.olingo.ext.proxy.commons.AbstractInvocationHandler.invokeSelfMethod(AbstractInvocationHandler.java:90)
>       at 
> org.apache.olingo.ext.proxy.commons.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:279)
>       at com.sun.proxy.$Proxy40.execute(Unknown Source)
>       at 
> com.saasure.application.office365.msgraphapi.MsGraphApiClient.addLicenseForUser(MsGraphApiClient.java:494)
>       at 
> com.saasure.application.office365.msgraphapi.MsGraphApiClient.addLicenseForUser(MsGraphApiClient.java:482)
>       at 
> com.saasure.application.office365.msgraphapi.MsGraphApiClientTest.testAddAndRemoveLicenseForUser(MsGraphApiClientTest.java:260)
> This is because the exception is checked but not declared on the proxy 
> interface (see 
> http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/UndeclaredThrowableException.html
>  and 
> http://amitstechblog.wordpress.com/2011/07/24/java-proxies-and-undeclaredthrowableexception/).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to