asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Blow (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: IFrameWriter.close() can be called if open() failed
Date Sun, 11 Jun 2017 05:46:19 GMT
Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1832

Change subject: IFrameWriter.close() can be called if open() failed
......................................................................

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

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

Change-Id: I6f53258765719c30b132bf67680f280924b624be
---
M hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/result/ResultWriterOperatorDescriptor.java
1 file changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/32/1832/1

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 @@
 
             @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();
                 }
             }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f53258765719c30b132bf67680f280924b624be
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mblow@apache.org>

Mime
View raw message