public OutputStream getFileOutputStream(File file, boolean append) throws IOException { removeLocalInputFile(file); String owner = this.buildNewOwnerId("getFileOutputStream"); AbstractProxy proxy = this.getAvailableProxy(owner); try { OutputStream raw = proxy.getFileOutputStream(this.translateToRemote(file), append); if (USE_BUFFER) { return new BufferedOutputStream(raw, BUFFER_SIZE); } else { return raw; } } catch (IOException e) { releaseProxy(proxy, owner); throw e; } catch (RuntimeException e) { releaseProxy(proxy, owner); throw e; } // Pas de "releaseLock" systematique ici car c'est le stream qui s'en charge a la fermeture }