File tree 1 file changed +6
-1
lines changed
src/main/java/org/springframework/data/domain
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 41
41
* @author Thomas Darimont
42
42
* @author Mark Paluch
43
43
* @author Johannes Englmeier
44
+ * @author Jan Kurella
44
45
*/
45
46
public class Sort implements Streamable <org .springframework .data .domain .Sort .Order >, Serializable {
46
47
@@ -341,14 +342,18 @@ public static Direction fromString(String value) {
341
342
}
342
343
343
344
/**
344
- * Returns the {@link Direction} enum for the given {@link String} or null if it cannot be parsed into an enum
345
+ * Returns the {@link Direction} enum for the given {@link String} or empty if it cannot be parsed into an enum
345
346
* value.
346
347
*
347
348
* @param value
348
349
* @return
349
350
*/
350
351
public static Optional <Direction > fromOptionalString (String value ) {
351
352
353
+ if (value == null ) {
354
+ return Optional .empty ();
355
+ }
356
+
352
357
try {
353
358
return Optional .of (fromString (value ));
354
359
} catch (IllegalArgumentException e ) {
You can’t perform that action at this time.
0 commit comments