[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath

Kaffe CVS cvs-commits at kaffe.org
Fri Jan 2 19:25:03 PST 2004


PatchSet 4268 
Date: 2004/01/03 03:08:28
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath

2004-01-03  Dalibor Topic <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2003-12-29 Guilhem Lavaux <guilhem at kaffe.org>

        * java/io/ObjectInputStream.java: Use if instead of catching
        NullPointerException.

        2003-12-28  Guilhem Lavaux <guilhem at kaffe.org>

        * java/io/ObjectInputStream.java: Reindented. Some exception message
        has been added.

Members: 
	ChangeLog:1.1855->1.1856 
	libraries/javalib/java/io/ObjectInputStream.java:1.28->1.29 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1855 kaffe/ChangeLog:1.1856
--- kaffe/ChangeLog:1.1855	Sat Jan  3 02:54:38 2004
+++ kaffe/ChangeLog	Sat Jan  3 03:08:28 2004
@@ -2,6 +2,20 @@
 
 	Resynced with GNU Classpath.
 
+	2003-12-29 Guilhem Lavaux <guilhem at kaffe.org>
+
+        * java/io/ObjectInputStream.java: Use if instead of catching
+        NullPointerException.
+
+	2003-12-28  Guilhem Lavaux <guilhem at kaffe.org>
+
+        * java/io/ObjectInputStream.java: Reindented. Some exception message
+        has been added.
+
+2004-01-03  Dalibor Topic <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2003-12-28  Guilhem Lavaux <guilhem at kaffe.org>
 
         * java/io/LineNumberReader.java
Index: kaffe/libraries/javalib/java/io/ObjectInputStream.java
diff -u kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.28 kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.29
--- kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.28	Tue Dec 23 20:18:55 2003
+++ kaffe/libraries/javalib/java/io/ObjectInputStream.java	Sat Jan  3 03:08:30 2004
@@ -47,6 +47,7 @@
 import java.util.Hashtable;
 import java.util.Vector;
 
+
 import gnu.java.io.ObjectIdentityWrapper;
 import gnu.java.lang.reflect.TypeSignature;
 import java.lang.reflect.Field;
@@ -72,7 +73,7 @@
    *
    * @see #readStreamHeader()
    */
-  public ObjectInputStream (InputStream in)
+  public ObjectInputStream(InputStream in)
     throws IOException, StreamCorruptedException
   {
     if (Configuration.DEBUG)
@@ -95,13 +96,13 @@
     this.blockDataPosition = 0;
     this.blockDataBytes = 0;
     this.blockData = new byte[BUFFER_SIZE];
-    this.blockDataInput = new DataInputStream (this);
-    this.realInputStream = new DataInputStream (in);
+    this.blockDataInput = new DataInputStream(this);
+    this.realInputStream = new DataInputStream(in);
     this.nextOID = baseWireHandle;
     this.objectLookupTable = new Hashtable();
     this.validators = new Vector();
     this.classLookupTable = new Hashtable();
-    setBlockDataMode (true);
+    setBlockDataMode(true);
     readStreamHeader();
   }
 
@@ -121,10 +122,10 @@
    * @exception IOException Exception from underlying
    * <code>InputStream</code>.
    */
-  public final Object readObject () throws ClassNotFoundException, IOException
+  public final Object readObject() throws ClassNotFoundException, IOException
   {
     if (this.useSubclassMethod)
-      return readObjectOverride ();
+      return readObjectOverride();
 
     boolean was_deserializing;
 
@@ -132,12 +133,12 @@
     was_deserializing = this.isDeserializing;
 
     boolean is_consumed = false;
-    boolean old_mode = setBlockDataMode (false);
+    boolean old_mode = setBlockDataMode(false);
 
     this.isDeserializing = true;
 
-    byte marker = this.realInputStream.readByte ();
-    dumpElement ("MARKER: 0x" + Integer.toHexString(marker) + " ");
+    byte marker = this.realInputStream.readByte();
+    dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " ");
 
     try
       {
@@ -154,43 +155,43 @@
 	  case TC_BLOCKDATALONG:
 	    {
 	      if (marker == TC_BLOCKDATALONG)
-		dumpElementln ("BLOCKDATALONG");
+		dumpElementln("BLOCKDATALONG");
 	      else
-		dumpElementln ("BLOCKDATA");
-	      readNextBlock (marker);
-	      throw new StreamCorruptedException ("Unexpected blockData");
+		dumpElementln("BLOCKDATA");
+	      readNextBlock(marker);
+	      throw new StreamCorruptedException("Unexpected blockData");
 	    }
 
 	  case TC_NULL:
 	    {
-	      dumpElementln ("NULL");
+	      dumpElementln("NULL");
 	      ret_val = null;
 	      break;
 	    }
 
 	  case TC_REFERENCE:
 	    {
-	      dumpElement ("REFERENCE ");
-	      Integer oid = new Integer (this.realInputStream.readInt ());
-	      dumpElementln (Integer.toHexString(oid.intValue()));
+	      dumpElement("REFERENCE ");
+	      Integer oid = new Integer(this.realInputStream.readInt());
+	      dumpElementln(Integer.toHexString(oid.intValue()));
 	      ret_val = ((ObjectIdentityWrapper)
-			 this.objectLookupTable.get (oid)).object;
+			 this.objectLookupTable.get(oid)).object;
 	      break;
 	    }
 
 	  case TC_CLASS:
 	    {
-	      dumpElementln ("CLASS");
-	      ObjectStreamClass osc = (ObjectStreamClass)readObject ();
-	      Class clazz = osc.forClass ();
-	      assignNewHandle (clazz);
+	      dumpElementln("CLASS");
+	      ObjectStreamClass osc = (ObjectStreamClass)readObject();
+	      Class clazz = osc.forClass();
+	      assignNewHandle(clazz);
 	      ret_val = clazz;
 	      break;
 	    }
 
 	  case TC_PROXYCLASSDESC:
 	    {
-	      dumpElementln ("PROXYCLASS");
+	      dumpElementln("PROXYCLASS");
 	      int n_intf = this.realInputStream.readInt();
 	      String[] intfs = new String[n_intf];
 	      for (int i = 0; i < n_intf; i++)
@@ -199,41 +200,41 @@
 		  System.out.println(intfs[i]);
 		}
 	      
-	      boolean oldmode = setBlockDataMode (true);
+	      boolean oldmode = setBlockDataMode(true);
 	      Class cl = resolveProxyClass(intfs);
 	      setBlockDataMode(oldmode);
 	      
-	      ObjectStreamClass osc = lookupClass (cl);
-	      assignNewHandle (osc);
+	      ObjectStreamClass osc = lookupClass(cl);
+	      assignNewHandle(osc);
 	      
 	      if (!is_consumed)
 		{
-		  byte b = this.realInputStream.readByte ();
+		  byte b = this.realInputStream.readByte();
 		  if (b != TC_ENDBLOCKDATA)
-		    throw new IOException ("Data annotated to class was not consumed." + b);
+		    throw new IOException("Data annotated to class was not consumed." + b);
 		}
 	      else
 		is_consumed = false;
-	      ObjectStreamClass superosc = (ObjectStreamClass)readObject ();
-	      osc.setSuperclass (superosc);
+	      ObjectStreamClass superosc = (ObjectStreamClass)readObject();
+	      osc.setSuperclass(superosc);
 	      ret_val = osc;
 	      break;
 	    }
 
 	  case TC_CLASSDESC:
 	    {
-	      ObjectStreamClass osc = readClassDescriptor ();
+	      ObjectStreamClass osc = readClassDescriptor();
 	      
 	      if (!is_consumed)
 		{
-		  byte b = this.realInputStream.readByte ();
+		  byte b = this.realInputStream.readByte();
 		  if (b != TC_ENDBLOCKDATA)
-		    throw new IOException ("Data annotated to class was not consumed." + b);
+		    throw new IOException("Data annotated to class was not consumed." + b);
 		}
 	      else
 		is_consumed = false;
 	      
-	      osc.setSuperclass ((ObjectStreamClass)readObject ());
+	      osc.setSuperclass ((ObjectStreamClass)readObject());
 	      ret_val = osc;
 	      break;
 	    }
@@ -241,105 +242,107 @@
 	  case TC_STRING:
 	  case TC_LONGSTRING:
 	    {
-	      dumpElement ("STRING=");
-	      String s = this.realInputStream.readUTF ();
-	      dumpElementln (s);
-	      ret_val = processResolution (s, assignNewHandle (s));
+	      dumpElement("STRING=");
+	      String s = this.realInputStream.readUTF();
+	      dumpElementln(s);
+	      ret_val = processResolution(s, assignNewHandle(s));
 	      break;
 	    }
 
 	  case TC_ARRAY:
 	    {
-	      dumpElementln ("ARRAY");
-	      ObjectStreamClass osc = (ObjectStreamClass)readObject ();
-	      Class componentType = osc.forClass ().getComponentType ();
-	      dumpElement ("ARRAY LENGTH=");
-	      int length = this.realInputStream.readInt ();
+	      dumpElementln("ARRAY");
+	      ObjectStreamClass osc = (ObjectStreamClass)readObject();
+	      Class componentType = osc.forClass().getComponentType();
+	      dumpElement("ARRAY LENGTH=");
+	      int length = this.realInputStream.readInt();
 	      dumpElementln (length + "; COMPONENT TYPE=" + componentType);
-	      Object array = Array.newInstance (componentType, length);
-	      int handle = assignNewHandle (array);
-	      readArrayElements (array, componentType);
-	      for (int i=0, len=Array.getLength(array); i < len; i++)
-		dumpElementln ("  ELEMENT[" + i + "]=" + Array.get(array, i));
-	      ret_val = processResolution (array, handle);
+	      Object array = Array.newInstance(componentType, length);
+	      int handle = assignNewHandle(array);
+	      readArrayElements(array, componentType);
+	      for (int i = 0, len = Array.getLength(array); i < len; i++)
+		dumpElementln("  ELEMENT[" + i + "]=" + Array.get(array, i));
+	      ret_val = processResolution(array, handle);
 	      break;
 	    }
 
 	  case TC_OBJECT:
 	    {
-	      dumpElementln ("OBJECT");
-	      ObjectStreamClass osc = (ObjectStreamClass)readObject ();
-	      Class clazz = osc.forClass ();
+	      dumpElementln("OBJECT");
+	      ObjectStreamClass osc = (ObjectStreamClass)readObject();
+	      Class clazz = osc.forClass();
 	      
-	      if (!Serializable.class.isAssignableFrom (clazz))
-		throw new NotSerializableException (clazz + " is not Serializable, and thus cannot be deserialized.");
+	      if (!Serializable.class.isAssignableFrom(clazz))
+		throw new NotSerializableException
+		  (clazz + " is not Serializable, and thus cannot be deserialized.");
 	      
-	      if (Externalizable.class.isAssignableFrom (clazz))
+	      if (Externalizable.class.isAssignableFrom(clazz))
 		{
 		  Externalizable obj = null;
 		  
 		  try
 		    {
-		      obj = (Externalizable)clazz.newInstance ();
+		      obj = (Externalizable)clazz.newInstance();
 		    }
 		  catch (InstantiationException e)
 		    {
-		      throw new ClassNotFoundException ("Instance of " + clazz
-							+ " could not be created");
+		      throw new ClassNotFoundException
+			("Instance of " + clazz + " could not be created");
 		    }
 		  catch (IllegalAccessException e)
 		    {
-		      throw new ClassNotFoundException ("Instance of " + clazz
-							+ " could not be created because class or zero-argument constructor is not accessible");
+		      throw new ClassNotFoundException
+			("Instance of " + clazz + " could not be created because class or "
+			 + "zero-argument constructor is not accessible");
 		    }
 		  catch (NoSuchMethodError e)
 		    {
-		      throw new ClassNotFoundException ("Instance of " + clazz
-							+ " could not be created because zero-argument constructor is not defined");
+		      throw new ClassNotFoundException
+			("Instance of " + clazz
+			 + " could not be created because zero-argument constructor is not defined");
 		    }
 		  
-		  int handle = assignNewHandle (obj);
+		  int handle = assignNewHandle(obj);
 		  
-		  boolean read_from_blocks = ((osc.getFlags () & SC_BLOCK_DATA) != 0);
+		  boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
 		  
 		  boolean oldmode = this.readDataFromBlock;
 		  if (read_from_blocks)
-		    setBlockDataMode (true);
+		    setBlockDataMode(true);
 		  
-		  obj.readExternal (this);
+		  obj.readExternal(this);
 		  
 		  if (read_from_blocks)
-		    setBlockDataMode (oldmode);
+		    setBlockDataMode(oldmode);
 		  
-		  ret_val = processResolution (obj, handle);
+		  ret_val = processResolution(obj, handle);
 		  break;
 		} // end if (Externalizable.class.isAssignableFrom (clazz))
 	      
 	      // find the first non-serializable, non-abstract
 	      // class in clazz's inheritance hierarchy
-	      Class first_nonserial = clazz.getSuperclass ();
-	      while (Serializable.class.isAssignableFrom (first_nonserial)
-		     || Modifier.isAbstract (first_nonserial.getModifiers ()))
-		first_nonserial = first_nonserial.getSuperclass ();
+	      Class first_nonserial = clazz.getSuperclass();
+	      while (Serializable.class.isAssignableFrom(first_nonserial)
+		     || Modifier.isAbstract(first_nonserial.getModifiers()))
+		first_nonserial = first_nonserial.getSuperclass();
 	      
 	      Object obj = null;
-	      obj = newObject (clazz, first_nonserial);
+	      obj = newObject(clazz, first_nonserial);
 	      
 	      if (obj == null)
-		throw new ClassNotFoundException ("Instance of " + clazz +
-						  " could not be created");
+		throw new ClassNotFoundException
+		  ("Instance of " + clazz + " could not be created");
 	      
-	      int handle = assignNewHandle (obj);
+	      int handle = assignNewHandle(obj);
 	      this.currentObject = obj;
 	      ObjectStreamClass[] hierarchy =
-		inputGetObjectStreamClasses (clazz);
+		inputGetObjectStreamClasses(clazz);
 	      
-	      for (int i=0; i < hierarchy.length; i++)
+	      for (int i = 0; i < hierarchy.length; i++)
 		{
 		  this.currentObjectStreamClass = hierarchy[i];
 		  
-		  dumpElementln ("Reading fields of "
-				 + this.currentObjectStreamClass.getName ());
+		  dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
 
 		  // XXX: should initialize fields in classes in the hierarchy
 		  // that aren't in the stream
@@ -349,68 +352,69 @@
 		  if (this.currentObjectStreamClass.hasReadMethod())
 		    {
 		      fieldsAlreadyRead = false;
-		      boolean oldmode = setBlockDataMode (true);
-		      callReadMethod (obj, this.currentObjectStreamClass);
-		      setBlockDataMode (oldmode);
-		      dumpElement ("ENDBLOCKDATA? ");
+		      boolean oldmode = setBlockDataMode(true);
+		      callReadMethod(obj, this.currentObjectStreamClass);
+		      setBlockDataMode(oldmode);
+		      dumpElement("ENDBLOCKDATA? ");
 		      try
 			{
 			  // FIXME: XXX: This try block is to catch EOF which is
 			  // thrown for some objects.  That indicates a bug in the logic.
-			  if (this.realInputStream.readByte () != TC_ENDBLOCKDATA)
-			    throw new IOException ("No end of block data seen for class with readObject (ObjectInputStream) method.");
-			  dumpElementln ("yes");
+			  if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
+			    throw new IOException
+			      ("No end of block data seen for class with readObject (ObjectInputStream) method.");
+			  dumpElementln("yes");
 			}
 		      catch (EOFException e)
 			{
-			  dumpElementln ("no, got EOFException");
+			  dumpElementln("no, got EOFException");
 			}
 		      catch (IOException e)
 			{
-			  dumpElementln ("no, got IOException");
+			  dumpElementln("no, got IOException");
 			}
 		    }
 		  else
 		    {
-		      readFields (obj, currentObjectStreamClass);
+		      readFields(obj, currentObjectStreamClass);
 		    }
 		}
 
 	      this.currentObject = null;
 	      this.currentObjectStreamClass = null;
-	      ret_val = processResolution (obj, handle);
+	      ret_val = processResolution(obj, handle);
 	      break;
 	    }
 
 	  case TC_RESET:
-	    dumpElementln ("RESET");
-	    clearHandles ();
-	    ret_val = readObject ();
+	    dumpElementln("RESET");
+	    clearHandles();
+	    ret_val = readObject();
 	    break;
 
 	  case TC_EXCEPTION:
 	    {
-	      dumpElement ("EXCEPTION=");
-	      Exception e = (Exception)readObject ();
-	      dumpElementln (e.toString());
-	      clearHandles ();
-	      throw new WriteAbortedException ("Exception thrown during writing of stream", e);
+	      dumpElement("EXCEPTION=");
+	      Exception e = (Exception)readObject();
+	      dumpElementln(e.toString());
+	      clearHandles();
+	      throw new WriteAbortedException("Exception thrown during writing of stream", e);
 	    }
 
 	  default:
-	    throw new IOException ("Unknown marker on stream: " + marker);
+	    throw new IOException("Unknown marker on stream: " + marker);
 	  }
       }
     finally
       {
-	setBlockDataMode (old_mode);
+	setBlockDataMode(old_mode);
 	
 	this.isDeserializing = was_deserializing;
 	
 	if (! was_deserializing)
 	  {
-	    if (validators.size () > 0)
-	      invokeValidators ();
+	    if (validators.size() > 0)
+	      invokeValidators();
 	  }
       }
     
@@ -433,74 +437,72 @@
    * @throws InvalidClassException If there was a compatibility problem
    * between the class present in the system and the serialized class.
    */
-  protected ObjectStreamClass readClassDescriptor ()
+  protected ObjectStreamClass readClassDescriptor()
     throws ClassNotFoundException, IOException
   {
-    dumpElement ("CLASSDESC NAME=");
-    String name = this.realInputStream.readUTF ();
-    dumpElement (name + "; UID=");
+    dumpElement("CLASSDESC NAME=");
+    String name = this.realInputStream.readUTF();
+    dumpElement(name + "; UID=");
     long uid = this.realInputStream.readLong ();
-    dumpElement (Long.toHexString(uid) + "; FLAGS=");
+    dumpElement(Long.toHexString(uid) + "; FLAGS=");
     byte flags = this.realInputStream.readByte ();
-    dumpElement (Integer.toHexString(flags) + "; FIELD COUNT=");
-    short field_count = this.realInputStream.readShort ();
-    dumpElementln (Short.toString(field_count));
+    dumpElement(Integer.toHexString(flags) + "; FIELD COUNT=");
+    short field_count = this.realInputStream.readShort();
+    dumpElementln(Short.toString(field_count));
     ObjectStreamField[] fields = new ObjectStreamField[field_count];
-    ObjectStreamClass osc = new ObjectStreamClass (name, uid,
-                                                   flags, fields);
-    assignNewHandle (osc);
+    ObjectStreamClass osc = new ObjectStreamClass(name, uid,
+						  flags, fields);
+    assignNewHandle(osc);
 	      
-    int real_count;
-    for (int i=0; i < field_count; i++)
+    for (int i = 0; i < field_count; i++)
       {
-	dumpElement ("  TYPE CODE=");
-	char type_code = (char)this.realInputStream.readByte ();
-	dumpElement (type_code + "; FIELD NAME=");
-	String field_name = this.realInputStream.readUTF ();
-	dumpElementln (field_name);
+	dumpElement("  TYPE CODE=");
+	char type_code = (char)this.realInputStream.readByte();
+	dumpElement(type_code + "; FIELD NAME=");
+	String field_name = this.realInputStream.readUTF();
+	dumpElementln(field_name);
 	String class_name;
-	
+		  
 	// If the type code is an array or an object we must
 	// decode a String here. In the other case we convert
 	// the type code and pass it to ObjectStreamField.
 	// Type codes are decoded by gnu.java.lang.reflect.TypeSignature.
 	if (type_code == 'L' || type_code == '[')
-	  class_name = (String)readObject ();
+	  class_name = (String)readObject();
 	else
-	  class_name = String.valueOf (type_code);
-
+	  class_name = String.valueOf(type_code);
+		  
 	fields[i] =
-	  new ObjectStreamField (field_name, class_name, currentLoader());
+	  new ObjectStreamField(field_name, class_name, currentLoader());
       }
-
-
+	      
     /* Now that fields have been read we may resolve the class
      * (and read annotation if needed). */
     Class clazz = resolveClass(osc);
     
-    for (int i=0; i < field_count; i++)
+    for (int i = 0; i < field_count; i++)
       {
 	Field f;
 	
 	try
 	  {
-	    f = clazz.getDeclaredField (fields[i].getName());
+	    f = clazz.getDeclaredField(fields[i].getName());
 	    if (f != null && !f.getType().equals(fields[i].getType()))
-	      throw new InvalidClassException("invalid field type for " +
-			      fields[i].getName() + " in class " + name +
-			      " (requested was \"" + fields[i].getType() +
-			      " and found \"" + f.getType() + "\")"); 
+	      throw new InvalidClassException
+		("invalid field type for " + fields[i].getName() + " in class "
+		 + name + " (requested was \"" + fields[i].getType()
+		 + " and found \"" + f.getType() + "\")"); 
 	  }
 	catch (NoSuchFieldException _)
 	  {
 	  }
       }
 
-    boolean oldmode = setBlockDataMode (true);
-    osc.setClass (clazz, lookupClass (clazz.getSuperclass()));
-    classLookupTable.put (clazz, osc);
-    setBlockDataMode (oldmode);
-	      
+    boolean oldmode = setBlockDataMode(true);
+    osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
+    classLookupTable.put(clazz, osc);
+    setBlockDataMode(oldmode);
+
     return osc;
   }
 
@@ -523,20 +525,20 @@
    * @exception IOException Exception from underlying
    * <code>OutputStream</code>.
    */
-  public void defaultReadObject ()
+  public void defaultReadObject()
     throws ClassNotFoundException, IOException, NotActiveException
   {
     if (this.currentObject == null || this.currentObjectStreamClass == null)
-      throw new NotActiveException ("defaultReadObject called by non-active"
-				    + " class and/or object");
+      throw new NotActiveException("defaultReadObject called by non-active"
+				   + " class and/or object");
 
     if (fieldsAlreadyRead)
-      throw new NotActiveException ("defaultReadObject called but fields "
-				    + "already read from stream (by "
-				    + "defaultReadObject or readFields)");
+      throw new NotActiveException("defaultReadObject called but fields "
+				   + "already read from stream (by "
+				   + "defaultReadObject or readFields)");
 
     boolean oldmode = setBlockDataMode(false);
-    readFields (this.currentObject, this.currentObjectStreamClass);
+    readFields(this.currentObject, this.currentObjectStreamClass);
     setBlockDataMode(oldmode);
 
     fieldsAlreadyRead = true;
@@ -561,20 +563,20 @@
    * validator outside of the <code>readObject</code> method of the
    * object currently being deserialized
    */
-  public void registerValidation (ObjectInputValidation validator,
-				  int priority)
+  public void registerValidation(ObjectInputValidation validator,
+				 int priority)
     throws InvalidObjectException, NotActiveException
   {
     if (this.currentObject == null || this.currentObjectStreamClass == null)
-      throw new NotActiveException ("registerValidation called by non-active "
-				    +"class and/or object");
+      throw new NotActiveException("registerValidation called by non-active "
+				   + "class and/or object");
 
     if (validator == null)
-      throw new InvalidObjectException ("attempt to add a null "
-					+"ObjectInputValidation object");
+      throw new InvalidObjectException("attempt to add a null "
+				       + "ObjectInputValidation object");
 
-    this.validators.addElement (new ValidatorAndPriority (validator,
-							  priority));
+    this.validators.addElement(new ValidatorAndPriority (validator,
+							 priority));
   }
 
 
@@ -594,10 +596,10 @@
    *
    * @see java.io.ObjectOutputStream#annotateClass (java.lang.Class)
    */
-  protected Class resolveClass (ObjectStreamClass osc)
+  protected Class resolveClass(ObjectStreamClass osc)
     throws ClassNotFoundException, IOException
   {
-    return Class.forName (osc.getName(), true, currentLoader()); 
+    return Class.forName(osc.getName(), true, currentLoader());
   }
 
   /**
@@ -608,13 +610,13 @@
    * @return The most recent non-system ClassLoader on the execution stack.
    * @see java.lang.SecurityManager#currentClassLoader()
    */
-  private ClassLoader currentLoader ()
+  private ClassLoader currentLoader()
   {
-    SecurityManager sm = System.getSecurityManager ();
+    SecurityManager sm = System.getSecurityManager();
     if (sm == null)
       sm = new SecurityManager () {};
- 
-    return currentClassLoader (sm);
+    
+    return currentClassLoader(sm);
   }
 
   /**
@@ -624,17 +626,17 @@
    * the behaviour detected in the JDK by Kaffe's team.
    *
    * @param clazz Class to lookup in the hash table or for which
-   * we must build a descriptor. 
+   * we must build a descriptor.
    * @return A valid instance of ObjectStreamClass corresponding
    * to the specified class.
    */
-  private ObjectStreamClass lookupClass (Class clazz)
+  private ObjectStreamClass lookupClass(Class clazz)
   {
     ObjectStreamClass oclazz;
-    
-    oclazz = (ObjectStreamClass) classLookupTable.get(clazz);
+
+    oclazz = (ObjectStreamClass)classLookupTable.get(clazz);
     if (oclazz == null)
-      return ObjectStreamClass.lookup (clazz);
+      return ObjectStreamClass.lookup(clazz);
     else
       return oclazz;
   }
@@ -651,32 +653,32 @@
    * @return An array of valid {@link java.io.ObjectStreamClass} instances which
    * represent the class hierarchy for clazz.
    */
-  private ObjectStreamClass[] inputGetObjectStreamClasses (Class clazz)
+  private ObjectStreamClass[] inputGetObjectStreamClasses(Class clazz)
   {
-    ObjectStreamClass osc = lookupClass (clazz);
+    ObjectStreamClass osc = lookupClass(clazz);
 
     ObjectStreamClass[] ret_val;
 
     if (osc == null)
       return new ObjectStreamClass[0];
     else
-    {
-      Vector oscs = new Vector ();
-
-      while (osc != null)
       {
-	oscs.addElement (osc);
-	osc = osc.getSuper ();
-      }
+        Vector oscs = new Vector();
 
-      int count = oscs.size ();
-      ObjectStreamClass[] sorted_oscs = new ObjectStreamClass[ count ];
+        while (osc != null)
+          {
+            oscs.addElement(osc);
+            osc = osc.getSuper();
+	  }
 
-      for (int i = count - 1; i >= 0; i--)
-	sorted_oscs[ count - i - 1 ] = (ObjectStreamClass)oscs.elementAt (i);
+        int count = oscs.size();
+	ObjectStreamClass[] sorted_oscs = new ObjectStreamClass[count];
 
-      return sorted_oscs;
-    }
+        for (int i = count - 1; i >= 0; i--)
+          sorted_oscs[count - i - 1] = (ObjectStreamClass) oscs.elementAt(i);
+
+        return sorted_oscs;
+      }
   }
 
   /**
@@ -692,36 +694,40 @@
    *
    * @see #enableResolveObject(boolean)
    */
-  protected Object resolveObject (Object obj) throws IOException
+  protected Object resolveObject(Object obj) throws IOException
   {
     return obj;
   }
 
 
-  protected Class resolveProxyClass (String[] intfs)
+  protected Class resolveProxyClass(String[] intfs)
     throws IOException, ClassNotFoundException
   {
-    SecurityManager sm = System.getSecurityManager ();
+    SecurityManager sm = System.getSecurityManager();
     
     if (sm == null)
-      sm = new SecurityManager () {};
+      sm = new SecurityManager() {};
     
-    ClassLoader cl = currentClassLoader (sm);
+    ClassLoader cl = currentClassLoader(sm);
     
     Class[] clss = new Class[intfs.length];
-    if(cl == null){
-      for (int i = 0; i < intfs.length; i++)
-	clss[i] = Class.forName(intfs[i]);
-      cl = ClassLoader.getSystemClassLoader();
-    }
+    if(cl == null)
+      {
+	for (int i = 0; i < intfs.length; i++)
+	  clss[i] = Class.forName(intfs[i]);
+	cl = ClassLoader.getSystemClassLoader();
+      }
     else
       for (int i = 0; i < intfs.length; i++)
 	clss[i] = cl.loadClass(intfs[i]);
-    try {
-      return Proxy.getProxyClass(cl, clss);
-    } catch (IllegalArgumentException e) {
-      throw new ClassNotFoundException(null, e);
-    }
+    try 
+      {
+	return Proxy.getProxyClass(cl, clss);
+      } 
+    catch (IllegalArgumentException e) 
+      {
+	throw new ClassNotFoundException(null, e);
+      }
   }
   
   /**
@@ -737,9 +743,9 @@
   {
     if (enable)
       {
-	SecurityManager sm = System.getSecurityManager ();
+	SecurityManager sm = System.getSecurityManager();
 	if (sm != null)
-	  sm.checkPermission (new SerializablePermission ("enableSubstitution"));
+	  sm.checkPermission(new SerializablePermission("enableSubstitution"));
       }
 
     boolean old_val = this.resolveEnabled;
@@ -756,31 +762,31 @@
    * @exception StreamCorruptedException An invalid stream magic
    * number or stream version was read from the stream.
    */
-  protected void readStreamHeader ()
+  protected void readStreamHeader()
     throws IOException, StreamCorruptedException
   {
-    dumpElement ("STREAM MAGIC ");
-    if (this.realInputStream.readShort () != STREAM_MAGIC)
-      throw new StreamCorruptedException ("Invalid stream magic number");
+    dumpElement("STREAM MAGIC ");
+    if (this.realInputStream.readShort() != STREAM_MAGIC)
+      throw new StreamCorruptedException("Invalid stream magic number");
 
-    dumpElementln ("STREAM VERSION ");
-    if (this.realInputStream.readShort () != STREAM_VERSION)
-      throw new StreamCorruptedException ("Invalid stream version number");
+    dumpElementln("STREAM VERSION ");
+    if (this.realInputStream.readShort() != STREAM_VERSION)
+      throw new StreamCorruptedException("Invalid stream version number");
   }
 
-  public int read () throws IOException
+  public int read() throws IOException
   {
     if (this.readDataFromBlock)
       {
 	if (this.blockDataPosition >= this.blockDataBytes)
-	  readNextBlock ();
+	  readNextBlock();
 	return (this.blockData[this.blockDataPosition++] & 0xff);
       }
     else
-      return this.realInputStream.read ();
+      return this.realInputStream.read();
   }
 
-  public int read (byte[] data, int offset, int length) throws IOException
+  public int read(byte[] data, int offset, int length) throws IOException
   {
     if (this.readDataFromBlock)
       {
@@ -789,25 +795,25 @@
 	    int remain = this.blockDataBytes - this.blockDataPosition;
 	    if (remain != 0)
 	      {
-		System.arraycopy (this.blockData, this.blockDataPosition,
-				  data, offset, remain);
+		System.arraycopy(this.blockData, this.blockDataPosition,
+				 data, offset, remain);
 		offset += remain;
 		length -= remain;
 	      }
 	    readNextBlock ();
 	  }
 
-	System.arraycopy (this.blockData, this.blockDataPosition,
-			  data, offset, length);
+	System.arraycopy(this.blockData, this.blockDataPosition,
+			 data, offset, length);
 	this.blockDataPosition += length;
 
 	return length;
       }
     else
-      return this.realInputStream.read (data, offset, length);
+      return this.realInputStream.read(data, offset, length);
   }
 
-  public int available () throws IOException
+  public int available() throws IOException
   {
     if (this.readDataFromBlock)
       {
@@ -817,15 +823,15 @@
 	return this.blockDataBytes - this.blockDataPosition;
       }
     else
-      return this.realInputStream.available ();
+      return this.realInputStream.available();
   }
 
-  public void close () throws IOException
+  public void close() throws IOException
   {
-    this.realInputStream.close ();
+    this.realInputStream.close();
   }
 
-  public boolean readBoolean () throws IOException
+  public boolean readBoolean() throws IOException
   {
     boolean switchmode = true;
     boolean oldmode = this.readDataFromBlock;
@@ -839,160 +845,160 @@
     return value;
   }
 
-  public byte readByte () throws IOException
+  public byte readByte() throws IOException
   {
     boolean switchmode = true;
     boolean oldmode = this.readDataFromBlock;
     if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1)
       switchmode = false;
     if (switchmode)
-      oldmode = setBlockDataMode (true);
-    byte value = this.dataInputStream.readByte ();
+      oldmode = setBlockDataMode(true);
+    byte value = this.dataInputStream.readByte();
     if (switchmode)
-      setBlockDataMode (oldmode);
+      setBlockDataMode(oldmode);
     return value;
   }
 
-  public int readUnsignedByte () throws IOException
+  public int readUnsignedByte() throws IOException
   {
     boolean switchmode = true;
     boolean oldmode = this.readDataFromBlock;
     if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1)
       switchmode = false;
     if (switchmode)
-      oldmode = setBlockDataMode (true);
-    int value = this.dataInputStream.readUnsignedByte ();
+      oldmode = setBlockDataMode(true);
+    int value = this.dataInputStream.readUnsignedByte();
     if (switchmode)
-      setBlockDataMode (oldmode);
+      setBlockDataMode(oldmode);
     return value;
   }
 
-  public short readShort () throws IOException
+  public short readShort() throws IOException
   {
     boolean switchmode = true;
     boolean oldmode = this.readDataFromBlock;
     if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2)
       switchmode = false;
     if (switchmode)
-      oldmode = setBlockDataMode (true);
-    short value = this.dataInputStream.readShort ();
+      oldmode = setBlockDataMode(true);
+    short value = this.dataInputStream.readShort();
     if (switchmode)
-      setBlockDataMode (oldmode);
+      setBlockDataMode(oldmode);
     return value;
   }
 
-  public int readUnsignedShort () throws IOException
+  public int readUnsignedShort() throws IOException
   {
     boolean switchmode = true;
     boolean oldmode = this.readDataFromBlock;
     if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2)
       switchmode = false;
     if (switchmode)
-      oldmode = setBlockDataMode (true);
-    int value = this.dataInputStream.readUnsignedShort ();
+      oldmode = setBlockDataMode(true);
+    int value = this.dataInputStream.readUnsignedShort();
     if (switchmode)
-      setBlockDataMode (oldmode);
+      setBlockDataMode(oldmode);
     return value;
   }
 
-  public char readChar () throws IOException
+  public char readChar() throws IOException
   {
     boolean switchmode = true;
     boolean oldmode = this.readDataFromBlock;
     if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2)
       switchmode = false;
     if (switchmode)
-      oldmode = setBlockDataMode (true);
-    char value = this.dataInputStream.readChar ();
+      oldmode = setBlockDataMode(true);
+    char value = this.dataInputStream.readChar();
     if (switchmode)
-      setBlockDataMode (oldmode);
+      setBlockDataMode(oldmode);
     return value;
   }

*** Patch too long, truncated ***




More information about the kaffe mailing list