You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by at...@apache.org on 2014/04/30 05:22:21 UTC
svn commit: r1591181 - in
/hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt
src/main/java/org/apache/hadoop/fs/PathIOException.java
src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java
Author: atm
Date: Wed Apr 30 03:22:20 2014
New Revision: 1591181
URL: http://svn.apache.org/r1591181
Log:
HADOOP-10543. RemoteException's unwrapRemoteException method failed for PathIOException. Contributed by Yongjun Zhang.
Modified:
hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1591181&r1=1591180&r2=1591181&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Wed Apr 30 03:22:20 2014
@@ -428,6 +428,9 @@ Release 2.5.0 - UNRELEASED
HADOOP-10547. Give SaslPropertiesResolver.getDefaultProperties() public
scope. (Benoy Antony via Arpit Agarwal)
+ HADOOP-10543. RemoteException's unwrapRemoteException method failed for
+ PathIOException. (Yongjun Zhang via atm)
+
Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java?rev=1591181&r1=1591180&r2=1591181&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java Wed Apr 30 03:22:20 2014
@@ -40,7 +40,7 @@ public class PathIOException extends IOE
* @param path for the exception
*/
public PathIOException(String path) {
- this(path, EIO, null);
+ this(path, EIO);
}
/**
@@ -59,7 +59,8 @@ public class PathIOException extends IOE
* @param error custom string to use an the error text
*/
public PathIOException(String path, String error) {
- this(path, error, null);
+ super(error);
+ this.path = path;
}
protected PathIOException(String path, String error, Throwable cause) {
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java?rev=1591181&r1=1591180&r2=1591181&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java Wed Apr 30 03:22:20 2014
@@ -19,11 +19,13 @@
package org.apache.hadoop.fs.shell;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathIOException;
+import org.apache.hadoop.ipc.RemoteException;
import org.junit.Test;
public class TestPathExceptions {
@@ -52,5 +54,25 @@ public class TestPathExceptions {
assertEquals(new Path(path), pe.getPath());
assertEquals("`" + path + "': " + error, pe.getMessage());
}
-
+
+ @Test
+ public void testRemoteExceptionUnwrap() throws Exception {
+ PathIOException pe;
+ RemoteException re;
+ IOException ie;
+
+ pe = new PathIOException(path);
+ re = new RemoteException(PathIOException.class.getName(), "test constructor1");
+ ie = re.unwrapRemoteException();
+ assertTrue(ie instanceof PathIOException);
+ ie = re.unwrapRemoteException(PathIOException.class);
+ assertTrue(ie instanceof PathIOException);
+
+ pe = new PathIOException(path, "constructor2");
+ re = new RemoteException(PathIOException.class.getName(), "test constructor2");
+ ie = re.unwrapRemoteException();
+ assertTrue(ie instanceof PathIOException);
+ ie = re.unwrapRemoteException(PathIOException.class);
+ assertTrue(ie instanceof PathIOException);
+ }
}