HADOOP-6490. Use StringUtils over String#replace in Path#normalizePath. Contributed by Uma Maheswara Rao G.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1182189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3f998db918
commit
eba49b8b11
|
@ -59,6 +59,9 @@ Trunk (unreleased changes)
|
||||||
|
|
||||||
HADOOP-7721. Add log before login in KerberosAuthenticationHandler. (jitendra)
|
HADOOP-7721. Add log before login in KerberosAuthenticationHandler. (jitendra)
|
||||||
|
|
||||||
|
HADOOP-6490. Use StringUtils over String#replace in Path#normalizePath.
|
||||||
|
(Uma Maheswara Rao G via harsh)
|
||||||
|
|
||||||
Release 0.23.0 - Unreleased
|
Release 0.23.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
|
|
||||||
package org.apache.hadoop.fs;
|
package org.apache.hadoop.fs;
|
||||||
|
|
||||||
import java.net.*;
|
import java.io.IOException;
|
||||||
import java.io.*;
|
import java.net.URI;
|
||||||
import org.apache.avro.reflect.Stringable;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import org.apache.avro.reflect.Stringable;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -157,8 +159,8 @@ public class Path implements Comparable {
|
||||||
|
|
||||||
private String normalizePath(String path) {
|
private String normalizePath(String path) {
|
||||||
// remove double slashes & backslashes
|
// remove double slashes & backslashes
|
||||||
path = path.replace("//", "/");
|
path = StringUtils.replace(path, "//", "/");
|
||||||
path = path.replace("\\", "/");
|
path = StringUtils.replace(path, "\\", "/");
|
||||||
|
|
||||||
// trim trailing slash from non-root path (ignoring windows drive)
|
// trim trailing slash from non-root path (ignoring windows drive)
|
||||||
int minLength = hasWindowsDrive(path, true) ? 4 : 1;
|
int minLength = hasWindowsDrive(path, true) ? 4 : 1;
|
||||||
|
|
Loading…
Reference in New Issue