Skip to content

Commit db8239f

Browse files
authored
TINKERPOP-3155 Fixed typo for Operator.addAll to check that all args are collections instead of just one. (#3095)
1 parent 94dda41 commit db8239f

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
4444
* Changed `PythonTranslator` to generate snake case step naming instead of camel case.
4545
* Changed `gremlin-go` Client `ReadBufferSize` and `WriteBufferSize` defaults to 1048576 (1MB) to align with DriverRemoteConnection.
4646
* Fixed bug in `IndexStep` which prevented Java serialization due to non-serializable lambda usage by creating serializable function classes.
47+
* Fixed bug in `Operator` which was caused only a single method parameter to be Collection type checked instead of all parameters.
4748
4849
[[release-3-7-3]]
4950
=== TinkerPop 3.7.3 (October 23, 2024)

gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Operator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public Object apply(final Object a, final Object b) {
186186

187187
if (a instanceof Map && b instanceof Map)
188188
((Map<?, ?>) a).putAll((Map) b);
189-
else if (a instanceof Collection && a instanceof Collection)
189+
else if (a instanceof Collection && b instanceof Collection)
190190
((Collection<?>) a).addAll((Collection) b);
191191
else
192192
throw new IllegalArgumentException(String.format("Objects must be both of Map or Collection: a=%s b=%s",

gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/OperatorExceptionTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.apache.tinkerpop.gremlin.process.traversal;
2020

21+
import java.util.Arrays;
2122
import org.junit.Test;
2223

2324
/**
@@ -44,4 +45,9 @@ public void shouldThrowIfValueToMultIsNotNumeric() {
4445
public void shouldThrowIfValueToSumIsNotNumeric() {
4546
Operator.sum.apply("1", "1");
4647
}
48+
49+
@Test(expected = IllegalArgumentException.class)
50+
public void shouldThrowForAddAllIfBothArgsNotCollection() {
51+
Operator.addAll.apply(Arrays.asList(1,2,3), "not a collection");
52+
}
4753
}

0 commit comments

Comments
 (0)