Package org.jruby.util
Class SafeDoubleParser
java.lang.Object
org.jruby.util.SafeDecimalParser
org.jruby.util.SafeDoubleParser
A safer way to parse double values
Prevents brute force attacks using the famous Java bug.
-
Field Summary
Fields inherited from class org.jruby.util.SafeDecimalParser
LOWER, MIDDLE, TWO, UPPER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubledoubleValue(Number number) Safe way of getting the double value
prevents BigDecimal from calling Double.parseDouble()static doubledoubleValue(BigDecimal bigDecimal) Safe way of getting the double value
Prevents BigDecimal from calling Double.parseDouble()static DoubleSafe way of parsing a Double value from a Stringstatic DoubleSafe way of parsing a Double value from a StringMethods inherited from class org.jruby.util.SafeDecimalParser
decimalValue, decimalValue, decimalValueOf, isSuspicious
-
Constructor Details
-
SafeDoubleParser
public SafeDoubleParser()
-
-
Method Details
-
valueOf
Safe way of parsing a Double value from a String- Parameters:
s- The input String- Returns:
- the Double value
-
parseDouble
Safe way of parsing a Double value from a String- Parameters:
s- The input String- Returns:
- the Double value
-
doubleValue
Safe way of getting the double value
prevents BigDecimal from calling Double.parseDouble()- Parameters:
number-- Returns:
- the double value
-
doubleValue
Safe way of getting the double value
Prevents BigDecimal from calling Double.parseDouble()- Parameters:
bigDecimal-- Returns:
- the double value
-