Author: rohini
Date: Mon Feb 1 16:25:08 2016
New Revision: 1727968
URL: http://svn.apache.org/viewvc?rev=1727968&view=rev
Log:
PIG-4792: Do not add java and sun system properties to jobconf (rohini)
Modified:
pig/trunk/CHANGES.txt
pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java
Modified: pig/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1727968&r1=1727967&r2=1727968&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Mon Feb 1 16:25:08 2016
@@ -24,6 +24,8 @@ INCOMPATIBLE CHANGES
IMPROVEMENTS
+PIG-4792: Do not add java and sun system properties to jobconf (rohini)
+
PIG-4787: Log JSONLoader exception while parsing records (rohini)
PIG-4763: Insufficient check for the number of arguments in runpigmix.pl
(sekikn via rohini)
Modified: pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java
URL:
http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java?rev=1727968&r1=1727967&r2=1727968&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java (original)
+++ pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java Mon Feb 1
16:25:08 2016
@@ -22,6 +22,7 @@ import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.logging.Log;
@@ -45,7 +46,7 @@ public class PropertiesUtil {
loadPropertiesFromClasspath(properties, DEFAULT_PROPERTIES_FILE);
loadPropertiesFromClasspath(properties, PROPERTIES_FILE);
setDefaultsIfUnset(properties);
-
+
//Now set these as system properties only if they are not already
defined.
if (log.isDebugEnabled()) {
for (Object o: properties.keySet()) {
@@ -61,7 +62,13 @@ public class PropertiesUtil {
// Add System properties which include command line overrides
// Any existing keys will be overridden
- properties.putAll(System.getProperties());
+ for (Entry<Object, Object> entry : System.getProperties().entrySet()) {
+ String key = (String) entry.getKey();
+ if (key.startsWith("sun.") || key.startsWith("java.")) {
+ continue;
+ }
+ properties.put(key, entry.getValue());
+ }
// For telling error fast when there are problems
ConfigurationValidator.validatePigProperties(properties) ;
@@ -150,7 +157,7 @@ public class PropertiesUtil {
properties.setProperty(PigConfiguration.PIG_OPT_FETCH, ""+true);
}
}
-
+
/**
* Loads default properties.
* @return default properties