diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/dev-support/findbugsExcludeFile.xml b/hadoop-hdfs-project/hadoop-hdfs-httpfs/dev-support/findbugsExcludeFile.xml
new file mode 100644
index 0000000000..1f5a4f5bc4
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/dev-support/findbugsExcludeFile.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml b/hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml
index fbe56b6395..956540dcf5 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml
@@ -384,6 +384,13 @@
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+
+ ${basedir}/dev-support/findbugsExcludeFile.xml
+
+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/lang/XException.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/lang/XException.java
index 1fb2fb7766..767e3fa4cb 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/lang/XException.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/lang/XException.java
@@ -111,7 +111,7 @@ private static String format(ERROR error, Object... args) {
}
template = sb.deleteCharAt(0).toString();
}
- return error + ": " + MessageFormat.format(error.getTemplate(), args);
+ return error + ": " + MessageFormat.format(template, args);
}
/**
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/InputStreamEntity.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/InputStreamEntity.java
index 336a62ce9e..e5361a80ef 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/InputStreamEntity.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/InputStreamEntity.java
@@ -42,7 +42,10 @@ public InputStreamEntity(InputStream is) {
@Override
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) {
IOUtils.copyBytes(is, os, 4096, true);
} else {
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 71ecda1160..60bb488370 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -180,6 +180,8 @@ Trunk (unreleased changes)
HDFS-2658. HttpFS introduced 70 javadoc warnings. (tucu)
+ HDFS-2646. Hadoop HttpFS introduced 4 findbug warnings. (tucu)
+
Release 0.23.1 - UNRELEASED
INCOMPATIBLE CHANGES