[ 
https://issues.apache.org/jira/browse/OLINGO-1342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16784742#comment-16784742
 ] 

Aleksandr Zaigraev edited comment on OLINGO-1342 at 3/5/19 6:23 PM:
--------------------------------------------------------------------

Because I needed to debug the connectivity issues, but I was getting 
ODataDeserializerException stack trace in logs, which is not helpful.

So I figured that I can intercept error message body before

odataClient.getReader().readError(entity, contentType)

is called, which throws ODataDeserializerException and masks real cause from 
logs. And if deserialization exception happens I will instead display raw 
message in logs, which is much more helpful.

 

Update:

Test for this specific case is added to ErrorTest class.


was (Author: dw3105):
Because I needed to debug the connectivity issues, but I was getting 
ODataDeserializerException stack trace in logs, which is not helpful.

So I figured that I can intercept error message body before

odataClient.getReader().readError(entity, contentType)

is called, which throws ODataDeserializerException and masks real cause from 
logs. And if deserialization exception happens I will instead display raw 
message in logs, which is much more helpful.

> Non-json errors not displayed properly in logs
> ----------------------------------------------
>
>                 Key: OLINGO-1342
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1342
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: (Java) V4 4.5.0, (Java) V4 4.6.0
>            Reporter: Aleksandr Zaigraev
>            Priority: Major
>              Labels: patch
>             Fix For: (Java) V4 4.5.0, (Java) V4 4.6.0
>
>         Attachments: OLINGO-1342.patch
>
>
> When http client receives non-json encoded error message, for example when 
> receiving this error message:
> <HEAD><TITLE>Tunnel Connection Failed</TITLE></HEAD>...
> In Spring logs following will be displayed:
> org.apache.olingo.client.api.serialization.ODataDeserializerException: 
> com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' 
> (code 60)): expected a valid value (number, String, array, object, 'true', 
> 'false' or 'null')
>  at [Source: (ByteArrayInputStream); line: 1, column: 2]
>  at 
> org.apache.olingo.client.core.serialization.JsonDeserializer.toError(JsonDeserializer.java:444)
>  ~[odata-client-core-4.5.0.jar:na]
>  at 
> org.apache.olingo.client.core.serialization.ClientODataDeserializerImpl.toError(ClientODataDeserializerImpl.java:105)
>  ~[odata-client-core-4.5.0.jar:na]
> ...



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to