Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2008-08-15 20:41:46 +0000
committerkmoore2008-08-15 20:41:46 +0000
commit0a2554f72950196b27620742cdb116d4f8e5d5dd (patch)
treebf71613a1e837e2e22337d4e1f8735e1996aebe3
parent9a7229b34c1ffe04dcc17ec92a9bd2b694e980dc (diff)
downloadwebtools.dali-0a2554f72950196b27620742cdb116d4f8e5d5dd.tar.gz
webtools.dali-0a2554f72950196b27620742cdb116d4f8e5d5dd.tar.xz
webtools.dali-0a2554f72950196b27620742cdb116d4f8e5d5dd.zip
244268 - closing InputStream
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java
index ed503de644..1057f07559 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.platform;
import java.io.IOException;
+import java.io.InputStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
@@ -295,8 +296,10 @@ public class GenericJpaFactory implements JpaFactory
// have to check the file contents instead of just the file name
// because for xml we base it on the rootElement name
private IContentType contentType(IFile file) {
+ InputStream inputStream = null;
try {
- return Platform.getContentTypeManager().findContentTypeFor(file.getContents(), file.getName());
+ inputStream = file.getContents();
+ return Platform.getContentTypeManager().findContentTypeFor(inputStream, file.getName());
}
catch (IOException ex) {
JptCorePlugin.log(ex);
@@ -304,6 +307,15 @@ public class GenericJpaFactory implements JpaFactory
catch (CoreException ex) {
JptCorePlugin.log(ex);
}
+ finally {
+ try {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ } catch (IOException ex) {
+ JptCorePlugin.log(ex);
+ }
+ }
return null;
}

Back to the top