diff options
author | Michael Valenta | 2002-04-18 12:13:20 +0000 |
---|---|---|
committer | Michael Valenta | 2002-04-18 12:13:20 +0000 |
commit | b93564ef7182b48e63db6a31244ff04e781da316 (patch) | |
tree | 2cd8a8b73ebdaa2d9bc323656b75aada89efc098 | |
parent | e068325492ab72bd8f8879039bcd6c55662ed8d0 (diff) | |
download | eclipse.platform.team-b93564ef7182b48e63db6a31244ff04e781da316.tar.gz eclipse.platform.team-b93564ef7182b48e63db6a31244ff04e781da316.tar.xz eclipse.platform.team-b93564ef7182b48e63db6a31244ff04e781da316.zip |
Added required close of stream
-rw-r--r-- | bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java index 4a28d4f1b..77707c9f0 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java @@ -363,28 +363,27 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { info = newInfo; } - /* - * @see ICVSFile#getInputStream() - */ public InputStream getContents() throws CVSException { return new ByteArrayInputStream(contents == null ? new byte[0] : contents); } - /* - * @see ICVSFile#setReadOnly() - */ public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor) throws CVSException { try { - byte[] buffer = new byte[1024]; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int read; - while ((read = stream.read(buffer)) >= 0) { - Policy.checkCanceled(monitor); - out.write(buffer, 0, read); + try { + byte[] buffer = new byte[1024]; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int read; + while ((read = stream.read(buffer)) >= 0) { + Policy.checkCanceled(monitor); + out.write(buffer, 0, read); + } + out.close(); + contents = out.toByteArray(); + } finally { + stream.close(); } - contents = out.toByteArray(); } catch(IOException e) { - throw new CVSException(Policy.bind("")); //$NON-NLS-1$ //$NON-NLS-2$ + throw CVSException.wrapException(e); } } |