Details
-
Bug
-
Resolution: Fixed
-
Major
-
16.3.1
-
None
-
Unknown
-
N/A
-
N/A
-
Description
org.xwiki.query.WrappingQuery 's bindValue and bindValues methods return the wrapped query instead of the current query. This is unexpected and can lead to breakage in calling code expecting to get the wrapping query instead (which is the documented behavior in the JavaDoc).
Current implementation:
@Override public Query bindValue(String var, Object val) { return getWrappedQuery().bindValue(var, val); } @Override public Query bindValue(int index, Object val) { return getWrappedQuery().bindValue(index, val); } @Override public Query bindValues(List<Object> values) { return getWrappedQuery().bindValues(values); } @Override public Query bindValues(Map<String, ?> values) { return getWrappedQuery().bindValues(values); }
Suggested implementation:
@Override public Query bindValue(String p, Object val) { getWrappedQuery().bindValue(p, val); return this; } @Override public Query bindValue(int index, Object val) { getWrappedQuery().bindValue(index, val); return this; } @Override public Query bindValues(List<Object> values) { getWrappedQuery().bindValues(values); return this; } @Override public Query bindValues(Map<String, ?> values) { getWrappedQuery().bindValues(values); return this; }