List of usage examples for java.lang Exception Exception
public Exception(String message, Throwable cause)
From source file:au.edu.unsw.cse.soc.federatedcloud.DataModelUtil.java
/** * Process an file and returns the CloudResourceDescription * * @param aFile input file to be processed (must be a JSON file) *//*from ww w .ja v a 2s . c o m*/ private static CloudResourceDescription processFile(File aFile) throws Exception { try { String fileContent = FileUtils.readFileToString(aFile); return readJSON(fileContent); } catch (Exception e) { throw new Exception("Error occured when processing:" + aFile.getAbsolutePath(), e); } }
From source file:net.mitnet.tools.pdf.book.publisher.ui.cli.BookPublisherCLI.java
public static void main(String[] args) throws Exception { try {/*from www . ja v a2 s . c o m*/ BookPublisherCLI cli = new BookPublisherCLI(); cli.run(args); } catch (Exception e) { // String msg = "Error publishing book \"" + config.getOutputBookFile() + "\" : " + e.getMessage(); String msg = "Error publishing book : " + e.getMessage(); error(msg, e); throw new Exception(msg, e); } System.exit(0); }
From source file:Main.java
/** * Performs a xpath query on a document and returns the matching nodelist. * * @param context the Context where to start with the query * @param query the XPath-Query/*from w ww .ja va 2 s.com*/ * @return nodelist of matches * @throws Exception on error */ public static NodeList query(Node context, String query) throws Exception { NodeList result = null; XPath xpath = XPathFactory.newInstance().newXPath(); try { result = (NodeList) xpath.evaluate(query, context, XPathConstants.NODESET); } catch (XPathExpressionException xpx) { throw new Exception("Error evaluating XPath: " + xpx.getMessage(), xpx); } return result; }
From source file:Main.java
static public String unescapeXml(String src) throws Exception { if (src == null || src.trim().length() == 0) return src; StringBuilder result = new StringBuilder(); int length = src.length(); for (int i = 0; i < length; i++) { char ch = src.charAt(i); if (ch != '&') { result.append(ch);/*from w w w .j av a 2s.c o m*/ continue; } int pos = src.indexOf(";", i); if (pos < 0) { result.append(ch); continue; } if (src.charAt(i + 1) == '#') { String esc = ""; try { esc = src.substring(i + 2, pos); int val = Integer.parseInt(src.substring(i + 2, pos), 16); result.append((char) val); i = pos; continue; } catch (Exception ex) { String msg = "Something wrong with hex code \"" + esc + "\""; throw new Exception(msg, ex); } } String esc = src.substring(i, pos + 1); if (esc.equals("&")) result.append('&'); else if (esc.equals("<")) result.append('<'); else if (esc.equals(">")) result.append('>'); else if (esc.equals(""")) result.append('"'); else if (esc.equals("'")) result.append('\''); else { String msg = "Unknown escape \"" + esc + "\""; throw new Exception(msg); } i = pos; } return result.toString(); }
From source file:Main.java
/** Locate a sub-element tagged 'name', return its value. * * @param element Element where to start looking. May be null. * @param name Name of sub-element to locate. * @param default_value Default value if not found * * @return Returns double string that was found * @throws Exception on error in number format *//*from w w w . ja v a 2 s . co m*/ final public static double getSubelementDouble(final Element element, final String name, final double default_value) throws Exception { final String text = getSubelementString(element, name, "").trim(); if (text.isEmpty()) return default_value; try { return Double.parseDouble(text); } catch (NumberFormatException ex) { throw new Exception("Invalid number for <" + name + ">", ex); } }
From source file:com.ut.healthelink.jobs.loadBatches.java
@Override public void execute(JobExecutionContext context) throws JobExecutionException { try {// w ww . j av a2 s .com SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); transactionInManager.loadBatches(); } catch (Exception ex) { try { throw new Exception("Error occurred trying to load batch files from schedule task", ex); } catch (Exception ex1) { Logger.getLogger(loadBatches.class.getName()).log(Level.SEVERE, null, ex1); } } }
From source file:com.ut.healthelink.jobs.processBatches.java
@Override public void execute(JobExecutionContext context) throws JobExecutionException { try {/*from w w w. ja va 2 s.co m*/ SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); transactionInManager.processBatches(); } catch (Exception ex) { try { throw new Exception("Error occurred trying to process batch files from schedule task", ex); } catch (Exception ex1) { Logger.getLogger(processBatches.class.getName()).log(Level.SEVERE, null, ex1); } } }
From source file:com.ut.healthelink.jobs.MoveSFTPFiles.java
@Override public void execute(JobExecutionContext context) throws JobExecutionException { try {/*from www. ja v a 2s . c om*/ SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); transactionInManager.moveSFTPFiles(); } catch (Exception ex) { try { throw new Exception("Error occurred trying to move SFTP files from schedule task", ex); } catch (Exception ex1) { Logger.getLogger(MoveSFTPFiles.class.getName()).log(Level.SEVERE, null, ex1); } } }
From source file:com.ut.healthelink.jobs.MoveRhapsodyFiles.java
@Override public void execute(JobExecutionContext context) throws JobExecutionException { try {//from www .jav a2s . c om SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); transactionInManager.moveRhapsodyFiles(); } catch (Exception ex) { try { throw new Exception("Error occurred trying to move Rhapsody files from schedule task", ex); } catch (Exception ex1) { Logger.getLogger(MoveRhapsodyFiles.class.getName()).log(Level.SEVERE, null, ex1); } } }
From source file:com.ut.healthelink.jobs.generateOutputFiles.java
@Override public void execute(JobExecutionContext context) throws JobExecutionException { try {/* w w w . j a va2s. c o m*/ SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); transactionOutManager.generateOutputFiles(); } catch (Exception ex) { try { throw new Exception("Error occurred trying to generate output files from schedule task", ex); } catch (Exception ex1) { Logger.getLogger(generateOutputFiles.class.getName()).log(Level.SEVERE, null, ex1); } } }