private static String resolveExpression(ModelControllerClient mcc, String expression) {
if (expression == null) {
return null;
}
CoreJBossASClient client = new CoreJBossASClient(mcc);
String resolvedExpression;
try {
resolvedExpression = client.resolveExpression(expression);
// https://issues.jboss.org/browse/WFLY-1177 - app server doesn't do recursive resolving, we have to do it here
while (resolvedExpression != null && resolvedExpression.contains("${")
&& !resolvedExpression.equals(expression)) {
expression = resolvedExpression;
resolvedExpression = client.resolveExpression(expression);
}
} catch (Exception e) {
LOG.warn("Cannot resolve expression [" + expression + "]; will use it as-is but errors may occur later.");
resolvedExpression = expression;
}