Refine search
private static IOException newIOException(String string, Throwable cause) { IOException exception = new IOException(string); exception.initCause(cause); return exception; } }
public static IOException create(String msg, Exception cause) { IOException exception = new IOException(msg); exception.initCause(cause); return exception; }
public static IOException create(String msg, Throwable cause) { IOException exception = new IOException(msg); exception.initCause(cause); return exception; }
private static IOException newIOException(Object file, IOException e) { IOException result = new IOException("Failing reading " + file); result.initCause(e); return result; }
public static IOException makeIOException(String msg, Throwable cause) { IOException e = new IOException(msg); e.initCause(cause); return e; } private static String getFileExtension(String name) {
public static void throwIOException(String msg, Throwable cause) throws IOException { IOException e = new IOException(msg); e.initCause(cause); throw e; }
/** * Wrap a {@code Throwable} in an {@code IOException} and return it. */ static IOException wrapInIOException(String message, Throwable t) { // IOException's constructor takes a Throwable, but only in JDK 6 IOException ioe = new IOException(message + ": " + t.getMessage()); ioe.initCause(t); return ioe; }
public static IOException create(Throwable cause) { IOException exception = new IOException(cause.getMessage()); exception.initCause(cause); return exception; }
public static IOException create(Exception cause) { IOException exception = new IOException(cause.getMessage()); exception.initCause(cause); return exception; }
public LocalArchiveEntry(String fileName) throws IOException { try { zipFile = new ZipFile(fileName); } catch (IOException e) { IOException ioe = new IOException("Could not open archive file " + fileName); ioe.initCause(e); throw ioe; } }
public void method() { try { new String(new byte[] {}, "xyz"); } catch (UnsupportedEncodingException e) { IOException pe = new IOException("cannot parse URL query part"); pe.initCause(e); } } }
@Override public void connectSocket(Socket socket, InetSocketAddress address, int connectTimeout) throws IOException { try { socket.connect(address, connectTimeout); } catch (AssertionError e) { if (Util.isAndroidGetsocknameError(e)) throw new IOException(e); throw e; } catch (SecurityException e) { // Before android 4.3, socket.connect could throw a SecurityException // if opening a socket resulted in an EACCES error. IOException ioException = new IOException("Exception in connect"); ioException.initCause(e); throw ioException; } }
public static IWatchManager createWatchManager() throws IOException { String watchManagerName = System.getProperty(ZOOKEEPER_WATCH_MANAGER_NAME); if (watchManagerName == null) { watchManagerName = WatchManager.class.getName(); } try { IWatchManager watchManager = (IWatchManager) Class.forName(watchManagerName).newInstance(); LOG.info("Using {} as watch manager", watchManagerName); return watchManager; } catch (Exception e) { IOException ioe = new IOException("Couldn't instantiate " + watchManagerName); ioe.initCause(e); throw ioe; } } }
static public ServerCnxnFactory createFactory() throws IOException { String serverCnxnFactoryName = System.getProperty(ZOOKEEPER_SERVER_CNXN_FACTORY); if (serverCnxnFactoryName == null) { serverCnxnFactoryName = NIOServerCnxnFactory.class.getName(); } try { ServerCnxnFactory serverCnxnFactory = (ServerCnxnFactory) Class.forName(serverCnxnFactoryName) .getDeclaredConstructor().newInstance(); LOG.info("Using {} as server connection factory", serverCnxnFactoryName); return serverCnxnFactory; } catch (Exception e) { IOException ioe = new IOException("Couldn't instantiate " + serverCnxnFactoryName); ioe.initCause(e); throw ioe; } }
public <T extends Enum<T>> T readEnum(String name, Class<T> enumType, T defVal) throws IOException { T ret = defVal; try { String eVal = currentElem.getAttribute(name); if (eVal != null && eVal.length() > 0) { ret = Enum.valueOf(enumType, eVal); } } catch (Exception e) { IOException io = new IOException(e.toString()); io.initCause(e); throw io; } return ret; }
public boolean readBoolean(String name, boolean defVal) throws IOException { String tmpString = currentElem.getAttribute(name); if (tmpString == null || tmpString.length() < 1) return defVal; try { return Boolean.parseBoolean(tmpString); } catch (DOMException de) { IOException io = new IOException(de.toString()); io.initCause(de); throw io; } }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public Savable load(InputStream f) throws IOException { try { domIn = new DOMInputCapsule(DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(f), this); return domIn.readSavable(null, null); } catch (SAXException e) { IOException ex = new IOException(); ex.initCause(e); throw ex; } catch (ParserConfigurationException e) { IOException ex = new IOException(); ex.initCause(e); throw ex; } }
@Override public void write(final int b) throws IOException { writeBuffer[writePointer] = (byte) (b & 0xFF); writePointer++; if (writePointer == writeBuffer.length) { writePointer = 0; try { doWrite(); } catch (DataFormatException e) { IOException ie = new IOException("Error decompressing data"); ie.initCause(e); throw ie; } } }
public short readShort(String name, short defVal) throws IOException { String tmpString = currentElem.getAttribute(name); if (tmpString == null || tmpString.length() < 1) return defVal; try { return Short.parseShort(tmpString); } catch (NumberFormatException nfe) { IOException io = new IOException(nfe.toString()); io.initCause(nfe); throw io; } catch (DOMException de) { IOException io = new IOException(de.toString()); io.initCause(de); throw io; } }