You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by va...@apache.org on 2023/01/14 00:28:58 UTC

[tinkerpop] branch 3.5-dev updated: TINKERPOP-2847 Compare and store request UUIDs as lower case strings in gremlin-javascript.

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

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


The following commit(s) were added to refs/heads/3.5-dev by this push:
     new e062140603 TINKERPOP-2847 Compare and store request UUIDs as lower case strings in gremlin-javascript.
     new 3992be1f29 Merge pull request #1940 from Bit-Quill/ken/TINKERPOP-2847
e062140603 is described below

commit e062140603b84851c83f4d90719032b76a536261
Author: Ken Hu <10...@users.noreply.github.com>
AuthorDate: Wed Jan 11 21:50:30 2023 -0800

    TINKERPOP-2847 Compare and store request UUIDs as lower case strings in gremlin-javascript.
    
    Storing and comparing the request IDs in lower case prevents issues that
    arise when the supplied ID and returned ID are using different cases to
    represent the hex values of the UUID.
---
 CHANGELOG.asciidoc                                             |  1 +
 .../javascript/gremlin-javascript/lib/driver/connection.js     | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index c62bea681a..82dc0ff69a 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -60,6 +60,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Prevented fast `NoHostAvailableException` in favor of more direct exceptions when borrowing connections from the `ConnectionPool`.
 * Fixed an issue in Go and Python GLVs where modifying per request settings to override request_id's was not working correctly.
 * Fixed incorrect implementation for `GraphTraversalSource.With` in `gremlin-go`.
+* Fixed a case sensitivity issue when comparing request UUIDs in `gremlin-javascript`.
 
 ==== Bugs
 
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
index acaeab4015..39bca7c025 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
@@ -83,7 +83,7 @@ class Connection extends EventEmitter {
      */
     this.mimeType = options.mimeType || defaultMimeType;
 
-    // A map containing the request id and the handler
+    // A map containing the request id and the handler. The id should be in lower case to prevent string comparison issues.
     this._responseHandlers = {};
     this._reader = options.reader || this._getDefaultReader(this.mimeType);
     this._writer = options.writer || this._getDefaultWriter(this.mimeType);
@@ -173,7 +173,8 @@ class Connection extends EventEmitter {
 
   /** @override */
   submit(processor, op, args, requestId) {
-    const rid = requestId || utils.getUuid();
+    // TINKERPOP-2847: Use lower case to prevent string comparison issues.
+    const rid = (requestId || utils.getUuid()).toLowerCase();
     return this.open().then(
       () =>
         new Promise((resolve, reject) => {
@@ -201,7 +202,8 @@ class Connection extends EventEmitter {
 
   /** @override */
   stream(processor, op, args, requestId) {
-    const rid = requestId || utils.getUuid();
+    // TINKERPOP-2847: Use lower case to prevent string comparison issues.
+    const rid = (requestId || utils.getUuid()).toLowerCase();
 
     const readableStream = new Stream.Readable({
       objectMode: true,
@@ -315,6 +317,8 @@ class Connection extends EventEmitter {
       return;
     }
 
+    // TINKERPOP-2847: Use lower case to prevent string comparison issues.
+    response.requestId = response.requestId.toLowerCase();
     const handler = this._responseHandlers[response.requestId];
 
     if (!handler) {