title: Code after readObject() does not run
body: <p>I am working on a UI which reads serialized object from zookeeper, deserializes it and then converts it into JSON. For some reason I am not able to deseerialize the MQTopic object. But I am able to do the same with other objects.</p>
  
  <p>This is the part which converts the byte[] into the MQTopic object.</p>
  
  <pre><code>if (tester != null &amp;&amp; tester.contains("com.ibm.mq.jms.MQTopic")) {
                  System.out.println(getValue());
                  ByteArrayInputStream in = new ByteArrayInputStream(this.value);
                  ObjectInputStream is = new ObjectInputStream(in);
                  System.out.println("after deserializing..");
                  topic = (MQTopic) is.readObject();
                  System.out.println("after typecasting..");
                  System.out.println(topic.getTopicName());
                  System.out.println(topic.toString());
  
                  is.close();
                  in.close();
  
              }
  </code></pre>
  
  <p>Here <strong>value</strong> is a byte array of the object after serialization.
  Nothing runs after <code>topic = (MQTopic) is.readObject();</code> . Not even the print statements. The program neither terminates nor an exception is thrown or caught.</p>
  
  <p><strong>EDIT</strong> : Whole Method</p>
  
  <pre><code>public String getStrValue() {
      FtpConnectionInfo ftp = null;
      MQTopic topic = null;
      try {
          String tester = new String(this.value, "UTF-8");
          if (tester != null &amp;&amp; tester.contains("FtpConnectionInfo")) {
              ByteArrayInputStream in = new ByteArrayInputStream(this.value);
              ObjectInputStream is = new ObjectInputStream(in);
              ftp = (FtpConnectionInfo) is.readObject();
              in.close();
              is.close();
              Gson gson = new Gson();
              return gson.toJson(ftp);
  
          } else if (tester != null
                  &amp;&amp; tester.contains("com.ibm.mq.jms.MQTopic")) {
              ByteArrayInputStream in = new ByteArrayInputStream(this.value);
              ObjectInputStream is = new ObjectInputStream(in);
              System.out.println("after deserializing..");
              topic = (MQTopic) is.readObject();
              System.out.println("after typecasting..");
              System.out.println(topic.getTopicName());
              System.out.println(topic.toString());
              is.close();
              in.close();
  
          } else {
              return new String(this.value, "UTF-8");
          }
      } catch (UnsupportedEncodingException ex) {
          System.out.println("unsupported error ");
          ex.printStackTrace();
          //logger.error(Arrays.toString(ex.getStackTrace()));
      } catch (Exception e) {
          System.out.println("Exception in new logic.");
          e.printStackTrace();
      }
      System.out.println("im out of try");
  
      return null;
  }
  </code></pre>
  
  <p>The FTP if loop works fine, but the Topic loop does not work beyond typecasting.</p>
  
  <p><strong>EDIT 2:</strong> This how the other team stores the object into Zookeeper</p>
  
  <pre><code>public static byte[] serialize(Object obj) throws IOException {
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          ObjectOutputStream os = new ObjectOutputStream(out);
          os.writeObject(obj);
          return out.toByteArray();
      }
  </code></pre>
  
  <p>The byte[] is stored in Zookeeper and that is what I am retrieving in my UI.</p>
  
  <p><strong>EDIT 3:</strong> I did a debug of the process and at the point where is is called, these are the values. Can anyone tell me if the object is right ?</p>
  
  <p><img src="https://i.stack.imgur.com/lUgOB.png" alt="is object"></p>