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

ASF subversion and git services commented on JCLOUDS-1200:
----------------------------------------------------------

Commit d47c776cf308e638c5ceff316852f29ceca89add in jclouds's branch 
refs/heads/2.1.x from [~jesse.gl...@netbeans.com]
[ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=d47c776 ]

[JCLOUDS-1200] Mark nonserializable fields in HttpResponseException and 
subtypes as transient.


> org.jclouds.http.HttpResponseException fails to serialize
> ---------------------------------------------------------
>
>                 Key: JCLOUDS-1200
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1200
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-core
>    Affects Versions: 1.9.2
>            Reporter: Ian Springer
>            Priority: Major
>
> The org.jclouds.http.HttpResponseException class fails to serialize due to 
> having a field of type org.jclouds.http.HttpCommand, which is not 
> Serializable. It appears the same is true for the other field with type 
> org.jclouds.http.HttpResponse. Per Java design, all Throwable subclasses 
> should be serializable.
> Here is the stack trace when an HttpResponseException fails to serialize:
> {code}
> Caused by: java.io.NotSerializableException: org.jclouds.http.HttpCommand
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
>       at 
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
>       at 
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
>       at 
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
>       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
>       at com.google.common.testing.Platform.reserialize(Platform.java:45)
>       ... 35 more
> {code}
> And here is a failing test that attempts to serialize a HttpResponseException 
> instance:
> {code}
>     @Test
>     public void testHttpResponseExceptionSerializable() {
>         HttpRequest request = ((HttpRequest.Builder) 
> HttpRequest.builder().method("GET")).endpoint("http://foo.com/";).build()
>         HttpResponse response = HttpResponse.builder().build()
>         HttpResponseException original = new HttpResponseException(new 
> HttpCommand(request), response)
>         HttpResponseException copy = SerializableTester.reserialize(original)
>         assert copy != null
>     }
> {code}



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

Reply via email to