Skip to content

Commit 0756e67

Browse files
committed
Merge branch '3.8-dev'
2 parents 6094688 + 5e65298 commit 0756e67

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
@@ -2096,6 +2100,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
20962100
Null values from the incoming traverser are not processed and remain as null when returned.
20972101
20982102
*Exceptions*
2103+
20992104
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
21002105
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
21012106
@@ -2152,6 +2157,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
21522157
Null values from the incoming traverser are not processed and remain as null when returned.
21532158
21542159
*Exceptions*
2160+
21552161
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
21562162
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
21572163
@@ -2182,6 +2188,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
21822188
Null values from the incoming traverser are not processed and remain as null when returned.
21832189
21842190
*Exceptions*
2191+
21852192
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
21862193
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
21872194
@@ -2214,6 +2221,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
22142221
Null values from the incoming traverser are not processed and remain as null when returned.
22152222
22162223
*Exceptions*
2224+
22172225
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
22182226
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
22192227
@@ -2243,6 +2251,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
22432251
Null values from the incoming traverser are not processed and remain as null when returned.
22442252
22452253
*Exceptions*
2254+
22462255
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
22472256
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
22482257
@@ -2272,6 +2281,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
22722281
Null values from the incoming traverser are not processed and remain as null when returned.
22732282
22742283
*Exceptions*
2284+
22752285
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
22762286
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
22772287
@@ -2300,6 +2310,7 @@ The `global` scope will operate on individual string traverser. The `local` scop
23002310
Null values from the incoming traverser are not processed and remain as null when returned.
23012311
23022312
*Exceptions*
2313+
23032314
* For `Scope.global` or parameterless function calls, if the incoming traverser is a non-String value then an `IllegalArgumentException` will be thrown.
23042315
* For `Scope.local`, if the incoming traverser is not a string or a list of strings then an `IllegalArgumentException` will be thrown.
23052316

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)