commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r883861 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
Date Tue, 24 Nov 2009 20:35:17 GMT
Author: sebb
Date: Tue Nov 24 20:35:17 2009
New Revision: 883861

URL: http://svn.apache.org/viewvc?rev=883861&view=rev
Log:
Arrays.toString is Java 1.5+

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java?rev=883861&r1=883860&r2=883861&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
Tue Nov 24 20:35:17 2009
@@ -578,10 +578,40 @@
             buf.append(", resultSetHoldability=");
             buf.append(_resultSetHoldability);
             buf.append(", columnIndexes=");
-            buf.append(Arrays.toString(_columnIndexes));
+// JDK1.5   buf.append(Arrays.toString(_columnIndexes));
+            arrayToString(buf,_columnIndexes);
             buf.append(", columnNames=");
-            buf.append(Arrays.toString(_columnNames));
+// JDK1.5   buf.append(Arrays.toString(_columnNames));
+            arrayToString(buf,_columnNames);
             return buf.toString();
         }
+        private void arrayToString(StringBuffer sb, int[] array){
+            if (array == null) {
+                sb.append("null");
+                return;
+            }
+            sb.append('[');
+            for(int i=0; i<array.length; i++){
+                if (i>0){
+                    sb.append(',');
+                }
+                sb.append(array[i]);
+            }
+            sb.append(']');
+        }
+        private void arrayToString(StringBuffer sb, String[] array){
+            if (array == null) {
+                sb.append("null");
+                return;
+            }
+            sb.append('[');
+            for(int i=0; i<array.length; i++){
+                if (i>0){
+                    sb.append(',');
+                }
+                sb.append(array[i]);
+            }
+            sb.append(']');
+        }
     }
 }



Mime
View raw message