asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in hyracks[master]: Misc. Coverity Issues
Date Fri, 04 Mar 2016 18:23:24 GMT
abdullah alamoudi has submitted this change and it was merged.

Change subject: Misc. Coverity Issues
......................................................................


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>
---
M algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/LogicalExpressionDeepCopyWithNewVariablesVisitor.java
M algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
M hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/dataset/DatasetDirectoryService.java
M hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
M hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
M hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractExternalSortRunMerger.java
M hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
7 files changed, 18 insertions(+), 16 deletions(-)

Approvals:
  Yingyi Bu: Looks good to me, approved
  Jenkins: Verified



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 @@
     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);
         }
     }
 
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 @@
                     + " 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 "
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 @@
         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();
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 @@
             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 @@
     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];
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 @@
         Arrays.fill(partitionArray, null);
     }
 
-    private class PartitionFrameBufferManager implements IFrameBufferManager {
+    private static class PartitionFrameBufferManager implements IFrameBufferManager {
 
         ArrayList<ByteBuffer> buffers = new ArrayList<>();
 
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 @@
                 }
             }
         } catch (Exception e) {
-            finalWriter.fail();
+            if (finalWriter != null) {
+                finalWriter.fail();
+            }
             throw new HyracksDataException(e);
         } finally {
-            finalWriter.close();
+            if (finalWriter != null) {
+                finalWriter.close();
+            }
         }
     }
 
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.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 @@
         return offset;
     }
 
-    class IntSerDeBuffer {
+    private static class IntSerDeBuffer {
 
         private byte[] bytes;
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/686
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie90a91682ae0ee2443fce1677fca0e00fa45c5f0
Gerrit-PatchSet: 2
Gerrit-Project: hyracks
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <michael.blow@couchbase.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message