tmf: Switch tmf.ui to Java 7 + fix warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / commands / ExportToTextJob.java
index 29c251d1d0c9464348da20fd51b09da05346ee7e..a3672a2a58b0c1b94c9e6f03d5c04a977ed5ca0c 100644 (file)
@@ -78,16 +78,7 @@ public class ExportToTextJob extends Job {
     }
 
     private IStatus saveImpl(IProgressMonitor monitor) {
-        final BufferedWriter bw;
-        try {
-            bw = new BufferedWriter(new FileWriter(destination));
-        } catch (IOException ex) {
-            Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                    MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination),
-                    ex);
-            return status;
-        }
-        try {
+        try (final BufferedWriter bw = new BufferedWriter(new FileWriter(destination));) {
             if (fHeader != null) {
                 bw.write(fHeader);
                 bw.append('\n');
@@ -98,11 +89,6 @@ public class ExportToTextJob extends Job {
                     MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination),
                     ex);
             return status;
-        } finally {
-            try {
-                bw.close();
-            } catch (IOException e) {
-            }
         }
     }
 
This page took 0.025967 seconds and 5 git commands to generate.