asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject incubator-asterixdb-hyracks git commit: Misc. Coverity Issues
Date Fri, 04 Mar 2016 18:28:59 GMT
Repository: incubator-asterixdb-hyracks
Updated Branches:
  refs/heads/master fb530551b -> f29a50c8c


Misc. Coverity Issues

Clean up a few issues encountered in Coverity scan

Change-Id: Ie90a91682ae0ee2443fce1677fca0e00fa45c5f0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/686
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/commit/f29a50c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/tree/f29a50c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/diff/f29a50c8

Branch: refs/heads/master
Commit: f29a50c8c0af6b7e0e1e364d68791dd93981b2fc
Parents: fb53055
Author: Michael Blow <michael.blow@couchbase.com>
Authored: Thu Mar 3 19:43:08 2016 -0500
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Fri Mar 4 10:23:23 2016 -0800

----------------------------------------------------------------------
 .../LogicalExpressionDeepCopyWithNewVariablesVisitor.java    | 6 +++---
 .../algebra/operators/physical/AbstractPhysicalOperator.java | 4 ++--
 .../hyracks/control/cc/dataset/DatasetDirectoryService.java  | 3 +--
 .../hyracks/control/nc/dataset/DatasetPartitionManager.java  | 8 ++++----
 .../std/buffermanager/VPartitionTupleBufferManager.java      | 2 +-
 .../dataflow/std/sort/AbstractExternalSortRunMerger.java     | 8 ++++++--
 .../dataflow/std/structures/SerializableHashTable.java       | 3 +--
 7 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/LogicalExpressionDeepCopyWithNewVariablesVisitor.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/LogicalExpressionDeepCopyWithNewVariablesVisitor.java
b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/LogicalExpressionDeepCopyWithNewVariablesVisitor.java
index 7f50db0..5eca2bd 100644
--- a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/LogicalExpressionDeepCopyWithNewVariablesVisitor.java
+++ b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/LogicalExpressionDeepCopyWithNewVariablesVisitor.java
@@ -61,9 +61,9 @@ public class LogicalExpressionDeepCopyWithNewVariablesVisitor
     private void deepCopyAnnotations(AbstractFunctionCallExpression src, AbstractFunctionCallExpression
dest) {
         Map<Object, IExpressionAnnotation> srcAnnotations = src.getAnnotations();
         Map<Object, IExpressionAnnotation> destAnnotations = dest.getAnnotations();
-        for (Object k : srcAnnotations.keySet()) {
-            IExpressionAnnotation annotation = srcAnnotations.get(k).copy();
-            destAnnotations.put(k, annotation);
+        for (Map.Entry<Object, IExpressionAnnotation> annotationEntry : srcAnnotations.entrySet())
{
+            IExpressionAnnotation annotation = annotationEntry.getValue().copy();
+            destAnnotations.put(annotationEntry.getKey(), annotation);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
index b1c16a1..0fb667a 100644
--- a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
+++ b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
@@ -145,8 +145,8 @@ public abstract class AbstractPhysicalOperator implements IPhysicalOperator
{
                     + " operator descriptors. Currently, nested plans can only consist in
linear pipelines of Asterix micro operators.");
         }
 
-        for (OperatorDescriptorId oid : opMap.keySet()) {
-            IOperatorDescriptor opd = opMap.get(oid);
+        for (Map.Entry<OperatorDescriptorId, IOperatorDescriptor> opEntry : opMap.entrySet())
{
+            IOperatorDescriptor opd = opEntry.getValue();
             if (!(opd instanceof AlgebricksMetaOperatorDescriptor)) {
                 throw new AlgebricksException(
                         "Can only generate Hyracks jobs for pipelinable Asterix nested plans,
not for "

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/dataset/DatasetDirectoryService.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/dataset/DatasetDirectoryService.java
b/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/dataset/DatasetDirectoryService.java
index 353ad21..5d45920 100644
--- a/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/dataset/DatasetDirectoryService.java
+++ b/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/dataset/DatasetDirectoryService.java
@@ -168,8 +168,7 @@ public class DatasetDirectoryService implements IDatasetDirectoryService
{
         final Waiters waiters = jobResultLocations.get(jobId).waiters;
         if (waiters != null) {
             for (ResultSetId rsId : waiters.keySet()) {
-                waiters.get(rsId).callback.setException(exceptions.get(0));
-                waiters.remove(rsId);
+                waiters.remove(rsId).callback.setException(exceptions.get(0));
             }
         }
         notifyAll();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
index b4b6229..55fa56e 100644
--- a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
+++ b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
@@ -196,8 +196,8 @@ public class DatasetPartitionManager implements IDatasetPartitionManager
{
             return;
         }
 
-        for (ResultSetId rsId : rsIdMap.keySet()) {
-            ResultState[] resultStates = rsIdMap.get(rsId);
+        for (Entry<ResultSetId, ResultState[]> mapEntry : rsIdMap.entrySet()) {
+            ResultState[] resultStates = mapEntry.getValue();
             if (resultStates != null) {
                 for (ResultState state : resultStates) {
                     if (state != null) {
@@ -240,8 +240,8 @@ public class DatasetPartitionManager implements IDatasetPartitionManager
{
     private void deinit(JobId jobId) {
         ResultSetMap rsIdMap = (ResultSetMap) partitionResultStateMap.get(jobId);
         if (rsIdMap != null) {
-            for (ResultSetId rsId : rsIdMap.keySet()) {
-                ResultState[] resultStates = rsIdMap.get(rsId);
+            for (Entry<ResultSetId, ResultState[]> mapEntry : rsIdMap.entrySet()) {
+                ResultState[] resultStates = mapEntry.getValue();
                 if (resultStates != null) {
                     for (int i = 0; i < resultStates.length; i++) {
                         ResultState state = resultStates[i];

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
index ed54973..f46a374 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
@@ -208,7 +208,7 @@ public class VPartitionTupleBufferManager implements IPartitionedTupleBufferMana
         Arrays.fill(partitionArray, null);
     }
 
-    private class PartitionFrameBufferManager implements IFrameBufferManager {
+    private static class PartitionFrameBufferManager implements IFrameBufferManager {
 
         ArrayList<ByteBuffer> buffers = new ArrayList<>();
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractExternalSortRunMerger.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractExternalSortRunMerger.java
b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractExternalSortRunMerger.java
index 24154f7..6e2c3f0 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractExternalSortRunMerger.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractExternalSortRunMerger.java
@@ -158,10 +158,14 @@ public abstract class AbstractExternalSortRunMerger {
                 }
             }
         } catch (Exception e) {
-            finalWriter.fail();
+            if (finalWriter != null) {
+                finalWriter.fail();
+            }
             throw new HyracksDataException(e);
         } finally {
-            finalWriter.close();
+            if (finalWriter != null) {
+                finalWriter.close();
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/f29a50c8/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
index 1f2ebef..8699c10 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hyracks.api.context.IHyracksFrameMgrContext;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 /**
@@ -295,7 +294,7 @@ public class SerializableHashTable implements ISerializableTable {
         return offset;
     }
 
-    class IntSerDeBuffer {
+    private static class IntSerDeBuffer {
 
         private byte[] bytes;
 


Mime
View raw message