List of usage examples for java.lang IllegalStateException getMessage
public String getMessage()
From source file:org.jumpmind.symmetric.io.stage.StagingManager.java
protected void refreshResourceList() { synchronized (StagingManager.class) { Collection<File> files = FileUtils.listFiles(this.directory, new String[] { State.CREATE.getExtensionName(), State.READY.getExtensionName(), State.DONE.getExtensionName() }, true);/* w ww .j a va 2 s. c o m*/ for (File file : files) { try { StagedResource resource = new StagedResource(0, directory, file, this); String path = resource.getPath(); if (!resourceList.containsKey(path)) { resourceList.put(path, resource); } } catch (IllegalStateException ex) { log.warn(ex.getMessage()); } } } }
From source file:org.resthub.rpc.hessian.AMQPProxyTest.java
@Test(groups = "hessian-serialization") public void testSerializationError() throws Exception { FailingServiceRPCEndpoint endpoint = new FailingServiceRPCEndpoint(); endpoint.setConnectionFactory(connectionFactory); endpoint.setSerializationHandler(serializationHandler); endpoint.run();//w w w . j a va2s . c o m AMQPProxyFactory factory = new AMQPProxyFactory(); factory.setReadTimeout(5000); factory.setConnectionFactory(connectionFactory); factory.setSerializationHandler(new HessianSerializationHandler()); FailingService service = factory.create(FailingService.class); try { service.getNotSerializable(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("must implement java.io.Serializable")); } finally { endpoint.destroy(); } }
From source file:org.resthub.rpc.java.AMQPProxyTest.java
@Test(groups = "java-serialization") public void testSerializationError() throws Exception { FailingServiceRPCEndpoint endpoint = new FailingServiceRPCEndpoint(); endpoint.setConnectionFactory(connectionFactory); endpoint.setSerializationHandler(serializationHandler); endpoint.run();//from ww w . j a v a2 s. c o m AMQPProxyFactory factory = new AMQPProxyFactory(); factory.setReadTimeout(5000); factory.setConnectionFactory(connectionFactory); factory.setSerializationHandler(new DefaultSerializationHandler()); FailingService service = factory.create(FailingService.class); try { service.getNotSerializable(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("must implement java.io.Serializable")); } finally { endpoint.destroy(); } }
From source file:org.apache.metron.parsers.integration.components.ParserTopologyComponent.java
@Override public void stop() { if (stormCluster != null) { try {/* w w w .j a v a2s .co m*/ try { // Kill the topology directly instead of sitting through the wait period killTopology(); stormCluster.shutdown(); } catch (IllegalStateException ise) { if (!(ise.getMessage().contains("It took over") && ise.getMessage().contains("to shut down slot"))) { throw ise; } else { assassinateSlots(); LOG.error("Storm slots didn't shut down entirely cleanly *sigh*. " + "I gave them the old one-two-skadoo and killed the slots with prejudice. " + "If tests fail, we'll have to find a better way of killing them.", ise); } } } catch (Throwable t) { LOG.error(t.getMessage(), t); } finally { cleanupWorkerDir(); } } }
From source file:org.apache.solr.schema.ChangedSchemaMergeTest.java
public void testSanityOfSchemaSimilarityFactoryInform() { // sanity check that SchemaSimilarityFactory will throw an Exception if you // try to use it w/o inform(SolrCoreAware) otherwise assertSimilarity is useless SchemaSimilarityFactory broken = new SchemaSimilarityFactory(); broken.init(new ModifiableSolrParams()); // NO INFORM/*from w w w. ja v a2s .co m*/ try { Similarity bogus = broken.getSimilarity(); fail("SchemaSimilarityFactory should have thrown IllegalStateException b/c inform not used"); } catch (IllegalStateException expected) { assertTrue("GOT: " + expected.getMessage(), expected.getMessage().contains("SolrCoreAware.inform")); } }
From source file:com.oneteam.framework.android.net.AbstractHttpConnection.java
protected void connect(HttpRequestBase httpMethod) { DefaultHttpClient httpClient = new DefaultHttpClient(); try {//from w w w .j a v a 2 s . c om mHttpResponse = httpClient.execute(httpMethod); } catch (IllegalStateException e) { Logger.w("Invalid url, Error > " + e.getMessage()); e.printStackTrace(); } catch (ClientProtocolException e) { Logger.w("HTTP Protocol Error > " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { Logger.w("IO Error > " + e.getMessage()); e.printStackTrace(); } }
From source file:org.codemucker.testserver.TestServerTest.java
private void assertActionThrowsError(final Action action) throws Exception { boolean thrown = false; try {//from ww w. ja va 2 s . c o m action.doit(); } catch (final IllegalStateException e) { assertContains("wrong error msg thrown", "server is already running", e.getMessage().toLowerCase()); thrown = true; } assertTrue("Expected server operation to of thrown an error as it was already started", thrown); }
From source file:com.xtructure.xutil.valid.strategy.UTestStateValidationStrategy.java
public void processFailureBehavesAsExpected() { Condition predicate = isNotNull(); Object object = null;/*from w w w . j a va 2 s. c om*/ String msg = RandomStringUtils.randomAlphanumeric(10); StateValidationStrategy<Object> vs = new StateValidationStrategy<Object>(predicate); try { vs.validate(object); } catch (IllegalStateException e) { if (!String.format("%s (%s): %s", StateValidationStrategy.DEFAULT_MSG, object, predicate) .equals(e.getMessage())) { throw new AssertionError(); } } try { vs.validate(object, msg); } catch (IllegalStateException e) { if (!String.format("%s (%s): %s", msg, object, predicate).equals(e.getMessage())) { throw new AssertionError(); } } }
From source file:com.netflix.metacat.connector.hive.sql.HiveConnectorFastTableService.java
/** * Update a table with the given metadata. * * If table is an iceberg table, then lock the table for update so that no other request can update it. If the meta * information is invalid, then throw an error. * If table is not an iceberg table, then do a regular table update. * * @param requestContext The request context * @param tableInfo The resource metadata *//*from w w w. j av a2 s.c o m*/ @Override public void update(final ConnectorRequestContext requestContext, final TableInfo tableInfo) { if (isIcebergTable(tableInfo)) { final QualifiedName tableName = tableInfo.getName(); final Long tableId = directSqlTable.getTableId(tableName); try { log.debug("Locking Iceberg table {}", tableName); directSqlTable.lockIcebergTable(tableId, tableName); try { final TableInfo existingTableInfo = get(requestContext, tableInfo.getName()); validateIcebergUpdate(existingTableInfo, tableInfo); final Table existingTable = getHiveMetacatConverters().fromTableInfo(existingTableInfo); super.update(requestContext, existingTable, tableInfo); } finally { directSqlTable.unlockIcebergTable(tableId); log.debug("Unlocked Iceberg table {}", tableName); } } catch (IllegalStateException e) { throw new TablePreconditionFailedException(tableName, e.getMessage()); } } else { super.update(requestContext, tableInfo); } }
From source file:es.pentalo.apps.RBPiCameraControl.API.RBPiCamera.java
synchronized public Bitmap shotPhoto(List<Command> commands) { HttpEntity entity = getEntityPost(mBaseUrl + "api/photo/shot/", commands); if (entity != null) { InputStream inputStream;/* w ww . j ava2 s . com*/ try { inputStream = entity.getContent(); return BitmapFactory.decodeStream(inputStream); } catch (IllegalStateException e) { Log.e(TAG, e.getMessage()); return null; } catch (IOException e) { Log.e(TAG, e.getMessage()); return null; } } return null; }