merged hyracks_asterix_stabilization r1829:1876

git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1878 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Task.java b/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Task.java
index 91e1d51..eba3ec9 100644
--- a/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Task.java
+++ b/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Task.java
@@ -308,19 +308,22 @@
                 reader.open();
                 try {
                     writer.open();
-                    ByteBuffer buffer = allocateFrame();
-                    while (reader.nextFrame(buffer)) {
-                        if (aborted) {
-                            return;
+                    try {
+                        ByteBuffer buffer = allocateFrame();
+                        while (reader.nextFrame(buffer)) {
+                            if (aborted) {
+                                return;
+                            }
+                            buffer.flip();
+                            writer.nextFrame(buffer);
+                            buffer.compact();
                         }
-                        buffer.flip();
-                        writer.nextFrame(buffer);
-                        buffer.compact();
+                    } catch (Exception e) {
+                        writer.fail();
+                        throw e;
+                    } finally {
+                        writer.close();
                     }
-                    writer.close();
-                } catch (Exception e) {
-                    writer.fail();
-                    throw e;
                 } finally {
                     reader.close();
                 }
@@ -346,6 +349,7 @@
 
     @Override
     public void sendApplicationMessageToCC(byte[] message, String nodeId) throws Exception {
-        this.ncs.sendApplicationMessageToCC(message, this.getJobletContext().getApplicationContext().getApplicationName(), nodeId);
+        this.ncs.sendApplicationMessageToCC(message, this.getJobletContext().getApplicationContext()
+                .getApplicationName(), nodeId);
     }
 }
\ No newline at end of file