Creates a {@code exception} tag based on the {@link Class#getSimpleName() simple
name} of the class of the given {@code exception}.

@param exception the exception, may be {@code null}
@return the exception tag derived from the exception
432898
public static Tag exception(@Nullable Throwable exception) {
        if (exception == null) {
            return EXCEPTION_NONE;
        }
        String simpleName = exception.getClass().getSimpleName();
        return Tag.of("exception", simpleName.isEmpty() ? exception.getClass().getName() : simpleName);
    }
843572
@Override
  public String getTag() throws IOException {

    URLConnection urlConnection = url.openConnection();
    
    String tag = urlConnection.getHeaderField(ETAG);
    if(tag == null) {
    
      String key = url.toString() + "@" + urlConnection.getLastModified();
      
      tag = md5Cache.getIfPresent(key);

      if(tag == null) {
          
        try(InputStream urlStream = urlConnection.getInputStream()) {
      
          byte[] data = ByteStreams.toByteArray(urlConnection.getInputStream());
      
          tag = Hashing.md5().hashBytes(data).toString();
      
          md5Cache.put(key, tag);
        }
        
      }
      
    }
    
    return tag;
  }
1003889
public Predicate<Exception> raise(Class<? extends Exception> exception) {
    return create(error -> error != null && exception.isAssignableFrom(error.getClass()));
  }
923892
public <T extends AbstractJaxb> T copyNoException(Class<T> tagType) {
        T copy = null;
        try {
            copy = (T) this.copy(tagType);
        } catch (final TagTypeUnmatchException e) {
            return null;
        }
        return copy;
    }
460555
public static Class<?> getExceptionCallerClass(final Throwable t) {
		final StackTraceElement[] stackTrace = t.getStackTrace();
		for (final StackTraceElement stackTraceElement : stackTrace) {
			logger.debug(stackTraceElement.getClassName().concat(".").concat(stackTraceElement.getMethodName()));
		}
		return null;
	}
1180262
@Override
    public ExceptionHandler getExceptionHandler(Exception exception) {
        Class<? extends Exception> exceptionClass = exception.getClass();
        if (!exceptionHandlers.containsKey(exceptionClass)) {
            Class<?> superClass = exceptionClass.getSuperclass();
            while (superClass != null) {
                if (exceptionHandlers.containsKey(superClass)) {
                    ExceptionHandler exceptionHandler = exceptionHandlers.get(superClass);
                    exceptionHandlers.put(exceptionClass, exceptionHandler);

                    return exceptionHandler;
                }

                superClass = superClass.getSuperclass();
            }

            // avoid superclass traversal in the future if we didn't find a handler
            exceptionHandlers.put(exceptionClass, null);
        }

        return exceptionHandlers.get(exceptionClass);
    }
1179495
public static String str_exception(Exception except) {
        String str = "";

        if (except instanceof ConnectionFailed)
            str += ((ConnectionFailed) (except)).getStack();
        else if (except instanceof CommunicationFailed)
            str += ((CommunicationFailed) (except)).getStack();
        else if (except instanceof WrongNameSyntax)
            str += ((WrongNameSyntax) (except)).getStack();
        else if (except instanceof WrongData)
            str += ((WrongData) (except)).getStack();
        else if (except instanceof NonDbDevice)
            str += ((NonDbDevice) (except)).getStack();
        else if (except instanceof NonSupportedFeature)
            str += ((NonSupportedFeature) (except)).getStack();
        else if (except instanceof EventSystemFailed)
            str += ((EventSystemFailed) (except)).getStack();
        else if (except instanceof AsynReplyNotArrived)
            str += ((AsynReplyNotArrived) (except)).getStack();
        else if (except instanceof DevFailed) {
            DevFailed df = (DevFailed) except;
            //	True DevFailed
            str += "Tango exception  " + df.toString() + "\n";
            for (int i = 0; i < df.errors.length; i++) {
                str += "Severity -> ";
                switch (df.errors[i].severity.value()) {
                    case ErrSeverity._WARN:
                        str += "WARNING \n";
                        break;

                    case ErrSeverity._ERR:
                        str += "ERROR \n";
                        break;

                    case ErrSeverity._PANIC:
                        str += "PANIC \n";
                        break;

                    default:
                        str += "Unknown severity code";
                        break;
                }
                str += "Desc   -> " + df.errors[i].desc + "\n";
                str += "Reason -> " + df.errors[i].reason + "\n";
                str += "Origin -> " + df.errors[i].origin + "\n";

                if (i < df.errors.length - 1)
                    str += "-------------------------------------------------------------\n";
            }
        } else
            str = except.toString();
        return str;
    }
1086463
private AccountReport22 createDay(BTag tag) throws Exception {
        AccountReport22 report = new AccountReport22();

        if (tag != null) {
            report.getBal().add(this.createSaldo(tag.start, true));
            report.getBal().add(this.createSaldo(tag.end, false));
        }

        if (tag != null && tag.my != null) {
            CashAccount36 acc = new CashAccount36();
            AccountIdentification4Choice id = new AccountIdentification4Choice();
            id.setIBAN(tag.my.iban);
            acc.setId(id);

            acc.setCcy(tag.my.curr);

            BranchAndFinancialInstitutionIdentification5 svc = new BranchAndFinancialInstitutionIdentification5();
            FinancialInstitutionIdentification8 inst = new FinancialInstitutionIdentification8();
            svc.setFinInstnId(inst);
            inst.setBICFI(tag.my.bic);
            report.setAcct(acc);
        }

        return report;
    }
117785
protected RuntimeException runtimeException(final Exception exception) {
        if (exception instanceof RuntimeException) {
            throw (RuntimeException) exception;
        } else {
            throw new RuntimeException(exception);
        }
    }
645098
public static Exception getLowestException(final Exception exception, final String exceptionPrefix) {

		if (exception == null) {
			return null;
		}

		Throwable nestedException = (Throwable) exception;
		Exception lastLowException = null;
		while (nestedException != null) {
			if (nestedException.getClass().toString().startsWith("class " + exceptionPrefix)) {
				lastLowException = (Exception) nestedException;
			}

			nestedException = getInnerException(nestedException);
		}

		return lastLowException;
	}
773498
public Element tagName(String tagName) {
        Validate.notEmpty(tagName, "Tag name must not be empty.");
        tag = Tag.valueOf(tagName, NodeUtils.parser(this).settings()); // maintains the case option of the original parse
        return this;
    }
94509
private static String getExceptionMessage(final String[] exception) {
        StringBuffer buff = new StringBuffer();
        for (int i = 0; i < exception.length; i++) {
            buff.append(exception[i]);
        }
        return buff.toString();
    }
900811
public static String getExceptionMessage(Throwable exception)
    {
        StringWriter        out = new StringWriter();
        exception.printStackTrace(new PrintWriter(out));
        BufferedReader      in = new BufferedReader(new StringReader(out.toString()));
        try
        {
            StringBuilder       str = new StringBuilder();
            for(;;)
            {
                String  line = in.readLine();
                if ( line == null )
                {
                    break;
                }
                if ( str.length() > 0 )
                {
                    str.append(", ");
                }
                str.append(line);
            }
            return str.toString();
        }
        catch ( IOException e )
        {
            // ignore
        }
        return "n/a";
    }
1291711
public static String exceptionToString(Exception e)
    {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        return sw.toString();
    }
540333
private <T> String buildClassListTag(final T t) {
        return (exportClassFullName != null)
                ? exportClassFullName
                : t.getClass().getSimpleName() + exportClassEnding;
    }
1107785
public <T extends AbstractJaxb> T getByName(String name, Class<T> tagType) {
        return GetByNameUtil.getByName((T) this, name, tagType);
    }
228479
public static Tag exception(RequestEvent event) {
        Throwable exception = event.getException();
        if (exception == null) {
            return EXCEPTION_NONE;
        }
        ContainerResponse response = event.getContainerResponse();
        if (response != null) {
            int status = response.getStatus();
            if (status == 404 || isRedirection(status)) {
                return EXCEPTION_NONE;
            }
        }
        if (exception.getCause() != null) {
            exception = exception.getCause();
        }
        String simpleName = exception.getClass().getSimpleName();
        return Tag.of("exception", StringUtils.isNotEmpty(simpleName) ? simpleName
                : exception.getClass().getName());
    }