List of usage examples for java.lang IllegalArgumentException getMessage
public String getMessage()
From source file:org.inbio.ait.web.ajax.controller.IndicatorsTreeController.java
@Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String param = request.getParameter("query"); String errorMsj = "No se pudo obtener la lista de hijos para el nodo: " + param; List<AutocompleteNode> acnList = new ArrayList<AutocompleteNode>(); try {//from w w w . j ava 2 s.co m int paramInt = Integer.parseInt(param); acnList = indicatorsManager.getChildNodesByNodeId(paramInt); return writeReponse(request, response, acnList); } catch (IllegalArgumentException iae) { throw new Exception(errorMsj + " " + iae.getMessage()); } }
From source file:edu.cudenver.bios.matrixsvc.resource.MatrixRankResource.java
/** * Handle POST request to calculate the rank of a matrix * @param entity XMl formatted matrix list * @return XML representation of the matrix rank * @throws ResourceException/*from w w w.j ava 2s . com*/ */ @Post public Representation matrixRank(Representation entity) throws ResourceException { if (entity == null) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "No Input- Calculation of Matrix Rank not possible"); } DomRepresentation rep = new DomRepresentation(entity); NamedRealMatrix reqMatrix = null; try { // parse the parameters from the entity body reqMatrix = MatrixParamParser.getMatrixRankParamsFromDomNode(rep.getDocument().getDocumentElement()); //perform rank operation and set value in our parameter object SingularValueDecompositionImpl impl = new SingularValueDecompositionImpl(reqMatrix); //create our response representation RankXmlRepresentation response = new RankXmlRepresentation(impl.getRank()); /* getResponse().setEntity(response); getResponse().setStatus(Status.SUCCESS_CREATED);*/ return response; } catch (IllegalArgumentException iae) { MatrixLogger.getInstance().error(iae.getMessage()); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, iae.getMessage()); } catch (IOException ioe) { MatrixLogger.getInstance().error(ioe.getMessage()); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, ioe.getMessage()); } }
From source file:com.itemanalysis.jmetrik.graph.scatterplot.ScatterplotPanel.java
private void processCommand() { try {/* ww w . j a va 2s .c om*/ title = command.getFreeOption("title").getString(); subtitle = command.getFreeOption("subtitle").getString(); xlabel = command.getFreeOption("xvar").getString(); ylabel = command.getFreeOption("yvar").getString(); showLegend = command.getSelectAllOption("options").isArgumentSelected("legend"); showMarkers = true;//must be true otherwise chart will show not points width = command.getPairedOptionList("dimensions").getIntegerAt("width"); height = command.getPairedOptionList("dimensions").getIntegerAt("height"); } catch (IllegalArgumentException ex) { logger.fatal(ex.getMessage(), ex); this.firePropertyChange("error", "", "Error - Check log for details."); } }
From source file:com.google.api.client.http.apache.ApacheHttpTransportTest.java
private void subtestUnsupportedRequestsWithContent(ApacheHttpRequest request, String method) throws Exception { try {// w w w . j a va 2s . c om execute(request); fail("expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { // expected assertEquals(e.getMessage(), "Apache HTTP client does not support " + method + " requests with content."); } }
From source file:com.prasanna.android.http.HttpGzipResponseInterceptor.java
@Override public void process(HttpResponse response, HttpContext context) throws HttpException, IOException { HttpEntity entity = response.getEntity(); Header encodingHeader = entity.getContentEncoding(); if (encodingHeader != null) { HeaderElement[] codecs = encodingHeader.getElements(); for (int i = 0; i < codecs.length; i++) { if (codecs[i].getName().equalsIgnoreCase(contentEncoding)) { try { entityWrapper.getConstructor(HttpEntity.class).newInstance(entity); response.setEntity(new GzipDecompressingEntity(entity)); return; } catch (IllegalArgumentException e) { LogWrapper.e(TAG, e.getMessage()); } catch (SecurityException e) { LogWrapper.e(TAG, e.getMessage()); } catch (InstantiationException e) { LogWrapper.e(TAG, e.getMessage()); } catch (IllegalAccessException e) { LogWrapper.e(TAG, e.getMessage()); } catch (InvocationTargetException e) { LogWrapper.e(TAG, e.getMessage()); } catch (NoSuchMethodException e) { LogWrapper.e(TAG, e.getMessage()); }/* w ww .jav a2s . c o m*/ } } } }
From source file:eu.scidipes.toolkits.pawebapp.web.RegistryAuthController.java
@ExceptionHandler(IllegalArgumentException.class) @ResponseBody// www . j a va 2 s. c o m public ResponseEntity<String> handleExceptions(final IllegalArgumentException ex) { final String err = ex.getMessage(); LOG.error(err, ex); return new ResponseEntity<String>(err, HttpStatus.INTERNAL_SERVER_ERROR); }
From source file:com.example.notes.RestNotesControllerAdvice.java
@ExceptionHandler(IllegalArgumentException.class) public void handleIllegalArgumentException(IllegalArgumentException ex, HttpServletResponse response) throws IOException { response.sendError(HttpStatus.BAD_REQUEST.value(), ex.getMessage()); }
From source file:ar.com.zauber.commons.web.proxy.impl.ValidateURLRequestMapperTest.java
/** @throws Exception on error */ public final void testNullReturn() throws Exception { final URLRequestMapper v = new ValidateURLRequestMapper(new URLRequestMapper() { public URLResult getProxiedURLFromRequest(final HttpServletRequest request) { return null; }/* w w w .j a v a 2 s. c o m*/ }); try { v.getProxiedURLFromRequest(new MockHttpServletRequest()); fail(); } catch (final IllegalArgumentException e) { assertEquals("a retured URL from URLRequestMapper can't be null", e.getMessage()); } }
From source file:com.cultureofcode.diceware.NumberController.java
@ExceptionHandler(IllegalArgumentException.class) public ClientError handleIllegalArgs(IllegalArgumentException iae, HttpServletResponse resp) { resp.setStatus(HttpStatus.BAD_REQUEST.value()); return new ClientError(iae.getMessage()); }
From source file:controllers.ProducerCompanyController.java
@RequestMapping(value = "/register", method = RequestMethod.POST, params = "save") public ModelAndView save(@ModelAttribute("producerForm") @Valid ProducerCompanyForm form, BindingResult binding) {// www . j a v a 2s .c om ModelAndView result; ProducerCompany producer; if (binding.hasErrors()) { result = createEditModelAndView(form); } else { try { producer = producerService.reconstruct(form); producerService.save(producer); result = new ModelAndView("redirect:../security/login.do"); } catch (IllegalArgumentException oops) { String msg; if (oops.getMessage() != null && oops.getMessage().startsWith("actor")) { msg = oops.getMessage(); } else { msg = "actor.error.commit"; } result = createEditModelAndView(form, msg); } catch (Throwable oops) { result = createEditModelAndView(form, "actor.error.commit"); } } return result; }