You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using JMail 1.3.2 to validate an email address ending with a "High Octet Preset" control character, e.g. JMail.isValid("a@b.com\u0081"); fails with:
java.lang.IllegalArgumentException: java.text.ParseException: A prohibited code point was found in the inputcom�
at java.base/java.net.IDN.toASCIIInternal(IDN.java:275)
at java.base/java.net.IDN.toASCII(IDN.java:123)
at com.sanctionco.jmail.JMail.isValidIdn(JMail.java:512)
at com.sanctionco.jmail.JMail.lambda$tryParse$0(JMail.java:119)
at java.base/java.util.Optional.filter(Optional.java:218)
at com.sanctionco.jmail.JMail.tryParse(JMail.java:119)
at com.sanctionco.jmail.JMail.isValid(JMail.java:67)
Caused by: java.text.ParseException: A prohibited code point was found in the inputcom�
at java.base/jdk.internal.icu.text.StringPrep.prepare(StringPrep.java:448)
at java.base/java.net.IDN.toASCIIInternal(IDN.java:273)
... 74 more
I guess that is not the expected behavior, or am I wrong?
By the way: Thank you very much for developing JMail! It is the best Java E-Mail validation library.
The text was updated successfully, but these errors were encountered:
Thank you for the report @PascalSchumacher. You're right that this is not the expected behavior, I believe JMail should return false in this case as this would not be considered a valid email address.
@RohanNagar Thanks for the quick fix. I always a bit nervous when I see a catch block catching Exception because it also catches Throwables like OutOfMemoryError. According to the Java Doc this method only throws IllegalArgumentExceptions so I believe catching that would be better. What do you think?
@PascalSchumacher Good point. OutOfMemoryError actually would not be caught since it extends Error. If we did something like catch (Throwable t), then it would be caught.
However since this method only throws IllegalArgumentException it makes sense to only catch that. I've updated and released version 1.3.3, which should be available on maven central in about 10 minutes!
@PascalSchumacher Good point. OutOfMemoryError actually would not be caught since it extends Error. If we did something like catch (Throwable t), then it would be caught.
Yes, you are right. I do not know what I was thinking. Sorry!
Using JMail
1.3.2
to validate an email address ending with a "High Octet Preset" control character, e.g.JMail.isValid("a@b.com\u0081");
fails with:I guess that is not the expected behavior, or am I wrong?
By the way: Thank you very much for developing JMail! It is the best Java E-Mail validation library.
The text was updated successfully, but these errors were encountered: