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

Diff of /classpath/java/io/ObjectInputStream.java

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

revision 1.60 by jfrijters, Fri Aug 5 08:28:17 2005 UTC revision 1.61 by jfrijters, Sun Aug 7 12:25:10 2005 UTC
# Line 528  public class ObjectInputStream extends I Line 528  public class ObjectInputStream extends I
528                                
529      /* Now that fields have been read we may resolve the class      /* Now that fields have been read we may resolve the class
530       * (and read annotation if needed). */       * (and read annotation if needed). */
531      Class clazz;      Class clazz = resolveClass(osc);
     try  
       {  
         clazz = resolveClass(osc);  
       }  
     catch (ClassNotFoundException cnfe)  
       {  
         // Maybe it was an primitive class?  
         if (name.equals("void"))  
           clazz = Void.TYPE;  
         else if (name.equals("boolean"))  
           clazz = Boolean.TYPE;  
         else if (name.equals("byte"))  
           clazz = Byte.TYPE;  
         else if (name.equals("short"))  
           clazz = Short.TYPE;  
         else if (name.equals("char"))  
           clazz = Character.TYPE;  
         else if (name.equals("int"))  
           clazz = Integer.TYPE;  
         else if (name.equals("long"))  
           clazz = Long.TYPE;  
         else if (name.equals("float"))  
           clazz = Float.TYPE;  
         else if (name.equals("double"))  
           clazz = Double.TYPE;  
         else  
           throw cnfe;  
       }  
   
532      boolean oldmode = setBlockDataMode(true);      boolean oldmode = setBlockDataMode(true);
533      osc.setClass(clazz, lookupClass(clazz.getSuperclass()));      osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
534      classLookupTable.put(clazz, osc);      classLookupTable.put(clazz, osc);
# Line 1275  public class ObjectInputStream extends I Line 1246  public class ObjectInputStream extends I
1246              }              }
1247            catch (NoSuchFieldException e)            catch (NoSuchFieldException e)
1248              {              {
1249                throw new IllegalArgumentException(e.getMessage());                throw new IllegalArgumentException(e);
1250              }              }
1251          }          }
1252    
# Line 1420  public class ObjectInputStream extends I Line 1391  public class ObjectInputStream extends I
1391            ObjectStreamField field = clazz.getField(name);            ObjectStreamField field = clazz.getField(name);
1392            boolean illegal = false;            boolean illegal = false;
1393    
1394              // XXX This code is horrible and needs to be rewritten!
1395            try            try
1396              {              {
1397                try                try
# Line 1479  public class ObjectInputStream extends I Line 1451  public class ObjectInputStream extends I
1451                catch (NoSuchFieldException e)                catch (NoSuchFieldException e)
1452                  {                  {
1453                    if (field == null)                    if (field == null)
1454                      throw new IllegalArgumentException(e.getMessage());                      throw new IllegalArgumentException(e);
1455                  }                  }
1456                                
1457              }              }
# Line 1823  public class ObjectInputStream extends I Line 1795  public class ObjectInputStream extends I
1795        }        }
1796      catch (InstantiationException e)      catch (InstantiationException e)
1797        {        {
1798          throw new ClassNotFoundException          throw (ClassNotFoundException) new ClassNotFoundException
1799                  ("Instance of " + real_class + " could not be created");            ("Instance of " + real_class + " could not be created").initCause(e);
1800        }        }
1801    }    }
1802    
# Line 1865  public class ObjectInputStream extends I Line 1837  public class ObjectInputStream extends I
1837          if (exception instanceof ClassNotFoundException)          if (exception instanceof ClassNotFoundException)
1838            throw (ClassNotFoundException) exception;            throw (ClassNotFoundException) exception;
1839    
1840          throw new IOException("Exception thrown from readObject() on " +          throw (IOException) new IOException(
1841                                 klass + ": " + exception.getClass().getName());            "Exception thrown from readObject() on " + klass).initCause(x);
1842        }        }
1843      catch (Exception x)      catch (Exception x)
1844        {        {
1845          throw new IOException("Failure invoking readObject() on " +          throw (IOException) new IOException(
1846                                 klass + ": " + x.getClass().getName());            "Failure invoking readObject() on " + klass).initCause(x);
1847        }        }
1848    
1849      // Invalidate fields which has been read through readFields.      // Invalidate fields which has been read through readFields.

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

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