This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: Fixed SocketTest to test for ConnectException
- From: Wolfgang Baer <WBaer at gmx dot de>
- To: mauve-patches at sources dot redhat dot com
- Date: Mon, 06 Feb 2006 09:11:45 +0100
- Subject: FYI: Fixed SocketTest to test for ConnectException
Hi all,
I adapted the SocketTest to test for ConnectException if connection
fails instead of the general IOException. Fix is checked into classpath.
2006-02-06 Wolfgang Baer <WBaer@gmx.de>
* gnu/testlet/java/net/Socket/SocketTest.java (test_Basics): Specialized
Exceptions to be thrown to ConnectException if connection fails.
Wolfgang
Index: SocketTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/Socket/SocketTest.java,v
retrieving revision 1.23
diff -u -r1.23 SocketTest.java
--- SocketTest.java 8 Nov 2005 21:49:39 -0000 1.23
+++ SocketTest.java 6 Feb 2006 08:06:50 -0000
@@ -295,8 +295,13 @@
"Unknown host exception should not have been thrown here");
harness.debug(e);
}
+ catch (ConnectException e) {
+ harness.check(true);
+ }
catch (IOException e) {
- harness.check(true);
+ harness.fail("Error : test_Basics failed - 4 " +
+ "ConnectException should have been thrown here");
+ harness.debug(e);
}
finally {
try {
@@ -316,9 +321,14 @@
"Unknown host exception should not have been thrown here");
harness.debug(e);
}
- catch (IOException e) {
+ catch (ConnectException e) {
harness.check(true);
}
+ catch (IOException e) {
+ harness.fail("Error : test_Basics failed - 6 " +
+ "ConnectException should have been thrown here");
+ harness.debug(e);
+ }
finally {
try {
if (s != null)
@@ -350,9 +360,14 @@
harness.fail("Error : test_Basics failed - 8 " +
"exception should have been thrown here");
}
- catch (Exception e) {
+ catch (ConnectException e) {
harness.check(true);
}
+ catch (IOException e) {
+ harness.fail("Error : test_Basics failed - 8 " +
+ "ConnectException should have been thrown here");
+ harness.debug(e);
+ }
finally {
try {
if (s != null)