You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2020/05/29 13:04:28 UTC

[velocity-engine] branch master updated: don't leak classes via Stop.STOP_ALL stack trace

This is an automated email from the ASF dual-hosted git repository.

cbrisson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/velocity-engine.git


The following commit(s) were added to refs/heads/master by this push:
     new 95e4623  don't leak classes via Stop.STOP_ALL stack trace
     new 6b6a42a  Merge pull request #15 from donnerpeter/classloader-leak
95e4623 is described below

commit 95e4623cc3f899edc70af2abd49e92606d3eea0e
Author: Peter Gromov <pe...@jetbrains.com>
AuthorDate: Tue May 26 13:03:30 2020 +0200

    don't leak classes via Stop.STOP_ALL stack trace
    
    this prevented garbage-collecting classloaders that accidentally happened to be in the stack trace when Stop class was first accessed
---
 .../src/main/java/org/apache/velocity/runtime/directive/Stop.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java
index 3df6899..1ffe017 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java
@@ -36,7 +36,12 @@ import java.util.ArrayList;
  */
 public class Stop extends Directive
 {
-    private static final StopCommand STOP_ALL = new StopCommand("StopCommand to exit merging");
+    private static final StopCommand STOP_ALL = new StopCommand("StopCommand to exit merging") {
+        @Override
+        public synchronized Throwable fillInStackTrace() {
+            return this;
+        }
+    };
 
     private boolean hasMessage = false;