Fix to check image_strong_intern table when inserting weaks.
The ExpatSaxParserTest.testNameSpaces test found that the empty string
"" would be .equals() another instance of the empty string, but they
weren't ==. The bug was that weak references were not checking the
image_strong_interns_ table before creating a weak reference.
Change-Id: I096eaee09973ccd19ca180ca07ac9438c2549296
diff --git a/src/intern_table.cc b/src/intern_table.cc
index f3c82ac..10dd7f0 100644
--- a/src/intern_table.cc
+++ b/src/intern_table.cc
@@ -86,14 +86,15 @@
uint32_t hash_code = s->GetHashCode();
if (is_strong) {
- // Check the strong tables for a match.
+ // Check the strong table for a match.
String* strong = Lookup(strong_interns_, s, hash_code);
if (strong != NULL) {
return strong;
}
- strong = Lookup(image_strong_interns_, s, hash_code);
- if (strong != NULL) {
- return strong;
+ // Check the image table for a match.
+ String* image = Lookup(image_strong_interns_, s, hash_code);
+ if (image != NULL) {
+ return image;
}
// There is no match in the strong table, check the weak table.
@@ -113,6 +114,11 @@
if (strong != NULL) {
return strong;
}
+ // Check the image table for a match.
+ String* image = Lookup(image_strong_interns_, s, hash_code);
+ if (image != NULL) {
+ return image;
+ }
// Check the weak table for a match.
String* weak = Lookup(weak_interns_, s, hash_code);
if (weak != NULL) {