private MuleException handledException(OperationContext operationContext, Exception e) { Throwable root = ExceptionUtils.getRootCause(e); if (root == null) { root = e; } return new MessagingException(createStaticMessage(root.getMessage()), ((OperationContextAdapter) operationContext).getEvent(), root, this); }
private void disposeLostObjects() { for (Object obj : registryMap.getLostObjects()) { try { ((Disposable) obj).dispose(); } catch (Exception e) { logger.warn("Can not dispose object. " + ExceptionUtils.getMessage(e)); if (logger.isDebugEnabled()) { logger.debug("Can not dispose object. " + ExceptionUtils.getStackTrace(e)); } } } }
/** * Similar to {@link #getFullStackTrace(Throwable)} but removing the exception and causes * messages. This is useful to determine if two exceptions have matching stack traces regardless of * the messages which may contain invokation specific data * * @param throwable the throwable to inspect, may be <code>null</code> * @return the stack trace as a string, with the messages stripped out. Empty string if throwable was <code>null</code> */ public static String getFullStackTraceWithoutMessages(Throwable throwable) { StringBuilder builder = new StringBuilder(); for (String frame : getStackFrames(throwable)) { builder.append(frame.replaceAll(":\\s+([\\w\\s]*.*)", "").trim()).append(LINE_SEPARATOR); } return builder.toString(); }
logger.error(null, ExceptionUtils.getRootCause(e)); throw new DeploymentStartException(CoreMessages.createStaticMessage(ExceptionUtils.getRootCauseMessage(e)), e);
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { log("Starting Resources generator for Extensions"); ResourcesGenerator generator = new AnnotationProcessorResourceGenerator(processingEnv, new SpiServiceRegistry()); try { for (TypeElement extensionElement : findExtensions(roundEnv)) { Extension extension = parseExtension(extensionElement, roundEnv); generator.generateFor(extension); } generator.dumpAll(); return false; } catch (Exception e) { processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, String.format("%s\n%s", e.getMessage(), ExceptionUtils.getStackTrace(e))); throw e; } }
Throwable cause = ExceptionUtils.getCause(itex); throwExceptionIfNotOptional(cause instanceof NoClassDefFoundError && optional, cause, "Ignoring optional transformer: " + transformerClass.getClass().getName());
/** * This method returns true if the throwable contains a {@link Throwable} that * matches the specified class or subclass in the exception chain. Subclasses of * the specified class do match. * * @param throwable the throwable to inspect, may be null * @param type the type to search for, subclasses match, null returns false * @return the index into the throwable chain, false if no match or null input */ public static boolean containsType(Throwable throwable, Class<?> type) { return indexOfType(throwable, type) > -1; }
/** * This method returns the throwable closest to the root cause that matches the * specified class or subclass. Any null argument will make the method return * null. * * @param throwable the throwable to inspect, may be null * @param type the type to search for, subclasses match, null returns null * @return the throwable that is closest to the root in the throwable chain that * matches the type or subclass of that type. */ @SuppressWarnings("unchecked") public static <ET> ET getDeepestOccurenceOfType(Throwable throwable, Class<ET> type) { if (throwable == null || type == null) { return null; } List<Throwable> throwableList = getThrowableList(throwable); ListIterator<Throwable> listIterator = throwableList.listIterator(throwableList.size()); while (listIterator.hasPrevious()) { Throwable candidate = listIterator.previous(); if (type.isAssignableFrom(candidate.getClass())) { return (ET)candidate; } } return null; }
@Override public void install() { if (logger.isInfoEnabled()) { logger.info(miniSplash(String.format("New app '%s'", descriptor.getName()))); } // set even though it might be redundant, just in case the app is been redeployed updateStatusFor(NotInLifecyclePhase.PHASE_NAME); try { for (String configResourceAbsolutePatch : this.descriptor.getAbsoluteResourcePaths()) { File configResource = new File(configResourceAbsolutePatch); if (!configResource.exists()) { String message = String.format("Config for app '%s' not found: %s", getArtifactName(), configResource); throw new InstallException(createStaticMessage(message)); } } deploymentClassLoader = applicationClassLoaderFactory.create(descriptor); } catch (Exception e) { setStatusToFailed(); throw new DeploymentStartException(createStaticMessage(ExceptionUtils.getRootCauseMessage(e)), e); } }
logger.error(null, ExceptionUtils.getRootCause(e)); throw new DeploymentStartException(createStaticMessage(ExceptionUtils.getRootCauseMessage(e)), e);
Throwable cause = ExceptionUtils.getCause(itex); throwExceptionIfNotOptional(cause instanceof NoClassDefFoundError && optional, cause, "Ignoring optional object: " + className);
logger.error(null, ExceptionUtils.getRootCause(e)); throw new DeploymentInitException(createStaticMessage(ExceptionUtils.getRootCauseMessage(e)), e);
results.add(error(ExceptionUtils.getRootCause(e).getMessage()));
logger.error(null, ExceptionUtils.getRootCause(e)); throw new DeploymentInitException(CoreMessages.createStaticMessage(ExceptionUtils.getRootCauseMessage(e)), e);