/** Returns the static method defined in an element, or null if failed. */ /*package*/ static MethodInfo getMethodInfo(Element el) { final String clsnm = IDOMs.getRequiredAttributeValue(el, "class"); final String sig = IDOMs.getRequiredAttributeValue(el, "signature"); final Class cls; try { cls = Classes.forNameByThread(clsnm); } catch (ClassNotFoundException ex) { log.error("Class not found: " + clsnm + ", " + el.getLocator()); return null; // to report as many errors as possible } try { final Method mtd = Classes.getMethodBySignature(cls, sig, null); if ((mtd.getModifiers() & Modifier.STATIC) == 0) { log.error("Not a static method: " + mtd); return null; } final Object[] args = new Object[mtd.getParameterTypes().length]; for (int j = 0; j < args.length; ++j) args[j] = el.getAttributeValue("arg" + j); return new MethodInfo(mtd, args); } catch (ClassNotFoundException ex) { log.realCauseBriefly( "Unable to load class when resolving " + sig + " " + el.getLocator(), ex); } catch (NoSuchMethodException ex) { log.error("Method not found in " + clsnm + ": " + sig + " " + el.getLocator()); } return null; }
private void handleFailedModal(int oldmode, boolean oldvisi) { try { if (Executions.getCurrent().getAttribute("javax.servlet.error.exception") != null) { // handle it specially if it is used for dispalying err setMode(HIGHLIGHTED); } else { setMode(oldmode); // restore setVisible(oldvisi); } } catch (Throwable ex) { log.realCauseBriefly("Causing another error", ex); } }
private static Extension getExtension() { if (_ext == null) { synchronized (BindUiLifeCycle.class) { if (_ext == null) { String clsnm = Library.getProperty("org.zkoss.bind.tracker.impl.extension"); if (clsnm != null) { try { _ext = (Extension) Classes.newInstanceByThread(clsnm); } catch (Throwable ex) { log.realCauseBriefly("Unable to instantiate " + clsnm, ex); } } if (_ext == null) _ext = new DefaultExtension(); } } } return _ext; }
private static final String getNotFound(int code, Locale locale) { if (code == NULL_CODE) return ""; // special code try { log.error( "Message code not found: " + Integer.toHexString(code) + " not in " + locale + ":" + Aide.getBundleInfo(code)); final String hexcode = Integer.toHexString(code); final String s = getFromBundle(MCommon.MESSAGE_CODE_NOT_FOUND, locale); return s != null ? MessageFormats.format(s, new Object[] {hexcode}, locale) : "Unknown message code: " + hexcode; } catch (Exception ex) { log.realCauseBriefly(ex); return "Unknown message code: " + Integer.toHexString(code); } }