HADOOP-9576. Changed NetUtils#wrapException to throw EOFException instead of wrapping it as IOException. Contributed by Steve Loughran
This commit is contained in:
parent
2cc868dede
commit
86bf8c7193
|
@ -422,6 +422,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HADOOP-11294. Nfs3FileAttributes should not change the values of rdev,
|
HADOOP-11294. Nfs3FileAttributes should not change the values of rdev,
|
||||||
nlink and size in the constructor. (Brandon Li via wheat9)
|
nlink and size in the constructor. (Brandon Li via wheat9)
|
||||||
|
|
||||||
|
HADOOP-9576. Changed NetUtils#wrapException to throw EOFException instead
|
||||||
|
of wrapping it as IOException. (Steve Loughran via jianhe)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-15
|
Release 2.6.0 - 2014-11-15
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.net;
|
package org.apache.hadoop.net;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -759,6 +760,13 @@ public class NetUtils {
|
||||||
+ " failed on socket timeout exception: " + exception
|
+ " failed on socket timeout exception: " + exception
|
||||||
+ ";"
|
+ ";"
|
||||||
+ see("NoRouteToHost"));
|
+ see("NoRouteToHost"));
|
||||||
|
} else if (exception instanceof EOFException) {
|
||||||
|
return wrapWithMessage(exception,
|
||||||
|
"End of File Exception between "
|
||||||
|
+ getHostDetailsAsString(destHost, destPort, localHost)
|
||||||
|
+ ": " + exception
|
||||||
|
+ ";"
|
||||||
|
+ see("EOFException"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (IOException) new IOException("Failed on local exception: "
|
return (IOException) new IOException("Failed on local exception: "
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.hadoop.net;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.BindException;
|
import java.net.BindException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
@ -256,6 +257,17 @@ public class TestNetUtils {
|
||||||
assertInException(wrapped, "/UnknownHost");
|
assertInException(wrapped, "/UnknownHost");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWrapEOFException() throws Throwable {
|
||||||
|
IOException e = new EOFException("eof");
|
||||||
|
IOException wrapped = verifyExceptionClass(e, EOFException.class);
|
||||||
|
assertInException(wrapped, "eof");
|
||||||
|
assertWikified(wrapped);
|
||||||
|
assertInException(wrapped, "localhost");
|
||||||
|
assertRemoteDetailsIncluded(wrapped);
|
||||||
|
assertInException(wrapped, "/EOFException");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetConnectAddress() throws IOException {
|
public void testGetConnectAddress() throws IOException {
|
||||||
NetUtils.addStaticResolution("host", "127.0.0.1");
|
NetUtils.addStaticResolution("host", "127.0.0.1");
|
||||||
|
|
Loading…
Reference in New Issue