harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r379170 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
Date Mon, 20 Feb 2006 17:22:53 GMT
Author: tellison
Date: Mon Feb 20 09:22:48 2006
New Revision: 379170

URL: http://svn.apache.org/viewcvs?rev=379170&view=rev
Log:
Enhance toString() to handle self referencing maps

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java?rev=379170&r1=379169&r2=379170&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
Mon Feb 20 09:22:48 2006
@@ -326,10 +326,20 @@
 		Iterator it = entrySet().iterator();
 		while (it.hasNext()) {
 			Map.Entry entry = (Map.Entry) it.next();
-			buffer.append(entry.getKey());
+			Object key = entry.getKey();
+			if (key != this) {
+				buffer.append(key);
+			} else {
+				buffer.append("(this Map)");
+			}
 			buffer.append('=');
-			buffer.append(entry.getValue());
-			buffer.append(", "); //$NON-NLS-1$
+			Object value = entry.getValue();
+			if (value != this) {
+				buffer.append(value);
+			} else {
+				buffer.append("(this Map)");
+			}
+			buffer.append(", ");
 		}
 		// Remove the trailing ", "
 		if (buffer.length() > 1)



Mime
View raw message