List of usage examples for java.lang.reflect UndeclaredThrowableException getMessage
public String getMessage()
From source file:com.wisemapping.rest.BaseController.java
@ExceptionHandler(java.lang.reflect.UndeclaredThrowableException.class) @ResponseStatus(HttpStatus.BAD_REQUEST)/* w w w .ja v a 2 s . c om*/ public RestErrors handleSecurityErrors(@NotNull UndeclaredThrowableException ex) { final Throwable cause = ex.getCause(); RestErrors result; if (cause instanceof ClientException) { result = handleClientErrors((ClientException) cause); } else { result = new RestErrors(ex.getMessage(), Severity.INFO); } return result; }
From source file:org.bonitasoft.engine.api.HTTPServerAPI.java
@Override public Object invokeMethod(final Map<String, Serializable> options, final String apiInterfaceName, final String methodName, final List<String> classNameParameters, final Object[] parametersValues) throws ServerWrappedException { String response = null;/* w w w .ja v a 2 s. c om*/ try { response = executeHttpPost(options, apiInterfaceName, methodName, classNameParameters, parametersValues, XSTREAM); return checkInvokeMethodReturn(response, XSTREAM); } catch (final UndeclaredThrowableException e) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, e.getMessage(), e); } throw new ServerWrappedException(e); } catch (final Throwable e) { final StackTraceElement[] stackTrace = new Exception().getStackTrace(); StackTraceTransformer.addStackTo(e, stackTrace); throw new ServerWrappedException(e.getMessage() + "response= " + response, e); } }
From source file:com.cloudera.beeswax.BeeswaxServiceImpl.java
private <T> T doWithState(RunningQueryState state, PrivilegedExceptionAction<T> action) throws BeeswaxException { try {//from w w w. j av a 2s . c om UserGroupInformation ugi; if (UserGroupInformation.isSecurityEnabled()) ugi = UserGroupInformation.createProxyUser(state.query.hadoop_user, UserGroupInformation.getLoginUser()); else { ugi = UserGroupInformation.createRemoteUser(state.query.hadoop_user); } return ugi.doAs(action); } catch (UndeclaredThrowableException e) { if (e.getUndeclaredThrowable() instanceof PrivilegedActionException) { Throwable bwe = e.getUndeclaredThrowable().getCause(); if (bwe instanceof BeeswaxException) { LOG.error("Caught BeeswaxException", (BeeswaxException) bwe); throw (BeeswaxException) bwe; } } LOG.error("Caught unexpected exception.", e); throw new BeeswaxException(e.getMessage(), state.handle.log_context, state.handle); } catch (IOException e) { LOG.error("Caught IOException", e); throw new BeeswaxException(e.getMessage(), state.handle.log_context, state.handle); } catch (InterruptedException e) { LOG.error("Caught InterruptedException", e); throw new BeeswaxException(e.getMessage(), state.handle.log_context, state.handle); } }
From source file:it.cnr.icar.eric.server.persistence.rdb.SQLPersistenceManagerImpl.java
private void createConnectionPool() { try {// w w w.j a v a 2 s . c o m RegistryProperties registryProperties = RegistryProperties.getInstance(); String initialSize = registryProperties.getProperty("eric.persistence.rdb.pool.initialSize"); int initConns = 1; if (initialSize != null) { initConns = Integer.parseInt(initialSize); } String maxSize = registryProperties.getProperty("eric.persistence.rdb.pool.maxSize"); int maxConns = 1; if (maxSize != null) { maxConns = Integer.parseInt(maxSize); } String connectionTimeOut = registryProperties .getProperty("eric.persistence.rdb.pool.connectionTimeOut"); int timeOut = 0; if (connectionTimeOut != null) { timeOut = Integer.parseInt(connectionTimeOut); } connectionPool = new ConnectionPool("ConnectionPool", databaseURL, user, password, maxConns, initConns, timeOut, transactionIsolation); } catch (java.lang.reflect.UndeclaredThrowableException t) { log.error(ServerResourceBundle.getInstance().getString("message.FailedToCreateConnectionPool", new Object[] { t.getClass().getName(), t.getMessage() }), t); throw t; } }
From source file:org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.java
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object ret = null;/*from w w w . j a v a2s. c om*/ int retriesMade = 0; TException caughtException = null; while (true) { try { reloginExpiringKeytabUser(); if (retriesMade > 0 || hasConnectionLifeTimeReached(method)) { base.reconnect(); lastConnectionTime = System.currentTimeMillis(); } if (metaCallTimeMap == null) { ret = method.invoke(base, args); } else { // need to capture the timing long startTime = System.currentTimeMillis(); ret = method.invoke(base, args); long timeTaken = System.currentTimeMillis() - startTime; addMethodTime(method, timeTaken); } break; } catch (UndeclaredThrowableException e) { throw e.getCause(); } catch (InvocationTargetException e) { if ((e.getCause() instanceof TApplicationException) || (e.getCause() instanceof TProtocolException) || (e.getCause() instanceof TTransportException)) { caughtException = (TException) e.getCause(); } else if ((e.getCause() instanceof MetaException) && e.getCause().getMessage() .matches("(?s).*(JDO[a-zA-Z]*|TApplication|TProtocol|TTransport)Exception.*")) { caughtException = (MetaException) e.getCause(); } else { throw e.getCause(); } } catch (MetaException e) { if (e.getMessage().matches("(?s).*(IO|TTransport)Exception.*")) { caughtException = e; } else { throw e; } } if (retriesMade >= retryLimit) { throw caughtException; } retriesMade++; LOG.warn("MetaStoreClient lost connection. Attempting to reconnect.", caughtException); Thread.sleep(retryDelaySeconds * 1000); } return ret; }
From source file:org.freebxml.omar.server.persistence.rdb.SQLPersistenceManagerImpl.java
private void createConnectionPool() { try {/*w w w. ja v a 2s. c om*/ RegistryProperties registryProperties = RegistryProperties.getInstance(); String initialSize = registryProperties.getProperty("omar.persistence.rdb.pool.initialSize"); int initConns = 1; if (initialSize != null) { initConns = Integer.parseInt(initialSize); } String maxSize = registryProperties.getProperty("omar.persistence.rdb.pool.maxSize"); int maxConns = 1; if (maxSize != null) { maxConns = Integer.parseInt(maxSize); } String connectionTimeOut = registryProperties .getProperty("omar.persistence.rdb.pool.connectionTimeOut"); int timeOut = 0; if (connectionTimeOut != null) { timeOut = Integer.parseInt(connectionTimeOut); } connectionPool = new ConnectionPool("ConnectionPool", databaseURL, user, password, maxConns, initConns, timeOut, transactionIsolation); } catch (java.lang.reflect.UndeclaredThrowableException t) { log.error(ServerResourceBundle.getInstance().getString("message.FailedToCreateConnectionPool", new Object[] { t.getClass().getName(), t.getMessage() }), t); throw t; } }