File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/org/springframework/data/domain Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 4141 * @author Thomas Darimont
4242 * @author Mark Paluch
4343 * @author Johannes Englmeier
44+ * @author Jan Kurella
4445 */
4546public class Sort implements Streamable <org .springframework .data .domain .Sort .Order >, Serializable {
4647
@@ -341,14 +342,18 @@ public static Direction fromString(String value) {
341342 }
342343
343344 /**
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
345346 * value.
346347 *
347348 * @param value
348349 * @return
349350 */
350351 public static Optional <Direction > fromOptionalString (String value ) {
351352
353+ if (value == null ) {
354+ return Optional .empty ();
355+ }
356+
352357 try {
353358 return Optional .of (fromString (value ));
354359 } catch (IllegalArgumentException e ) {
You can’t perform that action at this time.
0 commit comments