List of usage examples for java.lang IllegalArgumentException getMessage
public String getMessage()
From source file:com.coroptis.coidi.rp.services.impl.DiscoveryProcessorYadis.java
@Override public DiscoveryResult dicovery(String userSuppliedId) { Preconditions.checkNotNull(userSuppliedId, "userSuppliedId"); userSuppliedId = userSuppliedId.trim(); try {//from ww w . j a va2 s .c o m return doHead(userSuppliedId); } catch (IllegalArgumentException e) { logger.error(e.getMessage(), e); throw new AuthenticationProcessException("Invalid format of you identificator"); } catch (ClientProtocolException e) { logger.error(e.getMessage(), e); throw new AuthenticationProcessException( "There is problem to get XRDS document, check your identificator"); } catch (ConnectException e) { logger.error(e.getMessage(), e); throw new AuthenticationProcessException( "Unable to connect to OpenID provider, check your identificator"); } catch (IOException e) { logger.error(e.getMessage(), e); throw new AuthenticationProcessException( "There is problem to get XRDS document, check your identificator"); } }
From source file:acmi.l2.clientmod.bytecode_editor.calc.CalcController.java
@Override public void initialize(URL location, ResourceBundle resources) { BooleanBinding disable = unrealPackageProperty().isNull(); bytes.disableProperty().bind(disable); tokens.disableProperty().bind(disable); bytes.textProperty().bindBidirectional(tokens.textProperty(), new StringConverter<String>() { @Override/* w w w.ja v a2s. c o m*/ public String fromString(String string) { string = string.replaceAll("\\s", ""); if (string.length() % 2 == 1) return ""; try { BytecodeContext context = new BytecodeContext(getUnrealPackage()); ObjectInputStream<BytecodeContext> ois = new ObjectInputStream<>( new ByteArrayInputStream(DatatypeConverter.parseHexBinary(string)), getUnrealPackage().getFile().getCharset(), tokenSerializer, context); Token token = ois.readObject(Token.class); size.setText(String.valueOf(token.getSize(context))); return token.toString(); } catch (UncheckedIOException ignore) { } catch (IllegalArgumentException e) { return e.getMessage(); } return ""; } @Override public String toString(String object) { try { Token token = (Token) shell.evaluate("def methodMissing(String name, args) {\n" + "Class.forName(\"acmi.l2.clientmod.unreal.bytecode.token.$name\").newInstance(args)\n" + "}\n" + object); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BytecodeContext context = new BytecodeContext(getUnrealPackage()); size.setText(String.valueOf(token.getSize(context))); ObjectOutputStream<BytecodeContext> oos = new ObjectOutputStream<>(baos, getUnrealPackage().getFile().getCharset(), tokenSerializer, context); oos.write(token); return DatatypeConverter.printHexBinary(baos.toByteArray()); } catch (Exception ignore) { return ""; } } }); }
From source file:com.epam.cme.storefront.interceptors.beforecontroller.SetLanguageBeforeControllerHandler.java
@Override public boolean beforeController(final HttpServletRequest request, final HttpServletResponse response) { if (isGetMethod(request)) { final String languageIdentifier = request.getParameter(languageParameter); if (StringUtils.isNotBlank(languageIdentifier)) { try { final LanguageModel languageModel = languageResolver.getLanguage(languageIdentifier); commonI18NService.setCurrentLanguage(languageModel); } catch (final IllegalArgumentException ile) { LOG.warn("Can not set session language to [" + languageIdentifier + "]. " + ile.getMessage()); if (LOG.isDebugEnabled()) { LOG.debug("Exception setting the language", ile); }/*from w w w . j a va 2 s . c o m*/ } } } return true; }
From source file:com.realdolmen.rdfleet.webmvc.controllers.fleet.EmployeeCarManagementController.java
private String setCarStatusTo(Long employeeId, Model model, CarStatus status) { if (employeeId == null) { model.addAttribute("error", "Employee id must be given."); }// www .j a va2s . c om RdEmployee employee = employeeService.findRdEmployee(employeeId); if (employee == null) { model.addAttribute("error", "Employee was not found."); return "fleet/employee.list"; } try { switch (status) { case REMOVED: employeeService.setEmployeeCarRemoved(employee); break; case NOT_USED: employeeService.setEmployeeCarInFreePool(employee); break; default: throw new IllegalArgumentException("An invalid status was provided."); } } catch (IllegalArgumentException e) { model.addAttribute("error", e.getMessage()); } if (model.containsAttribute("error")) { model.addAttribute("employee", employee); return "fleet/employee.car.detail"; } return "redirect:" + fromMappingName("REMC#employees").build(); }
From source file:net.sf.jooreports.openoffice.converter.OpenOfficeDocumentConverterTest.java
public void testNoSuchInputFile() throws IOException { try {/*from w w w . ja va 2 s . c om*/ getDocumentConverter().convert(new File("no-such-file.odt"), new File("unused")); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("inputFile doesn't exist")); } }
From source file:net.sf.jooreports.openoffice.converter.OpenOfficeDocumentConverterTest.java
public void testUnknownInputFileFormat() throws IOException { try {/*from w w w . j a v a 2 s . c o m*/ getDocumentConverter().convert(getTestFile("unknown-type.xyz"), new File("unused")); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("unknown document format")); } }
From source file:com.realdolmen.rdfleet.webmvc.controllers.rd.OrderCarController.java
@RequestMapping(value = "/freepool", method = RequestMethod.GET) public String getCarsFromFreePool(Model model) { try {/*from w w w . j a va2 s . c o m*/ model.addAttribute("employeeCars", employeeCarService.findAllIsNotUsed()); } catch (IllegalArgumentException e) { model.addAttribute("error", e.getMessage()); } return "rd/freepool.list"; }
From source file:de.kaiserpfalzEdv.office.core.impl.KPOEntity.java
public UUID getId() { try {// www . jav a 2 s. co m return UUID.fromString(id); } catch (IllegalArgumentException e) { throw new IllegalStateException(e.getMessage() + "'" + id + "'", e); } }
From source file:io.fabric8.maven.enricher.api.util.InitContainerHandlerTest.java
@Test public void existingDifferent() { try {//from ww w . j a va 2 s . c om PodTemplateSpecBuilder builder = getPodTemplateBuilder("blub", "foo/bla"); assertTrue(handler.hasInitContainer(builder, "blub")); JSONObject initContainer = createInitContainer("blub", "foo/blub"); handler.appendInitContainer(builder, initContainer); fail(); } catch (IllegalArgumentException exp) { assertTrue(exp.getMessage().contains("blub")); } }
From source file:net.sf.jooreports.openoffice.converter.OpenOfficeDocumentConverterTest.java
public void testExportOnlyFormatAsInput() throws IOException { DocumentFormat inputFormat = new DocumentFormat("XYZ", "application/xyz", "xyz"); DocumentFormat outputFormat = new DocumentFormat("ABC", "application/abc", "abc"); try {// ww w. j a va 2 s . c om getDocumentConverter().convert(getTestFile("unknown-type.xyz"), inputFormat, new File("unused"), outputFormat); fail("should throw exception"); } catch (IllegalArgumentException argumentException) { assertTrue(argumentException.getMessage().startsWith("unsupported input format")); } }