SPR-5847: require quotes for dotted map key names, eg. map['a.b.c']

This commit is contained in:
Andy Clement
2009-07-07 16:32:56 +00:00
parent a4b7ce168c
commit dbdac9fa31
2 changed files with 28 additions and 3 deletions

View File

@@ -57,8 +57,15 @@ public class Indexer extends SpelNodeImpl {
index = reference.getName();
indexValue = new TypedValue(index,CommonTypeDescriptors.STRING_TYPE_DESCRIPTOR);
} else {
indexValue = children[0].getValueInternal(state);
index = indexValue.getValue();
// In case the map key is unqualified, we want it evaluated against the root object so
// temporarily push that on whilst evaluating the key
try {
state.pushActiveContextObject(state.getRootContextObject());
indexValue = children[0].getValueInternal(state);
index = indexValue.getValue();
} finally {
state.popActiveContextObject();
}
}
// Indexing into a Map