asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject asterixdb git commit: IFrameWriter.close() can be called if open() failed
Date Sun, 11 Jun 2017 16:28:04 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master f0759c85b -> 86f3908ba


IFrameWriter.close() can be called if open() failed

Fix potential NPE in ResultWriterOperatorDescriptor should open() fail
and close() be subsequently called

Change-Id: I6f53258765719c30b132bf67680f280924b624be
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1832
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


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

Branch: refs/heads/master
Commit: 86f3908ba93090c2546b6887db930d523864b639
Parents: f0759c8
Author: Michael Blow <mblow@apache.org>
Authored: Sun Jun 11 01:45:24 2017 -0400
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Sun Jun 11 09:27:39 2017 -0700

----------------------------------------------------------------------
 .../result/ResultWriterOperatorDescriptor.java    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/86f3908b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/result/ResultWriterOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/result/ResultWriterOperatorDescriptor.java
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/result/ResultWriterOperatorDescriptor.java
index d3120bb..78417ac 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/result/ResultWriterOperatorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/result/ResultWriterOperatorDescriptor.java
@@ -117,15 +117,17 @@ public class ResultWriterOperatorDescriptor extends AbstractSingleActivityOperat
 
             @Override
             public void close() throws HyracksDataException {
-                try {
-                    if (!failed && frameOutputStream.getTupleCount() > 0) {
-                        frameOutputStream.flush(datasetPartitionWriter);
+                if (datasetPartitionWriter != null) {
+                    try {
+                        if (!failed && frameOutputStream.getTupleCount() > 0)
{
+                            frameOutputStream.flush(datasetPartitionWriter);
+                        }
+                    } catch (Exception e) {
+                        datasetPartitionWriter.fail();
+                        throw e;
+                    } finally {
+                        datasetPartitionWriter.close();
                     }
-                } catch (Exception e) {
-                    datasetPartitionWriter.fail();
-                    throw e;
-                } finally {
-                    datasetPartitionWriter.close();
                 }
             }
 


Mime
View raw message