Examples of ObjectInputStreamWithClassLoader


Examples of org.hornetq.utils.ObjectInputStreamWithClassLoader

         ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest.newClassLoader(obj.getClass());
         Thread.currentThread().setContextClassLoader(testClassLoader);

         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
         org.hornetq.utils.ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(bais);

         Object deserializedObj = ois.readObject();

         Assert.assertNotSame(obj, deserializedObj);
         Assert.assertNotSame(obj.getClass(), deserializedObj.getClass());
         Assert.assertNotSame(obj.getClass().getClassLoader(), deserializedObj.getClass().getClassLoader());
         Assert.assertSame(testClassLoader, deserializedObj.getClass().getClassLoader());
View Full Code Here

Examples of org.hornetq.utils.ObjectInputStreamWithClassLoader

         ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest.newClassLoader(obj.getClass());
         Thread.currentThread().setContextClassLoader(testClassLoader);

         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
         org.hornetq.utils.ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(bais);

         Object deserializedObj = ois.readObject();

         Assert.assertNotSame(obj, deserializedObj);
         Assert.assertNotSame(obj.getClass(), deserializedObj.getClass());
         Assert.assertNotSame(obj.getClass().getClassLoader(), deserializedObj.getClass().getClassLoader());
         Assert.assertSame(testClassLoader, deserializedObj.getClass().getClassLoader());
View Full Code Here

Examples of org.hornetq.utils.ObjectInputStreamWithClassLoader

         ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest
               .newClassLoader(this.getClass());
         Thread.currentThread().setContextClassLoader(testClassLoader);
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
         org.hornetq.utils.ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(
               bais);

         Runnable toRun = (Runnable) testClassLoader.loadClass(
               ProxyReader.class.getName()).newInstance();
         toRun.getClass().getField("ois").set(toRun, ois);
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

            {
                // use system loader
                cl = SerializationHelper.class.getClassLoader();
            }
            ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(byteArray);
            ObjectInputStream objectinputstream = new ObjectInputStreamWithClassLoader(bytearrayinputstream,cl);
            Object obj = objectinputstream.readObject();
            return obj;
        }
        catch (OptionalDataException optionaldataexception)
        {
            throw new IOException(optionaldataexception.getMessage());
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

        //System.err.println(">> getException - clazz ("+className+") returned: "+clazz);
        if (cl==null)
        {
            cl=getClass().getClassLoader();
        }
        ObjectInputStream ois=new ObjectInputStreamWithClassLoader(new ByteArrayInputStream(data), cl);
        return (Throwable)ois.readObject();
    }
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

        if (cl==null)
        {
            cl = this.getClass().getClassLoader();
        }
        //System.err.println(">> class classLoader= "+cl);
        ObjectInputStream ois=new ObjectInputStreamWithClassLoader(new ByteArrayInputStream(data), cl);
        return ois.readObject();
    }
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

               String encodedPath = path.substring("/stub/".length());
               byte[] decodedPath = Base64.decode(encodedPath);

               ByteArrayInputStream bin = new ByteArrayInputStream(decodedPath);

               ObjectInputStream ois = new ObjectInputStreamWithClassLoader(bin, defaultClassLoader);
               try
               {
                  Object obj = ois.readObject();
                  rmiServer = (RMIServer) PortableRemoteObject.narrow(obj, RMIServer.class);
               }
               catch(ClassNotFoundException e)
               {
                  log.error("Could not find class " + e.getMessage() + " when loading stub.", e);
                  throw new MalformedURLException("Could not find class " + e.getMessage() + " when loading stub.");
               }
               catch(ClassCastException cce)
               {
                  log.error("Could not convert stub to RMIServer type.", cce);
                  throw new MalformedURLException("Could not convert stub to RMIServer type.");
               }
               finally
               {
                  if(ois != null)
                  {
                     ois.close();
                  }
               }
            }
            else
            {
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

            {
                // use system loader
                cl = SerializationHelper.class.getClassLoader();
            }
            ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(byteArray);
            ObjectInputStream objectinputstream = new ObjectInputStreamWithClassLoader(bytearrayinputstream,cl);
            Object obj = objectinputstream.readObject();
            return obj;
        }
        catch (OptionalDataException optionaldataexception)
        {
            throw new IOException(optionaldataexception.getMessage());
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

/* 70 */       if (cl == null)
/*    */       {
/* 73 */         cl = SerializationHelper.class.getClassLoader();
/*    */       }
/* 75 */       ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(byteArray);
/* 76 */       ObjectInputStream objectinputstream = new ObjectInputStreamWithClassLoader(bytearrayinputstream, cl);
/* 77 */       Object obj = objectinputstream.readObject();
/* 78 */       return obj;
/*    */     }
/*    */     catch (OptionalDataException optionaldataexception) {
/*    */     }
/* 82 */     throw new IOException(optionaldataexception.getMessage());
View Full Code Here

Examples of org.jboss.mx.server.ObjectInputStreamWithClassLoader

/*     */     try
/*     */     {
/* 276 */       is = this.ctxClassLoader.getResourceAsStream(element.getObject());
/* 277 */       if (is == null)
/* 278 */         throw new IllegalArgumentException("Object not found " + element.getObject());
/* 279 */       ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(is, this.ctxClassLoader);
/* 280 */       instance = ois.readObject();
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 284 */       throw new MBeanException(e);
/*     */     }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.