[openrtm-commit:02382] r931 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 2月 6日 (月) 11:54:40 JST


Author: win-ei
Date: 2017-02-06 11:54:40 +0900 (Mon, 06 Feb 2017)
New Revision: 931

Modified:
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/StringUtil.java
Log:
[bug] Fixed bugs.

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/StringUtil.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/StringUtil.java	2017-02-06 02:51:56 UTC (rev 930)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/StringUtil.java	2017-02-06 02:54:40 UTC (rev 931)
@@ -448,7 +448,7 @@
 	return false;
     }
 
-    private static final Pattern V4_FORMAT = Pattern.compile("((([01]?\\d{1,2})|(2[0-4]\\d)|(25[0-5]))\\.){3}(([01]?\\d{1,2})|(2[0-4]\\d)|(25[0-5]))");
+    private static final Pattern V4_FORMAT = Pattern.compile("((([01]?\\d{1,2})|(2[0-4]\\d)|(25[0-5]))\\.){3}(([01]?\\d{1,2})|(2[0-4]\\d)|(25[0-5]))(:\\d{1,5})?");
     public static boolean isIPv4(final String str, boolean strict) {
         if (strict) {
             return V4_FORMAT.matcher(str).matches();
@@ -507,6 +507,8 @@
                 if (ipv6[ic].isEmpty()) { 
                     continue; 
                 }
+                ipv6[ic] = ipv6[ic].replace("[", "");
+                ipv6[ic] = ipv6[ic].replace("]", "");
                 int hexval = Integer.decode("0x"+ipv6[ic]);
                 if (hexval < 0x0 || hexval > 0xFFFF) { 
                     return false; 
@@ -519,6 +521,6 @@
         return true;
     }
     public static boolean isIPv6(final String str) {
-        return isIPv6(str,true);
+        return isIPv6(str,false);
     }
 }



More information about the openrtm-commit mailing list