Refine search
if (getLogger().isDebugEnabled()) { getLogger().debug("Starting filters"); for (Entry<String,FilterDef> entry : filterDefs.entrySet()) { String name = entry.getKey(); if (getLogger().isDebugEnabled()) { getLogger().debug(" Starting filter '" + name + "'"); filterConfigs.put(name, filterConfig); } catch (Throwable t) { t = ExceptionUtils.unwrapInvocationTargetException(t); ExceptionUtils.handleThrowable(t); getLogger().error(sm.getString( "standardContext.filterStart", name), t); ok = false;
public Tomcat() { ExceptionUtils.preload(); }
protected final void handlePojoMethodException(Throwable t) { t = ExceptionUtils.unwrapInvocationTargetException(t); ExceptionUtils.handleThrowable(t); if (t instanceof RuntimeException) { throw (RuntimeException) t; } else { throw new RuntimeException(t); } } }
private String getClasspath( ClassLoader loader ) { try { Method m=loader.getClass().getMethod("getClasspath", new Class[] {}); if( log.isTraceEnabled()) log.trace("getClasspath " + m ); if( m==null ) return null; Object o=m.invoke( loader, new Object[] {} ); if( log.isDebugEnabled() ) log.debug("gotClasspath " + o); if( o instanceof String ) return (String)o; return null; } catch( Exception ex ) { Throwable t = ExceptionUtils.unwrapInvocationTargetException(ex); ExceptionUtils.handleThrowable(t); if (log.isDebugEnabled()) log.debug("getClasspath ", ex); } return null; }
/** * Notify interested listeners that attribute has been removed. */ private void notifyAttributeRemoved(String name, Object value) { Object listeners[] = context.getApplicationEventListeners(); if ((listeners == null) || (listeners.length == 0)) { return; } ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(), name, value); for (int i = 0; i < listeners.length; i++) { if (!(listeners[i] instanceof ServletRequestAttributeListener)) { continue; } ServletRequestAttributeListener listener = (ServletRequestAttributeListener) listeners[i]; try { listener.attributeRemoved(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t); // Error valve will pick this exception up and display it to user attributes.put(RequestDispatcher.ERROR_EXCEPTION, t); } } }
throws IOException { RequestDispatcher disp = context.getServletContext().getRequestDispatcher (config.getErrorPage()); try { if (context.fireRequestInitEvent(request)) { disp.forward(request.getRequest(), response); context.fireRequestDestroyEvent(request); ExceptionUtils.handleThrowable(t); String msg = sm.getString("formAuthenticator.forwardErrorFail"); log.warn(msg, t); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);
@Override public boolean fireRequestInitEvent(ServletRequest request) { Object instances[] = getApplicationEventListeners(); if ((instances != null) && (instances.length > 0)) { ServletRequestEvent event = new ServletRequestEvent(getServletContext(), request); for (int i = 0; i < instances.length; i++) { if (instances[i] == null) continue; if (!(instances[i] instanceof ServletRequestListener)) continue; ServletRequestListener listener = (ServletRequestListener) instances[i]; try { listener.requestInitialized(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); getLogger().error(sm.getString( "standardContext.requestListener.requestInit", instances[i].getClass().getName()), t); request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; } } } return true; }
private void undeploy(DeployedApplication app) { if (log.isInfoEnabled()) log.info(sm.getString("hostConfig.undeploy", app.name)); Container context = host.findChild(app.name); try { host.removeChild(context); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString ("hostConfig.context.remove", app.name), t); } deployed.remove(app.name); }
request.setCoyoteRequest(req); response = connector.createResponse(); response.setCoyoteResponse(res); request.setResponse(response); response.setRequest(request); if (context != null) { logged = true; context.logAccess(request, response, time, true); } else if (host != null) { logged = true; host.logAccess(request, response, time, true); ExceptionUtils.handleThrowable(t); log.warn(sm.getString("coyoteAdapter.accesslogFail"), t); } finally { updateWrapperErrorCount(request, response); request.recycle(); response.recycle();
/** * Attempt to load a class using the given Container's class loader. If the * class cannot be loaded, a debug level log message will be written to the * Container's log and null will be returned. * @param context The class loader of this context will be used to attempt * to load the class * @param className The class name * @return the loaded class or <code>null</code> if loading failed */ public static Class<?> loadClass(Context context, String className) { ClassLoader cl = context.getLoader().getClassLoader(); Log log = context.getLogger(); Class<?> clazz = null; try { clazz = cl.loadClass(className); } catch (ClassNotFoundException | NoClassDefFoundError | ClassFormatError e) { log.debug(sm.getString("introspection.classLoadFailed", className), e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.debug(sm.getString("introspection.classLoadFailed", className), t); } return clazz; }
Context context = (Context) host.findChild(cn.getName()); if (context == null) { writer.println(smClient.getString("managerServlet.noContext", Escape.htmlElementContent(cn.getDisplayName()))); return; if (context.getName().equals(this.context.getName())) { writer.println(smClient.getString("managerServlet.noSelf")); return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName())); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log("ManagerServlet.reload[" + cn.getDisplayName() + "]", t); writer.println(smClient.getString("managerServlet.exception",
public void setErrorState(Throwable t, boolean fireOnError) { if (t!=null) request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); request.getCoyoteRequest().action(ActionCode.ASYNC_ERROR, null); listener.fireOnError(errorEvent); } catch (Throwable t2) { ExceptionUtils.handleThrowable(t2); log.warn(sm.getString("asyncContextImpl.onErrorError", listener.getClass().getName()), t2); request.getCoyoteRequest().action(ActionCode.ASYNC_IS_ERROR, result); if (result.get()) { Host host = (Host) context.getParent(); Valve stdHostValve = host.getPipeline().getBasic(); if (stdHostValve instanceof StandardHostValve) { ((StandardHostValve) stdHostValve).throwable(request,
private void process() { Set<BackgroundProcess> currentProcesses = new HashSet<>(); synchronized (processesLock) { currentProcesses.addAll(processes); } for (BackgroundProcess process : currentProcesses) { try { process.backgroundProcess(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString( "backgroundProcessManager.processFailed"), t); } } }
protected void recycleSessionInfo() { if (session != null) { try { session.endAccess(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString("coyoteRequest.sessionEndAccessFail"), t); } } session = null; requestedSessionCookie = false; requestedSessionId = null; requestedSessionURL = false; requestedSessionSSL = false; }
ExceptionUtils.handleThrowable(t); context.getLogger().error(sm.getString( "applicationFilterConfig.release", filterDef.getFilterName(), filterDef.getFilterClass()), t); if (!context.getIgnoreAnnotations()) { try { ((StandardContext) context).getInstanceManager().destroyInstance(this.filter); } catch (Exception e) { Throwable t = ExceptionUtils .unwrapInvocationTargetException(e); ExceptionUtils.handleThrowable(t); context.getLogger().error("ApplicationFilterConfig.preDestroy", t);
/** * Perform the internal processing required to passivate * this session. */ public void passivate() { // Notify interested session event listeners fireSessionEvent(Session.SESSION_PASSIVATED_EVENT, null); // Notify ActivationListeners HttpSessionEvent event = null; String keys[] = keys(); for (int i = 0; i < keys.length; i++) { Object attribute = attributes.get(keys[i]); if (attribute instanceof HttpSessionActivationListener) { if (event == null) event = new HttpSessionEvent(getSession()); try { ((HttpSessionActivationListener)attribute) .sessionWillPassivate(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); manager.getContext().getLogger().error (sm.getString("standardSession.attributeEvent"), t); } } } }
@Override public void fireOnComplete() { List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(); listenersCopy.addAll(listeners); ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null); try { for (AsyncListenerWrapper listener : listenersCopy) { try { listener.fireOnComplete(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString("asyncContextImpl.onCompleteError", listener.getClass().getName()), t); } } } finally { context.fireRequestDestroyEvent(request.getRequest()); clearServletRequestResponse(); context.unbind(Globals.IS_SECURITY_ENABLED, oldCL); } }
/** * Write the configuration information for <code>Context</code> * out to the specified configuration file. * * @param context the context which should save its configuration * @exception InstanceNotFoundException * if the managed resource object cannot be found * @exception MBeanException * if the initializer of the object throws an exception * or persistence is not supported * @exception javax.management.RuntimeOperationsException * if an exception is reported by the persistence mechanism */ public synchronized void storeContext(Context context) throws InstanceNotFoundException, MBeanException { try { // Note: Hard-coded domain used since this object is per Server/JVM ObjectName sname = new ObjectName("Catalina:type=StoreConfig"); if (mserver.isRegistered(sname)) { mserver.invoke(sname, "store", new Object[] {context}, new String [] { "java.lang.String"}); } else { log.error(sm.getString("standardServer.storeConfig.notAvailable", sname)); } } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString("standardServer.storeConfig.contextError", context.getName()), t); } }
Context context = (Context) host.findChild(cn.getName()); if (context == null) { writer.println(smClient.getString("managerServlet.noContext", Escape.htmlElementContent(displayPath))); return; if (context.getName().equals(this.context.getName())) { writer.println(smClient.getString("managerServlet.noSelf")); return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath)); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log("ManagerServlet.stop[" + displayPath + "]", t); writer.println(smClient.getString("managerServlet.exception",
public boolean timeout() { AtomicBoolean result = new AtomicBoolean(); request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result); // Avoids NPEs during shutdown. A call to recycle will null this field. Context context = this.context; if (result.get()) { ClassLoader oldCL = context.bind(false, null); try { List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(); listenersCopy.addAll(listeners); for (AsyncListenerWrapper listener : listenersCopy) { try { listener.fireOnTimeout(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString("asyncContextImpl.onTimeoutError", listener.getClass().getName()), t); } } request.getCoyoteRequest().action( ActionCode.ASYNC_IS_TIMINGOUT, result); } finally { context.unbind(false, oldCL); } } return !result.get(); }