commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From britter <...@git.apache.org>
Subject [GitHub] commons-lang pull request #208: LANG-1066: Add shell/XSI escape/unescape sup...
Date Sat, 19 Nov 2016 11:37:09 GMT
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?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message