You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2017/11/15 11:40:00 UTC

[jira] [Commented] (IO-555) Add org.apache.commons.io.FilenameUtils.WINDOWS_ILLEGAL_FILE_NAME_CHARS

    [ https://issues.apache.org/jira/browse/IO-555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16253327#comment-16253327 ] 

Sebb commented on IO-555:
-------------------------

Possible fixes:

* A getter which clones a private array
* non-modifiable list
* API to check its input against the list and report if there are any illegals

I think an API would be better as callers will have to implement it otherwise.

According to the quoted URL, there may be other characters that the file system does not allow.
This should be noted in the Javadoc.

> Add org.apache.commons.io.FilenameUtils.WINDOWS_ILLEGAL_FILE_NAME_CHARS
> -----------------------------------------------------------------------
>
>                 Key: IO-555
>                 URL: https://issues.apache.org/jira/browse/IO-555
>             Project: Commons IO
>          Issue Type: Improvement
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 2.7
>
>
> Add {{org.apache.commons.io.FilenameUtils.WINDOWS_ILLEGAL_FILE_NAME_CHARS}}.
> {code:java}
>     /**
>      * The characters that are illegal in Windows file names.
>      * 
>      * <ul>
>      * <li>< (less than</li>
>      * <li>> (greater than</li>
>      * <li>: (colon</li>
>      * <li>" (double quote</li>
>      * <li>/ (forward slash</li>
>      * <li>\ (backslash</li>
>      * <li>| (vertical bar or pipe</li>
>      * <li>? (question mark</li>
>      * <li>* (asterisk</li>
>      * <li>ASCII NUL (0)</li>
>      * <li>Integer characters 1 through 31</li>
>      * </ul>
>      * 
>      * @since 2.7
>      * @see <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx">Naming Files,
>      *      Paths, and Namespaces</a>
>      */
>     public static final char[] WINDOWS_ILLEGAL_FILE_NAME_CHARS = {
>             // @formatter:off
>             // ASCII NULL
>             0,  
>             // 1-31 may be allowed in file streams
>             1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
>             29, 30, 31, 
>             '<', '>', ':', '"', '/', '\\', '|', '?', '*'
>             // @formatter:on
>     };
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)