Author: gates
Date: Thu Oct 30 10:09:09 2008
New Revision: 709212

URL: http://svn.apache.org/viewvc?rev=709212&view=rev
Log:
PIG-510.  Fix JDK 5 incompatibility in PigStorage.java


Modified:
    hadoop/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java

Modified: hadoop/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java?rev=709212&r1=709211&r2=709212&view=diff
==============================================================================
--- hadoop/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java 
(original)
+++ hadoop/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java Thu 
Oct 30 10:09:09 2008
@@ -223,8 +223,15 @@
             // if the user requested this to be viewed as a certain
             // type, and if so, then construct it appropriately.
             byte[] array = mBuf.toByteArray();
-            if (array[array.length-1]=='\r' && os==OS_WINDOWS)
-                array = Arrays.copyOf(array, array.length-1);
+            if (array[array.length-1]=='\r' && os==OS_WINDOWS) {
+                // This is a java 1.6 function.  Until pig officially moves to
+                // 1.6 we can't use this.
+                // array = Arrays.copyOf(array, array.length-1);
+                byte[] tmp = new byte[array.length - 1];
+                for (int i = 0; i < array.length - 1; i++) tmp[i] = array[i];
+                array = tmp;
+            }
+                
             if (array.length==0)
                 mProtoTuple.add(null);
             else


Reply via email to