diff options
author | Brian Vosburgh | 2013-06-12 02:56:53 +0000 |
---|---|---|
committer | Thomas Watson | 2013-06-12 02:56:53 +0000 |
commit | 07a628c1c661a28a3f61265c34e4c1e3b5e2afc5 (patch) | |
tree | 28c297bed90bb5886b36537b8d68b9d488f02625 | |
parent | 2368c6930bdda51fd9b8c6df8b2a3d6459174b95 (diff) | |
download | rt.equinox.framework-07a628c1c661a28a3f61265c34e4c1e3b5e2afc5.tar.gz rt.equinox.framework-07a628c1c661a28a3f61265c34e4c1e3b5e2afc5.tar.xz rt.equinox.framework-07a628c1c661a28a3f61265c34e4c1e3b5e2afc5.zip |
Bug 410510 - Headers.toString() not very helpful
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java index 3268b3efc..c01ef6d86 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2010 IBM Corporation and others. + * Copyright (c) 2003, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -248,7 +248,30 @@ public class Headers<K, V> extends Dictionary<K, V> implements Map<K, V> { } public String toString() { - return values.toString(); + StringBuilder sb = new StringBuilder(); + sb.append('{'); + + for (int i = 0; i < size; i++) { + if (i != 0) { + sb.append(", "); //$NON-NLS-1$ + } + K header = headers[i]; + if (header == this) { + sb.append("(this Dictionary)"); //$NON-NLS-1$ + } else { + sb.append(header); + } + sb.append('='); + V value = values[i]; + if (value == this) { + sb.append("(this Dictionary)"); //$NON-NLS-1$ + } else { + sb.append(value); + } + } + + sb.append('}'); + return sb.toString(); } public static Headers<String, String> parseManifest(InputStream in) throws BundleException { |