mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Reformat floatutil.
This commit is contained in:
parent
3634cab1a5
commit
5e605f992a
3 changed files with 11 additions and 17 deletions
|
@ -34,7 +34,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.8.4-R0.1-SNAPSHOT</version>
|
<version>1.8.7-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>BOSEconomy</groupId>
|
<groupId>BOSEconomy</groupId>
|
||||||
|
|
|
@ -3,33 +3,27 @@ package com.earth2me.essentials.utils;
|
||||||
/**
|
/**
|
||||||
* parseFloat and parseDouble proxies that are protected against non-finite values.
|
* parseFloat and parseDouble proxies that are protected against non-finite values.
|
||||||
*/
|
*/
|
||||||
public class FloatUtil
|
public class FloatUtil {
|
||||||
{
|
private FloatUtil() {
|
||||||
private FloatUtil() {}
|
}
|
||||||
|
|
||||||
public static float parseFloat(String s) throws NumberFormatException
|
public static float parseFloat(String s) throws NumberFormatException {
|
||||||
{
|
|
||||||
float f = Float.parseFloat(s);
|
float f = Float.parseFloat(s);
|
||||||
if (Float.isNaN(f))
|
if (Float.isNaN(f)) {
|
||||||
{
|
|
||||||
throw new NumberFormatException("NaN is not valid");
|
throw new NumberFormatException("NaN is not valid");
|
||||||
}
|
}
|
||||||
if (Float.isInfinite(f))
|
if (Float.isInfinite(f)) {
|
||||||
{
|
|
||||||
throw new NumberFormatException("Infinity is not valid");
|
throw new NumberFormatException("Infinity is not valid");
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double parseDouble(String s) throws NumberFormatException
|
public static double parseDouble(String s) throws NumberFormatException {
|
||||||
{
|
|
||||||
double d = Double.parseDouble(s);
|
double d = Double.parseDouble(s);
|
||||||
if (Double.isNaN(d))
|
if (Double.isNaN(d)) {
|
||||||
{
|
|
||||||
throw new NumberFormatException("NaN is not valid");
|
throw new NumberFormatException("NaN is not valid");
|
||||||
}
|
}
|
||||||
if (Double.isInfinite(d))
|
if (Double.isInfinite(d)) {
|
||||||
{
|
|
||||||
throw new NumberFormatException("Infinity is not valid");
|
throw new NumberFormatException("Infinity is not valid");
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -47,7 +47,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
<version>1.8.7-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|
Loading…
Reference in a new issue