pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1605660 - in /pig/trunk: ./ src/org/apache/pig/ src/org/apache/pig/impl/util/ test/org/apache/pig/
Date Thu, 26 Jun 2014 04:20:03 GMT
Author: daijy
Date: Thu Jun 26 04:20:03 2014
New Revision: 1605660

URL: http://svn.apache.org/r1605660
Log:
PIG-4025: TestLoadFuncWrapper, TestLoadFuncMetaDataWrapper,TestStoreFuncWrapper and TestStoreFuncMetadataWrapper
fail on IBM JDK

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/LoadFuncWrapper.java
    pig/trunk/src/org/apache/pig/StoreFuncWrapper.java
    pig/trunk/src/org/apache/pig/impl/util/Utils.java
    pig/trunk/test/org/apache/pig/TestLoadFuncWrapper.java
    pig/trunk/test/org/apache/pig/TestStoreFuncWrapper.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1605660&r1=1605659&r2=1605660&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Thu Jun 26 04:20:03 2014
@@ -40,6 +40,9 @@ OPTIMIZATIONS
  
 BUG FIXES
 
+PIG-4025: TestLoadFuncWrapper, TestLoadFuncMetaDataWrapper,TestStoreFuncWrapper
+ and TestStoreFuncMetadataWrapper fail on IBM JDK (ahireanup via daijy)
+
 PIG-4024: TestPigStreamingUDF and TestPigStreaming fail on IBM JDK (ahireanup via daijy)
 
 PIG-4023: BigDec/Int sort is broken (ahireanup via daijy)

Modified: pig/trunk/src/org/apache/pig/LoadFuncWrapper.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/LoadFuncWrapper.java?rev=1605660&r1=1605659&r2=1605660&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/LoadFuncWrapper.java (original)
+++ pig/trunk/src/org/apache/pig/LoadFuncWrapper.java Thu Jun 26 04:20:03 2014
@@ -25,6 +25,7 @@ import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.RecordReader;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit;
 import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.util.Utils;
 
 /**
  * Convenience class to extend when decorating a LoadFunc. Subclasses must call the setLoadFunc
@@ -100,7 +101,13 @@ public class LoadFuncWrapper extends Loa
      */
     protected String getMethodName(final int depth) {
         final StackTraceElement[] ste = Thread.currentThread().getStackTrace();
-        return ste[2 + depth].getMethodName();
+        int index;
+        if (Utils.isVendorIBM()) {
+          index = 3 + depth;
+        } else {
+          index = 2 + depth;
+        }
+        return ste[index].getMethodName();
     }
 
 }

Modified: pig/trunk/src/org/apache/pig/StoreFuncWrapper.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/StoreFuncWrapper.java?rev=1605660&r1=1605659&r2=1605660&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/StoreFuncWrapper.java (original)
+++ pig/trunk/src/org/apache/pig/StoreFuncWrapper.java Thu Jun 26 04:20:03 2014
@@ -22,6 +22,7 @@ import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.OutputFormat;
 import org.apache.hadoop.mapreduce.RecordWriter;
 import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.util.Utils;
 
 import java.io.IOException;
 
@@ -110,6 +111,12 @@ public class StoreFuncWrapper implements
      */
     protected String getMethodName(final int depth) {
         final StackTraceElement[] ste = Thread.currentThread().getStackTrace();
-        return ste[2 + depth].getMethodName();
+        int index;
+        if (Utils.isVendorIBM()) {
+          index = 3 + depth;
+        } else {
+          index = 2 + depth;
+        }
+        return ste[index].getMethodName();
     }
-}
+}
\ No newline at end of file

Modified: pig/trunk/src/org/apache/pig/impl/util/Utils.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/impl/util/Utils.java?rev=1605660&r1=1605659&r2=1605660&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/impl/util/Utils.java (original)
+++ pig/trunk/src/org/apache/pig/impl/util/Utils.java Thu Jun 26 04:20:03 2014
@@ -81,6 +81,17 @@ import com.google.common.collect.Lists;
  */
 public class Utils {
     private static final Log log = LogFactory.getLog(Utils.class);
+    
+    /**
+     * This method checks whether JVM vendor is IBM
+     * @return true if IBM JVM is being used
+     * false otherwise
+     */
+    public static boolean isVendorIBM() {    	
+    	  return System.getProperty("java.vendor").contains("IBM");
+    }
+    
+    
     /**
      * This method is a helper for classes to implement {@link java.lang.Object#equals(java.lang.Object)}
      * checks if two objects are equals - two levels of checks are

Modified: pig/trunk/test/org/apache/pig/TestLoadFuncWrapper.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/TestLoadFuncWrapper.java?rev=1605660&r1=1605659&r2=1605660&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/TestLoadFuncWrapper.java (original)
+++ pig/trunk/test/org/apache/pig/TestLoadFuncWrapper.java Thu Jun 26 04:20:03 2014
@@ -31,6 +31,7 @@ import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.RecordReader;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit;
 import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.util.Utils;
 import org.junit.Test;
 
 /**
@@ -39,8 +40,10 @@ import org.junit.Test;
 public class TestLoadFuncWrapper {
 
     // Asserts that each call to a Wrapper invokes the correct method on the Wrappee.
+	
     @Test
-    public void testSucess() throws IOException {
+    public void testSucess() throws IOException {    	
+    	
         DummyLoadFunc loadFunc = new DummyLoadFunc();
         MockWrapper wrapper = new MockWrapper(loadFunc);
 
@@ -107,7 +110,14 @@ public class TestLoadFuncWrapper {
 
         public String getLastMethodCalled() { return methodCalls.pop(); }
         protected void setLastMethodCalled() {
-            methodCalls.push(Thread.currentThread().getStackTrace()[2].getMethodName());
+        	StackTraceElement e[] = Thread.currentThread().getStackTrace();            
+            int index;
+            if (Utils.isVendorIBM()) {
+              index = 3;
+            } else {
+              index = 2;
+            }
+            methodCalls.push(e[index].getMethodName());
         }
         
         @Override

Modified: pig/trunk/test/org/apache/pig/TestStoreFuncWrapper.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/TestStoreFuncWrapper.java?rev=1605660&r1=1605659&r2=1605660&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/TestStoreFuncWrapper.java (original)
+++ pig/trunk/test/org/apache/pig/TestStoreFuncWrapper.java Thu Jun 26 04:20:03 2014
@@ -22,6 +22,7 @@ import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.OutputFormat;
 import org.apache.hadoop.mapreduce.RecordWriter;
 import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.util.Utils;
 import org.junit.Test;
 
 import java.io.IOException;
@@ -111,8 +112,15 @@ public class TestStoreFuncWrapper {
         private LinkedList<String> methodCalls = new LinkedList<String>();
 
         public String getLastMethodCalled() { return methodCalls.pop(); }
-        protected void setLastMethodCalled() {
-            methodCalls.push(Thread.currentThread().getStackTrace()[2].getMethodName());
+        protected void setLastMethodCalled() {            
+            StackTraceElement e[] = Thread.currentThread().getStackTrace();             
     
+            int index;
+            if (Utils.isVendorIBM()) {
+              index = 3;
+            } else {
+              index = 2;
+            }
+            methodCalls.push(e[index].getMethodName());
         }
 
         @Override



Mime
View raw message