aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.report
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2011-06-03 07:55:57 +0000
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2011-06-03 07:55:57 +0000
commitc4613ac5c5d1475e920a4b6d78eac6577dab5882 (patch)
treef8866fc6c98e4a297a3f27af290767c91c94a6c5 /org.jacoco.report
parente7e7219a96d19a1be5a4b34f93d012b74e05b33a (diff)
downloadjacoco-c4613ac5c5d1475e920a4b6d78eac6577dab5882.tar.gz
Trac #157: Fixed problem with reporting of nested group structures
Diffstat (limited to 'org.jacoco.report')
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java b/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java
index 5c1b6a8a..47bc7f16 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java
@@ -42,6 +42,7 @@ public abstract class AbstractGroupVisitor implements IReportGroupVisitor {
public final void visitBundle(final IBundleCoverage bundle,
final ISourceFileLocator locator) throws IOException {
+ finalizeLastChild();
total.increment(bundle);
handleBundle(bundle, locator);
}
@@ -58,10 +59,7 @@ public abstract class AbstractGroupVisitor implements IReportGroupVisitor {
public final IReportGroupVisitor visitGroup(final String name)
throws IOException {
- if (lastChild != null) {
- lastChild.visitEnd();
- total.increment(lastChild.total);
- }
+ finalizeLastChild();
lastChild = handleGroup(name);
return lastChild;
}
@@ -82,10 +80,7 @@ public abstract class AbstractGroupVisitor implements IReportGroupVisitor {
* @throws IOException
*/
public final void visitEnd() throws IOException {
- if (lastChild != null) {
- lastChild.visitEnd();
- total.increment(lastChild.total);
- }
+ finalizeLastChild();
handleEnd();
}
@@ -96,4 +91,12 @@ public abstract class AbstractGroupVisitor implements IReportGroupVisitor {
*/
protected abstract void handleEnd() throws IOException;
+ private void finalizeLastChild() throws IOException {
+ if (lastChild != null) {
+ lastChild.visitEnd();
+ total.increment(lastChild.total);
+ lastChild = null;
+ }
+ }
+
}