/[classpath]/classpath/java/io/ObjectStreamClass.java
ViewVC logotype

Diff of /classpath/java/io/ObjectStreamClass.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.32 by mkoch, Thu Apr 8 15:04:37 2004 UTC revision 1.33 by jfrijters, Sat Jul 10 07:57:31 2004 UTC
# Line 832  outer: Line 832  outer:
832      return fieldsArray;      return fieldsArray;
833    }    }
834    
835      /**
836       * Returns a new instance of the Class this ObjectStreamClass corresponds
837       * to.
838       * Note that this should only be used for Externalizable classes.
839       *
840       * @return A new instance.
841       */
842      Externalizable newInstance() throws InvalidClassException
843      {
844        synchronized(this)
845        {
846            if (constructor == null)
847            {
848                try
849                {
850                    final Constructor c = clazz.getConstructor(new Class[0]);
851    
852                    AccessController.doPrivileged(new PrivilegedAction()
853                    {
854                        public Object run()
855                        {
856                            c.setAccessible(true);
857                            return null;
858                        }
859                    });
860    
861                    constructor = c;
862                }
863                catch(NoSuchMethodException x)
864                {
865                    throw new InvalidClassException(clazz.getName(),
866                        "No public zero-argument constructor");
867                }
868            }
869        }
870    
871        try
872        {
873            return (Externalizable)constructor.newInstance(null);
874        }
875        catch(Throwable t)
876        {
877            throw (InvalidClassException)
878                new InvalidClassException(clazz.getName(),
879                         "Unable to instantiate").initCause(t);
880        }
881      }
882    
883    public static final ObjectStreamField[] NO_FIELDS = {};    public static final ObjectStreamField[] NO_FIELDS = {};
884    
885    private static Hashtable classLookupTable = new Hashtable();    private static Hashtable classLookupTable = new Hashtable();
# Line 861  outer: Line 909  outer:
909    boolean realClassIsExternalizable;    boolean realClassIsExternalizable;
910    ObjectStreamField[] fieldMapping;    ObjectStreamField[] fieldMapping;
911    Class firstNonSerializableParent;    Class firstNonSerializableParent;
912      private Constructor constructor;  // default constructor for Externalizable
913    
914    boolean isProxyClass = false;    boolean isProxyClass = false;
915    

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26