Skip to content

Commit 5e65298

Browse files
committed
Merge branch '3.7-dev' into 3.8-dev
2 parents 482475e + d5f4a29 commit 5e65298

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

docs/src/dev/provider/gremlin-semantics.asciidoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ None
822822
Incoming date remains unchanged.
823823
824824
*Exceptions*
825+
825826
* If the incoming traverser is a non-String/Number/Date value then an `IllegalArgumentException` will be thrown.
826827
827828
See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsDateStep.java[source],
@@ -851,6 +852,7 @@ list of string instead.
851852
Null values from the incoming traverser are not processed and remain as null when returned.
852853
853854
*Exceptions*
855+
854856
None
855857
856858
See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsStringGlobalStep.java[source],
@@ -1611,6 +1613,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
16111613
Null values from the incoming traverser are not processed and remain as null when returned.
16121614
16131615
*Exceptions*
1616+
16141617
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
16151618
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
16161619
@@ -1709,6 +1712,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
17091712
Null values from the incoming traverser are not processed and remain as null when returned.
17101713
17111714
*Exceptions*
1715+
17121716
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
17131717
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
17141718
@@ -2097,6 +2101,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
20972101
Null values from the incoming traverser are not processed and remain as null when returned.
20982102
20992103
*Exceptions*
2104+
21002105
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
21012106
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
21022107
@@ -2153,6 +2158,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
21532158
Null values from the incoming traverser are not processed and remain as null when returned.
21542159
21552160
*Exceptions*
2161+
21562162
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
21572163
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
21582164
@@ -2183,6 +2189,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
21832189
Null values from the incoming traverser are not processed and remain as null when returned.
21842190
21852191
*Exceptions*
2192+
21862193
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
21872194
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
21882195
@@ -2215,6 +2222,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
22152222
Null values from the incoming traverser are not processed and remain as null when returned.
22162223
22172224
*Exceptions*
2225+
22182226
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
22192227
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
22202228
@@ -2244,6 +2252,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
22442252
Null values from the incoming traverser are not processed and remain as null when returned.
22452253
22462254
*Exceptions*
2255+
22472256
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
22482257
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
22492258
@@ -2273,6 +2282,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
22732282
Null values from the incoming traverser are not processed and remain as null when returned.
22742283
22752284
*Exceptions*
2285+
22762286
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
22772287
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
22782288
@@ -2301,6 +2311,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
23012311
Null values from the incoming traverser are not processed and remain as null when returned.
23022312
23032313
*Exceptions*
2314+
23042315
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
23052316
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
23062317

gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/DateDiffStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected Long map(final Traverser.Admin<S> traverser) {
7070
} else {
7171
// note: null handling consistency to be resolved https://issues.apache.org/jira/browse/TINKERPOP-3152
7272
throw new IllegalArgumentException(
73-
String.format("DateDiff can only take OffsetDateTime or Date (deprecated) as argument, encountered %s", object.getClass()));
73+
String.format("DateDiff can only take OffsetDateTime or Date (deprecated) as argument, encountered %s", object == null ? null : object.getClass()));
7474
}
7575
} else {
7676
date = (OffsetDateTime) object;

gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/DateDiffStepTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,9 @@ public void shouldHandleNullDateWithDateCompatibility() {
136136

137137
assertEquals(now.getTime() / 1000, (long) __.__(now).dateDiff((Date) null).next());
138138
}
139+
140+
@Test(expected = IllegalArgumentException.class)
141+
public void shouldThrowWhenInputIsNull() {
142+
__.__((Object) null).dateDiff(new Date()).next();
143+
}
139144
}

0 commit comments

Comments
 (0)