Repository: commons-io
Updated Branches:
refs/heads/master 2c30851e4 -> cfb682e9d
PR: IO-567
- Replaced NtfsAdsNameException with IllegalArgumentException.
- Fixed Javadoc ("Output will be the same irrespective of the
machine...")
Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/748eef8b
Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/748eef8b
Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/748eef8b
Branch: refs/heads/master
Commit: 748eef8b96068cadc45894967f58f015860afb1b
Parents: 947c01f 72d0053
Author: Jochen Wiedmann (jwi) <[email protected]>
Authored: Tue Jan 30 15:31:29 2018 +0100
Committer: Jochen Wiedmann (jwi) <[email protected]>
Committed: Wed Jan 31 09:49:35 2018 +0100
----------------------------------------------------------------------
.../org/apache/commons/io/FilenameUtils.java | 23 ++++++++++++--------
.../apache/commons/io/NtfsAdsNameException.java | 18 ---------------
2 files changed, 14 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-io/blob/748eef8b/src/main/java/org/apache/commons/io/FilenameUtils.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/io/FilenameUtils.java
index 382df41,382df41..71bd4d4
--- a/src/main/java/org/apache/commons/io/FilenameUtils.java
+++ b/src/main/java/org/apache/commons/io/FilenameUtils.java
@@@ -714,20 -714,20 +714,22 @@@ public class FilenameUtils
* {@link #indexOfLastSeparator(String)} which will handle a file in
either Unix or Windows format.
* </p>
* <p>
-- * The output will be the same irrespective of the machine that the code
is running on.
++ * The output will be the same irrespective of the machine that the code
is running on, with the
++ * exception of a possible {@link IllegalArgumentException} on Windows
(see below).
* </p>
* <b>Note:</b> This method used to have a hidden problem for names like
"foo.exe:bar.txt".
* In this case, the name wouldn't be the name of a file, but the
identifier of an
* alternate data stream (bar.txt) on the file foo.exe. The method used
to return
* ".txt" here, which would be misleading. Commons IO 2.7, and later
versions, are throwing
-- * at {@link NtfsAdsNameException} for names like this.
++ * an {@link IllegalArgumentException} for names like this.
*
* @param filename
* the filename to find the last extension separator in, null
returns -1
* @return the index of the last extension separator character, or -1 if
there is no such character
-- * @throws NtfsAdsNameException The filename argument
++ * @throws IllegalArgumentException <b>Windows only:/b> The filename
parameter is, in fact,
++ * the identifier of an Alternate Data Stream, for example
"foo.exe:bar.txt".
*/
-- public static int indexOfExtension(final String filename) throws
NtfsAdsNameException {
++ public static int indexOfExtension(final String filename) throws
IllegalArgumentException {
if (filename == null) {
return NOT_FOUND;
}
@@@ -735,7 -735,7 +737,7 @@@
// Special handling for NTFS ADS: Don't accept colon in the
filename.
final int offset = filename.indexOf(':',
getAdsCriticalOffset(filename));
if (offset != -1) {
-- throw new NtfsAdsNameException("NTFS ADS separator
(':') in filename is forbidden.");
++ throw new IllegalArgumentException("NTFS ADS separator
(':') in filename is forbidden.");
}
}
final int extensionPos = filename.lastIndexOf(EXTENSION_SEPARATOR);
@@@ -1039,20 -1039,20 +1041,23 @@@
* a/b/c --> ""
* </pre>
* <p>
-- * The output will be the same irrespective of the machine that the code
is running on.
++ * The output will be the same irrespective of the machine that the code
is running on, with the
++ * exception of a possible {@link IllegalArgumentException} on Windows
(see below).
++ * </p>
++ * <p>
* <b>Note:</b> This method used to have a hidden problem for names like
"foo.exe:bar.txt".
* In this case, the name wouldn't be the name of a file, but the
identifier of an
* alternate data stream (bar.txt) on the file foo.exe. The method used
to return
* ".txt" here, which would be misleading. Commons IO 2.7, and later
versions, are throwing
-- * at {@link NtfsAdsNameException} for names like this.
++ * an {@link IllegalArgumentException} for names like this.
*
* @param filename the filename to retrieve the extension of.
* @return the extension of the file or an empty string if none exists or
{@code null}
* if the filename is {@code null}.
-- * @throws NtfsAdsNameException <b>Windows only:/b> The filename
parameter is, in fact,
++ * @throws IllegalArgumentException <b>Windows only:/b> The filename
parameter is, in fact,
* the identifier of an Alternate Data Stream, for example
"foo.exe:bar.txt".
*/
-- public static String getExtension(final String filename) throws
NtfsAdsNameException {
++ public static String getExtension(final String filename) throws
IllegalArgumentException {
if (filename == null) {
return null;
}
http://git-wip-us.apache.org/repos/asf/commons-io/blob/748eef8b/src/main/java/org/apache/commons/io/NtfsAdsNameException.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/io/NtfsAdsNameException.java
index 2ca9ab1,2ca9ab1..0000000
deleted file mode 100644,100644
--- a/src/main/java/org/apache/commons/io/NtfsAdsNameException.java
+++ /dev/null
@@@ -1,18 -1,18 +1,0 @@@
--package org.apache.commons.io;
--
--
--/**
-- * This exception is thrown, if an NTFS ADS name is passed to certain methods,
-- * where it might affect the result. For example, if you pass a name like
-- * "foo.exe:bar.txt" to {@link FilenameUtils#getExtension(String)}, then it
-- * might return ".txt", which would be misleading, because the actual
extension
-- * would be ".txt".
-- */
--public class NtfsAdsNameException extends IllegalArgumentException {
--
-- private static final long serialVersionUID = -9158109384797441214L;
--
-- public NtfsAdsNameException(String pMessage) {
-- super(pMessage);
-- }
--}