From 45620eee687b1093c812873a99833dab068e43d2 Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Wed, 21 Dec 2011 02:46:04 +0000 Subject: [PATCH] HDFS-2646. Hadoop HttpFS introduced 4 findbug warnings. (tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1221572 13f79535-47bb-0310-9956-ffa450edef68 --- .../dev-support/findbugsExcludeFile.xml | 12 ++++++++++++ hadoop-hdfs-project/hadoop-hdfs-httpfs/pom.xml | 7 +++++++ .../java/org/apache/hadoop/lib/lang/XException.java | 2 +- .../apache/hadoop/lib/wsrs/InputStreamEntity.java | 5 ++++- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 hadoop-hdfs-project/hadoop-hdfs-httpfs/dev-support/findbugsExcludeFile.xml 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 00000000000..1f5a4f5bc4f --- /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 fbe56b6395c..956540dcf5d 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 1fb2fb77668..767e3fa4cbb 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 @@ public class XException extends Exception { } 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 336a62ce9e2..e5361a80efe 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 class InputStreamEntity implements StreamingOutput { @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 71ecda11604..60bb488370b 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