public void reportException(RhinoException ex) { if (ex instanceof WrappedException) { WrappedException we = (WrappedException) ex; we.printStackTrace(err); } else { String lineSeparator = SecurityUtilities.getSystemProperty("line.separator"); String msg = getExceptionMessage(ex) + lineSeparator + ex.getScriptStackTrace(); reportErrorMessage( msg, ex.sourceName(), ex.lineNumber(), ex.lineSource(), ex.columnNumber(), false); } }
static Class<?> loadAdapterClass(String className, byte[] classBytes) { Object staticDomain; Class<?> domainClass = SecurityController.getStaticSecurityDomainClass(); if (domainClass == CodeSource.class || domainClass == ProtectionDomain.class) { // use the calling script's security domain if available ProtectionDomain protectionDomain = SecurityUtilities.getScriptProtectionDomain(); if (protectionDomain == null) { protectionDomain = JavaAdapter.class.getProtectionDomain(); } if (domainClass == CodeSource.class) { staticDomain = protectionDomain == null ? null : protectionDomain.getCodeSource(); } else { staticDomain = protectionDomain; } } else { staticDomain = null; } GeneratedClassLoader loader = SecurityController.createLoader(null, staticDomain); Class<?> result = loader.defineClass(className, classBytes); loader.linkClass(result); return result; }