hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1156972 - in /hadoop/common/trunk/hdfs/src: java/org/apache/hadoop/hdfs/server/namenode/ test/aop/org/apache/hadoop/hdfs/server/namenode/
Date Fri, 12 Aug 2011 05:51:50 GMT
Author: eli
Date: Fri Aug 12 05:51:50 2011
New Revision: 1156972

URL: http://svn.apache.org/viewvc?rev=1156972&view=rev
Log:
Fix HDFS-2235 FI test failure.

Modified:
    hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileChecksumServlets.java
    hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
    hadoop/common/trunk/hdfs/src/test/aop/org/apache/hadoop/hdfs/server/namenode/FileDataServletAspects.aj

Modified: hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileChecksumServlets.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileChecksumServlets.java?rev=1156972&r1=1156971&r2=1156972&view=diff
==============================================================================
--- hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileChecksumServlets.java
(original)
+++ hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileChecksumServlets.java
Fri Aug 12 05:51:50 2011
@@ -59,7 +59,7 @@ public class FileChecksumServlets {
     /** Create a redirection URL */
     private URL createRedirectURL(UserGroupInformation ugi, DatanodeID host,
         HttpServletRequest request, NameNode nn) 
-        throws IOException, URISyntaxException {
+        throws IOException {
       final String hostname = host instanceof DatanodeInfo 
           ? ((DatanodeInfo)host).getHostName() : host.getHost();
       final String scheme = request.getScheme();
@@ -94,8 +94,6 @@ public class FileChecksumServlets {
       try {
         response.sendRedirect(
             createRedirectURL(ugi, datanode, request, namenode).toString());
-      } catch(URISyntaxException e) {
-        throw new ServletException(e); 
       } catch (IOException e) {
         response.sendError(400, e.getMessage());
       }

Modified: hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java?rev=1156972&r1=1156971&r2=1156972&view=diff
==============================================================================
--- hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
(original)
+++ hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
Fri Aug 12 05:51:50 2011
@@ -48,7 +48,7 @@ public class FileDataServlet extends Dfs
   /** Create a redirection URL */
   private URL createRedirectURL(String path, String encodedPath, HdfsFileStatus status, 
       UserGroupInformation ugi, ClientProtocol nnproxy, HttpServletRequest request, String
dt)
-      throws IOException, URISyntaxException {
+      throws IOException {
     String scheme = request.getScheme();
     final LocatedBlocks blks = nnproxy.getBlockLocations(
         status.getFullPath(new Path(path)).toUri().getPath(), 0, 1);
@@ -121,12 +121,8 @@ public class FileDataServlet extends Dfs
 
           HdfsFileStatus info = nn.getFileInfo(path);
           if (info != null && !info.isDir()) {
-            try {
-              response.sendRedirect(createRedirectURL(path, encodedPath, 
-                  info, ugi, nn, request, delegationToken).toString());
-            } catch (URISyntaxException e) {
-              response.getWriter().println(e.toString());
-            }
+            response.sendRedirect(createRedirectURL(path, encodedPath,
+                info, ugi, nn, request, delegationToken).toString());
           } else if (info == null) {
             response.sendError(400, "File not found " + path);
           } else {

Modified: hadoop/common/trunk/hdfs/src/test/aop/org/apache/hadoop/hdfs/server/namenode/FileDataServletAspects.aj
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hdfs/src/test/aop/org/apache/hadoop/hdfs/server/namenode/FileDataServletAspects.aj?rev=1156972&r1=1156971&r2=1156972&view=diff
==============================================================================
--- hadoop/common/trunk/hdfs/src/test/aop/org/apache/hadoop/hdfs/server/namenode/FileDataServletAspects.aj
(original)
+++ hadoop/common/trunk/hdfs/src/test/aop/org/apache/hadoop/hdfs/server/namenode/FileDataServletAspects.aj
Fri Aug 12 05:51:50 2011
@@ -17,8 +17,8 @@
  */
 package org.apache.hadoop.hdfs.server.namenode;
 
-import java.net.URI;
-import java.net.URISyntaxException;
+import java.net.URL;
+import java.io.IOException;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -30,18 +30,17 @@ import org.apache.hadoop.security.UserGr
 public aspect FileDataServletAspects {
   static final Log LOG = FileDataServlet.LOG;
 
-  pointcut callCreateUri() : call (URI FileDataServlet.createUri(
-      String, HdfsFileStatus, UserGroupInformation, ClientProtocol,
+  pointcut callCreateUrl() : call (URL FileDataServlet.createRedirectURL(
+      String, String, HdfsFileStatus, UserGroupInformation, ClientProtocol,
       HttpServletRequest, String));
 
   /** Replace host name with "localhost" for unit test environment. */
-  URI around () throws URISyntaxException : callCreateUri() {
-    final URI original = proceed(); 
-    LOG.info("FI: original uri = " + original);
-    final URI replaced = new URI(original.getScheme(), original.getUserInfo(),
-        "localhost", original.getPort(), original.getPath(),
-        original.getQuery(), original.getFragment()) ; 
-    LOG.info("FI: replaced uri = " + replaced);
+  URL around () throws IOException : callCreateUrl() {
+    final URL original = proceed();
+    LOG.info("FI: original url = " + original);
+    final URL replaced = new URL("http", "localhost", original.getPort(),
+        original.getPath() + '?' + original.getQuery());
+    LOG.info("FI: replaced url = " + replaced);
     return replaced;
   }
 }



Mime
View raw message