private static KeyStore loadStore(String storeType, File storePath, String storePass) throws KeyStoreException, IOException, GeneralSecurityException { KeyStore ks = KeyStore.getInstance(storeType); FileInputStream stream = null; try { stream = new FileInputStream(storePath); ks.load(stream, storePass.toCharArray()); } finally { Util.closeQuietly(stream); } return ks; }
@Override public String next() throws NoSuchElementException { if (savedException != null){ throw new NoSuchElementException(savedException.toString()); } String prev = line; if (prev == null) { throw new NoSuchElementException(); } try { line = reader.readLine(); // save next line if (line == null) { Util.closeQuietly(reader); } } catch (IOException ex) { savedException = ex; // if it fails, save the exception, as it does not apply to this call Util.closeQuietly(reader); } return prev; }
/** * * @param _reader the reader to wrap * @param addDotReader whether to additionally wrap the reader in a DotTerminatedMessageReader * @throws IOException */ ReplyIterator(BufferedReader _reader, boolean addDotReader) throws IOException { reader = addDotReader ? new DotTerminatedMessageReader(_reader) : _reader; line = reader.readLine(); // prime the iterator if (line == null) { Util.closeQuietly(reader); } }
/** * Initiate list parsing for MLSD listings. * * @param pathname * @return the engine * @throws IOException */ private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = _openDataConnection_(FTPCmd.MLSD, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance(), __configuration); if (socket == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; }
false); } finally { Util.closeQuietly(input); Util.closeQuietly(socket); if (csl != null) {
Util.closeQuietly(socket);
Util.closeQuietly(socket); // ignore close errors here if (csl != null) {
private KeyStore loadStore(String storeType, File storePath, String storePass) throws KeyStoreException, IOException, GeneralSecurityException { KeyStore ks = KeyStore.getInstance(storeType); FileInputStream stream = null; try { stream = new FileInputStream(storePath); ks.load(stream, storePass.toCharArray()); } finally { Util.closeQuietly(stream); } return ks; }
/** * Initiate list parsing for MLSD listings. * * @param pathname * @return the engine * @throws IOException */ private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket; FTPListParseEngine engine = new FTPListParseEngine(new MLSxLoggingEntryParser(log)); if ((socket = _openDataConnection_(FTPCommand.MLSD, pathname)) == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; } //[IntelliJ] WI-12266 Support directory listing with MLSD command (adding logging of mlsd command)-------
/** * Initiate list parsing for MLSD listings. * * @param pathname * @return the engine * @throws IOException */ public FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket; FTPListParseEngine engine = new FTPListParseEngine(new MLSxLoggingEntryParser(log)); if ((socket = _openDataConnection_(FTPCommand.MLSD, pathname)) == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; } //[IntelliJ] WI-12266 Support directory listing with MLSD command (adding logging of mlsd command)-------