tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r883362 - /tomcat/trunk/java/org/apache/catalina/tribes/util/Arrays.java
Date Mon, 23 Nov 2009 15:10:20 GMT
Author: markt
Date: Mon Nov 23 15:10:20 2009
New Revision: 883362

URL: http://svn.apache.org/viewvc?rev=883362&view=rev
Log:
Rest of fix required for https://issues.apache.org/bugzilla/show_bug.cgi?id=48113
Based on a patch by Quintin Beukes

Modified:
    tomcat/trunk/java/org/apache/catalina/tribes/util/Arrays.java

Modified: tomcat/trunk/java/org/apache/catalina/tribes/util/Arrays.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/util/Arrays.java?rev=883362&r1=883361&r2=883362&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/util/Arrays.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/util/Arrays.java Mon Nov 23 15:10:20 2009
@@ -62,10 +62,17 @@
     public static String toString(byte[] data, int offset, int length, boolean asInt) {
         StringBuilder buf = new StringBuilder("{");
         if ( data != null && length > 0 ) {
-            if (asInt) buf.append((int)data[offset++]);
-            else buf.append(data[offset++]);
-            for (int i = offset; i < length; i++) {
-                buf.append(", ").append(data[i]);
+            int i = offset;
+            if (asInt) {
+                buf.append(data[i++] & 0xff);
+                for (; i < length; i++) {
+                    buf.append(", ").append(data[i] & 0xff);
+                }
+            } else {
+                buf.append(data[i++]);
+                for (; i < length; i++) {
+                    buf.append(", ").append(data[i]);
+                }
             }
         }
         buf.append("}");



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message