private void setHeaders(XMLHttpRequest xmlHttpRequest) throws RequestException { if (headers != null && headers.size() > 0) { for (Map.Entry<String, String> header : headers.entrySet()) { try { xmlHttpRequest.setRequestHeader(header.getKey(), header.getValue()); } catch (JavaScriptException e) { throw new RequestException(e.getMessage()); } } } else { xmlHttpRequest.setRequestHeader("Content-Type", "text/plain; charset=utf-8"); } } }
private void ensureInit() { if (message == null) { Object exception = getThrown(); name = getExceptionName(exception); description = description + ": " + getExceptionDescription(exception); message = "(" + name + ") " + description; } }
@Override public String getMessage() { ensureInit(); return message; }
public static int getArraySize(JSONValue array) { if (array instanceof JSONArray) { return ((JSONArray) array).size(); } if (array instanceof JSONObject) { return ((JSONObject) array).size(); } throw new JavaScriptException("Not implemented"); }
private static native void reportToBrowser(Object e) /*-{ $wnd.setTimeout(function () { throw e; }, 0); }-*/;
throw e; } else { JavaScriptException materialized = new JavaScriptException(e.getName(), e.getDescription()); materialized.setStackTrace(e.getStackTrace()); throw materialized;
private void doExecute(Runnable r) { try { r.run(); } catch (JavaScriptException jse) { if (jse.isThrownSet()) { LOG.severe("Caught JavaScriptException, wrapped error is: " + jse.getThrown()); } ThrowableHandlers.handle(jse); } catch (Throwable t) { ThrowableHandlers.handle(t); } }
private static String getExceptionName(Object e) { if (e == null) { return "null"; } else if (e instanceof JavaScriptObject) { return getExceptionName0((JavaScriptObject) e); } else if (e instanceof String) { return "String"; } else { return e.getClass().getName(); } }
private static String getExceptionDescription(Object e) { if (e instanceof JavaScriptObject) { return getExceptionDescription0((JavaScriptObject) e); } else { return e + ""; } }
static JavaScriptException convertJavaScriptObjectToException(JavaScriptObject e) { return new JavaScriptException(javaScriptExceptionName(e), javaScriptExceptionDescription(e)); }
private static native void reportToBrowser(Object e) /*-{ $wnd.setTimeout(function () { throw e; }, 0); }-*/;
private static String getExceptionName(Object e) { if (e == null) { return "null"; } else if (e instanceof JavaScriptObject) { return getExceptionName0((JavaScriptObject) e); } else if (e instanceof String) { return "String"; } else { return e.getClass().getName(); } }
private static String getExceptionDescription(Object e) { if (e instanceof JavaScriptObject) { return getExceptionDescription0((JavaScriptObject) e); } else { return e + ""; } }
RequestPermissionException requestPermissionException = new RequestPermissionException( url); requestPermissionException.initCause(new RequestException(e.getMessage())); throw requestPermissionException; xmlHttpRequest.send(requestData); } catch (JavaScriptException e) { throw new RequestException(e.getMessage());
private void ensureInit() { if (message == null) { Object exception = getThrown(); name = getExceptionName(exception); description = description + ": " + getExceptionDescription(exception); message = "(" + name + ") " + description; } }
public OMSVGICCColor iccColor(String str) { // GWT.log("iccColor(" + str + ")"); ICC.setLastIndex(0); MatchResult result = ICC.exec(str); if (result != null && result.getGroupCount() == 3) { String[] intArray = result.getGroup(2).split(COMMA); List<Integer> intList = new ArrayList<Integer>(); for (int i = 0; i < intArray.length; i++) { if (intArray[i].length() > 0) { intList.add(Integer.parseInt(intArray[i])); } } return new OMSVGICCColor(result.getGroup(1), intList); } throw new JavaScriptException("Invalid icc-color spec: " + str); }
/** * Returns the original JavaScript message of the exception; may be * <code>null</code>. */ public String getDescription() { ensureInit(); return description; }
private static native void reportToBrowser(Object e) /*-{ $wnd.setTimeout(function () { throw e; }, 0); }-*/;
private static String getExceptionName(Object e) { if (e == null) { return "null"; } else if (e instanceof JavaScriptObject) { return getExceptionName0((JavaScriptObject) e); } else if (e instanceof String) { return "String"; } else { return e.getClass().getName(); } }
private static String getExceptionDescription(Object e) { if (e instanceof JavaScriptObject) { return getExceptionDescription0((JavaScriptObject) e); } else { return e + ""; } }