File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
exist-core/src/main/java/org/exist/xquery/value Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -74,18 +74,15 @@ public DoubleValue(final String stringValue) throws XPathException {
74
74
public DoubleValue (final Expression expression , final String stringValue ) throws XPathException {
75
75
super (expression );
76
76
try {
77
- if ("INF" .equals (stringValue )) {
78
- value = Double .POSITIVE_INFINITY ;
79
- } else if ("-INF" .equals (stringValue )) {
80
- value = Double .NEGATIVE_INFINITY ;
81
- } else if ("NaN" .equals (stringValue )) {
82
- value = Double .NaN ;
83
- } else {
84
- value = Double .parseDouble (stringValue );
85
- }
77
+ value = switch (stringValue ) {
78
+ case "INF" -> Double .POSITIVE_INFINITY ;
79
+ case "-INF" -> Double .NEGATIVE_INFINITY ;
80
+ case "NaN" -> Double .NaN ;
81
+ default -> Double .parseDouble (stringValue );
82
+ };
86
83
} catch (final NumberFormatException e ) {
87
- throw new XPathException (getExpression (), ErrorCodes .FORG0001 , "cannot construct " + Type . getTypeName ( this . getItemType ()) +
88
- " from '" + stringValue + "'" );
84
+ throw new XPathException (getExpression (), ErrorCodes .FORG0001 ,
85
+ "Cannot construct " + Type . getTypeName ( getItemType ()) + " from '" + stringValue + "'" );
89
86
}
90
87
}
91
88
You can’t perform that action at this time.
0 commit comments