HADOOP-9909. org.apache.hadoop.fs.Stat should permit other LANG. (Shinichi Yamashita via Andrew Wang)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1518862 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2cc851a66e
commit
87e449fd23
|
@ -357,6 +357,9 @@ Release 2.3.0 - UNRELEASED
|
|||
HADOOP-9877. Fix listing of snapshot directories in globStatus.
|
||||
(Binglin Chang via Andrew Wang)
|
||||
|
||||
HADOOP-9909. org.apache.hadoop.fs.Stat should permit other LANG.
|
||||
(Shinichi Yamashita via Andrew Wang)
|
||||
|
||||
Release 2.1.1-beta - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -20,6 +20,8 @@ package org.apache.hadoop.fs;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
@ -62,6 +64,10 @@ public class Stat extends Shell {
|
|||
this.path = new Path(qualified.toUri().getPath());
|
||||
this.blockSize = blockSize;
|
||||
this.dereference = deref;
|
||||
// LANG = C setting
|
||||
Map<String, String> env = new HashMap<String, String>();
|
||||
env.put("LANG", "C");
|
||||
setEnvironment(env);
|
||||
}
|
||||
|
||||
public FileStatus getFileStatus() throws IOException {
|
||||
|
|
|
@ -540,6 +540,13 @@ abstract public class Shell {
|
|||
protected abstract void parseExecResult(BufferedReader lines)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* Get the environment variable
|
||||
*/
|
||||
public String getEnvironment(String env) {
|
||||
return environment.get(env);
|
||||
}
|
||||
|
||||
/** get the current sub-process executing the given command
|
||||
* @return process executing the command
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package org.apache.hadoop.fs;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -119,4 +120,9 @@ public class TestStat {
|
|||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout=10000)
|
||||
public void testStatEnvironment() throws Exception {
|
||||
assertEquals(stat.getEnvironment("LANG"), "C");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue