List of usage examples for java.lang IllegalStateException getMessage
public String getMessage()
From source file:org.apache.metron.common.dsl.functions.resolver.ClasspathFunctionResolver.java
@Override public void initialize(Context context) { super.initialize(context); if (context != null) { Optional<Object> optional = context.getCapability(STELLAR_CONFIG, false); if (optional.isPresent()) { Map<String, Object> stellarConfig = (Map<String, Object>) optional.get(); if (LOG.isDebugEnabled()) { LOG.debug("Setting up classloader using the following config: " + stellarConfig); }/* w w w . j av a2s . c om*/ include(STELLAR_SEARCH_INCLUDES_KEY.get(stellarConfig, String.class).split(STELLAR_SEARCH_DELIMS)); exclude(STELLAR_SEARCH_EXCLUDES_KEY.get(stellarConfig, String.class).split(STELLAR_SEARCH_DELIMS)); Optional<ClassLoader> vfsLoader = null; try { vfsLoader = VFSClassloaderUtil .configureClassloader(STELLAR_VFS_PATHS.get(stellarConfig, String.class)); if (vfsLoader.isPresent()) { LOG.debug("CLASSLOADER LOADED WITH: " + STELLAR_VFS_PATHS.get(stellarConfig, String.class)); if (LOG.isDebugEnabled()) { for (FileObject fo : ((VFSClassLoader) vfsLoader.get()).getFileObjects()) { LOG.error(fo.getURL() + " - " + fo.exists()); } } classLoaders(vfsLoader.get()); } } catch (FileSystemException e) { LOG.error("Unable to process filesystem: " + e.getMessage(), e); } } else { LOG.info("No stellar config set; I'm reverting to the context classpath with no restrictions."); if (LOG.isDebugEnabled()) { try { throw new IllegalStateException("No config set, stacktrace follows."); } catch (IllegalStateException ise) { LOG.error(ise.getMessage(), ise); } } } } else { throw new IllegalStateException("CONTEXT IS NULL!"); } }
From source file:cz.cas.lib.proarc.common.workflow.profile.WorkflowProfilesTest.java
@Test public void testBlockerCycle() throws Exception { String xml = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n" + "<workflow xmlns='http://proarc.lib.cas.cz/xml/common/workflow/v1'>\n" + " <job name='ndk'>\n" + " <step taskRef='task.id1'/>\n" + " <step taskRef='task.id2'>\n" + " <blocker taskRef='task.id3'/>\n" + " </step>\n" + " <step taskRef='task.id3'>\n" + " <blocker taskRef='task.id4'/>\n" + " <blocker taskRef='task.id1'/>\n" + " </step>\n" + " <step taskRef='task.id4'>\n" + " <blocker taskRef='task.id2'/>\n" + " </step>\n" + " </job>\n" + " <task name='task.id1'/>\n" + " <task name='task.id2'/>\n" + " <task name='task.id3'/>\n" + " <task name='task.id4'/>\n" + "</workflow>\n"; File xmlFile = new File(temp.getRoot(), "workflow.xml"); FileUtils.write(xmlFile, xml);/* w w w . ja v a 2 s . co m*/ WorkflowProfiles profiles = new WorkflowProfiles(xmlFile); try { WorkflowDefinition wf = profiles.getProfiles(); fail(String.valueOf(profiles.getSortedTaskNames(wf.getJobs().get(0)))); } catch (IllegalStateException ex) { assertTrue(ex.getMessage(), ex.getMessage().startsWith("There must be a cycle")); } }
From source file:edu.umn.msi.tropix.common.logging.ExceptionUtilsTest.java
@Test(groups = "unit") public void convert() { final IOException ioException = new FileNotFoundException(); final RuntimeException re = ExceptionUtils.convertException(ioException, RuntimeException.class); assert re.getCause().equals(ioException); final IllegalStateException ie = ExceptionUtils.convertException(ioException, "Moo", IllegalStateException.class); assert ie.getCause().equals(ioException) && ie.getMessage().equals("Moo"); final FileNotFoundException fe = ExceptionUtils.convertException(ioException, FileNotFoundException.class); assert fe == ioException; ExceptionUtils.ExceptionConversionException ee = null; try {//w ww. ja v a 2 s . co m ExceptionUtils.convertException(new Throwable(), NullPointerException.class); } catch (final ExceptionUtils.ExceptionConversionException iee) { ee = iee; } assert ee != null; }
From source file:com.joyent.manta.http.MantaConnectionFactoryTest.java
public void willShutdownCreatedConnectionManager() throws IOException { connectionFactory = new MantaConnectionFactory(config); final CloseableHttpClient client = connectionFactory.createConnection(); connectionFactory.close();/*from w w w . ja v a 2 s . c om*/ final IllegalStateException shutdownException = Assert.expectThrows(IllegalStateException.class, () -> client.execute(new HttpGet(UNIT_TEST_URL))); Assert.assertTrue(shutdownException.getMessage().contains("Connection pool shut down")); }
From source file:net.sf.ehcache.StatisticsTest.java
/** * CacheStatistics should always be sensible when the cache has not started. */// w w w . jav a2s.c o m public void testCacheStatisticsDegradesElegantlyWhenCacheDisposed() { Cache cache = new Cache("test", 1, true, false, 5, 2); try { Statistics statistics = cache.getStatistics(); fail(); } catch (IllegalStateException e) { assertEquals("The test Cache is not alive.", e.getMessage()); } }
From source file:com.yeahmobi.yunit.TestExecutionListenerChainTests.java
@Test public void shouldNotCreateWithIllegalConstructor() throws Exception { try {//from www . j a v a 2s.co m this.chain = new TestExecutionListenerChain() { @Override protected Class<?>[] getChain() { return new Class<?>[] { InvalidTestListener.class }; }; }; fail(); } catch (IllegalStateException e) { assertEquals("Unable to create chain for classes [class com.yeahmobi.yunit." + "TestExecutionListenerChainTests$InvalidTestListener]", e.getMessage()); } }
From source file:org.cerberus.servlet.publi.ExecuteNextInQueue.java
/** * Executes the next test case represented by the given * {@link TestCaseExecutionInQueue}/*from w ww .j a v a 2 s .com*/ * * @param lastInQueue * @param req * @param resp * @throws IOException */ private void executeNext(TestCaseExecutionInQueue lastInQueue, HttpServletRequest req, HttpServletResponse resp) throws IOException { String charset = resp.getCharacterEncoding(); String query = ""; try { ParamRequestMaker paramRequestMaker = makeParamRequestfromLastInQueue(lastInQueue); // TODO : Prefer use mkString(charset) instead of mkString(). // However the RunTestCase servlet does not decode parameters, // then we have to mkString() without using charset query = paramRequestMaker.mkString(); } catch (UnsupportedEncodingException uee) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, uee.getMessage()); return; } catch (IllegalArgumentException iae) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, iae.getMessage()); return; } catch (IllegalStateException ise) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, ise.getMessage()); return; } CloseableHttpClient httpclient = null; HttpGet httpget = null; try { httpclient = HttpClients.createDefault(); URI uri = new URIBuilder().setScheme(req.getScheme()).setHost(req.getServerName()) .setPort(req.getServerPort()).setPath(req.getContextPath() + RunTestCase.SERVLET_URL) .setCustomQuery(query).build(); httpget = new HttpGet(uri); } catch (URISyntaxException use) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, use.getMessage()); return; } CloseableHttpResponse response = null; try { response = httpclient.execute(httpget); if (response.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) { resp.sendError(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase()); } } catch (ClientProtocolException cpe) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, cpe.getMessage()); } finally { if (response != null) { response.close(); } } }
From source file:ch.cyberduck.core.worker.ConcurrentTransferWorker.java
@Override protected void release(final Session session) { if (log.isInfoEnabled()) { log.info(String.format("Release session %s to pool", session)); }//from ww w.j a v a2 s .c o m try { pool.returnObject(session); } catch (IllegalStateException e) { log.warn(String.format("Failed to release session %s. %s", session, e.getMessage())); } }
From source file:name.richardson.james.maven.plugins.uploader.UploadMojo.java
@SuppressWarnings("unchecked") private Map<String, String> getRemoteBukkitVersions() throws MojoExecutionException { final HttpGet request = new HttpGet("http://" + this.game + ".curseforge.com/game-versions.json"); JSONObject json;//w w w . j av a 2 s .co m final Map<String, String> map = new HashMap<String, String>(); try { final HttpClient client = new DefaultHttpClient(); final HttpResponse response = client.execute(request); json = new JSONObject(EntityUtils.toString(response.getEntity())); final Iterator<String> itr = json.keys(); while (itr.hasNext()) { final String key = itr.next(); final String version = json.getJSONObject(key).getString("name"); map.put(version, key); } } catch (final IllegalStateException e) { throw new MojoExecutionException(e.getMessage()); } catch (final IOException e) { throw new MojoExecutionException(e.getMessage()); } catch (final ParseException e) { throw new MojoExecutionException(e.getMessage()); } catch (final JSONException e) { throw new MojoExecutionException(e.getMessage()); } this.getLog().debug(map.size() + " remote versions found."); return map; }
From source file:org.apache.metron.integration.components.FluxTopologyComponent.java
@Override public void stop() { if (stormCluster != null) { try {/*from w w w .j a v a 2s .c o 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 { LOG.error("Attempting to assassinate slots"); 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 (RuntimeException re) { if (re.getCause() instanceof TProtocolException) { //let this go, it's some intermittent weirdness. } else { throw re; } } } catch (Throwable t) { LOG.error(t.getMessage(), t); } finally { cleanupWorkerDir(); } } }