Browse Source

HADOOP-1568 followup to fix java 1.5 incompatibility

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@565434 13f79535-47bb-0310-9956-ffa450edef68
Owen O'Malley 18 năm trước cách đây
mục cha
commit
7fe59cb194
1 tập tin đã thay đổi với 11 bổ sung3 xóa
  1. 11 3
      src/java/org/apache/hadoop/dfs/HftpFileSystem.java

+ 11 - 3
src/java/org/apache/hadoop/dfs/HftpFileSystem.java

@@ -95,7 +95,9 @@ public class HftpFileSystem extends FileSystem {
       connection.setRequestMethod("GET");
       connection.connect();
     } catch (URISyntaxException e) {
-      throw new IOException(e);
+      IOException ie = new IOException("invalid url");
+      ie.initCause(e);
+      throw ie;
     }
     final InputStream in = connection.getInputStream();
     return new FSDataInputStream(new FSInputStream() {
@@ -162,8 +164,14 @@ public class HftpFileSystem extends FileSystem {
 
         InputStream resp = connection.getInputStream();
         xr.parse(new InputSource(resp));
-      } catch (Exception e) {
-        throw new IOException(e);
+      } catch (SAXException e) { 
+        IOException ie = new IOException("invalid xml directory content");
+        ie.initCause(e);
+        throw ie;
+      } catch (URISyntaxException e) {
+        IOException ie = new IOException("invalid url");
+        ie.initCause(e);
+        throw ie;
       }
     }