List of usage examples for java.lang IllegalArgumentException getMessage
public String getMessage()
From source file:com.sap.dirigible.runtime.registry.RepositoryServlet.java
@Override protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String repositoryPath = null; final OutputStream out = response.getOutputStream(); try {/*from ww w .j a v a2 s . c om*/ repositoryPath = extractRepositoryPath(request); IEntity entity = getEntity(repositoryPath, request); if (entity != null) { getRepository(request).removeResource(repositoryPath); } } catch (IllegalArgumentException ex) { logger.error(String.format(REQUEST_PROCESSING_FAILED_S, repositoryPath) + ex.getMessage()); response.sendError(HttpServletResponse.SC_BAD_REQUEST, ex.getMessage()); } catch (MissingResourceException ex) { logger.error(String.format(REQUEST_PROCESSING_FAILED_S, repositoryPath) + ex.getMessage()); response.sendError(HttpServletResponse.SC_NO_CONTENT, ex.getMessage()); } finally { out.flush(); out.close(); } }
From source file:com.vmware.loginsightapi.TestConfiguration.java
@Test public void testBuildConfigInvalidIngestionPort() { Map<String, String> configData = new HashMap<String, String>(); try {//from w w w. j ava 2 s .com configData.put(Configuration.KEY_LI_HOST, "hostname"); configData.put(Configuration.KEY_LI_USER, "username"); configData.put(Configuration.KEY_LI_PASSWORD, "password"); configData.put(Configuration.KEY_LI_PORT, Integer.toString(Configuration.DEFAULT_PORT)); configData.put(Configuration.KEY_LI_INGESTION_PORT, ""); configData.put(Configuration.KEY_CONNECTION_SCHEME, Configuration.DEFAULT_SCHEME); Configuration config = Configuration.buildConfig(configData); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Invalid Ingestion port"); } }
From source file:org.eel.kitchen.jsonschema.uri.URIManagerTest.java
@Test public void shouldNotBeAbleToRegisterEmptyScheme() { try {/*from ww w . j av a2 s .c o m*/ manager.registerScheme("", mock); fail("No exception thrown!"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "scheme is empty"); } }
From source file:org.eel.kitchen.jsonschema.uri.URIManagerTest.java
@Test public void shouldNotBeAbleToRegisterAnIllegalScheme() { try {/* w w w . j a va 2 s. c o m*/ manager.registerScheme("+23", mock); fail("No exception thrown!"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "illegal scheme \"+23\""); } }
From source file:org.eel.kitchen.jsonschema.uri.URIManagerTest.java
@Test public void shouldRefuseToHandleNonAbsoluteURIs() throws JsonSchemaException { try {/*w w w.java 2 s.co m*/ manager.getContent(URI.create("")); fail("No exception thrown!"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "requested URI () is not absolute"); } }
From source file:com.vmware.loginsightapi.TestConfiguration.java
@Test public void testBuildConfigInvalidHost() { Map<String, String> configData = new HashMap<String, String>(); try {//from w w w.j a va 2 s . c o m configData.put(Configuration.KEY_LI_HOST, ""); configData.put(Configuration.KEY_LI_USER, "username"); configData.put(Configuration.KEY_LI_PASSWORD, "password"); configData.put(Configuration.KEY_LI_PORT, Integer.toString(Configuration.DEFAULT_PORT)); configData.put(Configuration.KEY_LI_INGESTION_PORT, Integer.toString(Configuration.DEFAULT_INGESTION_PORT)); configData.put(Configuration.KEY_CONNECTION_SCHEME, Configuration.DEFAULT_SCHEME); Configuration config = Configuration.buildConfig(configData); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Invalid host name"); } }
From source file:com.vmware.loginsightapi.TestConfiguration.java
@Test public void testBuildConfigInvalidPassword() { Map<String, String> configData = new HashMap<String, String>(); try {/*ww w .j a v a 2 s .c o m*/ configData.put(Configuration.KEY_LI_HOST, "hostname"); configData.put(Configuration.KEY_LI_USER, "username"); configData.put(Configuration.KEY_LI_PASSWORD, ""); configData.put(Configuration.KEY_LI_PORT, Integer.toString(Configuration.DEFAULT_PORT)); configData.put(Configuration.KEY_LI_INGESTION_PORT, Integer.toString(Configuration.DEFAULT_INGESTION_PORT)); configData.put(Configuration.KEY_CONNECTION_SCHEME, Configuration.DEFAULT_SCHEME); Configuration config = Configuration.buildConfig(configData); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Invalid password"); } }
From source file:com.vmware.loginsightapi.TestConfiguration.java
@Test public void testBuildConfigInvalidUsername() { Map<String, String> configData = new HashMap<String, String>(); try {//from w ww . ja v a2 s . com configData.put(Configuration.KEY_LI_HOST, "hostname"); configData.put(Configuration.KEY_LI_USER, ""); configData.put(Configuration.KEY_LI_PASSWORD, "password"); configData.put(Configuration.KEY_LI_PORT, Integer.toString(Configuration.DEFAULT_PORT)); configData.put(Configuration.KEY_LI_INGESTION_PORT, Integer.toString(Configuration.DEFAULT_INGESTION_PORT)); configData.put(Configuration.KEY_CONNECTION_SCHEME, Configuration.DEFAULT_SCHEME); Configuration config = Configuration.buildConfig(configData); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Invalid user name"); } }
From source file:com.vmware.loginsightapi.TestConfiguration.java
@Test public void testBuildConfigInvalidPort() { Map<String, String> configData = new HashMap<String, String>(); try {//from www . j a v a2s . co m configData.put(Configuration.KEY_LI_HOST, "hostname"); configData.put(Configuration.KEY_LI_USER, "username"); configData.put(Configuration.KEY_LI_PASSWORD, "password"); configData.put(Configuration.KEY_LI_PORT, ""); configData.put(Configuration.KEY_LI_INGESTION_PORT, Integer.toString(Configuration.DEFAULT_INGESTION_PORT)); configData.put(Configuration.KEY_CONNECTION_SCHEME, Configuration.DEFAULT_SCHEME); Configuration config = Configuration.buildConfig(configData); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Invalid port"); } }
From source file:com.vmware.loginsightapi.TestConfiguration.java
@Test public void testBuildConfigEmptyScheme() { Map<String, String> configData = new HashMap<String, String>(); try {/* www .ja va 2s . co m*/ configData.put(Configuration.KEY_LI_HOST, "hostname"); configData.put(Configuration.KEY_LI_USER, "username"); configData.put(Configuration.KEY_LI_PASSWORD, "password"); configData.put(Configuration.KEY_LI_PORT, Integer.toString(Configuration.DEFAULT_PORT)); configData.put(Configuration.KEY_LI_INGESTION_PORT, Integer.toString(Configuration.DEFAULT_INGESTION_PORT)); configData.put(Configuration.KEY_CONNECTION_SCHEME, ""); Configuration config = Configuration.buildConfig(configData); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Invalid http scheme. Should be https"); } }