Author: olga
Date: Wed Nov  4 17:25:25 2009
New Revision: 832804

URL: http://svn.apache.org/viewvc?rev=832804&view=rev
Log:
PIG-1058: FINDBUGS: remaining Correctness Warnings (olgan)

Modified:
    hadoop/pig/trunk/CHANGES.txt
    
hadoop/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2InputStream.java
    hadoop/pig/trunk/src/org/apache/pig/Main.java
    hadoop/pig/trunk/src/org/apache/pig/PigServer.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/POPackageAnnotator.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPackageLite.java
    
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/PushDownForeachFlatten.java
    
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/StreamOptimizer.java
    hadoop/pig/trunk/src/org/apache/pig/impl/plan/Operator.java
    hadoop/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java
    hadoop/pig/trunk/src/org/apache/pig/impl/util/JarManager.java
    hadoop/pig/trunk/test/findbugsExcludeFile.xml

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Wed Nov  4 17:25:25 2009
@@ -26,6 +26,8 @@
 
 IMPROVEMENTS
 
+PIG-1058: FINDBUGS: remaining "Correctness Warnings" (olgan)
+
 PIG-1036: Fragment-replicate left outer join (ankit.modi via pradeepkth)
 
 PIG-920:  optimizing diamond queries (rding via pradeepkth)

Modified: 
hadoop/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2InputStream.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2InputStream.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- 
hadoop/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2InputStream.java 
(original)
+++ 
hadoop/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2InputStream.java 
Wed Nov  4 17:25:25 2009
@@ -403,12 +403,10 @@
         int v;
         while (bsLive < n) {
             int zzi;
-            char thech = 0;
-            thech = (char) readBs();
-            if (thech == -1) {
+            zzi = readBs();
+            if (zzi == -1) {
                 compressedStreamEOF();
             }
-            zzi = thech;
             bsBuff = (bsBuff << 8) | (zzi & 0xff);
             bsLive += 8;
         }
@@ -621,17 +619,15 @@
                 {
                     {
                         while (bsLive < 1) {
-                            int zzi;
-                            char thech = 0;
+                            int zzi = 0;
                             try {
-                                thech = (char) readBs();
+                                zzi = readBs();
                             } catch (IOException e) {
                                 compressedStreamEOF();
                             }
-                            if (thech == -1) {
+                            if (zzi == -1) {
                                 compressedStreamEOF();
                             }
-                            zzi = thech;
                             bsBuff = (bsBuff << 8) | (zzi & 0xff);
                             bsLive += 8;
                         }
@@ -676,17 +672,15 @@
                             {
                                 {
                                     while (bsLive < 1) {
-                                        int zzi;
-                                        char thech = 0;
+                                        int zzi = 0;
                                         try {
-                                            thech = (char) readBs();
+                                            zzi = readBs();
                                         } catch (IOException e) {
                                             compressedStreamEOF();
                                         }
-                                        if (thech == -1) {
+                                        if (zzi == -1) {
                                             compressedStreamEOF();
                                         }
-                                        zzi = thech;
                                         bsBuff = (bsBuff << 8) | (zzi & 0xff);
                                         bsLive += 8;
                                     }

Modified: hadoop/pig/trunk/src/org/apache/pig/Main.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/Main.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/Main.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/Main.java Wed Nov  4 17:25:25 2009
@@ -99,7 +99,6 @@
         opts.registerOpt('j', "jar", CmdLineParser.ValueExpected.REQUIRED);
         opts.registerOpt('l', "logfile", CmdLineParser.ValueExpected.REQUIRED);
         opts.registerOpt('m', "param_file", 
CmdLineParser.ValueExpected.OPTIONAL);
-        opts.registerOpt('o', "hod", CmdLineParser.ValueExpected.NOT_ACCEPTED);
         opts.registerOpt('p', "param", CmdLineParser.ValueExpected.OPTIONAL);
         opts.registerOpt('r', "dryrun", 
CmdLineParser.ValueExpected.NOT_ACCEPTED);
         opts.registerOpt('t', "optimizer_off", 
CmdLineParser.ValueExpected.REQUIRED);
@@ -214,16 +213,6 @@
                 properties.setProperty("opt.multiquery",""+false);
                 break;
                             
-            case 'o': 
-                // TODO sgroschupf using system properties is always a very 
bad idea
-                String gateway = System.getProperty("ssh.gateway");
-                if (gateway == null || gateway.length() == 0) {
-                    properties.setProperty("hod.server", "local");
-                } else {
-                    properties.setProperty("hod.server", 
System.getProperty("ssh.gateway"));
-                }
-                break;
-
             case 'p': 
                 String val = opts.getValStr();
                 params.add(opts.getValStr());
@@ -566,7 +555,6 @@
         System.out.println("    -j, -jar jarfile load jarfile"); 
         System.out.println("    -l, -logfile path to client side log file; 
current working directory is default");
         System.out.println("    -m, -param_file path to the parameter file");
-        System.out.println("    -o, -hod read hod server from system property 
ssh.gateway");
         System.out.println("    -p, -param key value pair of the form 
param=val");
         System.out.println("    -r, -dryrun");
         System.out.println("    -t, -optimizer_off optimizer rule name, turn 
optimizer off for this rule; use all to turn all rules off, optimizer is turned 
on by default");

Modified: hadoop/pig/trunk/src/org/apache/pig/PigServer.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/PigServer.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/PigServer.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/PigServer.java Wed Nov  4 17:25:25 2009
@@ -677,7 +677,8 @@
             allPaths.add(elem.toString());
         }
             
-        return (String[])(allPaths.toArray());
+        String[] type = new String[1];
+        return allPaths.toArray(type);
     }
     
     public long totalHadoopTimeSpent() {

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
 Wed Nov  4 17:25:25 2009
@@ -186,8 +186,6 @@
         ds = new HDataStorage(properties);
                 
         // The above HDataStorage constructor sets 
DEFAULT_REPLICATION_FACTOR_KEY in properties.
-        // So we need to reconstruct the configuration object for the non HOD 
case
-        // In the HOD case, this is the first time the configuration object 
will be created
         configuration = ConfigurationUtil.toConfiguration(properties);
         
             

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/POPackageAnnotator.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/POPackageAnnotator.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/POPackageAnnotator.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/POPackageAnnotator.java
 Wed Nov  4 17:25:25 2009
@@ -212,7 +212,7 @@
             if(keyInfo == null)
                 keyInfo = new HashMap<Integer, Pair<Boolean, Map<Integer, 
Integer>>>();
             
-            if(keyInfo.get(lrearrange.getIndex()) != null) {
+            if(keyInfo.get(Integer.valueOf(lrearrange.getIndex())) != null) {
                 // something is wrong - we should not be getting key info 
                 // for the same index from two different Local Rearranges
                 int errCode = 2087;

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPackageLite.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPackageLite.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPackageLite.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPackageLite.java
 Wed Nov  4 17:25:25 2009
@@ -23,6 +23,10 @@
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.apache.pig.impl.util.Pair;
 
 import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
@@ -96,6 +100,10 @@
     public POPackageLite clone() throws CloneNotSupportedException {
         POPackageLite clone = (POPackageLite)super.clone();
         clone.inner = null;
+        clone.keyInfo = new HashMap<Integer, 
Pair<Boolean,Map<Integer,Integer>>>();
+        for (Entry<Integer, Pair<Boolean, Map<Integer,Integer>>> entry: 
keyInfo.entrySet()) {
+            clone.keyInfo.put(entry.getKey(), entry.getValue());
+        }
         return clone;
     }
     

Modified: 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/PushDownForeachFlatten.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/PushDownForeachFlatten.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/PushDownForeachFlatten.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/PushDownForeachFlatten.java
 Wed Nov  4 17:25:25 2009
@@ -163,12 +163,14 @@
             
             // check if any of the foreach's peers is a foreach flatten
             // if so then this rule does not apply
-            for(LogicalOperator peer: peers) {
-                if(!peer.equals(foreach)) {
-                    if(peer instanceof LOForEach) {
-                        LOForEach peerForeach = (LOForEach)peer;
-                        if(peerForeach.hasFlatten().first) {
-                            return false;
+            if (peers != null){
+                for(LogicalOperator peer: peers) {
+                    if(!peer.equals(foreach)) {
+                        if(peer instanceof LOForEach) {
+                            LOForEach peerForeach = (LOForEach)peer;
+                            if(peerForeach.hasFlatten().first) {
+                                return false;
+                            }
                         }
                     }
                 }

Modified: 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/StreamOptimizer.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/StreamOptimizer.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/StreamOptimizer.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/StreamOptimizer.java
 Wed Nov  4 17:25:25 2009
@@ -210,7 +210,7 @@
             LogicalOperator lo = nodes.get(0);
             if (lo == null || !(lo instanceof LOStream)) {
                 throw new RuntimeException("Expected stream, got " +
-                    lo.getClass().getName());
+                    (lo == null ? lo : lo.getClass().getName()));
             }
             LOStream stream = (LOStream)lo;
             if(mOptimizeLoad) {

Modified: hadoop/pig/trunk/src/org/apache/pig/impl/plan/Operator.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/plan/Operator.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/impl/plan/Operator.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/impl/plan/Operator.java Wed Nov  4 
17:25:25 2009
@@ -94,13 +94,10 @@
      */
     @Override
     public boolean equals(Object obj) {
-        if(obj instanceof Operator){
-            Operator opObj = (Operator)obj;
-            if(obj==this)
-                return true;
-            return mKey.equals(opObj);
-        }
-        return false;
+        if(obj==this)
+            return true;
+        else
+            return false;
     }
     
     /**

Modified: 
hadoop/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java 
(original)
+++ hadoop/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java 
Wed Nov  4 17:25:25 2009
@@ -347,12 +347,12 @@
                     // We should receive an EOP only when *ALL* input
                     // for this process has already been sent and no
                     // more input is expected
-                    if (inp.returnStatus == POStatus.STATUS_EOP) {
+                    if (inp != null && inp.returnStatus == 
POStatus.STATUS_EOP) {
                         // signal cleanup in ExecutableManager
                         close();
                         return;
                     }
-                    if (inp.returnStatus == POStatus.STATUS_OK) {
+                    if (inp != null && inp.returnStatus == POStatus.STATUS_OK) 
{
                         // Check if there was a problem with the managed 
process
                         if (outerrThreadsError != null) {
                             throw new IOException(

Modified: hadoop/pig/trunk/src/org/apache/pig/impl/util/JarManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/util/JarManager.java?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/impl/util/JarManager.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/impl/util/JarManager.java Wed Nov  4 
17:25:25 2009
@@ -120,10 +120,9 @@
             // log.error("Adding extra " + pigContext.extraJars.get(i));
             mergeJar(jarFile, pigContext.extraJars.get(i), null, contents);
         }
-        if (pigContext != null) {
-            jarFile.putNextEntry(new ZipEntry("pigContext"));
-            new ObjectOutputStream(jarFile).writeObject(pigContext);
-        }
+
+        jarFile.putNextEntry(new ZipEntry("pigContext"));
+        new ObjectOutputStream(jarFile).writeObject(pigContext);
         jarFile.close();
     }
 

Modified: hadoop/pig/trunk/test/findbugsExcludeFile.xml
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/findbugsExcludeFile.xml?rev=832804&r1=832803&r2=832804&view=diff
==============================================================================
--- hadoop/pig/trunk/test/findbugsExcludeFile.xml (original)
+++ hadoop/pig/trunk/test/findbugsExcludeFile.xml Wed Nov  4 17:25:25 2009
@@ -276,5 +276,53 @@
         <Class 
name="org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POStream"
 />
         <Bug pattern="IS2_INCONSISTENT_SYNC" />
     </Match>
+    <Match>
+        <Class name="org.apache.pig.impl.builtin.DefaultIndexableLoader" />
+        <Bug pattern="UWF_NULL_FIELD" />
+    </Match>
+    <Match>
+        <Class name="org.apache.pig.impl.builtin.MergeJoinIndexer" />
+        <Bug pattern="UWF_NULL_FIELD" />
+    </Match>
+    <Match>
+        <Class 
name="org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MRCompiler" 
/>
+        <Bug pattern="NM_WRONG_PACKAGE" />
+    </Match>
+    <Match>
+        <Class 
name="org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.NoopStoreRemover$PhysicalRemover"
 />
+        <Bug pattern="NM_WRONG_PACKAGE" />
+    </Match>
+    <Match>
+        <Class 
name="org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PhyPlanSetter"
 />
+        <Bug pattern="NM_WRONG_PACKAGE" />
+    </Match>
+    <Match>
+        <Class name="org.apache.pig.impl.logicalLayer.schema.Schema" />
+        <Method name = "equals" />
+        <Bug pattern="NP_NULL_ON_SOME_PATH" />
+    </Match>
+    <Match>
+        <Class 
name="org.apache.pig.impl.logicalLayer.schema.Schema$FieldSchema" />
+        <Method name = "equals" />
+        <Bug pattern="NP_NULL_ON_SOME_PATH" />
+    </Match>
+    <Match>
+        <Class 
name="org.apache.pig.impl.logicalLayer.optimizer.StreamOptimizer" />
+        <Method name = "transform" />
+        <Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE" />
+    </Match>
+    <Match>
+        <Class name="org.apache.pig.impl.logicalLayer.LogicalPlanBuilder" />
+        <Field name = "classloader" />
+        <Bug pattern="MS_CANNOT_BE_FINAL" />
+    </Match>
+    <Match>
+        <Bug pattern="RV_ABSOLUTE_VALUE_OF_HASHCODE" />
+    </Match>
+    <Match>
+        <Class 
name="org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.ConstantExpression"
 />
+        <Field name = "res" />
+        <Bug pattern="MF_CLASS_MASKS_FIELD" />
+    </Match>
     
 </FindBugsFilter>


Reply via email to