Hi, I was using <foreach> in an <insert> (within a <mapper>) statement and I got the following NPE:
Caused by: java.lang.NullPointerException at java.util.regex.Pattern.<init>(Pattern.java:1132) at java.util.regex.Pattern.compile(Pattern.java:823) at java.lang.String.replaceFirst(String.java:2146) at org.apache.ibatis.builder.xml.dynamic.ForEachSqlNode$FilteredDynamicContext$1.handleToken(ForEachSqlNode.java:116) at org.apache.ibatis.parsing.GenericTokenParser.parse(GenericTokenParser.java:29) at org.apache.ibatis.builder.xml.dynamic.ForEachSqlNode$FilteredDynamicContext.appendSql(ForEachSqlNode.java:121) at org.apache.ibatis.builder.xml.dynamic.TextSqlNode.apply(TextSqlNode.java:18) at org.apache.ibatis.builder.xml.dynamic.MixedSqlNode.apply(MixedSqlNode.java:14) at org.apache.ibatis.builder.xml.dynamic.ForEachSqlNode.apply(ForEachSqlNode.java:51) at org.apache.ibatis.builder.xml.dynamic.MixedSqlNode.apply(MixedSqlNode.java:14) at org.apache.ibatis.builder.xml.dynamic.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:22) at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:198) at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:45) at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:16) at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:27) at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:192) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:27) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:65) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:39) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:93) ... 26 more This occurred when I didn't specify the item field in my <foreach> tag. Once I specify item="something" then the NPE goes away. Changing the statement within the <foreach> did not seem to effect this. Bug? -- View this message in context: http://old.nabble.com/Null-Pointer-Exception-on-Malformed-%3Cforeach%3E-tp26779961p26779961.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org