Merge "Install tools/libs from doc hub image"
[aaf/authz.git] / misc / env / src / main / java / org / onap / aaf / misc / env / util / IPValidator.java
index d6ac850..3e02c00 100644 (file)
@@ -1,57 +1,57 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END====================================================
- *
- */
-
-package org.onap.aaf.misc.env.util;
-
-import java.util.regex.Pattern;
-
-public class IPValidator {
-       private static final Pattern ipv4_p = Pattern.compile(
-                       "^((\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}\\2$"
-                       );
-
-       private static final Pattern ipv6_p = Pattern.compile(
-                       "^(([0-9a-fA-F]{0,4})([:|.])){2,7}([0-9a-fA-F]{0,4})$"
-                       );
-       
-       private static final Pattern doubleColon = Pattern.compile(
-                       ".*::.*::.*"
-                       );
-
-       private static final Pattern tooManyColon = Pattern.compile(
-                       "(.*:){1,7}"
-                       );
-
-       
-       public static boolean ipv4(String str) {
-               return ipv4_p.matcher(str).matches();
-       }
-       
-       public static boolean ipv6(String str) {
-               return ipv6_p.matcher(str).matches() &&
-                          !doubleColon.matcher(str).matches() &&
-                          !tooManyColon.matcher(str).matches();
-       }
-       
-       public static boolean ip (String str) {
-               return ipv4_p.matcher(str).matches() || ipv6(str);
-       }
-}
+/**\r
+ * ============LICENSE_START====================================================\r
+ * org.onap.aaf\r
+ * ===========================================================================\r
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ===========================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END====================================================\r
+ *\r
+ */\r
+\r
+package org.onap.aaf.misc.env.util;\r
+\r
+import java.util.regex.Pattern;\r
+\r
+public class IPValidator {\r
+       private static final Pattern ipv4_p = Pattern.compile(\r
+                       "^((\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}\\2$"\r
+                       );\r
+\r
+       private static final Pattern ipv6_p = Pattern.compile(\r
+                       "^(([0-9a-fA-F]{0,4})([:|.])){2,7}([0-9a-fA-F]{0,4})$"\r
+                       );\r
+       \r
+       private static final Pattern doubleColon = Pattern.compile(\r
+                       ".*::.*::.*"\r
+                       );\r
+\r
+       private static final Pattern tooManyColon = Pattern.compile(\r
+                       "(.*:){1,7}"\r
+                       );\r
+\r
+       \r
+       public static boolean ipv4(String str) {\r
+               return ipv4_p.matcher(str).matches();\r
+       }\r
+       \r
+       public static boolean ipv6(String str) {\r
+               return ipv6_p.matcher(str).matches() &&\r
+                          !doubleColon.matcher(str).matches() &&\r
+                          !tooManyColon.matcher(str).matches();\r
+       }\r
+       \r
+       public static boolean ip (String str) {\r
+               return ipv4_p.matcher(str).matches() || ipv6(str);\r
+       }\r
+}\r