[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-29 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1066:
--

Github user PascalSchumacher closed the pull request at:

https://github.com/apache/commons-lang/pull/208


> 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
> Fix For: Discussion
>
> Attachments: commons-lang3.trunk.rev1639624.patch
>
>
> Please add the supplied patch. Thanks!



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


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-29 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1066:
--

Github user PascalSchumacher commented on the issue:

https://github.com/apache/commons-lang/pull/208
  
As discussed on the mailing list string escaping will move to commons-text, 
so I'm closing this pull request.


> 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
> Fix For: Discussion
>
> Attachments: commons-lang3.trunk.rev1639624.patch
>
>
> Please add the supplied patch. Thanks!



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


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-20 Thread Sebb (JIRA)

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

Sebb commented on LANG-1066:


I'm not sure this belongs in LANG at all.

It only applies to the some Shell syntaxes.
It does not apply to shells on OSes that are not related to Unix, and AFAICT 
does not even apply to all Unix shells.

If anything, it belongs in EXEC, but I'm not sure it makes sense to provide 
escaping only for shell that happen to use the XSI syntax.

What is the use case for it?

> 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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-20 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1066:
--

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

https://github.com/apache/commons-lang/pull/208#discussion_r88799517
  
--- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
@@ -413,6 +447,47 @@ public int translate(final CharSequence input, final 
int index, final Writer out
 }
 }
 
+public static final CharSequenceTranslator UNESCAPE_XSI = new 
BackslashUnescaper();
+
+/**
+ * Translator object for unescaping backslash escaped entries.
+ *
+ * @since 3.6
+ */
+static class BackslashUnescaper extends CharSequenceTranslator {
--- End diff --

No sure why the author of the patch choose this naming. I'm fine with 
changing it.


> 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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-20 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1066:
--

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

https://github.com/apache/commons-lang/pull/208#discussion_r88799453
  
--- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
@@ -272,6 +272,40 @@ public int translate(final CharSequence input, final 
int index, final Writer out
 }
 }
 
+/**
+ * Translator object for escaping Shell command language.
+ *
+ * @see http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html;>Shell 
Command Language
+ */
+public static final CharSequenceTranslator ESCAPE_XSI =
+  new LookupTranslator(
+new String[][] {
+  {"|", "\\|"},
+  {"&", "\\&"},
+  {";", "\\;"},
+  {"<", "\\<"},
+  {">", "\\>"},
+  {"(", "\\("},
+  {")", "\\)"},
+  {"$", "\\$"},
+  {"`", "\\`"},
+  {"\\", ""},
+  {"\"", "\\\""},
+  {"'", "\\'"},
+  {" ", "\\ "},
+  {"\t", "\\\t"},
+  {"\r\n", ""},
+  {"\n", ""},
+  {"*", "\\*"},
+  {"?", "\\?"},
+  {"[", "\\["},
--- End diff --

according to http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html it 
does not have to be escaped


> 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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-19 Thread ASF GitHub Bot (JIRA)

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

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_r88777893
  
--- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
@@ -413,6 +447,47 @@ public int translate(final CharSequence input, final 
int index, final Writer out
 }
 }
 
+public static final CharSequenceTranslator UNESCAPE_XSI = new 
BackslashUnescaper();
+
+/**
+ * Translator object for unescaping backslash escaped entries.
+ *
+ * @since 3.6
+ */
+static class BackslashUnescaper extends CharSequenceTranslator {
--- End diff --

Why not XsiUnescaper?


> 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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-19 Thread ASF GitHub Bot (JIRA)

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

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_r88777887
  
--- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
@@ -272,6 +272,40 @@ public int translate(final CharSequence input, final 
int index, final Writer out
 }
 }
 
+/**
+ * Translator object for escaping Shell command language.
+ *
+ * @see http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html;>Shell 
Command Language
+ */
+public static final CharSequenceTranslator ESCAPE_XSI =
+  new LookupTranslator(
+new String[][] {
+  {"|", "\\|"},
+  {"&", "\\&"},
+  {";", "\\;"},
+  {"<", "\\<"},
+  {">", "\\>"},
+  {"(", "\\("},
+  {")", "\\)"},
+  {"$", "\\$"},
+  {"`", "\\`"},
+  {"\\", ""},
+  {"\"", "\\\""},
+  {"'", "\\'"},
+  {" ", "\\ "},
+  {"\t", "\\\t"},
+  {"\r\n", ""},
+  {"\n", ""},
+  {"*", "\\*"},
+  {"?", "\\?"},
+  {"[", "\\["},
--- End diff --

What about the closing braked?


> 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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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
+/**
+ * Escapes the characters in a {@code String} using XSI rules.
+ *
+ * Beware! 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.
+ *
+ * Example:
+ * 
+ * input string: He didn't say, "Stop!"
+ * output string: He\ didn\'t\ say,\ \"Stop!\"
+ * 
+ *
+ * @see http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html;>Shell 
Command Language
+ * @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);
+}
+
+/**
+ * Alias for {@link #escapeXSI(String)}.
+ *
+ * @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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1066:
--

Github user coveralls commented on the issue:

https://github.com/apache/commons-lang/pull/208
  

[![Coverage 
Status](https://coveralls.io/builds/8904313/badge)](https://coveralls.io/builds/8904313)

Coverage decreased (-0.02%) to 93.652% when pulling 
**a1e4319d9f7a13a1d162c4e077dbd0f25ae24910 on 
PascalSchumacher:shell_xsi_escape_unescape_support** into 
**dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**.



> 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)


[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support

2016-11-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1066:
--

GitHub user PascalSchumacher opened a pull request:

https://github.com/apache/commons-lang/pull/208

LANG-1066: Add shell/XSI escape/unescape support

patch supplied by Mark

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/PascalSchumacher/commons-lang 
shell_xsi_escape_unescape_support

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-lang/pull/208.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #208


commit 003ce0723989586685333156124fa3fc441dbdd8
Author: pascalschumacher 
Date:   2016-11-04T18:38:53Z

LANG-1066: Add shell/XSI escape/unescape support

patch supplied by Mark




> 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)