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); |
1246 |
} |
} |
1247 |
catch (NoSuchFieldException e) |
catch (NoSuchFieldException e) |
1248 |
{ |
{ |
1249 |
throw new IllegalArgumentException(e.getMessage()); |
throw new IllegalArgumentException(e); |
1250 |
} |
} |
1251 |
} |
} |
1252 |
|
|
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 |
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 |
} |
} |
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 |
|
|
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. |