summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-08-20 22:11:31 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-08-20 22:11:31 +0000
commit855da7da34da9509613179584653dd99c5aa4e59 (patch)
tree95e0874d9cf81097faaa6822a92e6cffcd11ec5f /src/main/java/com/amazon
parent3f6beac3a91be0b04386b03370705787ac13c998 (diff)
Fixed bug in GroupedCursor which discarded last group if it had one element.
Diffstat (limited to 'src/main/java/com/amazon')
-rw-r--r--src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java b/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java
index daf9419..6d9afc5 100644
--- a/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java
+++ b/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java
@@ -137,9 +137,7 @@ public abstract class GroupedCursor<S, G> extends AbstractCursor<G> {
addToGroup(groupMember);
} else {
G aggregate = finishGroup();
-
beginGroup(mGroupLeader = groupMember);
-
if (aggregate != null) {
mNextAggregate = aggregate;
return true;
@@ -150,7 +148,7 @@ public abstract class GroupedCursor<S, G> extends AbstractCursor<G> {
}
G aggregate = finishGroup();
-
+ mGroupLeader = null;
if (aggregate != null) {
mNextAggregate = aggregate;
return true;
@@ -166,6 +164,15 @@ public abstract class GroupedCursor<S, G> extends AbstractCursor<G> {
throw e;
}
+ if (mGroupLeader != null) {
+ G aggregate = finishGroup();
+ mGroupLeader = null;
+ if (aggregate != null) {
+ mNextAggregate = aggregate;
+ return true;
+ }
+ }
+
return false;
}