Updated Branches:
  refs/heads/master 8976beb70 -> c81121902

o Add constant and some documentation


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/c8112190
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/c8112190
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/c8112190

Branch: refs/heads/master
Commit: c81121902f119a9960df2a04e034c6b7f810e3c4
Parents: 8976beb
Author: Andreas Gudian <agud...@apache.org>
Authored: Tue Jul 30 23:30:55 2013 +0200
Committer: Andreas Gudian <agud...@apache.org>
Committed: Tue Jul 30 23:30:55 2013 +0200

----------------------------------------------------------------------
 .../apache/maven/surefire/util/internal/StringUtils.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c8112190/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
----------------------------------------------------------------------
diff --git 
a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
 
b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
index a851e52..4e1cabd 100644
--- 
a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
+++ 
b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
@@ -53,6 +53,13 @@ import java.util.StringTokenizer;
  */
 public class StringUtils
 {
+    /*
+     * Uses "unicode" as encoding, as system default encodings might not be 
completely reversible or they might be
+     * different between main VM and forked VM. Downturn: they require a lot 
of bytes, most of them are not
+     * "pretty printable"
+     */
+    private static final String CHARSET_NAME = "unicode";
+
     private static final byte[] HEX_CHARS = new byte[] {
         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
         'A', 'B', 'C', 'D', 'E', 'F' };
@@ -143,7 +150,7 @@ public class StringUtils
         byte[] inputBytes;
         try
         {
-            inputBytes = str.getBytes("unicode");
+            inputBytes = str.getBytes(CHARSET_NAME);
         }
         catch ( UnsupportedEncodingException e )
         {
@@ -182,7 +189,7 @@ public class StringUtils
 
         try
         {
-            target.append( new String( unescapedBytes, 0, unescaped, "unicode" 
) );
+            target.append( new String( unescapedBytes, 0, unescaped, 
CHARSET_NAME ) );
         }
         catch ( UnsupportedEncodingException e )
         {

Reply via email to