@Override public int compare(File o1, File o2) { try { String path1 = o1.getCanonicalPath(); String path2 = o2.getCanonicalPath(); return path2.compareTo(path1); } catch(IOException e) { throw new WrappedException(e); } } };
Throwable cause = err.getCause(); if(cause instanceof ParseException) throw (ParseException)cause; throw err;
} else if(thrown instanceof WrappedException) { WrappedException wrapped=(WrappedException)thrown; Object[] wrappedInfo=wrapped.getExtraInfo(); if(wrappedInfo!=null && wrappedInfo.length>0) { for(int c=0;c<(indent+4);c++) append(' ', out);
Throwable cause = err.getCause(); if(cause instanceof IOException) throw (IOException)cause; if(cause instanceof SQLException) throw (SQLException)cause;
/** * SHA-256 hashes the given key. * * @see #generateKey() */ public static byte[] hash(byte[] key) { try { MessageDigest md = MessageDigest.getInstance(ALGORITHM); md.update(key); return md.digest(); } catch(NoSuchAlgorithmException e) { throw new WrappedException(e); } }
Throwable cause = err.getCause(); if(cause instanceof IOException) throw (IOException)cause; if(cause instanceof SQLException) throw (SQLException)cause;
@Override public String toString() { try { log.write("result["); log.write(Long.toString(id)); log.write("].toString();\n"); log.flush(); } catch(IOException e) { throw new WrappedException(e); } return wrapped.toString(); }
/** * Gets the SemanticCMS instance, creating it if necessary. */ public static SemanticCMS getInstance(ServletContext servletContext) { try { synchronized(instanceLock) { SemanticCMS semanticCMS = (SemanticCMS)servletContext.getAttribute(SemanticCMS.ATTRIBUTE_NAME); if(semanticCMS == null) { semanticCMS = new SemanticCMS(servletContext); servletContext.setAttribute(SemanticCMS.ATTRIBUTE_NAME, semanticCMS); } return semanticCMS; } } catch(IOException e) { throw new WrappedException(e); } catch(SAXException e) { throw new WrappedException(e); } catch(ParserConfigurationException e) { throw new WrappedException(e); } catch(XPathExpressionException e) { throw new WrappedException(e); } }
@Override public String next() { try { if(next==null) throw new NoSuchElementException(); String retVal = next.getPath(); next = filesystemIterator.getNextFile(); return retVal; } catch(IOException err) { throw new WrappedException(err); } }
@Override public void afterRelease() { try { sortIfNeeded(list); } catch(IOException | SQLException err) { throw new WrappedException(err); } } }
@Override final public String toString() { try { return getTableSchema().display; } catch(IOException | SQLException err) { throw new WrappedException(err); } }
@Override public int hashCode() { try { return FileUtils.contentHashCode(file); } catch(IOException e) { throw new WrappedException(e); } }
@Override default Object[] toArray() { try { return getRows().toArray(); } catch(SQLException err) { throw new WrappedException(err); } }
/** * Performs a one-way hash of the plaintext value using SHA-1. * * @exception WrappedException if any problem occurs. */ public static String hash(String plaintext) throws WrappedException { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(plaintext.getBytes("UTF-8")); return new String(Base64Coder.encode(md.digest())); } catch(NoSuchAlgorithmException err) { throw new WrappedException(err); } catch(UnsupportedEncodingException err) { throw new WrappedException(err); } }
@Override public void clear() { try { frf.removeAllRecords(); modCount++; } catch(IOException err) { throw new WrappedException(err, new Object[] {"frf="+frf}); } }
@Override final public Object getColumn(int i) { try { return getColumnImpl(i); } catch(IOException | SQLException err) { throw new WrappedException(err); } }
@Override public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof FileMessage)) return false; FileMessage other = (FileMessage)o; try { return FileUtils.contentEquals(file, other.file); } catch(IOException e) { throw new WrappedException(e); } }
/** * Gets a string representation of this object in the current thread locale. * * @see #toString(java.util.Locale) */ @Override final public String toString() { try { return toStringImpl(); } catch(IOException | SQLException err) { throw new WrappedException(err); } }
public void swap(int index1, int index2) { try { frf.swap(index1, index2); } catch(IOException err) { throw new WrappedException(err, new Object[] {"frf="+frf}); } }
@Override public int size() { try { return frf.getRecordCount(); } catch(IOException err) { throw new WrappedException(err, new Object[] {"frf="+frf}); } }