You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2014/10/01 08:46:08 UTC

svn commit: r1628617 - in /pig/branches/branch-0.14: CHANGES.txt src/org/apache/pig/tools/parameters/PreprocessorContext.java

Author: daijy
Date: Wed Oct  1 06:46:08 2014
New Revision: 1628617

URL: http://svn.apache.org/r1628617
Log:
PIG-4215: Fix unit test failure TestParamSubPreproc and TestMacroExpansion

Modified:
    pig/branches/branch-0.14/CHANGES.txt
    pig/branches/branch-0.14/src/org/apache/pig/tools/parameters/PreprocessorContext.java

Modified: pig/branches/branch-0.14/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/CHANGES.txt?rev=1628617&r1=1628616&r2=1628617&view=diff
==============================================================================
--- pig/branches/branch-0.14/CHANGES.txt (original)
+++ pig/branches/branch-0.14/CHANGES.txt Wed Oct  1 06:46:08 2014
@@ -84,6 +84,8 @@ OPTIMIZATIONS
  
 BUG FIXES
 
+PIG-4215: Fix unit test failure TestParamSubPreproc and TestMacroExpansion (daijy)
+
 PIG-4175: PIG CROSS operation follow by STORE produces non-deterministic results each run (daijy)
 
 PIG-4202: Reset UDFContext state before OutputCommitter invocations in Tez (rohini)

Modified: pig/branches/branch-0.14/src/org/apache/pig/tools/parameters/PreprocessorContext.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/src/org/apache/pig/tools/parameters/PreprocessorContext.java?rev=1628617&r1=1628616&r2=1628617&view=diff
==============================================================================
--- pig/branches/branch-0.14/src/org/apache/pig/tools/parameters/PreprocessorContext.java (original)
+++ pig/branches/branch-0.14/src/org/apache/pig/tools/parameters/PreprocessorContext.java Wed Oct  1 06:46:08 2014
@@ -124,9 +124,10 @@ public class PreprocessorContext {
      * @param val - string containing command to be executed
      */
     public  void processShellCmd(String key, String val, Boolean overwrite)  throws ParameterSubstitutionException, FrontendException {
-        Preconditions.checkState(pigContext != null);
-        BlackAndWhitelistFilter filter = new BlackAndWhitelistFilter(pigContext);
-        filter.validate(PigCommandFilter.Command.SH);
+        if (pigContext != null) {
+            BlackAndWhitelistFilter filter = new BlackAndWhitelistFilter(pigContext);
+            filter.validate(PigCommandFilter.Command.SH);
+        }
 
         if (param_val.containsKey(key)) {
             if (param_source.get(key).equals(val) || !overwrite) {
@@ -146,7 +147,9 @@ public class PreprocessorContext {
     }
 
     public void validate(String preprocessorCmd) throws FrontendException {
-        Preconditions.checkState(pigContext != null);
+        if (pigContext == null) {
+            return;
+        }
 
         final BlackAndWhitelistFilter filter = new BlackAndWhitelistFilter(pigContext);
         final String declareToken = "%declare";