From 0dfec6f4308d8d19c60f1ce6299ffa81f7c5ae52 Mon Sep 17 00:00:00 2001 From: Oleg Sukhodolsky Date: Fri, 10 Oct 2003 16:42:54 +0000 Subject: [PATCH] Fixed leak in IndetationCheck (always clear the chaches ;) --- .../tools/checkstyle/checks/indentation/HandlerFactory.java | 6 ++++++ .../checkstyle/checks/indentation/IndentationCheck.java | 1 + 2 files changed, 7 insertions(+) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java index 60821a80f..3a52e4252 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java @@ -228,6 +228,12 @@ public class HandlerFactory return new MethodCallHandler(aIndentCheck, aAst, aParent); } + /** Clears cache of created handlers. */ + void clearCreatedHandlers() + { + mCreatedHandlers.clear(); + } + /** cache for created method call handlers */ private Map mCreatedHandlers = new HashMap(); } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java index 51f528398..c15cfa514 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java @@ -230,6 +230,7 @@ public class IndentationCheck extends Check */ public void beginTree(DetailAST aAst) { + mHandlerFactory.clearCreatedHandlers(); mHandlers.clear(); mHandlers.push(new PrimordialHandler(this)); }