You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ke...@apache.org on 2025/02/08 00:12:29 UTC

(tinkerpop) branch 3.7-dev updated: TINKERPOP-3038: Console plugins file can't accept empty lines (#3003)

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

kenhuuu pushed a commit to branch 3.7-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.7-dev by this push:
     new a439f81434 TINKERPOP-3038: Console plugins file can't accept empty lines (#3003)
a439f81434 is described below

commit a439f81434ed513b04a29a698a8276c2cdfcc62a
Author: Flora Jin <14...@users.noreply.github.com>
AuthorDate: Fri Feb 7 16:12:24 2025 -0800

    TINKERPOP-3038: Console plugins file can't accept empty lines (#3003)
    
    Updated changelog and added support for console to consider empty lines and typos
---
 CHANGELOG.asciidoc                                            |  1 +
 .../org/apache/tinkerpop/gremlin/console/Console.groovy       | 11 ++++++++---
 .../org/apache/tinkerpop/gremlin/console/Mediator.groovy      |  4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 447a9b33e3..3b000443e5 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -31,6 +31,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Changed Gremlin grammar to make use of `g` to spawn child traversals a syntax error.
 * Added `unexpected-response` handler to `ws` for `gremlin-javascript`
 * Fixed bug in `TinkerTransactionGraph` where a read-only transaction may leave elements trapped in a "zombie transaction".
+* Fixed issue in `gremlin-console` where it couldn't accept plugin files that included empty lines or invalid plugin names.
 
 [[release-3-7-3]]
 === TinkerPop 3.7.3 (October 23, 2024)
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index b54396b287..d9b342c358 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -151,10 +151,15 @@ class Console {
         // if there are active plugins then initialize them in the order that they are listed
         activePlugins.each { pluginName ->
             def pluggedIn = mediator.availablePlugins[pluginName]
-            pluggedIn.activate()
 
-            if (!io.quiet)
-                io.out.println(Colorizer.render(Preferences.infoColor, "plugin activated: " + pluggedIn.getPlugin().getName()))
+            if (pluggedIn != null) {
+                pluggedIn.activate()
+
+                if (!io.quiet)
+                    io.out.println(Colorizer.render(Preferences.infoColor, "plugin activated: " + pluggedIn.getPlugin().getName()))
+            } else if (!io.quiet) {
+                    io.out.println(Colorizer.render(Preferences.infoColor, "invalid plugin: " + pluginName))
+            }
         }
 
         // remove any "uninstalled" plugins from plugin state as it means they were installed, activated, but not
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
index 4efeb9b6ce..a7bc9b3cc4 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
@@ -22,6 +22,8 @@ import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor
 
 import java.util.concurrent.atomic.AtomicBoolean
 
+import org.apache.commons.lang3.StringUtils
+
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
@@ -104,7 +106,7 @@ class Mediator {
 
     static def readPluginState() {
         def file = new File(ConsoleFs.PLUGIN_CONFIG_FILE)
-        return file.exists() ? file.readLines() : []
+        return file.exists() ? file.readLines().findAll { StringUtils.isNotEmpty(it) } : []
     }
 
     def void close() {