commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1066) shell/XSI escape/unescape support
Date Sat, 19 Nov 2016 11:37:58 GMT

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

ASF GitHub Bot commented on LANG-1066:
--------------------------------------

Github user britter commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/208#discussion_r88777926
  
    --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
    @@ -801,4 +876,61 @@ public static final String unescapeCsv(final String input) {
             return UNESCAPE_CSV.translate(input);
         }
     
    +    // Shell
    +    /**
    +     * <p>Escapes the characters in a {@code String} using XSI rules.</p>
    +     *
    +     * <p><b>Beware!</b> In most cases you don't want to escape shell
commands but use multi-argument
    +     * methods provided by {@link java.lang.ProcessBuilder} or {@link java.lang.Runtime#exec(String[])}
    +     * instead.</p>
    +     *
    +     * <p>Example:</p>
    +     * <pre>
    +     * input string: He didn't say, "Stop!"
    +     * output string: He\ didn\'t\ say,\ \"Stop!\"
    +     * </pre>
    +     *
    +     * @see <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html">Shell
Command Language</a>
    +     * @param input  String to escape values in, may be null
    +     * @return String with escaped values, {@code null} if null string input
    +     * @since 3.6
    +     */
    +    public static final String escapeXSI(final String input) {
    +        return ESCAPE_XSI.translate(input);
    +    }
    +
    +    /**
    +     * <p>Alias for {@link #escapeXSI(String)}.</p>
    +     *
    +     * @param input String to escape values in, may be null
    +     * @return String with escaped values, {@code null} if null string input
    +     * @since 3.6
    +     */
    +    public static final String escapeShell(final String input) {
    --- End diff --
    
    I'm not sure whether it is a good idea to have aliases for methods. Does this help users
to find what they are looking for or does this really cause confusion?


> shell/XSI escape/unescape support
> ---------------------------------
>
>                 Key: LANG-1066
>                 URL: https://issues.apache.org/jira/browse/LANG-1066
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.3.2
>            Reporter: Mark
>            Priority: Minor
>         Attachments: commons-lang3.trunk.rev1639624.patch
>
>
> Please add the supplied patch. Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message