Add tests for serialization utils (and change exception types)

This commit is contained in:
dsyer
2010-03-04 12:24:00 +00:00
parent cfca1a9296
commit 1587d8d0da
2 changed files with 71 additions and 2 deletions

View File

@@ -46,7 +46,7 @@ public class SerializationUtils {
try {
new ObjectOutputStream(stream).writeObject(object);
} catch (IOException e) {
throw new IllegalStateException("Could not serialize object of type: "+object.getClass(), e);
throw new IllegalArgumentException("Could not serialize object of type: "+object.getClass(), e);
}
return stream.toByteArray();
@@ -67,7 +67,7 @@ public class SerializationUtils {
return new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
}
catch (IOException e) {
throw new IllegalStateException("Could not deserialize object", e);
throw new IllegalArgumentException("Could not deserialize object", e);
}
catch (ClassNotFoundException e) {
throw new IllegalStateException("Could not deserialize object type", e);