summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-09-29 16:53:00 -0700
committerElliott Hughes <enh@google.com>2011-09-30 10:49:07 -0700
commit9b4a8ec37805be3eabf3a4b443bbdb692ffa2608 (patch)
treebb3c313a56b5772eef2d25b5863cfd95154681ec /support
parent92cb29d71ca8fadc9b738a33e63ca39807647463 (diff)
downloadlibcore-9b4a8ec37805be3eabf3a4b443bbdb692ffa2608.zip
libcore-9b4a8ec37805be3eabf3a4b443bbdb692ffa2608.tar.gz
libcore-9b4a8ec37805be3eabf3a4b443bbdb692ffa2608.tar.bz2
Fix a couple of isReachable bugs.
We shouldn't throw NPE if you call isReachable on a deserialized InetAddress. Fixed by removing the "globals", which also fixes the unreported bug that calling isReachable on the same InetAddress was not thread-safe. Bug: http://code.google.com/p/android/issues/detail?id=20203 Also, the arguments to isReachableByTCP in isReachable(NetworkInterface, int, int) were the wrong way round, which meant we'd always return false (unless you were asking if localhost was reachable). Bug: http://code.google.com/p/android/issues/detail?id=20107 Bug: 2497441 Bug: 3213503 Change-Id: Ic808e774c28be6487e30e6acb8bc06f766f5c71d
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/tests/util/SerializationTester.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/support/src/test/java/tests/util/SerializationTester.java b/support/src/test/java/tests/util/SerializationTester.java
index e67529b..bd9bc93 100644
--- a/support/src/test/java/tests/util/SerializationTester.java
+++ b/support/src/test/java/tests/util/SerializationTester.java
@@ -66,7 +66,7 @@ public class SerializationTester {
* the input object
* @return the deserialized object
*/
- public static Object getDeserilizedObject(Object inputObject)
+ public static <T> T getDeserializedObject(T inputObject)
throws IOException, ClassNotFoundException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
@@ -78,7 +78,7 @@ public class SerializationTester {
Object outputObject = ois.readObject();
lastOutput = outputObject;
ois.close();
- return outputObject;
+ return (T) outputObject;
}
/**
@@ -92,7 +92,7 @@ public class SerializationTester {
* If any occurs.
*/
public static boolean assertSame(Object inputObject) throws Exception {
- return inputObject == getDeserilizedObject(inputObject);
+ return inputObject == getDeserializedObject(inputObject);
}
/**
@@ -106,7 +106,7 @@ public class SerializationTester {
* If any occurs.
*/
public static boolean assertEquals(Object inputObject) throws Exception {
- return inputObject.equals(getDeserilizedObject(inputObject));
+ return inputObject.equals(getDeserializedObject(inputObject));
}
/**
@@ -120,7 +120,7 @@ public class SerializationTester {
* @throws Exception
* If any occurs.
*/
- public static boolean assertCompabilitySame(Object obj, String fileName)
+ public static boolean assertCompatibilitySame(Object obj, String fileName)
throws Exception {
return obj == readObject(obj, fileName);
}
@@ -137,7 +137,7 @@ public class SerializationTester {
* @throws Exception
* If any occurs.
*/
- public static boolean assertCompabilityEquals(Object obj, String fileName)
+ public static boolean assertCompatibilityEquals(Object obj, String fileName)
throws Exception {
return obj.equals(readObject(obj, fileName));
}