This reverts back to the 1.4 code (except for the reflection part) and fixes the test failures.
However it is not a permanent solution. On 13 January 2015 at 22:30, <s...@apache.org> wrote: > Author: sebb > Date: Tue Jan 13 22:30:28 2015 > New Revision: 1651525 > > URL: http://svn.apache.org/r1651525 > Log: > Add temporary hack to get round IDN.toASCII bug > It is not supposed to change ASCII input but it converts trailing ".." to "." > > Modified: > > commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java > > Modified: > commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java > URL: > http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java?rev=1651525&r1=1651524&r2=1651525&view=diff > ============================================================================== > --- > commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java > (original) > +++ > commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java > Tue Jan 13 22:30:28 2015 > @@ -1085,6 +1085,9 @@ public class DomainValidator implements > */ > // Needed by UrlValidator > static String unicodeToASCII(String input) { > + if (isOnlyASCII(input)) { // TODO temporary hack to work round > IDN.toASCII bug > + return input; > + } > try { > return IDN.toASCII(input); > } catch (IllegalArgumentException e) { // input is not valid > @@ -1092,4 +1095,19 @@ public class DomainValidator implements > } > } > > + /* > + * Check if input contains only ASCII > + * Treats null as all ASCII > + */ > + private static boolean isOnlyASCII(String input) { > + if (input == null) { > + return true; > + } > + for(int i=0; i < input.length(); i++) { > + if (input.charAt(i) > 0x7F) { > + return false; > + } > + } > + return true; > + } > } > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org