if (!isPropertyValid(expressionBody)) {
String message =
MessageUtils
.getExceptionMessageString(MessageUtils.INVALID_RESOURCE_FORMAT_COLON_ERROR,
expressionBody);
throw new ELException(message);
}
Map<String, Object> appMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
String[] parts = Util.split(appMap, expressionBody, ":");
if (null == parts[0] || null == parts[1]) {
String message =
MessageUtils
.getExceptionMessageString(MessageUtils.INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR,
expressionBody);
throw new ELException(message);
}
try {
int mark = parts[0].indexOf("[") + 2;
char quoteMark = parts[0].charAt(mark - 1);
parts[0] = parts[0].substring(mark, colon);
if (parts[0].equals("this")) {
LibraryInfo libInfo = info.getLibraryInfo();
if (null != libInfo) {
parts[0] = libInfo.getName();
} else if (null != info.getContract()) {
parts[0] = info.getContract();
} else {
throw new NullPointerException("Resource expression is not a library or resource library contract");
}
mark = parts[1].indexOf("]") - 1;
parts[1] = parts[1].substring(0, mark);
expressionBody = "resource[" + quoteMark + parts[0] +
":" + parts[1] + quoteMark + "]";
}
}
catch (Exception e) {
String message =
MessageUtils
.getExceptionMessageString(MessageUtils.INVALID_RESOURCE_FORMAT_ERROR,
expressionBody);
throw new ELException(message);
}
}
ELContext elContext = ctx.getELContext();
expressionEvaluated = true;