From afc0f257955caf978a2f4808b52aace960010c30 Mon Sep 17 00:00:00 2001 From: Frits Jalvingh Date: Mon, 4 Jul 2016 08:51:27 +0200 Subject: [PATCH] Fix for 1501: CyclomaticComplexity rule causes OOM when class reporting is disabled --- .../lang/java/rule/codesize/StdCyclomaticComplexityRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codesize/StdCyclomaticComplexityRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codesize/StdCyclomaticComplexityRule.java index 488671b93d..5f8efed33c 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codesize/StdCyclomaticComplexityRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codesize/StdCyclomaticComplexityRule.java @@ -166,8 +166,8 @@ public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { entryStack.push( new Entry( node ) ); super.visit( node, data ); + Entry classEntry = entryStack.pop(); if ( showClassesComplexity ) { - Entry classEntry = entryStack.pop(); if ( classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel ) { addViolation( data, node, new String[] {