HDFS-6140. WebHDFS cannot create a file with spaces in the name after HA failover changes. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1580173 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-03-22 05:32:24 +00:00
parent 62d28901d6
commit 00ceaade05
3 changed files with 5 additions and 3 deletions

View File

@ -668,6 +668,9 @@ Release 2.4.0 - UNRELEASED
HDFS-6127. WebHDFS tokens cannot be renewed in HA setup. (wheat9)
HDFS-6140. WebHDFS cannot create a file with spaces in the name after HA
failover changes. (cnauroth)
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)

View File

@ -247,8 +247,7 @@ private Response put(
}
final String scheme = "http".equals(request.getScheme()) ?
WebHdfsFileSystem.SCHEME : SWebHdfsFileSystem.SCHEME;
final URI uri = URI.create(String.format("%s://%s/%s", scheme,
nnId, fullpath));
final URI uri = new URI(scheme, nnId, fullpath, null, null);
return Response.created(uri).type(MediaType.APPLICATION_OCTET_STREAM).build();
}
default:

View File

@ -504,7 +504,7 @@ public void testResponseCode() throws IOException {
{//test create with path containing spaces
HttpOpParam.Op op = PutOpParam.Op.CREATE;
Path path = new Path("/test/path%20with%20spaces");
Path path = new Path("/test/path with spaces");
URL url = webhdfs.toUrl(op, path);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod(op.getType().toString());