* Add some sanity checks to improve error messages.
This commit is contained in:
parent
4781c7a8ff
commit
aa648dd876
1 changed files with 7 additions and 4 deletions
|
@ -373,7 +373,8 @@ public final class Skin {
|
||||||
|
|
||||||
case '<':
|
case '<':
|
||||||
|
|
||||||
if (state == PARSE_PARAM && quotechar == '\u0000' && source[i + 1] == '%') {
|
if (state == PARSE_PARAM && quotechar == '\u0000'
|
||||||
|
&& b.length() == 0 && source[i + 1] == '%') {
|
||||||
Macro macro = new Macro(i, 2);
|
Macro macro = new Macro(i, 2);
|
||||||
hasNestedMacros = true;
|
hasNestedMacros = true;
|
||||||
addParameter(lastParamName, macro);
|
addParameter(lastParamName, macro);
|
||||||
|
@ -605,7 +606,7 @@ public final class Skin {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
// immediately return for comment macros
|
// immediately return for comment macros
|
||||||
if (isCommentMacro) {
|
if (isCommentMacro || name == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +666,7 @@ public final class Skin {
|
||||||
return filter(reval, value, thisObject, handlerCache);
|
return filter(reval, value, thisObject, handlerCache);
|
||||||
}
|
}
|
||||||
// display error message unless silent failmode is on
|
// display error message unless silent failmode is on
|
||||||
if ((handlerObject == null || !engine.hasProperty(handlerObject, propName))
|
if (!engine.hasProperty(handlerObject, propName)
|
||||||
&& standardParams.verboseFailmode(handlerObject, engine)) {
|
&& standardParams.verboseFailmode(handlerObject, engine)) {
|
||||||
throw new MacroUnhandledException(name);
|
throw new MacroUnhandledException(name);
|
||||||
}
|
}
|
||||||
|
@ -756,7 +757,9 @@ public final class Skin {
|
||||||
Object thisObject, Map handlerCache)
|
Object thisObject, Map handlerCache)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if ((sandbox != null) && !sandbox.contains(name)) {
|
if (name == null) {
|
||||||
|
throw new RuntimeException("Empty macro filter");
|
||||||
|
} else if (sandbox != null && !sandbox.contains(name)) {
|
||||||
throw new RuntimeException("Macro " + name + " not allowed in sandbox");
|
throw new RuntimeException("Macro " + name + " not allowed in sandbox");
|
||||||
}
|
}
|
||||||
Object handlerObject = null;
|
Object handlerObject = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue