Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/jpa/tests
diff options
context:
space:
mode:
authorbvosburgh2007-05-11 18:23:46 +0000
committerbvosburgh2007-05-11 18:23:46 +0000
commit0b289b1759aa8e370fc11f73ee88e18c5c80fe0e (patch)
tree23c09889b2a2a20165ef74c9ae57e8022b2dd625 /jpa/tests
parent15aa6e4307c8304539aad970d618ce44e4c29137 (diff)
downloadwebtools.dali-0b289b1759aa8e370fc11f73ee88e18c5c80fe0e.tar.gz
webtools.dali-0b289b1759aa8e370fc11f73ee88e18c5c80fe0e.tar.xz
webtools.dali-0b289b1759aa8e370fc11f73ee88e18c5c80fe0e.zip
isolated "unchecked" code
Diffstat (limited to 'jpa/tests')
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/TestTools.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/TestTools.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/TestTools.java
index 1eed587df1..04a3d84786 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/TestTools.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/TestTools.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.utility.tests.internal;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
@@ -34,7 +35,6 @@ public final class TestTools {
* specified object to a byte array; then de-serializing the byte array and
* returning the resultant object
*/
- @SuppressWarnings("unchecked")
public static <T> T serialize(T o) throws IOException, ClassNotFoundException {
ByteArrayOutputStream baOutStream = new ByteArrayOutputStream(2000);
ObjectOutputStream outStream = new ObjectOutputStream(baOutStream);
@@ -43,12 +43,17 @@ public final class TestTools {
ByteArrayInputStream baInStream = new ByteArrayInputStream(baOutStream.toByteArray());
ObjectInputStream inStream = new ObjectInputStream(baInStream);
- T o2 = (T) inStream.readObject();
+ T o2 = readObject(inStream);
inStream.close();
return o2;
}
+ @SuppressWarnings("unchecked")
+ private static <T> T readObject(ObjectInput objectInput) throws IOException, ClassNotFoundException {
+ return (T) objectInput.readObject();
+ }
+
/**
* some tests require access to the Web (e.g. any tests that parse an XML
* document that specifies a DTD or Schema that is loaded from the Web); use

Back to the top