List of usage examples for java.lang Throwable getMessage
public String getMessage()
From source file:de.tudarmstadt.lt.ltbot.postprocessor.DecesiveValueProducerPerplexity.java
static void addExtraInfo(CrawlURI uri, String key, Object value) { try {/*w w w.java2 s. c om*/ uri.getExtraInfo().put(key, value); uri.getData().put(key, value); } catch (Throwable t) { for (int i = 1; t != null && i < 10; i++) { LOG.log(Level.WARNING, String.format("Failed to add perplexity value to extra info for uri: '%s' (%d-%s:%s).", uri.toString(), i, t.getClass().getName(), t.getMessage())); t = t.getCause(); } } }
From source file:org.apache.asterix.api.http.server.ResultUtil.java
public static void printError(PrintWriter pw, Throwable e, boolean comma) { Throwable rootCause = getRootCause(e); if (rootCause == null) { rootCause = e;//from w ww. j a v a2s. c o m } final boolean addStack = false; pw.print("\t\""); pw.print(AbstractQueryApiServlet.ResultFields.ERRORS.str()); pw.print("\": [{ \n"); printField(pw, QueryServiceServlet.ErrorField.CODE.str(), "1"); final String msg = rootCause.getMessage(); printField(pw, QueryServiceServlet.ErrorField.MSG.str(), JSONUtil.escape(msg != null ? msg : rootCause.getClass().getSimpleName()), addStack); pw.print(comma ? "\t}],\n" : "\t}]\n"); }
From source file:com.clustercontrol.jobmanagement.util.MonitorJobWorker.java
/** * ?// w w w . ja v a 2 s . c o m * * @param runInstructionInfo */ public static void runJob(RunInstructionInfo runInstructionInfo) { m_log.info("runJob() SessionID=" + runInstructionInfo.getSessionId() + ", JobunitID=" + runInstructionInfo.getJobunitId() + ", JobID=" + runInstructionInfo.getJobId() + ", FacilityID=" + runInstructionInfo.getFacilityId() + ", CommandType=" + runInstructionInfo.getCommandType()); //? try { // ? service.execute(new JobMonitorTask(runInstructionInfo)); } catch (Throwable e) { m_log.warn("runJob() Error : " + e.getMessage()); } }
From source file:com.aw.core.domain.AWBusinessException.java
private static AWBusinessException wrapUnhandledException(Log logger, Throwable e, Object errorMessage) { try {// w w w.j a va 2s . c o m AWExcepcionInterpreter excepcionInterpreter = (AWExcepcionInterpreter) ApplicationBase.instance() .getBean("exceptionInterpreter", null); if (excepcionInterpreter != null) e = excepcionInterpreter.handle(e); } catch (Throwable e2) { } if (e instanceof AWBusinessException) return (AWBusinessException) e; else { logger.error(errorMessage, e); AWBusinessException awBusinessException = new AWBusinessException( errorMessage + " : " + e.getMessage()); awBusinessException.initCause(e); return awBusinessException; } }
From source file:de.lmu.ifi.dbs.jfeaturelib.utils.Extractor.java
/** * Print a brief error message plus the help screen * * @param parser/*from ww w. j a va 2 s.c o m*/ * @param throwable */ private static void printError(CmdLineParser parser, Throwable throwable) throws IOException { printHelp(parser); System.err.println("Message: " + throwable.getMessage()); System.err.println("----------------------------------------------------------"); }
From source file:Main.java
public static Class<?> findClass(String className) throws ClassNotFoundException { // [JACKSON-597]: support primitive types (and void) if (className.indexOf('.') < 0) { if ("int".equals(className)) return Integer.TYPE; if ("long".equals(className)) return Long.TYPE; if ("float".equals(className)) return Float.TYPE; if ("double".equals(className)) return Double.TYPE; if ("boolean".equals(className)) return Boolean.TYPE; if ("byte".equals(className)) return Byte.TYPE; if ("char".equals(className)) return Character.TYPE; if ("short".equals(className)) return Short.TYPE; if ("void".equals(className)) return Void.TYPE; }// w ww. j av a 2 s . com // Two-phase lookup: first using context ClassLoader; then default Throwable prob = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader != null) { try { return Class.forName(className, true, loader); } catch (Exception e) { prob = getRootCause(e); } } try { return Class.forName(className); } catch (Exception e) { if (prob == null) { prob = getRootCause(e); } } if (prob instanceof RuntimeException) { throw (RuntimeException) prob; } throw new ClassNotFoundException(prob.getMessage(), prob); }
From source file:edu.stanford.epad.epadws.handlers.HandlerUtil.java
public static int warningJSONResponse(int responseCode, String message, Throwable t, PrintWriter responseStream, EPADLogger log) {// w w w . j a v a 2 s .c om String finalMessage = message + (t == null ? "" : ((t.getMessage() == null) ? "" : ": " + t.getMessage())); log.warning(finalMessage, t); if (responseStream != null) responseStream.append(new EPADMessage(finalMessage).toJSON()); return responseCode; }
From source file:edu.stanford.epad.epadws.handlers.HandlerUtil.java
public static int warningResponse(int responseCode, String message, Throwable t, PrintWriter responseStream, EPADLogger log) {//w w w.java2 s .com String finalMessage = message + (t == null ? "" : ((t.getMessage() == null) ? "" : ": " + t.getMessage())); if (responseStream != null) { finalMessage = new EPADMessage(finalMessage).toJSON(); responseStream.append(finalMessage); } else log.warning(finalMessage); return responseCode; }
From source file:com.microsoft.alm.plugin.authentication.AuthHelper.java
public static boolean isNotAuthorizedError(final Throwable throwable) { //We get VssServiceResponseException when token is valid but does not have the required scopes //statusCode on VssServiceResponseException is set to 401 but that is not accessible, so we have to check the message //If the message gets localized, we won't detect the auth error if (throwable != null && (throwable instanceof NotAuthorizedException || (throwable instanceof VssServiceResponseException && StringUtils.containsIgnoreCase(throwable.getMessage(), "unauthorized")))) { return true; }/*from ww w .j ava 2 s.c o m*/ if (throwable != null && throwable.getCause() != null && (throwable.getCause() instanceof NotAuthorizedException || (throwable.getCause() instanceof VssServiceResponseException && (StringUtils.containsIgnoreCase(throwable.getMessage(), "unauthorized"))))) { return true; } return false; }
From source file:com.centurylink.mdw.services.util.AuthUtils.java
private static boolean checkBearerAuthenticationHeader(String authHeader, Map<String, String> headers) { try {/*from w w w .j a va 2 s .c om*/ // Do NOT try to authenticate if it's not Bearer if (authHeader == null || !authHeader.startsWith("Bearer")) throw new Exception("Invalid MDW Auth Header"); // This should never happen authHeader = authHeader.replaceFirst("Bearer ", ""); DecodedJWT jwt = JWT.decode(authHeader); // Validate it is a JWT and see which kind of JWT it is if (MDW_AUTH.equals(jwt.getIssuer())) // JWT was issued by MDW Central verifyMdwJWT(authHeader, headers); else if (verifierCustom.get(jwt.getIssuer()) != null || (PropertyManager.getInstance().getProperties(PropertyNames.MDW_JWT) != null && PropertyManager.getInstance().getProperties(PropertyNames.MDW_JWT).values() .contains(jwt.getIssuer()))) // Support for other issuers of JWTs verifyCustomJWT(authHeader, jwt.getAlgorithm(), jwt.getIssuer(), headers); else throw new Exception("Invalid JWT Issuer"); } catch (Throwable ex) { if (!ApplicationContext.isDevelopment()) { headers.put(Listener.AUTHENTICATION_FAILED, "Authentication failed for JWT '" + authHeader + "' " + ex.getMessage()); logger.severeException("Authentication failed for JWT '" + authHeader + "' " + ex.getMessage(), ex); } return false; } if (logger.isDebugEnabled()) { logger.debug( "authentication successful for user '" + headers.get(Listener.AUTHENTICATED_USER_HEADER) + "'"); } if (PropertyManager.getBooleanProperty(PropertyNames.MDW_JWT_PRESERVE, false)) headers.put(Listener.AUTHENTICATED_JWT, authHeader); return true; }