List of usage examples for java.lang Exception Exception
public Exception(Throwable cause)
From source file:edu.cornell.mannlib.vitro.webapp.controller.json.GetSearchIndividualsByVClass.java
@Override protected JSONObject process() throws Exception { VClass vclass = null;/* w ww . java2 s .c o m*/ String queryType = (String) vreq.getAttribute("queryType"); String vitroClassIdStr = vreq.getParameter("vclassId"); if (vitroClassIdStr != null && !vitroClassIdStr.isEmpty()) { vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); if (vclass == null) { log.debug("Couldn't retrieve vclass "); throw new Exception("Class " + vitroClassIdStr + " not found"); } } else { log.debug("parameter vclassId URI parameter expected "); throw new Exception("parameter vclassId URI parameter expected "); } vreq.setAttribute("displayType", vitroClassIdStr); if (queryType != null && queryType.equals("random")) { return JsonServlet.getRandomSearchIndividualsByVClass(vclass.getURI(), vreq); } else { return JsonServlet.getSearchIndividualsByVClass(vclass.getURI(), vreq); } }
From source file:grandroid.geo.Geocoder.java
public static String convertAddress(double lat, double lng) throws Exception { List<Address> adds = getFromLocation(lat, lng, 1); if (adds == null || adds.isEmpty()) { throw new Exception("no address can be found"); } else {// w ww . j a va2 s . c om Address add = adds.get(0); if (add.getFeatureName() == null) { return add.getAdminArea() + add.getLocality() + add.getAddressLine(0); } else { return add.getFeatureName(); } } }
From source file:com.meltmedia.cadmium.servlets.ErrorPageFilterSelectionTest.java
@Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { sendErrorFilterChain(404), "patient/404", "/patient/blah" }, { sendErrorFilterChain(407), "40x", "/hcp/ehh" }, { sendErrorFilterChain(412), "patient/4xx", "/patient/blah/ehh" }, { sendErrorFilterChain(501), "501", "/" }, { sendErrorFilterChain(502), "50x", "/" }, { sendErrorFilterChain(510), "5xx", "/" }, { throwExceptionFilterChain(new Exception("Oops!")), "50x", "/" }, { successFilterChain("Success"), "Success", "/" } }); }
From source file:com.thoughtworks.go.config.validation.ArtifactDirValidator.java
public void validate(CruiseConfig cruiseConfig) throws Exception { ServerConfig serverConfig = cruiseConfig.server(); String artifactDir = serverConfig.artifactsDir(); if (isEmpty(artifactDir)) { throw new Exception("Please provide a not empty value for artifactsdir"); }/*w ww . j a v a 2 s. co m*/ if (StringUtils.equals(".", artifactDir) || new File("").getAbsolutePath().equals(new File(artifactDir).getAbsolutePath())) { throw new Exception("artifactsdir should not point to the root of sand box [" + new File(artifactDir).getAbsolutePath() + "]"); } }
From source file:com.taobao.common.tfs.comm.TfsProtocolEncoder.java
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception { if (!(message instanceof byte[])) { throw new Exception("must send byte[]"); }/*from w w w .ja v a2 s .c om*/ byte[] payload = (byte[]) message; ByteBuffer buf = ByteBuffer.allocate(payload.length, false); buf.put(payload); buf.flip(); out.write(buf); }
From source file:com.thetdgroup.TextAlignmentAdapter.java
public void initialize(final JSONObject configurationObject) throws Exception { if (configurationObject.has("adapter_configuration_file") == false) { throw new Exception("The adapter_configuration_file parameter was not found"); }/*from w ww. j a v a2 s . c o m*/ // if (configurationObject.has("fuzein_connection_info")) { JSONObject jsonCommParams = configurationObject.getJSONObject("fuzein_connection_info"); fuzeInCommunication.setFuzeInConnection(jsonCommParams.getString("service_url"), jsonCommParams.getInt("service_socket_timeout"), jsonCommParams.getInt("service_connection_timeout"), jsonCommParams.getInt("service_connection_retry")); } // adapterConfigurationFile = configurationObject.getString("adapter_configuration_file"); parseAdapterConfiguration(configurationObject.getString("adapter_configuration_file")); // // Init the aligner ApptekDocumentAligner.initializeApptek(lexiconLibraryPath, alignerLibraryPath, jniLibraryPath); }
From source file:airbrake.BacktraceTest.java
@Test public void testEscapesExceptionClassName() { try {//from www . j av a 2s . c o m new Backtrace(new Exception("com.banana.MyClass{junk}")); } catch (PatternSyntaxException e) { fail("Throwing a pattern syntax exception means the class name might not have been escaped properly"); } }
From source file:com.sketchy.server.ServletAction.java
public static synchronized ServletAction getInstance(String servletActionClassName) throws Exception { try {//from w w w . ja v a 2 s. c o m ServletAction servletAction = instanceMap.get(servletActionClassName); if (servletAction == null) { servletAction = (ServletAction) Class.forName(servletActionClassName).newInstance(); instanceMap.put(servletActionClassName, servletAction); } return servletAction; } catch (ClassNotFoundException e) { throw e; } catch (Exception e) { throw new Exception("Error creating ServletAction Instance for class '" + servletActionClassName + "'! " + e.getMessage()); } }
From source file:pitayaa.nail.msg.business.account.AccountBusImpl.java
@Override public Account registerAccount(Account account, License license, Account isExistUsername) throws Exception { // Validate account with username boolean isExisted = this.validateRegister(isExistUsername); if (isExisted) { throw new Exception( "Account with this username have already been existed ! Cannot register with this username !"); }/* w w w .ja v a2 s . c o m*/ // Create Account License AccountLicense accountLicense = (AccountLicense) businessHelper.createModelStructure(new AccountLicense()); accountLicense = accLicenseBus.createDefaultAccountLicense(accountLicense, license); // Create Salon for account Salon salon = salonBus.createDefaultSalon(account, license); List<Salon> salonGroup = new ArrayList<Salon>(); salonGroup.add(salon); // Add salon to account account.setSalon(salonGroup); account.setAccountLicense(accountLicense); return account; }
From source file:at.molindo.notify.render.TemplateRenderService.java
@Override public void afterPropertiesSet() throws Exception { if (_renderer == null) { throw new Exception("renderer not configured"); }/*from w w w . j a va2s .c o m*/ if (_templateDAO == null) { throw new Exception("templateDAO not configured"); } }