List of usage examples for java.lang IllegalArgumentException getMessage
public String getMessage()
From source file:io.wcm.config.core.impl.ParameterOverrideProviderBridge.java
private String toCaConfigOverrideString(String key, String value, ConfigurationMetadata configMetadata) { try {// w ww . ja va 2 s .c o m ParameterOverrideInfo info = new ParameterOverrideInfo(key); Class type = String.class; if (configMetadata != null) { PropertyMetadata<?> propertyMetadata = configMetadata.getPropertyMetadata() .get(info.getParameterName()); if (propertyMetadata != null) { type = propertyMetadata.getType(); } } return (info.getConfigurationId() != null ? "[" + info.getConfigurationId() + "]" : "") + info.getParameterName() + "=" + toJsonValue(value, type); } catch (IllegalArgumentException ex) { log.warn("Ignoring invalid parameter override string ({}): {}={}", ex.getMessage(), key, value); } return null; }
From source file:com.github.springtestdbunit.bean.DatabaseConfigBeanTests.java
@Test public void shouldFailWhenSetingMandatoryFieldToNull() throws Exception { try {//from ww w . j av a 2 s. c o m this.configBean.setDatatypeFactory(null); fail(); } catch (IllegalArgumentException e) { assertEquals("dataTypeFactory cannot be null", e.getMessage()); } }
From source file:com.github.springtestdbunit.bean.DatabaseConfigBeanTest.java
@Test public void shouldFailWhenSetingMandatoryFieldToNull() throws Exception { try {/*w w w . j a va2 s . c om*/ this.configBean.setDatatypeFactory(null); fail(); } catch (IllegalArgumentException ex) { assertEquals("dataTypeFactory cannot be null", ex.getMessage()); } }
From source file:org.trustedanalytics.h2oscoringengine.rest.H2oScoringEngineController.java
@ExceptionHandler(IllegalArgumentException.class) void handleIllegalArgumentException(IllegalArgumentException e, HttpServletResponse response) throws IOException { LOGGER.error("Invalid input data size:", e); response.sendError(HttpStatus.BAD_REQUEST.value(), e.getMessage()); }
From source file:com.ngdata.sep.impl.SepModelImpl.java
@Override public boolean addSubscriptionSilent(String name) throws InterruptedException, KeeperException, IOException { ReplicationAdmin replicationAdmin = new ReplicationAdmin(hbaseConf); try {//from www . java2 s. c o m String internalName = toInternalSubscriptionName(name); if (replicationAdmin.listPeers().containsKey(internalName)) { return false; } String basePath = baseZkPath + "/" + internalName; UUID uuid = UUID.nameUUIDFromBytes(Bytes.toBytes(internalName)); // always gives the same uuid for the same name ZkUtil.createPath(zk, basePath + "/hbaseid", Bytes.toBytes(uuid.toString())); ZkUtil.createPath(zk, basePath + "/rs"); try { replicationAdmin.addPeer(internalName, zkQuorumString + ":" + zkClientPort + ":" + basePath); } catch (IllegalArgumentException e) { if (e.getMessage().equals("Cannot add existing peer")) { return false; } throw e; } catch (Exception e) { // HBase 0.95+ throws at least one extra exception: ReplicationException which we convert into IOException if (e instanceof InterruptedException) { throw (InterruptedException) e; } else if (e instanceof KeeperException) { throw (KeeperException) e; } else { throw new IOException(e); } } return true; } finally { Closer.close(replicationAdmin); } }
From source file:com.alibaba.dubbo.governance.web.home.module.screen.Restful.java
public void execute(Map<String, Object> context) throws Exception { Result result = new Result(); if (request.getParameter("url") != null) { url = URL.valueOf(URL.decode(request.getParameter("url"))); }/*ww w . j a v a 2 s .c om*/ if (context.get(WebConstants.CURRENT_USER_KEY) != null) { User user = (User) context.get(WebConstants.CURRENT_USER_KEY); currentUser = user; operator = user.getUsername(); role = user.getRole(); context.put(WebConstants.CURRENT_USER_KEY, user); } operatorAddress = (String) context.get("clientid"); if (operatorAddress == null || operatorAddress.isEmpty()) { operatorAddress = (String) context.get("request.remoteHost"); } context.put("operator", operator); context.put("operatorAddress", operatorAddress); String jsonResult = null; try { result = doExecute(context); result.setStatus("OK"); } catch (IllegalArgumentException t) { result.setStatus("ERROR"); result.setCode(3); result.setMessage(t.getMessage()); } // catch (InvalidRequestException t) { // result.setStatus("ERROR"); // result.setCode(2); // result.setMessage(t.getMessage()); // } catch (Throwable t) { result.setStatus("ERROR"); result.setCode(1); result.setMessage(t.getMessage()); } response.setContentType("application/javascript"); ServletOutputStream os = response.getOutputStream(); try { jsonResult = JSON.toJSONString(result); os.print(jsonResult); } catch (Exception e) { response.setStatus(500); os.print(e.getMessage()); } finally { os.flush(); } }
From source file:com.liyablieva.jaxws.endpoint.EmployeeServiceEndpoint.java
@WebMethod public void putEmployee(@XmlElement(required = true) @WebParam(name = "department") String department, @XmlElement(required = true) @WebParam(name = "employee_name") String name, @XmlElement(required = true) @WebParam(name = "gender") String gender, @WebParam(name = "license") String license, @WebParam(name = "result", mode = WebParam.Mode.OUT) Holder<Integer> result, @WebParam(name = "description", mode = WebParam.Mode.OUT) Holder<String> description) { try {/* w ww . j a va2s . co m*/ int status = employeeService.putEmployee(department, name, gender, license); if (status == 1) { description.value = "Employee put in db successfully."; } else { description.value = "Employee was not put in db!"; } result.value = status; } catch (IllegalArgumentException ex) { System.out.println("IllegalArgumentException in putEmployee: " + ex); result.value = -1; description.value = ex.getMessage(); } catch (Exception ex) { System.out.println("Exception in putEmployee: " + ex); result.value = -2; description.value = ex.getMessage(); } }
From source file:com.itemanalysis.jmetrik.graph.piechart.PieChartPanel.java
private void processCommand() { try {/* w w w. j a v a 2s. c o m*/ chartTitle = command.getFreeOption("title").getString(); chartSubtitle = command.getFreeOption("subtitle").getString(); explode = command.getPairedOptionList("explode").hasValue(); explodeValue = ""; explodePercent = 0; if (explode) { explodeValue = command.getPairedOptionList("explode").getStringAt("section"); int explodeAmount = command.getPairedOptionList("explode").getIntegerAt("amount"); explodePercent = explodeAmount / 100.0; } if (command.getFreeOption("groupvar").hasValue()) { hasGroupVariable = true; } else { hasGroupVariable = false; } } catch (IllegalArgumentException ex) { logger.fatal(ex.getMessage(), ex); this.firePropertyChange("error", "", "Error - Check log for details."); } }
From source file:uk.ac.ebi.eva.server.ws.ga4gh.GA4GHVariantWSServer.java
@ExceptionHandler(IllegalArgumentException.class) public void handleException(IllegalArgumentException e, HttpServletResponse response) throws IOException { response.sendError(HttpStatus.PAYLOAD_TOO_LARGE.value(), e.getMessage()); }
From source file:com.jimplush.goose.outputformatters.DefaultOutputFormatter.java
/** * remove paragraphs that have less than x number of words, would indicate that it's some sort of link *//* w w w . j ava 2s. co m*/ private void removeParagraphsWithFewWords() { if (logger.isDebugEnabled()) { logger.debug("removeParagraphsWithFewWords starting..."); } Elements allNodes = this.topNode.getAllElements(); for (Element el : allNodes) { try { // get stop words that appear in each node WordStats stopWords = StopWords.getStopWordCount(el.text()); if (stopWords.getStopWordCount() < 5 && el.getElementsByTag("object").size() == 0 && el.getElementsByTag("embed").size() == 0) { el.remove(); } } catch (IllegalArgumentException e) { logger.error(e.getMessage()); } //} } }