Index: Configuration.java
===================================================================
--- Configuration.java (revision 1546927)
+++ Configuration.java (working copy)
@@ -867,10 +867,28 @@
String[] names = handleDeprecation(name);
String result = null;
for(String n : names) {
+ if(n.contains("PATH")){
+ result = substituteVars(getProps().getProperty(n, defaultValue));
+ if(!isAbsolutePath(result)){
+ n="PROPERTY_NOT_SET";
+ result = substituteVars(getProps().getProperty(n, defaultValue));
+ }
+ }
+ else
result = substituteVars(getProps().getProperty(n, defaultValue));
}
return result;
}
+
+ private boolean isAbsolutePath(String path){
+ Pattern p1 = Pattern.compile("^[A-Za-z]:\\s*(.*?)");
+ Matcher m1 = p1.matcher(path);
+ if(path.startsWith("/") || m1.matches()){
+ return true;
+ }
+ else
+ return false;
+ }
/**
* Get the value of the name property as an int.
@@ -1446,6 +1464,11 @@
*/
public InetSocketAddress getSocketAddr(
String name, String defaultAddress, int defaultPort) {
+ //If YarnConfiguration.RM_ADDRESS is not in expected format set property name as property_not_set so that default is picked up.
+ Pattern p = Pattern.compile("^\\s*(.*?):(\\d+)\\s*$");
+ Matcher m = p.matcher(name);
+ if(!m.matches())
+ name = "PROPERTY_NOT_SET";
final String address = get(name, defaultAddress);
return NetUtils.createSocketAddr(address, defaultPort, name);
}