Create corresponding InfluxDBException from the message pack error body.
@param messagePackErrorBody
the error body if any
@return the Exception
480946
public static InfluxDBException buildExceptionForErrorState(final InputStream messagePackErrorBody) {
    try {
      MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(messagePackErrorBody);
      ImmutableMapValue mapVal = (ImmutableMapValue) unpacker.unpackValue();
      return InfluxDBException.buildExceptionFromErrorMessage(
          mapVal.map().get(new ImmutableStringValueImpl("error")).toString());
    } catch (Exception e) {
      return new InfluxDBException(e);
    }
  }
1111622
public static ClusterException create(Type type, String message) {
        switch (type) {
            case METASTORE:
                return new MetaStoreException(message);
            default:
                throw new IllegalArgumentException("Invalid exception type");
        }
    }
913717
public static IOException create(String msg, IOException exn)
  {
    if (exn.getClass().equals(IOException.class)
        || exn.getClass().equals(java.net.SocketException.class)
        || exn.getClass().getName().equals("javax.net.ssl.SSLException")) {
      return new ClientDisconnectException(msg, exn);
    }
    else
      return exn;
  }
932845
public static OAuth2Exception create(String errorCode, String errorMessage) {
		if (errorMessage == null) {
			errorMessage = errorCode == null ? "OAuth Error" : errorCode;
		}
		if (INVALID_CLIENT.equals(errorCode)) {
			return new InvalidClientException(errorMessage);
		}
		else if (UNAUTHORIZED_CLIENT.equals(errorCode)) {
			return new UnauthorizedClientException(errorMessage);
		}
		else if (INVALID_GRANT.equals(errorCode)) {
			return new InvalidGrantException(errorMessage);
		}
		else if (INVALID_SCOPE.equals(errorCode)) {
			return new InvalidScopeException(errorMessage);
		}
		else if (INVALID_TOKEN.equals(errorCode)) {
			return new InvalidTokenException(errorMessage);
		}
		else if (INVALID_REQUEST.equals(errorCode)) {
			return new InvalidRequestException(errorMessage);
		}
		else if (REDIRECT_URI_MISMATCH.equals(errorCode)) {
			return new RedirectMismatchException(errorMessage);
		}
		else if (UNSUPPORTED_GRANT_TYPE.equals(errorCode)) {
			return new UnsupportedGrantTypeException(errorMessage);
		}
		else if (UNSUPPORTED_RESPONSE_TYPE.equals(errorCode)) {
			return new UnsupportedResponseTypeException(errorMessage);
		}
		else if (ACCESS_DENIED.equals(errorCode)) {
			return new UserDeniedAuthorizationException(errorMessage);
		}
		else {
			return new OAuth2Exception(errorMessage);
		}
	}
952732
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final MessagePack messagePack, final Class<T> valueType) {
    if (!ClassUtils.isPrimitiveOrWrapper(valueType)) {
      messagePack.register(valueType);
    }
    return newClient(new MessagePackTranscoder<>(messagePack, valueType));
  }
906400
private RuntimeException unpackExecutionException(Throwable exc) {
    while (exc instanceof ExecutionException || exc instanceof UncheckedExecutionException) {
      exc = exc.getCause();
    }
    return Throwables.propagate(exc);
  }
1021671
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final MessagePack messagePack, final Type valueType) {
    return newClient(new MessagePackTranscoder<>(messagePack, valueType));
  }
109099
public static ValidationException info(String messageKey, 
			Object... params) {
		return new ValidationException(
				ValidationMessage.info(messageKey, params));		
	}
634684
public static MessageEmit getErrorObj(final HttpServletRequest request,
                                        final String errorObjAttrName) {
    if (errorObjAttrName == null) {
      // don't set
      return null;
    }

    HttpSession sess = request.getSession(false);

    if (sess == null) {
      logger.error("No session!!!!!!!");
      return null;
    }

    Object o = sess.getAttribute(errorObjAttrName);
    if ((o != null) && (o instanceof MessageEmit)) {
      return (MessageEmit)o;
    }

    return null;
  }
17006
private List<ErrorReport> getErrorReportOrNull(final String body) {
        ObjectMapper objectMapper = new ObjectMapper();

        try {
            JsonNode jsonNode = objectMapper.readValue(body, JsonNode.class);
            ErrorReport[] errors = objectMapper.readValue(jsonNode.get("errors").toString(), ErrorReport[].class);

            List<ErrorReport> result = Arrays.asList(errors);

            if (result.isEmpty()) {
                return null;
            }

            return result;
        } catch (IOException e) {
            return null;
        }
    }
85167
public static void createErrorMessageFromResourceBundle(String clientId, String messageId, String label) {
		String summary = null;
		String detail = null;
		ResourceBundle bundle;
		String bundleName;

		// see if we have a user-provided bundle
		Application app = FacesContext.getCurrentInstance().getApplication();
		Class<?> appClass = app.getClass();
		Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
		if (null != (bundleName = app.getMessageBundle())) {
			if (null != (bundle = ResourceBundle.getBundle(bundleName, locale, getCurrentLoader(appClass)))) {
				// see if we have a hit
				try {
					summary = bundle.getString(messageId);
					detail = bundle.getString(messageId + "_detail");
				} catch (MissingResourceException e) {
					// ignore
				}
			}
		}

		// we couldn't find a summary in the user-provided bundle
		if (null == summary) {
			// see if we have a summary in the app provided bundle
			bundle = ResourceBundle.getBundle(FacesMessage.FACES_MESSAGES, locale, getCurrentLoader(appClass));
			if (null == bundle) {
				throw new NullPointerException();
			}
			// see if we have a hit
			try {
				summary = bundle.getString(messageId);
				detail = bundle.getString(messageId + "_detail");
			} catch (MissingResourceException e) {
				// ignore
			}
		}

		summary = summary != null ? summary.replace("{0}", label) : "";
		detail = detail != null ? detail.replace("{0}", label) : "";

		// At this point, we have a summary and a bundle.
		FacesMessages.error(clientId, summary, detail);
	}
878028
protected <E extends Throwable> Set<ATError> handleException(E e, Log logger, 
			String key, String messageKey, String defaultMessagePrefix) {
		return handleException(e, logger, null, key, null, defaultMessagePrefix, new Object[] {});
	}
868706
public GelfMessage createGelfMessage(LogEvent logEvent) {

        GelfMessageBuilder builder = builders != null ? builders.get().recycle() : newInstance();

        Throwable throwable = logEvent.getThrowable();
        String message = logEvent.getMessage();

        if (GelfMessage.isEmpty(message) && throwable != null) {
            message = throwable.toString();
        }

        String shortMessage = message;
        if (message.length() > MAX_SHORT_MESSAGE_LENGTH) {
            shortMessage = message.substring(0, MAX_SHORT_MESSAGE_LENGTH - 1);
        }

        builder.withShortMessage(shortMessage).withFullMessage(message).withJavaTimestamp(logEvent.getLogTimestamp());
        builder.withLevel(logEvent.getSyslogLevel());
        builder.withVersion(getVersion());
        builder.withAdditionalFieldTypes(additionalFieldTypes);

        for (MessageField field : fields) {

            if (!isIncludeLocation() && field instanceof LogMessageField) {

                LogMessageField messageField = (LogMessageField) field;
                if (SOURCE_FIELDS.contains(messageField.getNamedLogField())) {
                    continue;
                }
            }

            Values values = getValues(logEvent, field);
            if (values == null || !values.hasValues()) {
                continue;
            }

            for (String entryName : values.getEntryNames()) {
                String value = values.getValue(entryName);
                if (value == null) {
                    continue;

                }
                builder.withField(entryName, value);
            }
        }

        if (stackTraceExtraction.isEnabled() && throwable != null) {
            addStackTrace(throwable, builder);
        }

        if (includeLogMessageParameters && logEvent.getParameters() != null) {
            for (int i = 0; i < logEvent.getParameters().length; i++) {
                Object param = logEvent.getParameters()[i];
                builder.withField(FIELD_MESSAGE_PARAM + i, "" + param);
            }
        }

        builder.withHost(getOriginHost());

        if (null != facility) {
            builder.withFacility(facility);
        }

        builder.withMaximumMessageSize(maximumMessageSize);
        return builder.build();
    }
959870
public static ErrorDetails exception( Throwable t ) {
		return new ErrorDetails( Utils.writeExceptionButDoNotUseItForLogging( t ), ErrorDetailsKind.EXCEPTION );
	}
748276
public static EvernoteException convert(Exception ex) {
		// construct exception message
		final StringBuilder sb = new StringBuilder();
		sb.append(ex.getClass().getName());
		if (ex instanceof EDAMUserException) {
			final EDAMErrorCode errorCode = ((EDAMUserException) ex).getErrorCode();
			if (errorCode == null) {
				sb.append(", ErrorCode [null");
			} else {
				sb.append(", ErrorCode [" + errorCode + "(" + errorCode.getValue() + ")");
			}
			sb.append("], Parameter [");
			sb.append(((EDAMUserException) ex).getParameter());
			sb.append("]");
		} else if (ex instanceof EDAMSystemException) {
			final EDAMErrorCode errorCode = ((EDAMSystemException) ex).getErrorCode();
			if (errorCode == null) {
				sb.append(", ErrorCode [null");
			} else {
				sb.append(", ErrorCode [" + errorCode + "(" + errorCode.getValue() + ")");
			}
			sb.append("], Message [");
			sb.append(((EDAMSystemException) ex).getMessage());
			sb.append("], RateLimitDuration [");
			sb.append(((EDAMSystemException) ex).getRateLimitDuration());
			sb.append("]");
		} else if (ex instanceof EDAMNotFoundException) {
			sb.append(", Identifier [");
			sb.append(((EDAMNotFoundException) ex).getIdentifier());
			sb.append("], Key [");
			sb.append(((EDAMNotFoundException) ex).getKey());
			sb.append("]");
		} else {
			sb.append(", Message [");
			sb.append(ex.getMessage());
			sb.append("]");
		}
		return new EvernoteException(sb.toString(), ex);
	}
59206
@Override
    public BytesMessage createBytesMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createBytesMessage");

        BytesMessage bytesMessage = null;

        try {
            bytesMessage = jmsSession.createBytesMessage();
        } catch (JMSException e) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(e, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createBytesMessage");
        }
        return bytesMessage;
    }
851123
public InternalFieldErrorBuilder createFieldError(final String field, final String[] errorCodes) {
        
        final String fieldPath = buildFieldPath(field);
        final Class<?> fieldType = getFieldType(field);
        final Object fieldValue = getFieldValue(field);
        
        String[] codes = new String[0];
        for(String errorCode : errorCodes) {
            codes = Utils.concat(codes, generateMessageCodes(errorCode, fieldPath, fieldType));
        }
        
        return new InternalFieldErrorBuilder(this, getObjectName(), fieldPath, codes)
                .sheetName(getSheetName())
                .rejectedValue(fieldValue);
                
    }