subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markp...@apache.org
Subject svn commit: r1166158 - /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Date Wed, 07 Sep 2011 13:08:16 GMT
Author: markphip
Date: Wed Sep  7 13:08:16 2011
New Revision: 1166158

URL: http://svn.apache.org/viewvc?rev=1166158&view=rev
Log:
JavaHL: Improve test code by properly specifying that svn:author and svn:log are
encoded as UTF8 byte strings.  This does not impact our tests since we only use
ASCII characters, but it helps show someone looking at our tests as a proper
example of using the API that they should specify the encoding when converting
the byte array to a String.

[ subversion/bindings/javahl/ ]
* tests/org/apache/subversion/javahl/BasicTests.java
  (MyLogMessageCallback): Specify the encoding when converting bytes to String.



Modified:
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1166158&r1=1166157&r2=1166158&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Wed Sep  7 13:08:16 2011
@@ -32,6 +32,7 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
 import java.text.ParseException;
 import java.util.Collection;
 import java.util.Arrays;
@@ -3679,8 +3680,17 @@ public class BasicTests extends SVNTests
                                       Map<String, byte[]> revprops,
                                       boolean hasChildren)
             {
-                String author = new String(revprops.get("svn:author"));
-                String message = new String(revprops.get("svn:log"));
+                String author, message;
+                try {
+                    author = new String(revprops.get("svn:author"), "UTF8");
+                } catch (UnsupportedEncodingException e) {
+                    author = new String(revprops.get("svn:author"));
+                }
+                try {
+                    message = new String(revprops.get("svn:log"), "UTF8");
+                } catch (UnsupportedEncodingException e) {
+                    message = new String(revprops.get("svn:log"));
+                }
                 long timeMicros;
 
                 try {



Mime
View raw message