diff --git a/java/src/main/java/org/rocksdb/AbstractMutableOptions.java b/java/src/main/java/org/rocksdb/AbstractMutableOptions.java index b0e8a043a..243b8040a 100644 --- a/java/src/main/java/org/rocksdb/AbstractMutableOptions.java +++ b/java/src/main/java/org/rocksdb/AbstractMutableOptions.java @@ -81,8 +81,8 @@ public abstract class AbstractMutableOptions { protected abstract T build(final String[] keys, final String[] values); public T build() { - final String keys[] = new String[options.size()]; - final String values[] = new String[options.size()]; + final String[] keys = new String[options.size()]; + final String[] values = new String[options.size()]; int i = 0; for (final Map.Entry> option : options.entrySet()) { @@ -227,7 +227,7 @@ public abstract class AbstractMutableOptions { } catch (NumberFormatException nfe) { final double doubleValue = Double.parseDouble(value); if (doubleValue != Math.round(doubleValue)) - throw new IllegalArgumentException("Unable to parse or round " + value + " to int"); + throw new IllegalArgumentException("Unable to parse or round " + value + " to long"); return Math.round(doubleValue); } } @@ -245,7 +245,7 @@ public abstract class AbstractMutableOptions { } catch (NumberFormatException nfe) { final double doubleValue = Double.parseDouble(value); if (doubleValue != Math.round(doubleValue)) - throw new IllegalArgumentException("Unable to parse or round " + value + " to long"); + throw new IllegalArgumentException("Unable to parse or round " + value + " to int"); return (int) Math.round(doubleValue); } } diff --git a/java/src/main/java/org/rocksdb/MutableOptionValue.java b/java/src/main/java/org/rocksdb/MutableOptionValue.java index 50d733d5c..7f69eeb9e 100644 --- a/java/src/main/java/org/rocksdb/MutableOptionValue.java +++ b/java/src/main/java/org/rocksdb/MutableOptionValue.java @@ -17,7 +17,7 @@ public abstract class MutableOptionValue { extends MutableOptionValue { protected final T value; - private MutableOptionValueObject(final T value) { + protected MutableOptionValueObject(final T value) { this.value = value; } @@ -153,10 +153,6 @@ public abstract class MutableOptionValue { @Override double asDouble() { - if(value > Double.MAX_VALUE || value < Double.MIN_VALUE) { - throw new NumberFormatException( - "long value lies outside the bounds of int"); - } return Long.valueOf(value).doubleValue(); } @@ -210,9 +206,6 @@ public abstract class MutableOptionValue { @Override double asDouble() { - if(value > Double.MAX_VALUE || value < Double.MIN_VALUE) { - throw new NumberFormatException("int value lies outside the bounds of int"); - } return Integer.valueOf(value).doubleValue(); }