diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/store/hibernate/query/HqlQueryUtils.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/store/hibernate/query/HqlQueryUtils.java index 7091687fb355..e2c6aa5f9cff 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/store/hibernate/query/HqlQueryUtils.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/store/hibernate/query/HqlQueryUtils.java @@ -378,7 +378,10 @@ public static Query toCompleteQuery(Query query) Query completeQuery = query; String completeStatement = toCompleteStatement(query.getStatement()); - if (completeStatement != query.getStatement()) { + // Check of toCompleteStatement returned a different String (which means it completed it) + @SuppressWarnings("java:S4973") + boolean isCompleted = completeStatement != query.getStatement(); + if (isCompleted) { completeQuery = new WrappingQuery(query) { @Override