-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can AddressValueException(String message)
be made public?
#127
Comments
At first glance, this seems reasonable for the next release. I presume you are using version 5.x.x. In the meantime, you can use this trick: throwAddressValueException("my string");
public static AddressValueException throwAddressValueException(String arg) throws AddressValueException {
Class<AddressValueException> clazz = AddressValueException.class;
try {
Constructor<AddressValueException> constructor = clazz.getDeclaredConstructor(String.class);
constructor.setAccessible(true);
AddressValueException instance = constructor.newInstance(arg);
throw instance;
} catch( NoSuchMethodException | SecurityException | InstantiationException |
IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new Error(e);
}
}
|
Yes, I'm using 5.5.0 - the block splitting and merging functionality is great. Thanks for the reflection example to tide me over, that will work for now. |
This has been addressed in version 5.5.1 |
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am subclassing
IPv4Address
andIPv6Address
, and I would like to be able to throw a subclass ofAddressValueException
with a custom error message.Can you please make
AddressValueException(String message)
so I can do this?The text was updated successfully, but these errors were encountered: