Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1200

org.jclouds.http.HttpResponseException fails to serialize

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.2
    • Fix Version/s: 2.2.0, 2.1.1
    • Component/s: jclouds-core
    • Labels:
      None

      Description

      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:

      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
      

      And here is a failing test that attempts to serialize a HttpResponseException instance:

          @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
          }
      

        Attachments

          Activity

            People

            • Assignee:
              gaul Andrew Gaul
              Reporter:
              ian.springer Ian Springer

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment