diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/ConfigurableHQLCompleteStatementValidator.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/ConfigurableHQLCompleteStatementValidator.java index c07d1036998..81f9dc95246 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/ConfigurableHQLCompleteStatementValidator.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/ConfigurableHQLCompleteStatementValidator.java @@ -29,8 +29,6 @@ import javax.inject.Named; import javax.inject.Singleton; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.slf4j.Logger; import org.xwiki.component.annotation.Component; import org.xwiki.component.descriptor.ComponentDescriptor; import org.xwiki.component.phase.Initializable; @@ -48,7 +46,7 @@ */ @Component @Singleton -@Named("configuration") +@Named("configurable") @Priority(ComponentDescriptor.DEFAULT_PRIORITY - 100) public class ConfigurableHQLCompleteStatementValidator implements HQLCompleteStatementValidator, Initializable { @@ -56,9 +54,6 @@ public class ConfigurableHQLCompleteStatementValidator implements HQLCompleteSta @Named("xwikiproperties") private ConfigurationSource configuration; - @Inject - private Logger logger; - private List unsafe; private List safe; @@ -70,7 +65,7 @@ public void initialize() throws InitializationException this.safe = getPatterns("query.hql.safe"); } - private List getPatterns(String key) + private List getPatterns(String key) throws InitializationException { List patternStrings = this.configuration.getProperty(key, List.class); @@ -81,8 +76,8 @@ private List getPatterns(String key) try { patterns.add(Pattern.compile(patternString)); } catch (Exception e) { - this.logger.warn("Failed to parse pattern [{}] for configuration [{}]: {}", patternString, key, - ExceptionUtils.getRootCauseMessage(e)); + throw new InitializationException( + String.format("Failed to parse pattern [%s] for configuration [%s]", patternString, key), e); } } } else { diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/HQLCompleteStatementValidator.java b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/HQLCompleteStatementValidator.java index 86610017694..363ad1fa027 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/HQLCompleteStatementValidator.java +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/HQLCompleteStatementValidator.java @@ -26,6 +26,10 @@ /** * A component in charge of validating a passed HQL statement. + *

+ * Note that since the {@code standard} validator always gives an answer, any extra validator must have a priority value + * lower than the default one ({@link org.xwiki.component.descriptor.ComponentDescriptor#DEFAULT_PRIORITY} to have a + * chance to be called. * * @version $Id$ * @since 17.0.0RC1