Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-03-19 15:12:10 +0000
committerAndre Weinand2004-03-19 15:12:10 +0000
commitff982b9998ecfaea0ceb2ea84f42b22da772b7a1 (patch)
treefa6c03bd0a9d5ab2da36bfdf23cc89e9d176ce98 /bundles/org.eclipse.compare/compare
parent98230c4b53f6db8bda4976cd122968f119eb0450 (diff)
downloadeclipse.platform.team-ff982b9998ecfaea0ceb2ea84f42b22da772b7a1.tar.gz
eclipse.platform.team-ff982b9998ecfaea0ceb2ea84f42b22da772b7a1.tar.xz
eclipse.platform.team-ff982b9998ecfaea0ceb2ea84f42b22da772b7a1.zip
added close utility
Diffstat (limited to 'bundles/org.eclipse.compare/compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java21
2 files changed, 14 insertions, 23 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
index 41b23e86d..9a0f33a28 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
@@ -98,20 +98,8 @@ public class BinaryCompareViewer extends AbstractViewer {
} catch (IOException ex) {
message= Utilities.getString(fBundle, "errorMessage"); //$NON-NLS-1$
} finally {
- if (left != null) {
- try {
- left.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
- if (right != null) {
- try {
- right.close();
- } catch (IOException ex) {
- // silently ignored
- }
- }
+ Utilities.close(left);
+ Utilities.close(right);
}
if (message != null)
fControl.setText(message);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
index 471f990a6..183c566ed 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -173,13 +173,7 @@ public class Utilities {
return null;
} finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- // silently ignored
- }
- }
+ Utilities.close(in);
try {
bos.close();
} catch (IOException x) {
@@ -382,8 +376,7 @@ public class Utilities {
* Status constant indicating that an validateEdit call has changed the
* content of a file on disk.
*/
- private static final int VALIDATE_EDIT_PROBLEM= 10004;
-
+ private static final int VALIDATE_EDIT_PROBLEM= 10004;
/**
* Makes the given resources committable. Committable means that all
@@ -579,4 +572,14 @@ public class Utilities {
encoding= ResourcesPlugin.getEncoding();
return Utilities.readString(is, encoding);
}
+
+ public static void close(InputStream is) {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ex) {
+ // silently ignored
+ }
+ }
+ }
}

Back to the top