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

paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 2233ec71ef GROOVY-10634: Regular expressions cause groovysh 3.0.10, 
JDK 17 to crash
2233ec71ef is described below

commit 2233ec71ef0b30ccc7d7207ac2924dd225dd81c9
Author: Paul King <[email protected]>
AuthorDate: Sat May 21 16:12:57 2022 +1000

    GROOVY-10634: Regular expressions cause groovysh 3.0.10, JDK 17 to crash
---
 .../src/main/groovy/org/apache/groovy/groovysh/Groovysh.groovy     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Groovysh.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Groovysh.groovy
index 701c947aa3..cd9518f68b 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Groovysh.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Groovysh.groovy
@@ -572,7 +572,7 @@ try {$COLLECTED_BOUND_VARS_MAP_VARNAME[\"$varname\"] = 
$varname;
 
                     io.err.println(buff)
 
-                    buff.setLength(0) // Reset the buffer
+                    Groovysh.reset(buff) // Reset the buffer
                     if (doBreak) {
                         io.err.println('        @|bold ...|@')
                         break
@@ -582,6 +582,11 @@ try {$COLLECTED_BOUND_VARS_MAP_VARNAME[\"$varname\"] = 
$varname;
         }
     }
 
+    @CompileStatic
+    private static void reset(StringBuilder buff) {
+        buff.setLength(0)
+    }
+
     // protected for mocking in tests
     protected String getPreference(final String key, final String theDefault) {
         return Preferences.get(key, theDefault)

Reply via email to