Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Deeply nested (3+ levels) result map could cause IllegalArgumentException #1176
For some cases, when parse the mapper xml, it may be have incompleteStatements.
But it maybe do twice.
The method org.apache.ibatis.binding.MapperMethod.SqlCommand#resolveMappedStatement:
call the hasStatement method, the validateIncompleteStatements is true, so it will call buildAllStatements method and add the statement to mappedStatements and return true.
then call getMappedStatement, the validateIncompleteStatements is also true, it will call buildAllStatements again.
it will throw 'java.lang.IllegalArgumentException' : Mapped Statements collection already contains...
so I think the code must be:
and I wonder, when the incompleteStatements is build success, why not clear them?
It says that the method recommend to be called once, but in the code, there are many place call the org.apache.ibatis.session.Configuration#getMappedStatement(java.lang.String) method, it means if it parse the mapper xml and produce the incompleteStatements, when run the code it will throw already have mapped statement exception?
I cannot understand why it has to be invoked twice.
The pending-dealing procedure is invoked after current xml mapper is parsed, but its logic is WRONG!
referenced this issue
Nov 8, 2018
I cannot upload the full jar, but I can describe the case:
added a commit
Nov 9, 2018
You might be surprised, but most reports without a repro do not reproduce the problem because there is a missing piece or two which looks irrelevant to the reporter.
Here is a project I created based on your report and it works without an error.