DSL parsing : Catch index out of bound exception (#3364)
* In case index being referred does not exist, throw appropriate error during DSL parsing * Fixing bad commit.
This commit is contained in:
parent
639913703a
commit
5e448b9331
|
|
@ -322,7 +322,13 @@ public class LayoutActionServiceImpl implements LayoutActionService {
|
||||||
parent = ((Map<String, ?>) parent).get(nextKey);
|
parent = ((Map<String, ?>) parent).get(nextKey);
|
||||||
} else if (parent instanceof List) {
|
} else if (parent instanceof List) {
|
||||||
if (Pattern.matches(Pattern.compile("[0-9]+").toString(), nextKey)) {
|
if (Pattern.matches(Pattern.compile("[0-9]+").toString(), nextKey)) {
|
||||||
parent = ((List) parent).get(Integer.parseInt(nextKey));
|
try {
|
||||||
|
parent = ((List) parent).get(Integer.parseInt(nextKey));
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
// The index being referred does not exist. Hence the path would not exist.
|
||||||
|
throw new AppsmithException(AppsmithError.INVALID_DYNAMIC_BINDING_REFERENCE, widgetType,
|
||||||
|
widgetName, widgetId, fieldPath, pageId, layoutId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new AppsmithException(AppsmithError.INVALID_DYNAMIC_BINDING_REFERENCE, widgetType,
|
throw new AppsmithException(AppsmithError.INVALID_DYNAMIC_BINDING_REFERENCE, widgetType,
|
||||||
widgetName, widgetId, fieldPath, pageId, layoutId);
|
widgetName, widgetId, fieldPath, pageId, layoutId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user