You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 16:04:55 UTC

[43/50] git commit: updated refs/heads/4.4 to d5220a8

Polish IPv6 input error information

(cherry picked from commit 09abcf354f395b8d701c8b84b5ed20807f41519a)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bb5ba26b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bb5ba26b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bb5ba26b

Branch: refs/heads/4.4
Commit: bb5ba26b60977630a6015e88b4aab2c1d269d0be
Parents: ab85d00
Author: Sheng Yang <sh...@citrix.com>
Authored: Tue Jul 1 15:16:40 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 16:02:50 2014 +0200

----------------------------------------------------------------------
 utils/src/com/cloud/utils/net/NetUtils.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb5ba26b/utils/src/com/cloud/utils/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java
index efb5ae5..aab1437 100755
--- a/utils/src/com/cloud/utils/net/NetUtils.java
+++ b/utils/src/com/cloud/utils/net/NetUtils.java
@@ -1381,11 +1381,19 @@ public class NetUtils {
     }
 
     public static String standardizeIp6Address(String ip6Addr) {
-        return IPv6Address.fromString(ip6Addr).toString();
+        try {
+            return IPv6Address.fromString(ip6Addr).toString();
+        } catch (IllegalArgumentException ex) {
+            throw new IllegalArgumentException("Invalid IPv6 address: " + ex.getMessage());
+        }
     }
 
     public static String standardizeIp6Cidr(String ip6Cidr){
-        return IPv6Network.fromString(ip6Cidr).toString();
+        try {
+            return IPv6Network.fromString(ip6Cidr).toString();
+        } catch (IllegalArgumentException ex) {
+            throw new IllegalArgumentException("Invalid IPv6 CIDR: " + ex.getMessage());
+        }
     }
 
     static final String VLAN_PREFIX = "vlan://";