List of usage examples for org.apache.commons.lang UnhandledException UnhandledException
public UnhandledException(Throwable cause)
From source file:gov.nih.nci.caarray.plugins.agilent.EndOfLineCorrectingReader.java
/** * @return a regular expression which matches carriage return/carriage return/line feed *///from w ww. ja v a2s. com private RE createRegularExpression() { try { return new RE(CRCRLF, RE.REG_MULTILINE); } catch (REException e) { throw new UnhandledException(e); } }
From source file:de.awtools.basic.io.AWToolsIOUtils.java
/** * Konvertiert eine Klassenpfad-Resource in ein <code>Image</code>. * * @param resource Eine Resource die im Klassenpfad liegt. * @param classLoader Der zu verwendende Klassenlader. * @return Das geladene Image.//from w w w .j a v a 2 s . c o m */ public static Image loadImage(final String resource, final Class<?> classLoader) { try { URL imageURL = classLoader.getResource(resource); // An alternative loading function: // return Toolkit.getDefaultToolkit().createImage(imageURL); return ImageIO.read(imageURL); } catch (IOException ex) { log.error("Fehler: ", ex); throw new UnhandledException(ex); } }
From source file:ar.com.zauber.commons.repository.Reference.java
/** @return the class that*/ public final Class<T> getClazz() { if (clazz == null) { try {//ww w . ja va 2 s . c o m clazz = (Class<T>) Class.forName(clazzName); } catch (final ClassNotFoundException e) { throw new UnhandledException(e); } } return clazz; }
From source file:ar.com.zauber.commons.web.proxy.impl.PathBasedURLRequestMapper.java
/** @see URLRequestMapper#getProxiedURLFromRequest(HttpServletRequest) */ public final URLResult getProxiedURLFromRequest(final HttpServletRequest request) { URLResult r = base.getProxiedURLFromRequest(request); if (r.hasResult()) { try {//from w w w . j av a 2 s . c om r = new InmutableURLResult(new URL(r.getURL().toExternalForm() + getRequestURI(request))); } catch (final MalformedURLException e) { throw new UnhandledException(e); } } return r; }
From source file:ar.com.zauber.commons.web.proxy.URLRequestMapperEditor.java
/** @see PropertyEditor#setAsText(String) */ public final void setAsText(final String s) throws IllegalArgumentException { ChainedURLRequestMapper r = null;/*from ww w . j a va2 s . c o m*/ if (!StringUtils.isBlank(s)) { final Map<String, String> m = new LinkedHashMap<String, String>(); final BufferedReader br = new BufferedReader(new StringReader(s)); String l; try { while ((l = br.readLine()) != null) { if (StringUtils.isBlank(l)) { continue; } final int i = l.indexOf("="); if (i == -1) { throw new IllegalArgumentException("missing = in line `" + l + "'"); } m.put(l.substring(0, i).trim(), l.substring(i + 1).trim()); } r = new ChainedURLRequestMapper(m, stripContextPath, stripServletPath); } catch (final IOException e) { throw new UnhandledException(e); } } setValue(r); }
From source file:ar.com.zauber.commons.web.transformation.processors.impl.DocumentBuilderFactoryDocumentProvider.java
public final Document parse(InputSource source) { try {/*from w ww . j a v a2s.co m*/ final DocumentBuilder db = dbf.newDocumentBuilder(); return db.parse(source); } catch (ParserConfigurationException e) { throw new UnhandledException(e); } catch (SAXException e) { throw new UnhandledException(e); } catch (IOException e) { throw new UnhandledException(e); } }
From source file:de.awtools.basic.io.IOUtilsTest.java
/** * Konvertiert einen InputStream in einen String. * <strong>Achtung:</strong> Diese Methode sollte nur in Verwendung mit * 'kleinen' <code>InputStream</code>s verwendet werden.<br> * * @param is Der zu konvertierende InputStream. * @return Das Endergebnis als String. Tritt whrend der Verarbeitung ein * Fehler ein, wird eine 'null'-Referenz zurck geliefert. * //from w w w. j av a 2 s . c om * @deprecated Siehe IOUtils#toString(InputStream) */ @Deprecated public static String toString(final InputStream is) { try { BufferedReader in = new BufferedReader(new InputStreamReader(is)); StringBuilder buf = new StringBuilder(); String string; while ((string = in.readLine()) != null) { buf.append(string); buf.append(LINESEPARATOR); } return buf.toString(); } catch (IOException ex) { throw new UnhandledException(ex); } }
From source file:hr.fer.zemris.vhdllab.platform.ui.wizard.schema.NewSchemaWizard.java
@Override protected String createData() { CircuitInterface ci = getCircuitInterface(fileForm, portWizardPage); try {// www .j a v a2 s. c om return createSchema(ci); } catch (Exception e) { throw new UnhandledException(e); } }
From source file:hr.fer.zemris.vhdllab.dao.impl.PredefinedFileDaoImpl.java
@PostConstruct public void initFiles() { for (java.io.File predefined : getLocation().listFiles()) { if (predefined.isFile() && !isReadme(predefined)) { String contents;/*from w ww . j a v a 2 s . co m*/ try { contents = FileUtils.readFileToString(predefined, IOUtil.DEFAULT_ENCODING); } catch (IOException e) { throw new UnhandledException(e); } String name = predefined.getName(); File file = new File(name, FileType.PREDEFINED, contents); files.put(name, file); if (LOG.isTraceEnabled()) { LOG.trace("Loaded predefined file: " + name); } } } if (LOG.isDebugEnabled()) { LOG.debug("Initialized with " + files.size() + " predefined files."); } }
From source file:ar.com.zauber.commons.repository.closures.OpenSessionClosure.java
/** @see Closure#execute(Object) */ public final void execute(final T t) { if (dryrun) { //permite evitar que se hagan commit() en el ambiente de test target.execute(t);/* ww w. jav a 2 s.c om*/ } else { final Session session = SessionFactoryUtils.getSession(sessionFactory, true); TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session)); Transaction transaction = null; try { transaction = session.beginTransaction(); target.execute(t); session.flush(); transaction.commit(); } catch (final Throwable e) { if (transaction != null && transaction.isActive()) { transaction.rollback(); } throw new UnhandledException(e); } finally { TransactionSynchronizationManager.unbindResource(sessionFactory); SessionFactoryUtils.closeSession(session); } } }