List of usage examples for java.lang IllegalArgumentException getMessage
public String getMessage()
From source file:com.appleframework.monitor.action.UserAction.java
@RequestMapping(value = "/user/update", method = RequestMethod.POST) public @ResponseBody WebResult update(HttpEntity<User> entity, HttpServletRequest request, ModelMap mm) throws UnsupportedEncodingException { User user = entity.getBody();// w w w.j a va 2 s.c o m WebResult result = new WebResult(); try { if (userManager.loadUserByUsername(user.getUsername()) == null) { userManager.registerUser(user); } else { userManager.monitorUser(user); } } catch (IllegalArgumentException e) { result.setSuccess(false); result.setMessage(e.getMessage()); } return result; }
From source file:com.github.springtestdbunit.bean.DatabaseDataSourceConnectionFactoryBeanTests.java
@Test public void shouldNotAllowObjectWithoutDataSet() throws Exception { try {//ww w .jav a 2 s . com this.factoryBean.getObject(); fail(); } catch (IllegalArgumentException e) { assertEquals("The dataSource is required", e.getMessage()); } }
From source file:ca.ualberta.physics.cssdp.util.JSONMnemonicDeserializer.java
@Override public Mnemonic deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { try {//w w w .j a va 2 s .co m return Mnemonic.of(jp.getText()); } catch (IllegalArgumentException e) { String msg = "Could not deserialize json representation of Mnemonic " + jp.getText() + " into a Mnemonic object because " + e.getMessage(); logger.error(msg, e); throw new JsonParseException(msg, jp.getCurrentLocation()); } }
From source file:uk.ac.ebi.eva.server.ws.ga4gh.GA4GHVariantCallSetWSServer.java
@ExceptionHandler(IllegalArgumentException.class) public void handleException(IllegalArgumentException e, HttpServletResponse response) throws IOException { response.sendError(HttpStatus.BAD_REQUEST.value(), e.getMessage()); }
From source file:net.sf.jooreports.openoffice.converter.OpenOfficeDocumentConverterTest.java
public void testNullArgumentWithFiles() throws IOException { try {//w w w .ja va 2 s.c o m getDocumentConverter().convert(null, new File("unused")); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("inputFile is null", argumentException.getMessage()); } try { getDocumentConverter().convert(new File("unused"), null); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertEquals("outputFile is null", argumentException.getMessage()); } }
From source file:com.itemanalysis.jmetrik.graph.barchart.BarChartPanel.java
public void updateDataset(TwoWayTable table) { String groupingName = ""; try {// ww w . ja va 2 s . c o m boolean showFreq = command.getSelectOneOption("yaxis").isValueSelected("freq"); if (command.getFreeOption("groupvar").hasValue()) { groupingName = command.getFreeOption("groupvar").getString(); } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Iterator<Comparable<?>> rowIter = table.rowValuesIterator(); Iterator<Comparable<?>> colIter = null; Comparable<?> r = null; Comparable<?> c = null; while (rowIter.hasNext()) { r = rowIter.next(); colIter = table.colValuesIterator(); while (colIter.hasNext()) { c = colIter.next(); if (showFreq) { dataset.addValue(table.getCount(r, c), r.toString(), c.toString()); } else { dataset.addValue(table.getCount(r, c) / table.getFreqSum(), (groupingName + " " + r.toString()), c.toString()); } } } CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDataset(dataset); } catch (IllegalArgumentException ex) { logger.fatal(ex.getMessage(), ex); this.firePropertyChange("error", "", "Error - Check log for details."); } }
From source file:com.tkmtwo.exhandler.handlers.IllegalArgumentExceptionHandler.java
@Override public ValidationErrorMessage createBody(IllegalArgumentException ex, HttpServletRequest req) { ErrorMessage tmpl = super.createBody(ex, req); ValidationErrorMessage msg = new ValidationErrorMessage(tmpl); msg.addError(ex.getMessage()); return msg;/*from w ww.j a va 2s . c o m*/ }
From source file:$.AccountSoapServiceImpl.java
@Override @AspectLogger(value = "", discover = true) public GetUserResult getUser(Integer id) { if (logger.isInfoEnabled()) logger.info("??!"); GetUserResult result = new GetUserResult(); try {/*from ww w. ja va 2 s .c o m*/ Validate.notNull(id, "id?"); UserPO userPo = accountDomain.getUser(id); Validate.notNull(userPo, "?(id:" + id + ")"); UserSoapDTO userDto = new UserSoapDTO(); BeanUtils.copyProperties(userPo, userDto); result.setUser(userDto); return result; } catch (IllegalArgumentException e) { if (logger.isErrorEnabled()) logger.error(e.getMessage()); return handleParameterError(result, e); } catch (RuntimeException e) { if (logger.isErrorEnabled()) logger.error(e.getMessage()); return handleGeneralError(result, e); } }
From source file:de.otto.jsonhome.registry.controller.RegistryHtmlController.java
@ResponseStatus(value = NOT_FOUND) @ExceptionHandler({ IllegalArgumentException.class }) public void handleNotFound(final IllegalArgumentException e, final HttpServletResponse response) throws IOException { response.sendError(404, e.getMessage()); }
From source file:org.springframework.cloud.dataflow.rest.util.HttpClientConfigurerTests.java
/** * Basic test ensuring that an exception is thrown if the scheme of the proxy * Uri is not set.//from w w w . j a v a 2 s . co m */ @Test public void testHttpClientWithProxyCreationWithMissingScheme() throws Exception { final URI targetHost = new URI("http://test.com"); final HttpClientConfigurer builder = HttpClientConfigurer.create(targetHost); try { builder.withProxyCredentials(URI.create("spring"), "spring", "cloud"); } catch (IllegalArgumentException e) { Assert.assertEquals("The scheme component of the proxyUri must not be empty.", e.getMessage()); return; } fail("Expected an IllegalArgumentException to be thrown."); }