Browse Source

Merge -r 1221571:1221572 from trunk to branch. FIXES: HDFS-2646

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1221576 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 13 years ago
parent
commit
dc82b91b5e

+ 12 - 0
hadoop-hdfs-project/hadoop-hdfs-httpfs/dev-support/findbugsExcludeFile.xml

@@ -0,0 +1,12 @@
+<FindBugsFilter>
+  <Match>
+    <Class name="org.apache.hadoop.lib.service.instrumentation.InstrumentationService" />
+    <Method name="getToAdd" />
+    <Bug pattern="UL_UNRELEASED_LOCK" />
+  </Match>
+  <Match>
+    <Class name="org.apache.hadoop.fs.http.server.HttpFSServerWebApp" />
+    <Method name="destroy" />
+    <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
+  </Match>
+</FindBugsFilter>

+ 7 - 0
hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml

@@ -384,6 +384,13 @@
           </execution>
           </execution>
         </executions>
         </executions>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>findbugs-maven-plugin</artifactId>
+        <configuration>
+          <excludeFilterFile>${basedir}/dev-support/findbugsExcludeFile.xml</excludeFilterFile>
+        </configuration>
+      </plugin>
     </plugins>
     </plugins>
   </build>
   </build>
 
 

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/lang/XException.java

@@ -111,7 +111,7 @@ public class XException extends Exception {
       }
       }
       template = sb.deleteCharAt(0).toString();
       template = sb.deleteCharAt(0).toString();
     }
     }
-    return error + ": " + MessageFormat.format(error.getTemplate(), args);
+    return error + ": " + MessageFormat.format(template, args);
   }
   }
 
 
   /**
   /**

+ 4 - 1
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/InputStreamEntity.java

@@ -42,7 +42,10 @@ public class InputStreamEntity implements StreamingOutput {
 
 
   @Override
   @Override
   public void write(OutputStream os) throws IOException {
   public void write(OutputStream os) throws IOException {
-    is.skip(offset);
+    long skipped = is.skip(offset);
+    if (skipped < offset) {
+      throw new IOException("Requested offset beyond stream size");
+    }
     if (len == -1) {
     if (len == -1) {
       IOUtils.copyBytes(is, os, 4096, true);
       IOUtils.copyBytes(is, os, 4096, true);
     } else {
     } else {

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -115,6 +115,8 @@ Release 0.23.1 - UNRELEASED
     HDFS-2706. Use configuration for blockInvalidateLimit if it is set.
     HDFS-2706. Use configuration for blockInvalidateLimit if it is set.
     (szetszwo)
     (szetszwo)
 
 
+    HDFS-2646. Hadoop HttpFS introduced 4 findbug warnings. (tucu)
+
 Release 0.23.0 - 2011-11-01 
 Release 0.23.0 - 2011-11-01 
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES