4444import org .apache .cloudstack .network .NetworkPermissionVO ;
4545import org .apache .cloudstack .network .dao .NetworkPermissionDao ;
4646import org .apache .commons .collections .CollectionUtils ;
47+ import org .apache .commons .lang3 .StringUtils ;
4748import org .apache .log4j .Logger ;
4849
4950import com .cloud .api .ApiDBUtils ;
122123import com .cloud .user .User ;
123124import com .cloud .user .dao .AccountDao ;
124125import com .cloud .utils .Pair ;
125- import com .cloud .utils .StringUtils ;
126126import com .cloud .utils .component .AdapterBase ;
127127import com .cloud .utils .component .ManagerBase ;
128128import com .cloud .utils .db .DB ;
@@ -2377,7 +2377,7 @@ public boolean isNetworkInlineMode(Network network) {
23772377 @ Override
23782378 public void checkIp6Parameters (String startIPv6 , String endIPv6 , String ip6Gateway , String ip6Cidr ) throws InvalidParameterValueException {
23792379
2380- if (org . apache . commons . lang3 . StringUtils .isAnyBlank (ip6Gateway , ip6Cidr )) {
2380+ if (StringUtils .isAnyBlank (ip6Gateway , ip6Cidr )) {
23812381 throw new InvalidParameterValueException ("ip6Gateway and ip6Cidr should be defined for an IPv6 network work properly" );
23822382 }
23832383
@@ -2392,7 +2392,7 @@ public void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gatew
23922392 throw new InvalidParameterValueException ("ip6Gateway is not in ip6cidr indicated network!" );
23932393 }
23942394
2395- if (org . apache . commons . lang3 . StringUtils .isNotBlank (startIPv6 )) {
2395+ if (StringUtils .isNotBlank (startIPv6 )) {
23962396 if (!NetUtils .isValidIp6 (startIPv6 )) {
23972397 throw new InvalidParameterValueException ("Invalid format for the startIPv6 parameter" );
23982398 }
@@ -2401,7 +2401,7 @@ public void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gatew
24012401 }
24022402 }
24032403
2404- if (org . apache . commons . lang3 . StringUtils .isNotBlank (endIPv6 )) {
2404+ if (StringUtils .isNotBlank (endIPv6 )) {
24052405 if (!NetUtils .isValidIp6 (endIPv6 )) {
24062406 throw new InvalidParameterValueException ("Invalid format for the endIPv6 parameter" );
24072407 }
@@ -2601,15 +2601,15 @@ public List<String[]> generateVmData(String userData, String userDataDetails, St
26012601 if (userData != null ) {
26022602 vmData .add (new String []{USERDATA_DIR , USERDATA_FILE , userData });
26032603 }
2604- vmData .add (new String []{METATDATA_DIR , SERVICE_OFFERING_FILE , StringUtils .unicodeEscape (serviceOffering )});
2605- vmData .add (new String []{METATDATA_DIR , AVAILABILITY_ZONE_FILE , StringUtils .unicodeEscape (zoneName )});
2606- vmData .add (new String []{METATDATA_DIR , LOCAL_HOSTNAME_FILE , StringUtils .unicodeEscape (vmHostName )});
2604+ vmData .add (new String []{METATDATA_DIR , SERVICE_OFFERING_FILE , com . cloud . utils . StringUtils .unicodeEscape (serviceOffering )});
2605+ vmData .add (new String []{METATDATA_DIR , AVAILABILITY_ZONE_FILE , com . cloud . utils . StringUtils .unicodeEscape (zoneName )});
2606+ vmData .add (new String []{METATDATA_DIR , LOCAL_HOSTNAME_FILE , com . cloud . utils . StringUtils .unicodeEscape (vmHostName )});
26072607 vmData .add (new String []{METATDATA_DIR , LOCAL_IPV4_FILE , guestIpAddress });
26082608
26092609 addUserDataDetailsToCommand (vmData , userDataDetails );
26102610
26112611 String publicIpAddress = guestIpAddress ;
2612- String publicHostName = StringUtils .unicodeEscape (vmHostName );
2612+ String publicHostName = com . cloud . utils . StringUtils .unicodeEscape (vmHostName );
26132613
26142614 if (dcVo .getNetworkType () != DataCenter .NetworkType .Basic ) {
26152615 if (publicIp != null ) {
@@ -2654,7 +2654,7 @@ public List<String[]> generateVmData(String userData, String userDataDetails, St
26542654 throw new CloudRuntimeException ("Unable to get MD5 MessageDigest" , e );
26552655 }
26562656 md5 .reset ();
2657- md5 .update (password .getBytes (StringUtils .getPreferredCharset ()));
2657+ md5 .update (password .getBytes (com . cloud . utils . StringUtils .getPreferredCharset ()));
26582658 byte [] digest = md5 .digest ();
26592659 BigInteger bigInt = new BigInteger (1 , digest );
26602660 String hashtext = bigInt .toString (16 );
@@ -2687,8 +2687,8 @@ protected void addUserDataDetailsToCommand(List<String[]> vmData, String userDat
26872687 String [] keyValuePairs = userDataDetails .split ("," );
26882688 for (String pair : keyValuePairs )
26892689 {
2690- final Pair <String , String > keyValue = StringUtils .getKeyValuePairWithSeparator (pair , "=" );
2691- vmData .add (new String []{METATDATA_DIR , keyValue .first (), StringUtils .unicodeEscape (keyValue .second ())});
2690+ final Pair <String , String > keyValue = com . cloud . utils . StringUtils .getKeyValuePairWithSeparator (pair , "=" );
2691+ vmData .add (new String []{METATDATA_DIR , keyValue .first (), com . cloud . utils . StringUtils .unicodeEscape (keyValue .second ())});
26922692 }
26932693 }
26942694 }
@@ -2711,42 +2711,42 @@ public String getValidNetworkCidr(Network guestNetwork) {
27112711
27122712 @ Override
27132713 public Pair <String , String > getNetworkIp4Dns (final Network network , final DataCenter zone ) {
2714- if (org . apache . commons . lang3 . StringUtils .isNotBlank (network .getDns1 ())) {
2714+ if (StringUtils .isNotBlank (network .getDns1 ())) {
27152715 return new Pair <>(network .getDns1 (), network .getDns2 ());
27162716 }
27172717 return new Pair <>(zone .getDns1 (), zone .getDns2 ());
27182718 }
27192719
27202720 @ Override
27212721 public Pair <String , String > getNetworkIp6Dns (final Network network , final DataCenter zone ) {
2722- if (org . apache . commons . lang3 . StringUtils .isNotBlank (network .getIp6Dns1 ())) {
2722+ if (StringUtils .isNotBlank (network .getIp6Dns1 ())) {
27232723 return new Pair <>(network .getIp6Dns1 (), network .getIp6Dns2 ());
27242724 }
27252725 return new Pair <>(zone .getIp6Dns1 (), zone .getIp6Dns2 ());
27262726 }
27272727
27282728 @ Override
27292729 public void verifyIp4DnsPair (String ip4Dns1 , String ip4Dns2 ) {
2730- if (org . apache . commons . lang3 . StringUtils .isEmpty (ip4Dns1 ) && org . apache . commons . lang3 . StringUtils .isNotEmpty (ip4Dns2 )) {
2730+ if (StringUtils .isEmpty (ip4Dns1 ) && StringUtils .isNotEmpty (ip4Dns2 )) {
27312731 throw new InvalidParameterValueException ("Second IPv4 DNS can be specified only with the first IPv4 DNS" );
27322732 }
2733- if (org . apache . commons . lang3 . StringUtils .isNotEmpty (ip4Dns1 ) && !NetUtils .isValidIp4 (ip4Dns1 )) {
2733+ if (StringUtils .isNotEmpty (ip4Dns1 ) && !NetUtils .isValidIp4 (ip4Dns1 )) {
27342734 throw new InvalidParameterValueException ("Invalid IPv4 for DNS1" );
27352735 }
2736- if (org . apache . commons . lang3 . StringUtils .isNotEmpty (ip4Dns2 ) && !NetUtils .isValidIp4 (ip4Dns2 )) {
2736+ if (StringUtils .isNotEmpty (ip4Dns2 ) && !NetUtils .isValidIp4 (ip4Dns2 )) {
27372737 throw new InvalidParameterValueException ("Invalid IPv4 for DNS2" );
27382738 }
27392739 }
27402740
27412741 @ Override
27422742 public void verifyIp6DnsPair (String ip6Dns1 , String ip6Dns2 ) {
2743- if (org . apache . commons . lang3 . StringUtils .isEmpty (ip6Dns1 ) && org . apache . commons . lang3 . StringUtils .isNotEmpty (ip6Dns2 )) {
2743+ if (StringUtils .isEmpty (ip6Dns1 ) && StringUtils .isNotEmpty (ip6Dns2 )) {
27442744 throw new InvalidParameterValueException ("Second IPv6 DNS can be specified only with the first IPv6 DNS" );
27452745 }
2746- if (org . apache . commons . lang3 . StringUtils .isNotEmpty (ip6Dns1 ) && !NetUtils .isValidIp6 (ip6Dns1 )) {
2746+ if (StringUtils .isNotEmpty (ip6Dns1 ) && !NetUtils .isValidIp6 (ip6Dns1 )) {
27472747 throw new InvalidParameterValueException ("Invalid IPv6 for IPv6 DNS1" );
27482748 }
2749- if (org . apache . commons . lang3 . StringUtils .isNotEmpty (ip6Dns2 ) && !NetUtils .isValidIp6 (ip6Dns2 )) {
2749+ if (StringUtils .isNotEmpty (ip6Dns2 ) && !NetUtils .isValidIp6 (ip6Dns2 )) {
27502750 throw new InvalidParameterValueException ("Invalid IPv6 for IPv6 DNS2" );
27512751 }
27522752 }
0 commit comments