-
- String javascript = new String(map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION));
- String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")")+1);
+
+ final byte[] controllerLoc = map.get(WidgetConstant.WIDGET_CONTROLLER_LOCATION);
+ if (controllerLoc == null || controllerLoc.length == 0)
+ throw new IllegalArgumentException(
+ "Map is missing required key " + WidgetConstant.WIDGET_CONTROLLER_LOCATION);
+ String javascript = new String(controllerLoc);
+ String functionHeader = javascript.substring(javascript.indexOf("function"), javascript.indexOf(")") + 1);