Skip to content

Commit d6dc40c

Browse files
jld01mickaelistria
authored andcommitted
Propagate exception on storage document content stream closure
1 parent 9ee7888 commit d6dc40c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

bundles/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,13 @@ protected void setDocumentContent(IDocument document, InputStream contentStream,
134134
if (encoding == null) {
135135
encoding= getDefaultEncoding();
136136
}
137-
try {
137+
try (contentStream) { // close content stream after read (PDE relies on it)
138138
String content= new String(contentStream.readAllBytes(), encoding);
139139
document.set(content);
140140
} catch (IOException x) {
141141
String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
142142
IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, x);
143143
throw new CoreException(s);
144-
} finally {
145-
try {
146-
// undocumented implementation detail kept for historic reasons (for example PDE relies on it):
147-
contentStream.close();
148-
} catch (IOException x) {
149-
// ignore
150-
}
151144
}
152145
}
153146

0 commit comments

Comments
 (0)