Bug 549149 - [region] use buffered streams for persistent digraph

Change-Id: Icb70c9c027a20879dc8b7622dc11c383f2df403e
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
diff --git a/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF
index 48252aa..e680ac7 100644
--- a/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-SymbolicName: org.eclipse.equinox.region
-Bundle-Version: 1.4.400.qualifier
+Bundle-Version: 1.4.500.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Fragment-Host: system.bundle
 ExtensionBundle-Activator: org.eclipse.equinox.internal.region.RegionManager
diff --git a/bundles/org.eclipse.equinox.region/pom.xml b/bundles/org.eclipse.equinox.region/pom.xml
index 0bf947a..5ee53bf 100644
--- a/bundles/org.eclipse.equinox.region/pom.xml
+++ b/bundles/org.eclipse.equinox.region/pom.xml
@@ -19,6 +19,6 @@
   </parent>
   <groupId>org.eclipse.equinox</groupId>
   <artifactId>org.eclipse.equinox.region</artifactId>
-  <version>1.4.400-SNAPSHOT</version>
+  <version>1.4.500-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/RegionManager.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/RegionManager.java
index d441e3a..3f75286 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/RegionManager.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/RegionManager.java
@@ -101,16 +101,9 @@
 			// no persistent digraph available, create a new one
 			return createRegionDigraph();
 		}
-		FileInputStream in = new FileInputStream(digraphFile);
-		try {
+		try (InputStream in = new BufferedInputStream(new FileInputStream(digraphFile))) {
 			// TODO need to validate bundle IDs to make sure they are consistent with current bundles
 			return StandardRegionDigraphPersistence.readRegionDigraph(new DataInputStream(in), this.bundleContext, this.threadLocal);
-		} finally {
-			try {
-				in.close();
-			} catch (IOException e) {
-				// We tried our best to clean up
-			}
 		}
 	}
 
@@ -124,17 +117,9 @@
 	}
 
 	private void saveDigraph() throws IOException {
-		FileOutputStream digraphFile = new FileOutputStream(bundleContext.getDataFile(DIGRAPH_FILE));
-		try {
-			digraph.getRegionDigraphPersistence().save(digraph, digraphFile);
-		} finally {
-			try {
-				digraphFile.close();
-			} catch (IOException e) {
-				// ignore;
-			}
+		try (OutputStream out = new BufferedOutputStream(new FileOutputStream(bundleContext.getDataFile(DIGRAPH_FILE)))) {
+			digraph.getRegionDigraphPersistence().save(digraph, out);
 		}
-
 	}
 
 	private StandardManageableRegionDigraph registerDigraphMbean(RegionDigraph regionDigraph) {