Fixed bug in Grace Hash Join

git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_dev_next@823 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/GraceHashJoinOperatorDescriptor.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/GraceHashJoinOperatorDescriptor.java
index 2a2141a..38e0b91 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/GraceHashJoinOperatorDescriptor.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/GraceHashJoinOperatorDescriptor.java
@@ -218,16 +218,15 @@
 
                         int entry = hpc.partition(accessor0, i, numPartitions);
                         ByteBuffer outbuf = outbufs[entry];
-                        appender.reset(outbuf, true);
-                        while (true) {
-                            if (appender.append(accessor0, i)) {
-                                break;
-                            } else {
-                                // buffer is full, ie. we cannot fit the tuple
-                                // into the buffer -- write it to disk
-                                write(entry, outbuf);
-                                outbuf.clear();
-                                appender.reset(outbuf, true);
+                        appender.reset(outbuf, false);
+                        if (!appender.append(accessor0, i)) {
+                            // buffer is full, ie. we cannot fit the tuple
+                            // into the buffer -- write it to disk
+                            write(entry, outbuf);
+                            outbuf.clear();
+                            appender.reset(outbuf, true);
+                            if (!appender.append(accessor0, i)) {
+                                throw new HyracksDataException("Item too big to fit in frame");
                             }
                         }
                     }