[jboss-cvs] JBossCache/src/org/jboss/cache/statetransfer ...

Manik Surtani msurtani at jboss.com
Thu Nov 9 08:43:25 EST 2006


  User: msurtani
  Date: 06/11/09 08:43:25

  Modified:    src/org/jboss/cache/statetransfer  Tag:
                        Branch_JBossCache_1_4_0 StateTransferFactory.java
  Log:
  Test for exceptions when creating marshalled value streams for interop with v.1.2.3
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +21 -13    JBossCache/src/org/jboss/cache/statetransfer/StateTransferFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StateTransferFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/statetransfer/StateTransferFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -b -r1.5 -r1.5.2.1
  --- StateTransferFactory.java	22 Apr 2006 05:08:13 -0000	1.5
  +++ StateTransferFactory.java	9 Nov 2006 13:43:25 -0000	1.5.2.1
  @@ -6,14 +6,14 @@
    */
   package org.jboss.cache.statetransfer;
   
  -import java.io.ByteArrayInputStream;
  -import java.io.IOException;
  -
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.Version;
   import org.jboss.invocation.MarshalledValueInputStream;
   
  +import java.io.ByteArrayInputStream;
  +import java.io.IOException;
  +
   public abstract class StateTransferFactory
   {
      private static final short RV_123 = Version.getVersionShort("1.2.3");
  @@ -66,17 +66,25 @@
         bais.mark(1024);      
         
         short version = 0;
  -      MarshalledValueInputStream in = new MarshalledValueInputStream(bais);
  +      MarshalledValueInputStream in = null;
  +      try {
  +         in = new MarshalledValueInputStream(bais);
  +      }
  +      catch (IOException e) {
  +         // No short at the head of the stream means version 123
  +         version = RV_123;
  +      }
  +
  +      try {
  +         if (in != null) {
         try {
  -         try
  -         {
               version = in.readShort();
            }
  -         catch (IOException io)
  -         {
  +            catch (IOException io) {
               // No short at the head of the stream means version 123
               version = RV_123;
            }
  +         }
            
            // Compiler won't let me use a switch
            
  @@ -96,7 +104,7 @@
         }
         finally {
            try {
  -            in.close();         
  +            if (in != null) in.close();
            }
            catch (IOException io) {}
         }
  
  
  



More information about the jboss-cvs-commits mailing list