You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2018/05/30 08:09:02 UTC
[4/6] commons-io git commit: checkstyle requires javadocs on private
methods?
checkstyle requires javadocs on private methods?
Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/71639e04
Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/71639e04
Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/71639e04
Branch: refs/heads/master
Commit: 71639e041876e4dca28785ac3e61d80ecc33db44
Parents: 2736b6f
Author: Stefan Bodewig <st...@innoq.com>
Authored: Wed May 16 08:49:15 2018 +0200
Committer: Stefan Bodewig <st...@innoq.com>
Committed: Wed May 30 10:06:07 2018 +0200
----------------------------------------------------------------------
.../org/apache/commons/io/FilenameUtils.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-io/blob/71639e04/src/main/java/org/apache/commons/io/FilenameUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/io/FilenameUtils.java b/src/main/java/org/apache/commons/io/FilenameUtils.java
index 30f2343..16ee782 100644
--- a/src/main/java/org/apache/commons/io/FilenameUtils.java
+++ b/src/main/java/org/apache/commons/io/FilenameUtils.java
@@ -1516,6 +1516,12 @@ public class FilenameUtils {
Pattern.compile("^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$");
private static final int IPV4_MAX_OCTET_VALUE = 255;
+ /**
+ * Checks whether a given string represents a valid IPv4 address.
+ *
+ * @param name the name to validate
+ * @return true if the given name is a valid IPv4 address
+ */
// mostly copied from org.apache.commons.validator.routines.InetAddressValidator#isValidInet4Address
private static boolean isIPv4Address(String name) {
Matcher m = IPV4_PATTERN.matcher(name);
@@ -1557,6 +1563,12 @@ public class FilenameUtils {
private static final int BASE_16 = 16;
// copied from org.apache.commons.validator.routines.InetAddressValidator#isValidInet6Address
+ /**
+ * Checks whether a given string represents a valid IPv6 address.
+ *
+ * @param inet6Address the name to validate
+ * @return true if the given name is a valid IPv6 address
+ */
private static boolean isIPv6Address(String inet6Address) {
boolean containsCompressedZeroes = inet6Address.contains("::");
if (containsCompressedZeroes && (inet6Address.indexOf("::") != inet6Address.lastIndexOf("::"))) {
@@ -1622,6 +1634,14 @@ public class FilenameUtils {
private static final Pattern REG_NAME_PART_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9-]*$");
+ /**
+ * Checks whether a given string is a valid host name according to
+ * RFC 3986 - not accepting IP addresses.
+ *
+ * @see "https://tools.ietf.org/html/rfc3986#section-3.2.2"
+ * @param name the hostname to validate
+ * @return true if the given name is a valid host name
+ */
private static boolean isRFC3986HostName(String name) {
String[] parts = name.split("\\.", -1);
for (int i = 0; i < parts.length; i++) {