List of usage examples for java.lang Exception getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:br.com.autonomiccs.starthost.plugin.proxies.StartHostMethodInterceptor.java
@Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { UUID uuid = UUID.randomUUID(); logger.debug(String.format(/*from w w w .ja v a2 s . com*/ "In proxy method before the method [%s] execution, we will use the idenfier [%s] for debug purpose.", methodInvocation.getMethod().getName(), uuid)); logger.debug(String.format("Parameters before request [%s] execution, parameters [%s]", uuid, ArrayUtils.toString(methodInvocation.getArguments()))); try { return methodInvocation.proceed(); } catch (Exception e) { logger.info(String.format("Dealing with exception [%s] for method [%s], UUID of the call [%s].", e.getClass(), methodInvocation.getMethod().getName(), uuid)); if (!hostService.isThereAnyHostOnCloudDeactivatedByOurManager() && !autonomicClusterManagementHeuristicService.getAdministrationAlgorithm() .canHeuristicShutdownHosts()) { throw e; } return synchronizedExecuteDeployVMStartingHostIfNeeded(methodInvocation); } }
From source file:com.acc.controller.BaseController.java
/** * /* w w w . java 2 s. c o m*/ * @param excp * to support basic exception marshaling to JSON and XML. It will determine the format based on the * request's Accept header. * @param request * @param writer * @throws IOException * @return {@link ErrorData} as a response body */ @ResponseStatus(value = HttpStatus.BAD_REQUEST) @ResponseBody @ExceptionHandler({ IllegalArgumentException.class, UnknownIdentifierException.class, AmbiguousIdentifierException.class, ModelSavingException.class, JaloInvalidParameterException.class, DuplicateUidException.class, PasswordMismatchException.class, ModelNotFoundException.class, ConversionException.class }) public ErrorData handleException(final Exception excp, final HttpServletRequest request, final Writer writer) throws IOException { LOG.info("Handling Exception for this request - " + excp.getClass().getSimpleName() + " - " + excp.getMessage()); if (LOG.isDebugEnabled()) { LOG.debug(excp); } final ErrorData errorData = handleErrorInternal(excp.getClass().getSimpleName(), excp.getMessage()); return errorData; }
From source file:org.terracotta.management.model.cluster.ClusterTest.java
@Test public void test_add_remove_client() { assertEquals(1, cluster1.getClients().size()); try {//w w w. ja va 2 s . c om cluster1.addClient(Client.create("12345@127.0.0.1:ehcache:uid")); fail(); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } assertEquals(1, cluster1.getClients().size()); cluster1.addClient(Client.create("123@127.0.0.1:cluster-client-2:uid")); assertEquals(2, cluster1.getClients().size()); assertTrue(cluster1.removeClient("123@127.0.0.1:cluster-client-2:uid").isPresent()); assertFalse(cluster1.getClient("123@127.0.0.1:cluster-client-2:uid").isPresent()); assertEquals(1, cluster1.getClients().size()); }
From source file:org.terracotta.management.model.cluster.ClusterTest.java
@Test public void test_add_remove_stripes() { assertEquals(2, cluster1.getStripes().size()); try {/* w w w. j av a 2 s . c om*/ cluster1.addStripe(Stripe.create("stripe-1")); fail(); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } assertEquals(2, cluster1.getStripes().size()); cluster1.addStripe(Stripe.create("stripe-3")); assertEquals(3, cluster1.getStripes().size()); assertTrue(cluster1.removeStripe("stripe-3").isPresent()); assertFalse(cluster1.getStripe("stripe-3").isPresent()); assertEquals(2, cluster1.getStripes().size()); }
From source file:eu.trentorise.game.managers.PlayerManager.java
public PlayerState saveState(PlayerState state) { if (StringUtils.isBlank(state.getGameId()) || StringUtils.isBlank(state.getPlayerId())) { throw new IllegalArgumentException("field gameId and playerId of PlayerState MUST be set"); }/* www . ja va 2s . co m*/ String key = state.getPlayerId() + "-" + state.getGameId(); data.put(key, convert(state)); try { mapper.writeValue(new FileOutputStream("playerstorage"), data); return state; } catch (Exception e) { logger.error("Error persisting playerstorage {}: {}", e.getClass().getName(), e.getMessage()); return null; } }
From source file:acmi.l2.clientmod.xdat.XdatEditor.java
private void loadSchema() { String versionsFilePath = "/versions.csv"; try (CSVParser parser = new CSVParser( new InputStreamReader(getClass().getResourceAsStream(versionsFilePath)), CSVFormat.DEFAULT)) { for (CSVRecord record : parser.getRecords()) { String name = record.get(0); String className = record.get(1); controller.registerVersion(name, className); }/*from ww w. j a v a 2 s . c o m*/ } catch (Exception e) { log.log(Level.WARNING, versionsFilePath + " read error", e); Dialogs.show(Alert.AlertType.WARNING, e.getClass().getSimpleName(), null, e.getMessage()); } }
From source file:org.terracotta.management.model.cluster.ClusterTest.java
@Test public void test_add_remove_server() { Stripe stripe = cluster1.getStripe("stripe-1").get(); assertEquals(2, stripe.getServers().size()); try {// www . j ava2s . com stripe.addServer(Server.create("server-1")); fail(); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } assertEquals(2, stripe.getServers().size()); stripe.addServer(Server.create("server-3")); assertEquals(3, stripe.getServers().size()); assertTrue(stripe.removeServerByName("server-3").isPresent()); assertFalse(stripe.getServerByName("server-3").isPresent()); assertEquals(2, stripe.getServers().size()); }
From source file:org.encos.flydown.Flydown.java
@AfterThrowing(value = "exceptionRatePointcut()", throwing = "e") public void afterThrowingExceptionRate(JoinPoint joinPoint, Exception e) throws RateExceededException { log.debug("handling exception rate {}", e.getClass().getSimpleName()); MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); ExceptionRate exceptionRate = methodSignature.getMethod().getAnnotation(ExceptionRate.class); if (exceptionRate != null) { afterThrowingExceptionRate(methodSignature, exceptionRate, e); }//from ww w .j a v a 2 s.c o m ExceptionRates exceptionRates = methodSignature.getMethod().getAnnotation(ExceptionRates.class); if (exceptionRates != null) { for (ExceptionRate singleRate : exceptionRates.value()) { afterThrowingExceptionRate(methodSignature, singleRate, e); } } }
From source file:com.alibaba.wasp.master.TestRestartCluster.java
@Test(timeout = 300000) public void testClusterRestart() throws Exception { UTIL.startMiniCluster(3);// ww w .ja v a 2 s . c om while (!UTIL.getMiniWaspCluster().getMaster().isInitialized()) { Threads.sleep(1); } LOG.info("\n\nCreating tables"); for (byte[] TABLE : TABLES) { UTIL.createTable(TABLE); } for (byte[] TABLE : TABLES) { UTIL.waitTableAvailable(TABLE, 30000); } List<EntityGroupInfo> allEntityGroups = FMetaScanner.listAllEntityGroups(UTIL.getConfiguration()); assertEquals(3, allEntityGroups.size()); LOG.info("\n\nShutting down cluster"); UTIL.shutdownMiniWaspCluster(); LOG.info("\n\nSleeping a bit"); Thread.sleep(2000); LOG.info("\n\nStarting cluster the second time"); UTIL.restartWaspCluster(3); // Need to use a new 'Configuration' so we make a new FConnection. // Otherwise we're reusing an FConnection that has gone stale because // the shutdown of the cluster also called shut of the connection. allEntityGroups = FMetaScanner.listAllEntityGroups(new Configuration(UTIL.getConfiguration())); assertEquals(3, allEntityGroups.size()); LOG.info("\n\nWaiting for tables to be available"); for (byte[] TABLE : TABLES) { try { UTIL.createTable(TABLE); assertTrue("Able to create table that should already exist", false); } catch (Exception t) { if (t instanceof RemoteException) { t = ((RemoteException) t).unwrapRemoteException(); } if (t.getClass().getName().equals("com.alibaba.wasp.TableExistsException")) { LOG.info("Table already exists as expected"); } else { throw t; } } UTIL.waitTableAvailable(TABLE, 30000); } UTIL.shutdownMiniCluster(); }
From source file:com.amalto.service.calltransformer.CallTransformerServiceBean.java
public String getConfiguration(String optionalParameters) throws XtentisException { try {//from w ww .j a v a 2 s .c o m String configuration = loadConfiguration(); if (configuration == null) { configuration = getDefaultConfiguration(); } return configuration; } catch (Exception e) { String err = "Unable to deserialize the configuration of the Call Transformer Service" + ": " + e.getClass().getName() + ": " + e.getLocalizedMessage(); LOGGER.error(err); throw new XtentisException(err); } }