commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1649155 - in /commons/proper/validator/trunk/src: main/java/org/apache/commons/validator/routines/InetAddressValidator.java test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
Date Sat, 03 Jan 2015 00:52:13 GMT
Author: sebb
Date: Sat Jan  3 00:52:13 2015
New Revision: 1649155

URL: http://svn.apache.org/r1649155
Log:
Fix up to use Java 1.4 compatible methods

Modified:
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
    commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java?rev=1649155&r1=1649154&r2=1649155&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
Sat Jan  3 00:52:13 2015
@@ -113,7 +113,7 @@ public class InetAddressValidator implem
      * @return true if the argument contains a valid IPv6 address
      */
     public boolean isValidInet6Address(String inet6Address) {
-        boolean containsCompressedZeroes = inet6Address.contains("::");
+        boolean containsCompressedZeroes = inet6Address.indexOf("::") > -1; // contains
is Java 1.5
         if (containsCompressedZeroes && (inet6Address.indexOf("::") != inet6Address.lastIndexOf("::")))
{
             return false;
         }
@@ -146,7 +146,7 @@ public class InetAddressValidator implem
                 }
             } else {
                 emptyOctets = 0;
-                if (octet.contains(".")) {
+                if (octet.indexOf(".") > -1) { // contains is Java 1.5+
                     if (!inet6Address.endsWith(octet)) {
                         return false;
                     }

Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java?rev=1649155&r1=1649154&r2=1649155&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
(original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
Sat Jan  3 00:52:13 2015
@@ -183,7 +183,7 @@ public class IBANCheckDigitTest extends
             String line;
             while((line=rdr.readLine()) != null) {
                 if (!line.startsWith("#") && line.length() > 0) {
-                    Assert.assertTrue(line, routine.isValid(line.replace(" ", "")));
+                    Assert.assertTrue(line, routine.isValid(line.replaceAll(" ", "")));
                 }
             }
         } finally {



Mime
View raw message