groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch GROOVY_2_5_X updated: GROOVY-9200: StringIndexOutOfBoundsException in AstBrowser (also apply to legacy class)
Date Mon, 22 Jul 2019 04:27:10 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new d7151a1  GROOVY-9200: StringIndexOutOfBoundsException in AstBrowser (also apply to
legacy class)
d7151a1 is described below

commit d7151a130b43b31ab5e0ccf18d097e417beb8c81
Author: Paul King <paulk@asert.com.au>
AuthorDate: Mon Jul 22 14:26:15 2019 +1000

    GROOVY-9200: StringIndexOutOfBoundsException in AstBrowser (also apply to legacy class)
---
 .../src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy        | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
b/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
index 9fa6a52..82c38d6 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
@@ -229,8 +229,10 @@ class AstBrowser {
                     def propList = it
                     if (propList[2] == "ListHashMap" && propList[1] != 'null' &&
propList[1] != '[:]') {
                         //If the class is a ListHashMap, make it accessible in a new frame
through a button
+                        def kvPairs = propList[1].substring(1, propList[1].length() - 1).tokenize(',')
+                        def kvFirst = kvPairs.get(0)
                         def btnPanel = swing.button(
-                            text: "See key/value pairs",
+                                text: "Key/value pairs: [" + kvFirst.substring(0, Math.min(25,
kvFirst.size())) + "...]",
                             actionPerformed: {
                                 def mapTable
                                 String title = titleSuffix ? propList[0] + " (" + titleSuffix
+ ")" : propList[0]
@@ -249,7 +251,7 @@ class AstBrowser {
                                     }
                                 }
                                 mapTable.model.rows.clear()
-                                propList[1].substring(1, propList[1].length() - 1).tokenize(',').each
{
+                                kvPairs.each {
                                     def kv = it.tokenize(':')
                                     if (kv)
                                         mapTable.model.rows << ["name": kv[0], "value":
kv[1]]


Mime
View raw message