Commit 9df9fa8a authored by cdanger's avatar cdanger

- Fixed equals() to work between different GenericInteger

implementations (subclasses)
- Fixed error parsing empty <AttributeValue />, e.g. for anyURI
parent 75c45d56
......@@ -34,7 +34,7 @@ public final class ArbitrarilyBigInteger extends GenericInteger
private static final long serialVersionUID = 1L;
private static final IllegalArgumentException TOO_BIGINTEGER_FOR_DOUBLE_ILLEGAL_ARGUMENT_EXCEPTION = new IllegalArgumentException(
"BigInteger argument outside the range which can be represented by a double");
"BigInteger argument outside the range which can be represented by a double");
private static final Logger LOGGER = LoggerFactory.getLogger(ArbitrarilyBigInteger.class);
......@@ -102,8 +102,7 @@ public final class ArbitrarilyBigInteger extends GenericInteger
{
l = big.longValueExact();
return INSTANCE_FACTORY.getValue(l);
}
catch (final ArithmeticException e)
} catch (final ArithmeticException e)
{
LOGGER.debug("Input integer value is too big to fit in a long: {}", big);
}
......@@ -178,13 +177,13 @@ public final class ArbitrarilyBigInteger extends GenericInteger
return true;
}
if (!(obj instanceof ArbitrarilyBigInteger))
if (!(obj instanceof GenericInteger))
{
return false;
}
final ArbitrarilyBigInteger other = (ArbitrarilyBigInteger) obj;
return value.equals(other.value);
final GenericInteger other = (GenericInteger) obj;
return value.equals(other.bigIntegerValue());
}
/** {@inheritDoc} */
......
......@@ -156,12 +156,19 @@ public final class LongInteger extends GenericInteger
return true;
}
if (!(obj instanceof LongInteger))
if (!(obj instanceof GenericInteger))
{
return false;
}
final GenericInteger other = (GenericInteger) obj;
try
{
return value == other.longValueExact();
} catch (final ArithmeticException e)
{
return false;
}
final LongInteger other = (LongInteger) obj;
return value == other.value;
}
@Override
......
......@@ -155,12 +155,19 @@ public final class MediumInteger extends GenericInteger
return true;
}
if (!(obj instanceof MediumInteger))
if (!(obj instanceof GenericInteger))
{
return false;
}
final GenericInteger other = (GenericInteger) obj;
try
{
return value == other.intValueExact();
} catch (final ArithmeticException e)
{
return false;
}
final MediumInteger other = (MediumInteger) obj;
return value == other.value;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment