You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2019/07/22 04:26:26 UTC

[groovy] branch master updated: GROOVY-9200: StringIndexOutOfBoundsException in AstBrowser (also apply to legacy class)

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

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


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

commit 01e72cc737c75ad8ec14875f42b5325126240b1a
Author: Paul King <pa...@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 03cf944..9882fc3 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]]