From a39992ea6345a9f29814587604ac61b21c99fc3e Mon Sep 17 00:00:00 2001
From: Vinod Kumar Vavilapalli
Date: Fri, 28 Oct 2011 07:44:35 +0000
Subject: [PATCH] MAPREDUCE-3296. Fixed the remaining nine FindBugs warnings.
(vinodkv)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1190187 13f79535-47bb-0310-9956-ffa450edef68
---
hadoop-mapreduce-project/CHANGES.txt | 8 +++++---
.../hadoop/mapreduce/v2/app/JobEndNotifier.java | 4 ++--
.../hadoop-yarn/dev-support/findbugs-exclude.xml | 15 +++++++++++++++
.../org/apache/hadoop/yarn/webapp/WebApps.java | 5 ++++-
.../yarn/server/webproxy/ProxyUriUtils.java | 2 +-
.../yarn/server/webproxy/amfilter/AmIpFilter.java | 6 +++---
6 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index 2cb31f83ee0..c075aacbeec 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -1841,9 +1841,11 @@ Release 0.23.0 - Unreleased
MAPREDUCE-3185. RM Web UI does not sort the columns in some cases.
(Jonathan Eagles via mahadev)
- MAPREDUCE-3292. In secure mode job submission fails with Provider
- org.apache.hadoop.mapreduce.security.token.JobTokenIndentifier$Renewer
- not found. (mahadev)
+ MAPREDUCE-3292. In secure mode job submission fails with Provider
+ org.apache.hadoop.mapreduce.security.token.JobTokenIndentifier$Renewer
+ not found. (mahadev)
+
+ MAPREDUCE-3296. Fixed the remaining nine FindBugs warnings. (vinodkv)
Release 0.22.0 - Unreleased
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java
index 497edcb5b11..f22b9b7ba02 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java
@@ -44,8 +44,8 @@ import org.mortbay.log.Log;
*
*/
public class JobEndNotifier implements Configurable {
- final String JOB_ID = "$jobId";
- final String JOB_STATUS = "$jobStatus";
+ private static final String JOB_ID = "$jobId";
+ private static final String JOB_STATUS = "$jobStatus";
private Configuration conf;
protected String userUrl;
diff --git a/hadoop-mapreduce-project/hadoop-yarn/dev-support/findbugs-exclude.xml b/hadoop-mapreduce-project/hadoop-yarn/dev-support/findbugs-exclude.xml
index eac86c37dea..0efcb3d2ebf 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/dev-support/findbugs-exclude.xml
+++ b/hadoop-mapreduce-project/hadoop-yarn/dev-support/findbugs-exclude.xml
@@ -171,6 +171,10 @@
+
+
+
+
@@ -185,6 +189,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApps.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApps.java
index 42e4ce4d7a9..22387f067d3 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApps.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApps.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.webapp;
import static com.google.common.base.Preconditions.checkNotNull;
+import java.io.IOException;
import java.net.ConnectException;
import java.net.URL;
import java.util.HashMap;
@@ -191,7 +192,9 @@ public class WebApps {
webapp.setHttpServer(server);
server.start();
LOG.info("Web app /"+ name +" started at "+ server.getPort());
- } catch (Exception e) {
+ } catch (ClassNotFoundException e) {
+ throw new WebAppException("Error starting http server", e);
+ } catch (IOException e) {
throw new WebAppException("Error starting http server", e);
}
Injector injector = Guice.createInjector(webapp, new AbstractModule() {
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/ProxyUriUtils.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/ProxyUriUtils.java
index 20fb8f0c74d..e9bc0c81f8e 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/ProxyUriUtils.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/ProxyUriUtils.java
@@ -92,7 +92,7 @@ public class ProxyUriUtils {
newp.append(getPath(id, path));
boolean first = appendQuery(newp, query, true);
if(approved) {
- first = appendQuery(newp, PROXY_APPROVAL_PARAM+"=true", first);
+ appendQuery(newp, PROXY_APPROVAL_PARAM+"=true", first);
}
return newp.toString();
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmIpFilter.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmIpFilter.java
index 9705b49ccd3..d1cae5cc1eb 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmIpFilter.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmIpFilter.java
@@ -59,8 +59,8 @@ public class AmIpFilter implements Filter {
private Set getProxyAddresses() throws ServletException {
long now = System.currentTimeMillis();
- if(proxyAddresses == null || (lastUpdate + updateInterval) >= now) {
- synchronized(this) {
+ synchronized(this) {
+ if(proxyAddresses == null || (lastUpdate + updateInterval) >= now) {
try {
proxyAddresses = new HashSet();
for(InetAddress add : InetAddress.getAllByName(proxyHost)) {
@@ -71,8 +71,8 @@ public class AmIpFilter implements Filter {
throw new ServletException("Could not locate "+proxyHost, e);
}
}
+ return proxyAddresses;
}
- return proxyAddresses;
}
@Override