hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject [17/50] [abbrv] hadoop git commit: HDFS-7709. Fix findbug warnings in httpfs. Contributed by Rakesh R.
Date Fri, 06 Feb 2015 21:46:49 GMT
HDFS-7709. Fix findbug warnings in httpfs. Contributed by Rakesh R.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/89598520
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/89598520
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/89598520

Branch: refs/heads/HDFS-EC
Commit: 89598520acfab5400d0c5a99fc8f03bc6678489e
Parents: 9b559cb
Author: Tsuyoshi Ozawa <ozawa@apache.org>
Authored: Thu Feb 5 19:57:07 2015 +0900
Committer: Zhe Zhang <zhz@apache.org>
Committed: Fri Feb 6 13:45:49 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/fs/http/client/HttpFSUtils.java   | 3 ++-
 .../hadoop/fs/http/server/HttpFSAuthenticationFilter.java    | 8 ++++++--
 .../hadoop/lib/service/hadoop/FileSystemAccessService.java   | 2 +-
 .../java/org/apache/hadoop/lib/wsrs/JSONMapProvider.java     | 3 ++-
 .../main/java/org/apache/hadoop/lib/wsrs/JSONProvider.java   | 3 ++-
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                  | 2 ++
 6 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/89598520/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSUtils.java
b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSUtils.java
index e1cb81b..45d9805 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSUtils.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSUtils.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.fs.http.client;
 
+import org.apache.commons.io.Charsets;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.fs.Path;
 import org.json.simple.parser.JSONParser;
@@ -127,7 +128,7 @@ public class HttpFSUtils {
   static Object jsonParse(HttpURLConnection conn) throws IOException {
     try {
       JSONParser parser = new JSONParser();
-      return parser.parse(new InputStreamReader(conn.getInputStream()));
+      return parser.parse(new InputStreamReader(conn.getInputStream(), Charsets.UTF_8));
     } catch (ParseException ex) {
       throw new IOException("JSON parser error, " + ex.getMessage(), ex);
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/89598520/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java
b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java
index f0fe4c5..004ff38 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.fs.http.server;
 
+import org.apache.commons.io.Charsets;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
@@ -24,8 +25,10 @@ import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthentica
 
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
-import java.io.FileReader;
+
+import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.Map;
 import java.util.Properties;
@@ -77,7 +80,8 @@ public class HttpFSAuthenticationFilter
 
     try {
       StringBuilder secret = new StringBuilder();
-      Reader reader = new FileReader(signatureSecretFile);
+      Reader reader = new InputStreamReader(new FileInputStream(
+          signatureSecretFile), Charsets.UTF_8);
       int c = reader.read();
       while (c > -1) {
         secret.append((char)c);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/89598520/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java
b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java
index 6091415..ccb15a3 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java
@@ -177,7 +177,7 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc
 
     String hadoopConfDirProp = getServiceConfig().get(HADOOP_CONF_DIR, getServer().getConfigDir());
     File hadoopConfDir = new File(hadoopConfDirProp).getAbsoluteFile();
-    if (hadoopConfDir == null) {
+    if (!hadoopConfDir.exists()) {
       hadoopConfDir = new File(getServer().getConfigDir()).getAbsoluteFile();
     }
     if (!hadoopConfDir.exists()) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/89598520/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONMapProvider.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONMapProvider.java
b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONMapProvider.java
index 12a2fc6..0809a85 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONMapProvider.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONMapProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.lib.wsrs;
 
+import org.apache.commons.io.Charsets;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.json.simple.JSONObject;
 
@@ -55,7 +56,7 @@ public class JSONMapProvider implements MessageBodyWriter<Map> {
   public void writeTo(Map map, Class<?> aClass, Type type, Annotation[] annotations,
                       MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap,
                       OutputStream outputStream) throws IOException, WebApplicationException
{
-    Writer writer = new OutputStreamWriter(outputStream);
+    Writer writer = new OutputStreamWriter(outputStream,  Charsets.UTF_8);
     JSONObject.writeJSONString(map, writer);
     writer.write(ENTER);
     writer.flush();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/89598520/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONProvider.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONProvider.java
b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONProvider.java
index 692643e..15ea8e6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONProvider.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/JSONProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.lib.wsrs;
 
+import org.apache.commons.io.Charsets;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.json.simple.JSONStreamAware;
 
@@ -55,7 +56,7 @@ public class JSONProvider implements MessageBodyWriter<JSONStreamAware>
{
   public void writeTo(JSONStreamAware jsonStreamAware, Class<?> aClass, Type type,
Annotation[] annotations,
                       MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap,
                       OutputStream outputStream) throws IOException, WebApplicationException
{
-    Writer writer = new OutputStreamWriter(outputStream);
+    Writer writer = new OutputStreamWriter(outputStream, Charsets.UTF_8);
     jsonStreamAware.writeJSONString(writer);
     writer.write(ENTER);
     writer.flush();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/89598520/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 0b60964..32e9d98 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -841,6 +841,8 @@ Release 2.7.0 - UNRELEASED
     in-memory state associated with volumes. (Lei (Eddy) Xu via Colin P.
     McCabe)
 
+    HDFS-7709. Fix findbug warnings in httpfs. (Rakesh R via ozawa)
+
 Release 2.6.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES


Mime
View raw message