Skip to content

Commit dc6b29b

Browse files
committed
Fix for issue #61
1 parent 43039bf commit dc6b29b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/main/java/org/apache/ibatis/scripting/xmltags/DynamicContext.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public ContextMap(MetaObject parameterMetaObject) {
7878
this.parameterMetaObject = parameterMetaObject;
7979
}
8080

81+
@Override
82+
public Object put(String key, Object value) {
83+
return super.put(key, value);
84+
}
85+
8186
@Override
8287
public Object get(Object key) {
8388
String strKey = (String) key;
@@ -87,9 +92,10 @@ public Object get(Object key) {
8792

8893
if (parameterMetaObject != null) {
8994
Object object = parameterMetaObject.getValue(strKey);
90-
if (object != null) {
91-
super.put(strKey, object);
92-
}
95+
// issue #61 do not modify the context when reading
96+
// if (object != null) {
97+
// super.put(strKey, object);
98+
// }
9399

94100
return object;
95101
}

src/test/java/org/apache/ibatis/submitted/ognlstatic/OgnlStaticTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ public void shouldGetAUserStatic() {
6363
try {
6464
Mapper mapper = sqlSession.getMapper(Mapper.class);
6565
User user = mapper.getUserStatic(1);
66+
Assert.assertNotNull(user);
6667
Assert.assertEquals("User1", user.getName());
6768
} finally {
6869
sqlSession.close();
6970
}
7071
}
7172

72-
@Ignore
73-
@Test // see issue #61
73+
@Test // see issue #61 (gh)
7474
public void shouldGetAUserWithIfNode() {
7575
SqlSession sqlSession = sqlSessionFactory.openSession();
7676
try {

0 commit comments

Comments
 (0)