Commit 3e4d9586 authored by Ard Schrijvers's avatar Ard Schrijvers

HSTTWO-1003 improve logging which configuration misses a referenced container

parent 4c4022b9
/*
* Copyright 2008-2017 Hippo B.V. (http://www.onehippo.com)
* Copyright 2008-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -396,7 +396,7 @@ public class HstComponentConfigurationService implements HstComponentConfigurati
}
try {
if (HstNodeTypes.NODETYPE_HST_CONTAINERCOMPONENTREFERENCE.equals(child.getNodeTypeName())) {
HstNode referencedContainerNode = getReferencedContainer(child, referenceableContainers);
HstNode referencedContainerNode = getReferencedContainer(child, referenceableContainers, rootConfigurationPathPrefix);
if (referencedContainerNode == null) {
return null;
}
......@@ -435,11 +435,12 @@ public class HstComponentConfigurationService implements HstComponentConfigurati
}
private HstNode getReferencedContainer(final HstNode child, final Map<String, HstNode> referenceableContainers) {
private HstNode getReferencedContainer(final HstNode child, final Map<String, HstNode> referenceableContainers, final String rootConfigurationPathPrefix) {
if (referenceableContainers == null || referenceableContainers.isEmpty()) {
log.warn("Component '{}' is of type '{}' but there are no referenceable containers at '{}'. Component '{}' will be ignored.",
log.warn("Component '{}' is of type '{}' but there are no referenceable containers at '{}' for configuration at '{}'. " +
"Component '{}' will be ignored.",
new String[]{child.getValueProvider().getPath(), HstNodeTypes.NODETYPE_HST_CONTAINERCOMPONENTREFERENCE,
HstNodeTypes.RELPATH_HST_WORKSPACE_CONTAINERS, child.getValueProvider().getPath()});
HstNodeTypes.RELPATH_HST_WORKSPACE_CONTAINERS, rootConfigurationPathPrefix, child.getValueProvider().getPath()});
return null;
}
// reference is mandatory so can't be null
......@@ -462,9 +463,9 @@ public class HstComponentConfigurationService implements HstComponentConfigurati
}
}
if (refNode == null) {
log.warn("Component '{}' contains an unresolvable reference '{}'. It should be a location relative to '{}'. " +
log.warn("Component '{}' contains an unresolvable reference '{}' for configuration '{}'. It should be a location relative to '{}'. " +
"Component '{}' will be ignored.",
new String[]{child.getValueProvider().getPath(), reference,
new String[]{child.getValueProvider().getPath(), reference, rootConfigurationPathPrefix,
HstNodeTypes.RELPATH_HST_WORKSPACE_CONTAINERS, child.getValueProvider().getPath()});
return null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment