reverting r5487 that was just for diagnostics
Patch by: amitmanjhi
Review by: scottb, jat
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7709 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/i18n/client/Dictionary.java b/user/src/com/google/gwt/i18n/client/Dictionary.java
index e17bf26..a5a18dd 100644
--- a/user/src/com/google/gwt/i18n/client/Dictionary.java
+++ b/user/src/com/google/gwt/i18n/client/Dictionary.java
@@ -102,7 +102,6 @@
null, name);
}
- private JavaScriptObject accessedKeys;
private JavaScriptObject dict;
private String label;
@@ -124,13 +123,8 @@
"Cannot find JavaScript object with the name '" + name + "'", name,
null);
}
- createAccessedKeysArray();
}
- private native void createAccessedKeysArray() /*-{
- this.@com.google.gwt.i18n.client.Dictionary::accessedKeys = new Array();
- }-*/;
-
/**
* Get the value associated with the given Dictionary key.
*
@@ -147,12 +141,6 @@
key = String(key);
var map = this.@com.google.gwt.i18n.client.Dictionary::dict;
var value = map[key];
- var keys = this.@com.google.gwt.i18n.client.Dictionary::accessedKeys;
- keys.unshift(key);
- // only keep the last 30 elements. Shrink it when array exceeds 60
- if (keys.length > 60) {
- keys.splice(30);
- }
if (value == null || !map.hasOwnProperty(key)) {
this.@com.google.gwt.i18n.client.Dictionary::resourceError(Ljava/lang/String;)(key);
}
@@ -192,7 +180,6 @@
if (s.size() < MAX_KEYS_TO_SHOW) {
error += "\n keys found: " + s;
}
- error += "\n accessed keys: " + accessedKeys;
throw new MissingResourceException(error, this.toString(), key);
}
diff --git a/user/test/com/google/gwt/i18n/client/I18NTest.java b/user/test/com/google/gwt/i18n/client/I18NTest.java
index 51a10ec..9e275c0 100644
--- a/user/test/com/google/gwt/i18n/client/I18NTest.java
+++ b/user/test/com/google/gwt/i18n/client/I18NTest.java
@@ -430,46 +430,6 @@
assertTrue(s.contains("a"));
assertTrue(s.contains("b"));
assertFalse(s.contains("c"));
- String nonExistentKey = "nonExistentKey";
- try {
- d.get(nonExistentKey);
- fail("should have thrown a MissingResourceException");
- } catch (MissingResourceException ex) {
- assertTrue(ex.getMessage(), ex.getMessage().indexOf(
- "accessed keys: " + nonExistentKey + ",d,formattedMessage") != -1);
- }
-
- /*
- * verify that accessedKeys maintains at least the last 30 entries in the
- * correct order. Steps involved: (i) create expectedKeys array, (ii) access
- * the dictionary, (iii) confirm that accessedKeys is maintained correctly.
- */
- // expectedKeys: nonExistentKey, 9 a's, 9 b's, 9 d's, 2 formattedMessage's
- StringBuffer expectedKeys = new StringBuffer();
- expectedKeys.append(nonExistentKey);
- for (String key : new String[] {"a", "b", "d"}) {
- for (int i = 0; i < 9; i++) {
- expectedKeys.append(",");
- expectedKeys.append(key);
- }
- }
- expectedKeys.append(",formattedMessage,formattedMessage");
- // access 360 keys. last 30 should match expectedKeys
- for (int i = 0; i < 10; i++) {
- for (String key : new String[] {"formattedMessage", "d", "b", "a"}) {
- for (int j = 0; j < 9; j++) {
- d.get(key);
- }
- }
- }
- try {
- d.get(nonExistentKey);
- fail("should have thrown a MissingResourceException");
- } catch (MissingResourceException ex) {
- assertTrue(ex.getMessage(), ex.getMessage().indexOf(
- "accessed keys: " + expectedKeys.toString()) != -1);
- }
-
Collection<String> s2 = d.values();
assertTrue(s2.contains("A"));
assertTrue(s2.contains("B"));