List of usage examples for java.lang Exception Exception
public Exception(Throwable cause)
From source file:com.bdx.rainbow.service.jc.impl.DrugService.java
public Drc selectDrcByCode(String jgmCode) throws Exception { if (StringUtil.isBlank(jgmCode)) throw new Exception("??"); Drc drc = drcMapper.selectByPrimaryKey(jgmCode); return drc;// w w w .ja v a 2 s.c o m }
From source file:com.registryKit.user.emailMessageManager.java
@Async public void sendEmail(mailMessage messageDetails) throws Exception { MimeMessage msg = mailSender.createMimeMessage(); try {//from ww w . j a v a 2 s . c o m MimeMessageHelper helper = new MimeMessageHelper(msg, true); helper.setFrom(messageDetails.getfromEmailAddress()); helper.setTo(messageDetails.gettoEmailAddress()); if (messageDetails.getccEmailAddress() != null) { helper.setCc(messageDetails.getccEmailAddress()); } helper.setSubject(messageDetails.getmessageSubject()); helper.setText("", messageDetails.getmessageBody()); helper.setReplyTo(messageDetails.getfromEmailAddress()); mailSender.send(msg); } catch (Exception e) { throw new Exception(e); } }
From source file:com.safedocs.license.controller.SafeDocsLicenseController.java
@RequestMapping(value = "/save", method = RequestMethod.POST) public ModelAndView save(@RequestParam Map<String, String> params) throws Exception { String uuid;/* www .ja v a2s . c om*/ if (params.get("uuid") == null) { throw new Exception("uuid? !!"); } else { uuid = params.get("uuid"); } String viewcnt = params.get("viewcnt") == null ? "0" : params.get("viewcnt"); int nViewCnt = Integer.parseInt(viewcnt.equals("") ? "0" : viewcnt); String viewperiod = params.get("viewperiod") == null ? "0" : params.get("viewperiod"); int nViewPeriod = Integer.parseInt(viewperiod.equals("") ? "0" : viewperiod); int nTargerCount = params.get("targetcnt") == null ? 0 : Integer.parseInt(params.get("targetcnt")); printInfo(params, "/save"); SafeDocsLicenseModel model = new SafeDocsLicenseModel(); model.setUuid(uuid); model.setViewcnt(nViewCnt); model.setViewperiod(nViewPeriod); return new ModelAndView(safedocsMarshallingView, (Map<String, ?>) licenseService.saveLicenseData(model, nTargerCount)); }
From source file:com.liferay.mobile.android.v62.theme.ThemeService.java
public JSONArray getThemes(long companyId) throws Exception { JSONObject _command = new JSONObject(); try {// w ww. j a v a 2 s . c o m JSONObject _params = new JSONObject(); _params.put("companyId", companyId); _command.put("/theme/get-themes", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getJSONArray(0); }
From source file:sg.edu.ntu.hrms.service.TitleService.java
public void addTitle(String name) throws Exception { Session session = sessionFactory.openSession(); Transaction txn = null;/*w ww. j a v a 2 s .co m*/ try { txn = session.beginTransaction(); titleDAO.setSession(session); TitleDTO titleDTO = new TitleDTO(); titleDTO.setDescription(name); if (titleDAO.getTitleByName(name) != null) { throw new Exception("Duplicate Title name is not allowed"); } else { titleDAO.addTitle(titleDTO); } txn.commit(); } catch (Exception ex) { ex.printStackTrace(); txn.rollback(); throw ex; } finally { session.close(); } }
From source file:apiserver.services.image.controllers.filters.ImageMarbleTests.java
@Test public void testFilterCache() throws Exception { throw new Exception("Not implemented yet"); }
From source file:com.artivisi.salary.payroll.system.controller.LemburController.java
@RequestMapping(value = "/lembur", method = RequestMethod.POST) public void saveLembur(@RequestBody Lembur lembur) throws Exception { if (lembur == null) { throw new Exception("User tidak boleh kosong"); }// w w w .java 2 s . co m lemburService.save(lembur); }
From source file:cz.cvut.fel.integracniportal.extension.SftpChannel.java
@PostConstruct private void init() throws Exception { sftpChannel = sshDataSource.getSftpChannel(); if (sftpChannel == null) { throw new Exception("Problem obtaining an ssh channel."); }//ww w. jav a 2s . c o m sftpChannel.connect(); }
From source file:com.oneandone.relesia.checker.ChangelogChecker.java
@Override public Set<IssueEntity> checkApp(WorkApplicationEntity wApplication) { Set<IssueEntity> issues = new HashSet<>(); File[] files;/*from w w w . ja v a 2s . c om*/ String path = CheckerUtils.workspace + "/" + wApplication.getLocalPath(); File directory = new File(path); if (!directory.isDirectory()) { try { throw new Exception("Not a folder, cannot check, verify path"); } catch (Exception e) { e.printStackTrace(); } } files = directory.listFiles(filter); if (files.length > 1) { issues.add(new IssueEntity(wApplication.getApplication(), "[CHANGELOG] Multiple changelogs found", "Changelog Checker reported multiple" + " changelogs are present\n Number of files: " + files.length, "", "", "", "")); } else if (files.length < 1) { issues.add(new IssueEntity(wApplication.getApplication(), "[CHANGELOG] No readme found", "Changelog Checker reported that no readme file is present", "", "", "", "")); } return issues; }
From source file:com.cloudera.sqoop.util.OptionsFileUtil.java
/** * Expands any options file that may be present in the given set of arguments. * * @param args the given arguments/*from ww w . jav a2s . c o m*/ * @return a new string array that contains the expanded arguments. * @throws Exception */ public static String[] expandArguments(String[] args) throws Exception { List<String> options = new ArrayList<String>(); for (int i = 0; i < args.length; i++) { if (args[i].equals(Sqoop.SQOOP_OPTIONS_FILE_SPECIFIER)) { if (i == args.length - 1) { throw new Exception("Missing options file"); } String fileName = args[++i]; File optionsFile = new File(fileName); BufferedReader reader = null; StringBuilder buffer = new StringBuilder(); try { reader = new BufferedReader(new FileReader(optionsFile)); String nextLine = null; while ((nextLine = reader.readLine()) != null) { nextLine = nextLine.trim(); if (nextLine.length() == 0 || nextLine.startsWith("#")) { // empty line or comment continue; } buffer.append(nextLine); if (nextLine.endsWith("\\")) { if (buffer.charAt(0) == '\'' || buffer.charAt(0) == '"') { throw new Exception("Multiline quoted strings not supported in file(" + fileName + "): " + buffer.toString()); } // Remove the trailing back-slash and continue buffer.deleteCharAt(buffer.length() - 1); } else { // The buffer contains a full option options.add(removeQuotesEncolosingOption(fileName, buffer.toString())); buffer.delete(0, buffer.length()); } } // Assert that the buffer is empty if (buffer.length() != 0) { throw new Exception( "Malformed option in options file(" + fileName + "): " + buffer.toString()); } } catch (IOException ex) { throw new Exception("Unable to read options file: " + fileName, ex); } finally { if (reader != null) { try { reader.close(); } catch (IOException ex) { LOG.info("Exception while closing reader", ex); } } } } else { // Regular option. Parse it and put it on the appropriate list options.add(args[i]); } } return options.toArray(new String[options.size()]); }