Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
 
 
 package org.jboss.remoting.serialization.impl.java;
 
An ObjectOutputStream subclass used by the MarshalledValue class to ensure the classes and proxies are loaded using the thread context class loader. Currently this does not do anything as neither class or proxy annotations are used.

Author(s):
Scott.Stark@jboss.org
Clebert.suconic@jboss.org - refactored packages only
Version:
$Revision: 566 $
 
       extends ObjectOutputStream
 {
   
Creates a new instance of MarshalledValueOutputStream If there is a security manager installed, this method requires a SerializablePermission("enableSubstitution") permission to ensure it's ok to enable the stream to do replacement of objects in the stream.
 
    {
       super(os);
       EnableReplaceObjectAction.enableReplaceObject(this);
    }

   

Throws:
java.io.IOException Any exception thrown by the underlying OutputStream.
 
    protected void annotateClass(Class clthrows IOException
    {
       super.annotateClass(cl);
    }

   

Throws:
java.io.IOException Any exception thrown by the underlying OutputStream.
 
    protected void annotateProxyClass(Class clthrows IOException
    {
       super.annotateProxyClass(cl);
    }

   
Override replaceObject to check for Remote objects that are not RemoteStubs.
 
    protected Object replaceObject(Object objthrows IOException
    {
       if((obj instanceof Remote) && !(obj instanceof RemoteStub))
       {
          Remote remote = (Remoteobj;
          try
          {
             obj = RemoteObject.toStub(remote);
          }
          catch(IOException ignore)
          {
             // Let the Serialization layer try with the orignal obj
          }
       }
       return obj;
    }
 
    private static class EnableReplaceObjectAction implements PrivilegedAction
    {
      {
         this. = os;
      }
      public Object run()
      {
         .enableReplaceObject(true);
         return null;
      }
      {
         EnableReplaceObjectAction action = new EnableReplaceObjectAction(os);
         AccessController.doPrivileged(action);
      }
   }
New to GrepCode? Check out our FAQ X