public void onExit(Context cx, boolean byThrow, Object resultOrException) { if (byThrow) { String name = null; if (script.isFunction()) { name = script.getFunctionName(); } else { name = "[script]"; } if (locations == null) { locations = new ArrayList(1); // start small } locations.add(new LocationImpl(name, script.getSourceName(), line, -1)); } else if (locations != null) { // The exception was handled by the script: clear any recorded locations locations = null; } } }