Parcourir la source

HADOOP-3506. Fix a rare NPE caused by error handling in S3. Contributed by Tom White.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@688936 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas il y a 17 ans
Parent
commit
323ed49021

+ 3 - 0
CHANGES.txt

@@ -365,6 +365,9 @@ Trunk (unreleased changes)
     HADOOP-3785. Fix FileSystem cache to be case-insensitive for scheme and
     authority. (Bill de hOra via cdouglas)
 
+    HADOOP-3506. Fix a rare NPE caused by error handling in S3. (Tom White via
+    cdouglas)
+
 Release 0.18.0 - 2008-08-19
 
   INCOMPATIBLE CHANGES

+ 2 - 2
src/core/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java

@@ -160,7 +160,7 @@ class Jets3tFileSystemStore implements FileSystemStore {
       }
       return object.getDataInputStream();
     } catch (S3ServiceException e) {
-      if (e.getS3ErrorCode().equals("NoSuchKey")) {
+      if ("NoSuchKey".equals(e.getS3ErrorCode())) {
         return null;
       }
       if (e.getCause() instanceof IOException) {
@@ -176,7 +176,7 @@ class Jets3tFileSystemStore implements FileSystemStore {
                                             null, byteRangeStart, null);
       return object.getDataInputStream();
     } catch (S3ServiceException e) {
-      if (e.getS3ErrorCode().equals("NoSuchKey")) {
+      if ("NoSuchKey".equals(e.getS3ErrorCode())) {
         return null;
       }
       if (e.getCause() instanceof IOException) {

+ 2 - 2
src/core/org/apache/hadoop/fs/s3/MigrationTool.java

@@ -174,7 +174,7 @@ public class MigrationTool extends Configured implements Tool {
     try {
       return s3Service.getObject(bucket, key);
     } catch (S3ServiceException e) {
-      if (e.getS3ErrorCode().equals("NoSuchKey")) {
+      if ("NoSuchKey".equals(e.getS3ErrorCode())) {
         return null;
       }
     }
@@ -232,7 +232,7 @@ public class MigrationTool extends Configured implements Tool {
         S3Object object = s3Service.getObject(bucket, key);
         return object.getDataInputStream();
       } catch (S3ServiceException e) {
-        if (e.getS3ErrorCode().equals("NoSuchKey")) {
+        if ("NoSuchKey".equals(e.getS3ErrorCode())) {
           return null;
         }
         if (e.getCause() instanceof IOException) {

+ 2 - 2
src/core/org/apache/hadoop/fs/s3native/Jets3tNativeFileSystemStore.java

@@ -140,7 +140,7 @@ class Jets3tNativeFileSystemStore implements NativeFileSystemStore {
       S3Object object = s3Service.getObject(bucket, key);
       return object.getDataInputStream();
     } catch (S3ServiceException e) {
-      if (e.getS3ErrorCode().equals("NoSuchKey")) {
+      if ("NoSuchKey".equals(e.getS3ErrorCode())) {
         return null;
       }
       if (e.getCause() instanceof IOException) {
@@ -157,7 +157,7 @@ class Jets3tNativeFileSystemStore implements NativeFileSystemStore {
                                             null, byteRangeStart, null);
       return object.getDataInputStream();
     } catch (S3ServiceException e) {
-      if (e.getS3ErrorCode().equals("NoSuchKey")) {
+      if ("NoSuchKey".equals(e.getS3ErrorCode())) {
         return null;
       }
       if (e.getCause() instanceof IOException) {