Bug 501707 - [Tests] Reduce warnings in org.eclipse.test.performance

* Some more generics.
* Try-with-resources


Change-Id: Ida6bd3309f8266270c4a0f32fcb4a24008c67f98
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java
index 8ae0351..e8011dc 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java
@@ -64,13 +64,11 @@
 
         @Override
         public void run() {
-            try {
-                BufferedReader reader = new BufferedReader(new InputStreamReader(fProcessOutput));
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(fProcessOutput))) {
                 String line = null;
                 while ((line = reader.readLine()) != null) {
                     fStream.println(line);
                 }
-                reader.close();
             } catch (IOException e) {
                 e.printStackTrace();
             }
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java
index 69b55d3..d177c20 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2003, 2016 IBM Corporation and others. 
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -138,23 +139,13 @@
   }
 
   private StringTokenizer readTokens(String procPath, boolean skipFirst) {
-    BufferedReader rdr = null;
-    try {
-      rdr = new BufferedReader(new FileReader(procPath));
+    try (BufferedReader rdr = new BufferedReader(new FileReader(procPath));){
       if (skipFirst)
         rdr.readLine(); // throw away the heading line
       return new StringTokenizer(rdr.readLine());
     } catch (IOException e) {
       PerformanceTestPlugin.log(e);
     }
-    finally {
-      try {
-        if (rdr != null)
-          rdr.close();
-      } catch (IOException e) {
-        // silently ignored
-      }
-    }
     return null;
   }
 
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/DataPoint.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/DataPoint.java
index 5c4cda6..cef23eb 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/DataPoint.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/DataPoint.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -18,9 +19,9 @@
 public class DataPoint {
 
     private int fStep;
-    private Map fScalars;
+    private Map<Dim, Scalar> fScalars;
 
-    public DataPoint(int step, Map values) {
+    public DataPoint(int step, Map<Dim, Scalar> values) {
         fStep = step;
         fScalars = values;
     }
@@ -30,11 +31,11 @@
     }
 
     public Dim[] getDimensions() {
-        Set set = fScalars.keySet();
-        return (Dim[]) set.toArray(new Dim[set.size()]);
+        Set<Dim> set = fScalars.keySet();
+        return set.toArray(new Dim[set.size()]);
     }
 
-    public Collection<?> getDimensions2() {
+    public Collection<Dim> getDimensions2() {
         return fScalars.keySet();
     }
 
@@ -43,11 +44,11 @@
     }
 
     public Scalar[] getScalars() {
-        return (Scalar[]) fScalars.values().toArray(new Scalar[fScalars.size()]);
+        return fScalars.values().toArray(new Scalar[fScalars.size()]);
     }
 
     public Scalar getScalar(Dim dimension) {
-        return (Scalar) fScalars.get(dimension);
+        return fScalars.get(dimension);
     }
 
     @Override
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/Sample.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/Sample.java
index c70e1b3..fc0b9ca 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/Sample.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/data/Sample.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -21,7 +22,7 @@
 
     String      fScenarioID;
     long        fStartTime;
-    Map         fProperties;
+    Map<String, String> fProperties;
     DataPoint[] fDataPoints;
 
     boolean     fIsSummary;
@@ -31,7 +32,7 @@
     int         fCommentType;
     String      fComment;
 
-    public Sample(String scenarioID, long starttime, Map properties, DataPoint[] dataPoints) {
+    public Sample(String scenarioID, long starttime, Map<String, String> properties, DataPoint[] dataPoints) {
         Assert.assertTrue("scenarioID is null", scenarioID != null); //$NON-NLS-1$
         fScenarioID = scenarioID;
         fStartTime = starttime;
@@ -66,14 +67,14 @@
     }
 
     public String getProperty(String name) {
-        return (String) fProperties.get(name);
+        return fProperties.get(name);
     }
 
     public String[] getPropertyKeys() {
         if (fProperties == null)
             return new String[0];
-        Set set = fProperties.keySet();
-        return (String[]) set.toArray(new String[set.size()]);
+        Set<String> set = fProperties.keySet();
+        return set.toArray(new String[set.size()]);
     }
 
     public DataPoint[] getDataPoints() {
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DB.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DB.java
index dd94616..e74ad4c 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DB.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DB.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2000, 2016 IBM Corporation and others. 
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -158,7 +159,7 @@
     }
 
     // Datapaoints
-    public static DataPoint[] queryDataPoints(final Variations variations, final String scenarioName, final Set dims) {
+    public static DataPoint[] queryDataPoints(final Variations variations, final String scenarioName, final Set<Dim> dims) {
         return getDefault().internalQueryDataPoints(variations, scenarioName, dims);
     }
 
@@ -509,7 +510,7 @@
         }
     }
 
-    private DataPoint[] internalQueryDataPoints(final Variations variations, final String scenarioName, final Set dimSet) {
+    private DataPoint[] internalQueryDataPoints(final Variations variations, final String scenarioName, final Set<Dim> dimSet) {
         if (fSQL == null) {
             return null;
         }
@@ -518,10 +519,9 @@
         if (DEBUG) {
             System.out.print("	- query data points from DB for scenario " + scenarioName + "..."); //$NON-NLS-1$ //$NON-NLS-2$
         }
-        ResultSet rs = null;
-        try {
-            final ArrayList<DataPoint> dataPoints = new ArrayList<>();
-            rs = fSQL.queryDataPoints(variations, scenarioName);
+        
+        final ArrayList<DataPoint> dataPoints = new ArrayList<>();
+        try (ResultSet rs = fSQL.queryDataPoints(variations, scenarioName)){
             if (DEBUG) {
                 final long time = System.currentTimeMillis();
                 System.out.println("done in " + (time - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -532,25 +532,23 @@
                 final int step = rs.getInt(2);
 
                 final HashMap<Dim, Scalar> map = new HashMap<>();
-                final ResultSet rs2 = fSQL.queryScalars(datapoint_id);
-                while (rs2.next()) {
-                    final int dim_id = rs2.getInt(1);
-                    final long value = rs2.getBigDecimal(2).longValue();
-                    final Dim dim = Dim.getDimension(dim_id);
-                    if (dim != null) {
-                        if ((dimSet == null) || dimSet.contains(dim)) {
-                            map.put(dim, new Scalar(dim, value));
+                try (final ResultSet rs2 = fSQL.queryScalars(datapoint_id)) {
+                    while (rs2.next()) {
+                        final int dim_id = rs2.getInt(1);
+                        final long value = rs2.getBigDecimal(2).longValue();
+                        final Dim dim = Dim.getDimension(dim_id);
+                        if (dim != null) {
+                            if ((dimSet == null) || dimSet.contains(dim)) {
+                                map.put(dim, new Scalar(dim, value));
+                            }
                         }
                     }
-                }
-                if (map.size() > 0) {
-                    dataPoints.add(new DataPoint(step, map));
-                }
+                    if (map.size() > 0) {
+                        dataPoints.add(new DataPoint(step, map));
+                    }
 
-                rs2.close();
+                }
             }
-            rs.close();
-
             final int n = dataPoints.size();
             if (DEBUG) {
                 final long time = System.currentTimeMillis();
@@ -561,17 +559,6 @@
         }
         catch (final SQLException e) {
             PerformanceTestPlugin.log(e);
-
-        }
-        finally {
-            if (rs != null) {
-                try {
-                    rs.close();
-                }
-                catch (final SQLException e1) {
-                    // ignored
-                }
-            }
         }
         return null;
     }
@@ -588,9 +575,7 @@
         if (DEBUG) {
             System.out.print("	- query distinct values from DB for scenario pattern '" + scenarioPattern + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
         }
-        ResultSet result = null;
-        try {
-            result = fSQL.queryVariations(variations.toExactMatchString(), scenarioPattern);
+        try (ResultSet result = fSQL.queryVariations(variations.toExactMatchString(), scenarioPattern)){
             while (result.next()) {
                 final Variations v = new Variations();
                 v.parseDB(result.getString(1));
@@ -599,20 +584,10 @@
                     values.add(build);
                 }
             }
-        }
-        catch (final SQLException e) {
+        } catch (final SQLException e) {
             PerformanceTestPlugin.log(e);
 
-        }
-        finally {
-            if (result != null) {
-                try {
-                    result.close();
-                }
-                catch (final SQLException e1) {
-                    // ignored
-                }
-            }
+        } finally {
             if (DEBUG) {
                 final long time = System.currentTimeMillis();
                 System.out.println("done in " + (time - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -628,30 +603,18 @@
         if (DEBUG) {
             System.out.print("	- query failure from DB for scenario pattern '" + scenarioPattern + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
         }
-        ResultSet result = null;
-        try {
+        try (ResultSet result = fSQL.queryFailure(variations, scenarioPattern)) {
             final Map<String, String> map = new HashMap<>();
-            result = fSQL.queryFailure(variations, scenarioPattern);
             while (result.next()) {
                 final String scenario = result.getString(1);
                 final String message = result.getString(2);
                 map.put(scenario, message);
             }
             return map;
-        }
-        catch (final SQLException e) {
+        } catch (final SQLException e) {
             PerformanceTestPlugin.log(e);
 
-        }
-        finally {
-            if (result != null) {
-                try {
-                    result.close();
-                }
-                catch (final SQLException e1) {
-                    // ignored
-                }
-            }
+        } finally {
             if (DEBUG) {
                 final long time = System.currentTimeMillis();
                 System.out.println("done in " + (time - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -671,29 +634,15 @@
         if (DEBUG) {
             System.out.print("	- query scenario names from DB for scenario pattern '" + scenarioPattern + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
         }
-        ResultSet result = null;
-        try {
-            result = fSQL.queryScenarios(variations, scenarioPattern);
+        try (ResultSet result = fSQL.queryScenarios(variations, scenarioPattern)) {
             final ArrayList<String> scenarios = new ArrayList<>();
             while (result.next()) {
                 scenarios.add(result.getString(1));
             }
             return scenarios.toArray(new String[scenarios.size()]);
-
-        }
-        catch (final SQLException e) {
+        } catch (final SQLException e) {
             PerformanceTestPlugin.log(e);
-
-        }
-        finally {
-            if (result != null) {
-                try {
-                    result.close();
-                }
-                catch (final SQLException e1) {
-                    // ignored
-                }
-            }
+        } finally {
             if (DEBUG) {
                 final long time = System.currentTimeMillis();
                 System.out.println("done in " + (time - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -788,10 +737,11 @@
                 int commentKind = 0;
                 String comment = null;
                 if (comment_id != 0) {
-                    final ResultSet rs2 = fSQL.getComment(comment_id);
-                    if (rs2.next()) {
-                        commentKind = rs2.getInt(1);
-                        comment = rs2.getString(2);
+                    try (final ResultSet rs2 = fSQL.getComment(comment_id)) {
+                        if (rs2.next()) {
+                            commentKind = rs2.getInt(1);
+                            comment = rs2.getString(2);
+                        }
                     }
                 }
                 if (dim_id != 0) {
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DBHelpers.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DBHelpers.java
index 92f4fd2..a88d915 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DBHelpers.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/DBHelpers.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2005, 2016 IBM Corporation and others. 
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -54,11 +55,11 @@
     }
 
     void renameVariation(String oldName, String newName) throws SQLException {
-        PreparedStatement update = fConnection.prepareStatement("update VARIATION set KEYVALPAIRS = ? where KEYVALPAIRS = ? "); //$NON-NLS-1$
-        update.setString(1, newName);
-        update.setString(2, oldName);
-        update.executeUpdate();
-        update.close();
+        try (PreparedStatement update = fConnection.prepareStatement("update VARIATION set KEYVALPAIRS = ? where KEYVALPAIRS = ? ")) { //$NON-NLS-1$
+            update.setString(1, newName);
+            update.setString(2, oldName);
+            update.executeUpdate();
+        }
     }
 
     void dumpSummaries(Variations variations, String scenarioPattern) {
@@ -68,30 +69,31 @@
     }
 
     void count(PrintStream ps) throws SQLException {
-        PreparedStatement stmt = fConnection
-                .prepareStatement("select count(*) from SCALAR where DATAPOINT_ID not in (select DATAPOINT.ID from DATAPOINT)"); //$NON-NLS-1$
-        ResultSet set = stmt.executeQuery();
-        if (set.next())
-            ps.println("count: " + set.getInt(1)); //$NON-NLS-1$
-        set.close();
-        stmt.close();
+        try (PreparedStatement stmt = fConnection.prepareStatement("select count(*) from SCALAR where DATAPOINT_ID not in (select DATAPOINT.ID from DATAPOINT)"); //$NON-NLS-1$
+                ResultSet set = stmt.executeQuery()) {
+            if (set.next())
+                ps.println("count: " + set.getInt(1)); //$NON-NLS-1$
+        }
     }
 
     void countDimension(PrintStream ps, Dim dim) throws SQLException {
-        PreparedStatement stmt = fConnection.prepareStatement("select count(*) from SCALAR where DIM_ID = ?"); //$NON-NLS-1$
-        stmt.setInt(1, dim.getId());
-        ResultSet set = stmt.executeQuery();
-        if (set.next())
-            ps.println("dimension " + dim + ": " + set.getInt(1)); //$NON-NLS-1$ //$NON-NLS-2$
+        try (PreparedStatement stmt = fConnection.prepareStatement("select count(*) from SCALAR where DIM_ID = ?")) { //$NON-NLS-1$
+            stmt.setInt(1, dim.getId());
+            try (ResultSet set = stmt.executeQuery()) {
+                if (set.next())
+                    ps.println("dimension " + dim + ": " + set.getInt(1)); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
     }
 
     void countAllDimensions(PrintStream ps) throws SQLException {
-        PreparedStatement stmt = fConnection.prepareStatement("select distinct DIM_ID from SCALAR"); //$NON-NLS-1$
-        ResultSet set = stmt.executeQuery();
-        while (set.next()) {
-            Dim dimension = Dim.getDimension(set.getInt(1));
-            if (dimension != null)
-                countDimension(ps, dimension);
+        try (PreparedStatement stmt = fConnection.prepareStatement("select distinct DIM_ID from SCALAR"); //$NON-NLS-1$
+                ResultSet set = stmt.executeQuery()) {
+            while (set.next()) {
+                Dim dimension = Dim.getDimension(set.getInt(1));
+                if (dimension != null)
+                    countDimension(ps, dimension);
+            }
         }
     }
 
@@ -99,30 +101,34 @@
         PreparedStatement stmt = fConnection
                 .prepareStatement("select count(*) from SAMPLE, VARIATION where VARIATION.KEYVALPAIRS = ? and SAMPLE.VARIATION_ID = VARIATION.ID"); //$NON-NLS-1$
         stmt.setString(1, v.toExactMatchString());
-        ResultSet set = stmt.executeQuery();
-        int n = 0;
-        if (set.next())
-            n = set.getInt(1);
-        ps.println("samples with variation " + v + ": " + n); //$NON-NLS-1$ //$NON-NLS-2$
-        return n;
+        try (ResultSet set = stmt.executeQuery()) {
+            int n = 0;
+            if (set.next())
+                n = set.getInt(1);
+            ps.println("samples with variation " + v + ": " + n); //$NON-NLS-1$ //$NON-NLS-2$
+            return n;
+        }
     }
 
     void countDatapoints(PrintStream ps, Variations v) throws SQLException {
-        PreparedStatement stmt = fConnection
-                .prepareStatement("select count(*) from DATAPOINT, SAMPLE, VARIATION where VARIATION.KEYVALPAIRS = ? and SAMPLE.VARIATION_ID = VARIATION.ID and DATAPOINT.SAMPLE_ID= SAMPLE.ID"); //$NON-NLS-1$
-        stmt.setString(1, v.toExactMatchString());
-        ResultSet set = stmt.executeQuery();
-        if (set.next())
-            ps.println("datapoints with variation " + v + ": " + set.getInt(1)); //$NON-NLS-1$ //$NON-NLS-2$
+        try (PreparedStatement stmt = fConnection.prepareStatement("select count(*) from DATAPOINT, SAMPLE, VARIATION where VARIATION.KEYVALPAIRS = ? and SAMPLE.VARIATION_ID = VARIATION.ID and DATAPOINT.SAMPLE_ID= SAMPLE.ID")) { //$NON-NLS-1$
+            stmt.setString(1, v.toExactMatchString());
+            try (ResultSet set = stmt.executeQuery()) {
+                if (set.next())
+                    ps.println("datapoints with variation " + v + ": " + set.getInt(1)); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
     }
 
     void countScalars(PrintStream ps, Variations v) throws SQLException {
-        PreparedStatement stmt = fConnection
-                .prepareStatement("select count(*) from SCALAR, DATAPOINT, SAMPLE, VARIATION where VARIATION.KEYVALPAIRS = ? and SAMPLE.VARIATION_ID = VARIATION.ID and DATAPOINT.SAMPLE_ID= SAMPLE.ID and DATAPOINT.ID = SCALAR.DATAPOINT_ID"); //$NON-NLS-1$
-        stmt.setString(1, v.toExactMatchString());
-        ResultSet set = stmt.executeQuery();
-        if (set.next())
-            ps.println("scalars with variation " + v + ": " + set.getInt(1)); //$NON-NLS-1$ //$NON-NLS-2$
+        try (PreparedStatement stmt = fConnection
+                .prepareStatement("select count(*) from SCALAR, DATAPOINT, SAMPLE, VARIATION where VARIATION.KEYVALPAIRS = ? and SAMPLE.VARIATION_ID = VARIATION.ID and DATAPOINT.SAMPLE_ID= SAMPLE.ID and DATAPOINT.ID = SCALAR.DATAPOINT_ID")) { //$NON-NLS-1$
+            stmt.setString(1, v.toExactMatchString());
+            try (ResultSet set = stmt.executeQuery()) {
+                if (set.next())
+                    ps.println("scalars with variation " + v + ": " + set.getInt(1)); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
     }
 
     void removeSamples(Variations v) throws SQLException {
@@ -132,12 +138,14 @@
         int n = countSamples(System.out, v);
 
         int variation_id = 0;
-        PreparedStatement stmt = fConnection.prepareStatement("select ID from VARIATION where KEYVALPAIRS = ?"); //$NON-NLS-1$
-        stmt.setString(1, v.toExactMatchString());
-        ResultSet set = stmt.executeQuery();
-        if (set.next()) {
-            variation_id = set.getInt(1);
-            System.err.println("variation_id: " + variation_id); //$NON-NLS-1$
+        try (PreparedStatement stmt = fConnection.prepareStatement("select ID from VARIATION where KEYVALPAIRS = ?")) { //$NON-NLS-1$
+            stmt.setString(1, v.toExactMatchString());
+            try (ResultSet set = stmt.executeQuery()) {
+                if (set.next()) {
+                    variation_id = set.getInt(1);
+                    System.err.println("variation_id: " + variation_id); //$NON-NLS-1$
+                }
+            }
         }
 
         if (variation_id <= 0) {
@@ -145,160 +153,128 @@
             return;
         }
 
-        PreparedStatement iterSamples = fConnection
-                .prepareStatement("select SAMPLE.ID, SAMPLE.SCENARIO_ID from SAMPLE where SAMPLE.VARIATION_ID = ?"); //$NON-NLS-1$
-        PreparedStatement iterDatapoints = fConnection
-                .prepareStatement("select DATAPOINT.ID from DATAPOINT where DATAPOINT.SAMPLE_ID = ?"); //$NON-NLS-1$
+        try (PreparedStatement iterSamples = fConnection.prepareStatement("select SAMPLE.ID, SAMPLE.SCENARIO_ID from SAMPLE where SAMPLE.VARIATION_ID = ?"); //$NON-NLS-1$
+                PreparedStatement iterDatapoints = fConnection.prepareStatement("select DATAPOINT.ID from DATAPOINT where DATAPOINT.SAMPLE_ID = ?"); //$NON-NLS-1$
 
-        PreparedStatement deleteScalars = fConnection.prepareStatement("delete from SCALAR where DATAPOINT_ID = ?"); //$NON-NLS-1$
-        PreparedStatement deleteDatapoints = fConnection.prepareStatement("delete from DATAPOINT where SAMPLE_ID = ?"); //$NON-NLS-1$
-        PreparedStatement deleteSamples = fConnection.prepareStatement("delete from SAMPLE where SAMPLE.ID = ?"); //$NON-NLS-1$
-        PreparedStatement deleteScenario = fConnection.prepareStatement("delete from SCENARIO where SCENARIO.ID = ?"); //$NON-NLS-1$
+                PreparedStatement deleteScalars = fConnection.prepareStatement("delete from SCALAR where DATAPOINT_ID = ?"); //$NON-NLS-1$
+                PreparedStatement deleteDatapoints = fConnection.prepareStatement("delete from DATAPOINT where SAMPLE_ID = ?"); //$NON-NLS-1$
+                PreparedStatement deleteSamples = fConnection.prepareStatement("delete from SAMPLE where SAMPLE.ID = ?"); //$NON-NLS-1$
+                PreparedStatement deleteScenario = fConnection.prepareStatement("delete from SCENARIO where SCENARIO.ID = ?")) { //$NON-NLS-1$
 
-        ResultSet samples = null, datapoints = null;
-        iterSamples.setInt(1, variation_id);
-        samples = iterSamples.executeQuery();
-        while (samples.next()) {
-            int sample_id = samples.getInt(1);
-            int scenario_id = samples.getInt(2);
-            System.out.print(n + ": sample(" + sample_id + "):"); //$NON-NLS-1$ //$NON-NLS-2$
-            iterDatapoints.setInt(1, sample_id);
-            datapoints = iterDatapoints.executeQuery();
-            int dps = 0;
-            while (datapoints.next()) {
-                int dp_id = datapoints.getInt(1);
-                //ps.println("  dp: " + dp_id); //$NON-NLS-1$
-                if (delete) {
-                    deleteScalars.setInt(1, dp_id);
-                    try {
-                        deleteScalars.executeUpdate();
-                        fConnection.commit();
-                        dps++;
+            iterSamples.setInt(1, variation_id);
+            try (ResultSet samples = iterSamples.executeQuery()) {
+                while (samples.next()) {
+                    int sample_id = samples.getInt(1);
+                    int scenario_id = samples.getInt(2);
+                    System.out.print(n + ": sample(" + sample_id + "):"); //$NON-NLS-1$ //$NON-NLS-2$
+                    iterDatapoints.setInt(1, sample_id);
+                    int dps = 0;
+                    try (ResultSet datapoints = iterDatapoints.executeQuery()) {
+                        while (datapoints.next()) {
+                            int dp_id = datapoints.getInt(1);
+                            // ps.println(" dp: " + dp_id); //$NON-NLS-1$
+                            if (delete) {
+                                deleteScalars.setInt(1, dp_id);
+                                try {
+                                    deleteScalars.executeUpdate();
+                                    fConnection.commit();
+                                    dps++;
+                                } catch (SQLException e) {
+                                    System.err.println("removing scalars: " + e); //$NON-NLS-1$
+                                }
+                            }
+                        }
                     }
-                    catch (SQLException e) {
-                        System.err.println("removing scalars: " + e); //$NON-NLS-1$
+                    System.out.println(" dps: " + dps); //$NON-NLS-1$
+                    if (delete) {
+                        deleteDatapoints.setInt(1, sample_id);
+                        try {
+                            deleteDatapoints.executeUpdate();
+                            fConnection.commit();
+                        } catch (SQLException e1) {
+                            System.err.println("removing datapoints: " + e1); //$NON-NLS-1$
+                        }
+
+                        deleteSamples.setInt(1, sample_id);
+                        try {
+                            deleteSamples.executeUpdate();
+                            fConnection.commit();
+                        } catch (SQLException e) {
+                            System.err.println("removing sample: " + e); //$NON-NLS-1$
+                        }
+
+                        deleteScenario.setInt(1, scenario_id);
+                        try {
+                            deleteScenario.executeUpdate();
+                            fConnection.commit();
+                        } catch (SQLException e) {
+                            // System.err.println("removing scenario: " + e); //$NON-NLS-1$
+                        }
                     }
+                    n--;
                 }
             }
-            System.out.println(" dps: " + dps); //$NON-NLS-1$
             if (delete) {
-                deleteDatapoints.setInt(1, sample_id);
-                try {
-                    deleteDatapoints.executeUpdate();
-                    fConnection.commit();
+                try (PreparedStatement deleteSummaries = fConnection.prepareStatement("delete from SUMMARYENTRY where VARIATION_ID = ?")) { //$NON-NLS-1$
+                    deleteSummaries.setInt(1, variation_id);
+                    deleteSummaries.executeUpdate();
                 }
-                catch (SQLException e1) {
-                    System.err.println("removing datapoints: " + e1); //$NON-NLS-1$
-                }
-
-                deleteSamples.setInt(1, sample_id);
-                try {
-                    deleteSamples.executeUpdate();
-                    fConnection.commit();
-                }
-                catch (SQLException e) {
-                    System.err.println("removing sample: " + e); //$NON-NLS-1$
-                }
-
-                deleteScenario.setInt(1, scenario_id);
-                try {
-                    deleteScenario.executeUpdate();
-                    fConnection.commit();
-                }
-                catch (SQLException e) {
-                    // System.err.println("removing scenario: " + e); //$NON-NLS-1$
+                try (PreparedStatement deleteVariation = fConnection.prepareStatement("delete from VARIATION where ID = ?")) { //$NON-NLS-1$
+                    deleteVariation.setInt(1, variation_id);
+                    try {
+                        deleteVariation.executeUpdate();
+                    } catch (SQLException e) {
+                        System.err.println("removing variation: " + e); //$NON-NLS-1$
+                    }
                 }
             }
-            n--;
+
         }
-        if (delete) {
-            PreparedStatement deleteSummaries = fConnection.prepareStatement("delete from SUMMARYENTRY where VARIATION_ID = ?"); //$NON-NLS-1$
-            deleteSummaries.setInt(1, variation_id);
-            deleteSummaries.executeUpdate();
-            deleteSummaries.close();
-
-            PreparedStatement deleteVariation = fConnection.prepareStatement("delete from VARIATION where ID = ?"); //$NON-NLS-1$
-            deleteVariation.setInt(1, variation_id);
-            try {
-                deleteVariation.executeUpdate();
-            }
-            catch (SQLException e) {
-                System.err.println("removing variation: " + e); //$NON-NLS-1$
-            }
-            deleteVariation.close();
-        }
-
-        if (samples != null)
-            samples.close();
-        if (datapoints != null)
-            datapoints.close();
-
-        if (iterSamples != null)
-            iterSamples.close();
-        if (iterDatapoints != null)
-            iterDatapoints.close();
-
-        if (deleteSamples != null)
-            deleteSamples.close();
-        if (deleteScenario != null)
-            deleteScenario.close();
-        if (deleteScalars != null)
-            deleteScalars.close();
-        if (deleteDatapoints != null)
-            deleteDatapoints.close();
     }
 
     void countSamplesWithNullVariations() throws SQLException {
-        Statement stmt = fConnection.createStatement();
-        ResultSet rs = stmt.executeQuery("select count(*) from SAMPLE where SAMPLE.VARIATION_ID is null"); //$NON-NLS-1$
-        while (rs.next()) {
-            int config_id = rs.getInt(1);
-            System.out.println("samples with NULL variation: " + config_id); //$NON-NLS-1$
+        try (Statement stmt = fConnection.createStatement(); ResultSet rs = stmt.executeQuery("select count(*) from SAMPLE where SAMPLE.VARIATION_ID is null")) { //$NON-NLS-1$
+            while (rs.next()) {
+                int config_id = rs.getInt(1);
+                System.out.println("samples with NULL variation: " + config_id); //$NON-NLS-1$
+            }
         }
-        rs.close();
-        stmt.close();
     }
 
     void removeDimension(Dim dim) throws SQLException {
-        PreparedStatement q = fConnection.prepareStatement("delete from SCALAR where SCALAR.DIM_ID = ?"); //$NON-NLS-1$
-        q.setInt(1, dim.getId());
-        q.executeUpdate();
-        q.close();
+        try (PreparedStatement q = fConnection.prepareStatement("delete from SCALAR where SCALAR.DIM_ID = ?")) { //$NON-NLS-1$
+            q.setInt(1, dim.getId());
+            q.executeUpdate();
+        }
     }
 
     void dumpScenarios(PrintStream ps, String pattern) throws SQLException {
-        PreparedStatement stmt = fConnection.prepareStatement("select NAME from SCENARIO where NAME like ? order by NAME"); //$NON-NLS-1$
-        stmt.setString(1, pattern);
-        ResultSet rs = stmt.executeQuery();
-        while (rs.next())
-            ps.println(rs.getString(1));
-        rs.close();
-        stmt.close();
+        try (PreparedStatement stmt = fConnection.prepareStatement("select NAME from SCENARIO where NAME like ? order by NAME")) { //$NON-NLS-1$
+            stmt.setString(1, pattern);
+            try (ResultSet rs = stmt.executeQuery()) {
+                while (rs.next())
+                    ps.println(rs.getString(1));
+            }
+        }
     }
 
     void dumpSizes(PrintStream ps) throws SQLException {
         if (fConnection == null)
             return;
-        Statement stmt = fConnection.createStatement();
-        try {
-            ResultSet rs = stmt
-                    .executeQuery("SELECT sys.systables.tablename FROM sys.systables WHERE sys.systables.tablename NOT LIKE 'SYS%' "); //$NON-NLS-1$
+        
+        try (Statement stmt = fConnection.createStatement(); ResultSet rs = stmt.executeQuery("SELECT sys.systables.tablename FROM sys.systables WHERE sys.systables.tablename NOT LIKE 'SYS%' ")) { //$NON-NLS-1$
+            // $NON-NLS-1$
             while (rs.next())
                 dumpSize(ps, rs.getString(1));
             rs.close();
         }
-        finally {
-            stmt.close();
-        }
     }
 
     void dumpSize(PrintStream ps, String table) throws SQLException {
-        Statement stmt = fConnection.createStatement();
-        ResultSet rs = stmt.executeQuery("select Count(*) from " + table); //$NON-NLS-1$
-        if (rs.next())
-            ps.println(table + ": " + rs.getInt(1)); //$NON-NLS-1$
-        rs.close();
-        stmt.close();
+        try (Statement stmt = fConnection.createStatement(); ResultSet rs = stmt.executeQuery("select Count(*) from " + table)) { //$NON-NLS-1$
+            if (rs.next())
+                ps.println(table + ": " + rs.getInt(1)); //$NON-NLS-1$
+        }
     }
 
     public void dumpAll(PrintStream ps, int maxRow) throws SQLException {
@@ -306,39 +282,33 @@
             return;
         if (maxRow < 0)
             maxRow = 1000000;
-        Statement stmt = fConnection.createStatement();
-        try {
-            ResultSet rs = stmt
-                    .executeQuery("select SYS.SYSTABLES.TABLENAME from SYS.SYSTABLES where SYS.SYSTABLES.TABLENAME not like 'SYS%' "); //$NON-NLS-1$
+        
+        try (Statement stmt = fConnection.createStatement(); ResultSet rs = stmt.executeQuery("select SYS.SYSTABLES.TABLENAME from SYS.SYSTABLES where SYS.SYSTABLES.TABLENAME not like 'SYS%' ")) { //$NON-NLS-1$
             while (rs.next()) {
                 dumpTable(ps, rs.getString(1), maxRow);
                 ps.println();
             }
-            rs.close();
-        }
-        finally {
-            stmt.close();
         }
     }
 
     void dumpTable(PrintStream ps, String tableName, int maxRow) throws SQLException {
         ps.print(tableName + '(');
-        Statement select = fConnection.createStatement();
-        ResultSet result = select.executeQuery("select * from " + tableName); //$NON-NLS-1$
-        ResultSetMetaData metaData = result.getMetaData();
-        int n = metaData.getColumnCount();
-        for (int i = 0; i < n; i++) {
-            ps.print(metaData.getColumnLabel(i + 1));
-            if (i < n - 1)
-                ps.print(", "); //$NON-NLS-1$
+        try (Statement select = fConnection.createStatement();
+                ResultSet result = select.executeQuery("select * from " + tableName)) { //$NON-NLS-1$
+            ResultSetMetaData metaData = result.getMetaData();
+            int n = metaData.getColumnCount();
+            for (int i = 0; i < n; i++) {
+                ps.print(metaData.getColumnLabel(i + 1));
+                if (i < n - 1)
+                    ps.print(", "); //$NON-NLS-1$
+            }
+            ps.println("):"); //$NON-NLS-1$
+            for (int r = 0; result.next() && r < maxRow; r++) {
+                for (int i = 0; i < n; i++)
+                    ps.print(' ' + result.getString(i + 1));
+                ps.println();
+            }
         }
-        ps.println("):"); //$NON-NLS-1$
-        for (int r = 0; result.next() && r < maxRow; r++) {
-            for (int i = 0; i < n; i++)
-                ps.print(' ' + result.getString(i + 1));
-            ps.println();
-        }
-        select.close();
     }
 
     void view(PrintStream ps, Variations v, String scenarioPattern) throws SQLException {
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/SQL.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/SQL.java
index 84743c7..07f0465 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/SQL.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/SQL.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -41,29 +42,30 @@
         boolean needsFailures = true;
         boolean needsComments = true;
 
-        Statement statement = fConnection.createStatement();
-        ResultSet rs = statement
-                .executeQuery("select SYS.SYSTABLES.TABLENAME from SYS.SYSTABLES where SYS.SYSTABLES.TABLENAME not like 'SYS%'"); //$NON-NLS-1$
-        while (rs.next()) {
-            String tablename = rs.getString(1);
-            if ("SUMMARYENTRY".equals(tablename)) //$NON-NLS-1$
-                needsUpgrade = false;
-            else if ("CONFIG_ORG".equals(tablename)) //$NON-NLS-1$
-                fCompatibility = true;
-            else if ("VARIATION".equals(tablename)) //$NON-NLS-1$
-                needsInitialization = false;
-            else if ("FAILURE".equals(tablename)) //$NON-NLS-1$
-                needsFailures = false;
-            else if ("COMMENT".equals(tablename)) //$NON-NLS-1$
-                needsComments = false;
-        }
-        if (!fCompatibility) {
-            // check whether table SAMPLE still has the CONFIG_ID column
-            rs = statement
-                    .executeQuery("select count(*) from SYS.SYSTABLES, SYS.SYSCOLUMNS where SYS.SYSTABLES.TABLENAME = 'SAMPLE' and " + //$NON-NLS-1$
-                            "SYS.SYSTABLES.TABLEID = SYS.SYSCOLUMNS.REFERENCEID and SYS.SYSCOLUMNS.COLUMNNAME = 'CONFIG_ID' "); //$NON-NLS-1$
-            if (rs.next() && rs.getInt(1) == 1)
-                fCompatibility = true;
+        try (Statement statement = fConnection.createStatement()) {
+            try (ResultSet rs = statement.executeQuery("select SYS.SYSTABLES.TABLENAME from SYS.SYSTABLES where SYS.SYSTABLES.TABLENAME not like 'SYS%'")) { //$NON-NLS-1$
+                while (rs.next()) {
+                    String tablename = rs.getString(1);
+                    if ("SUMMARYENTRY".equals(tablename)) //$NON-NLS-1$
+                        needsUpgrade = false;
+                    else if ("CONFIG_ORG".equals(tablename)) //$NON-NLS-1$
+                        fCompatibility = true;
+                    else if ("VARIATION".equals(tablename)) //$NON-NLS-1$
+                        needsInitialization = false;
+                    else if ("FAILURE".equals(tablename)) //$NON-NLS-1$
+                        needsFailures = false;
+                    else if ("COMMENT".equals(tablename)) //$NON-NLS-1$
+                        needsComments = false;
+                }
+            }
+            if (!fCompatibility) {
+                // check whether table SAMPLE still has the CONFIG_ID column
+                try (ResultSet rs = statement.executeQuery("select count(*) from SYS.SYSTABLES, SYS.SYSCOLUMNS where SYS.SYSTABLES.TABLENAME = 'SAMPLE' and " + //$NON-NLS-1$
+                        "SYS.SYSTABLES.TABLEID = SYS.SYSCOLUMNS.REFERENCEID and SYS.SYSCOLUMNS.COLUMNNAME = 'CONFIG_ID' ")) { //$NON-NLS-1$
+                    if (rs.next() && rs.getInt(1) == 1)
+                        fCompatibility = true;
+                }
+            }
         }
 
         if (needsInitialization)
@@ -122,9 +124,7 @@
     }
 
     private void initialize() throws SQLException {
-        Statement stmt = null;
-        try {
-            stmt = fConnection.createStatement();
+        try  (Statement stmt = fConnection.createStatement()) {
             stmt.executeUpdate("create table VARIATION (" + //$NON-NLS-1$
                     "ID int unique not null GENERATED ALWAYS AS IDENTITY," + //$NON-NLS-1$
                     "KEYVALPAIRS varchar(10000) not null " + //$NON-NLS-1$
@@ -206,17 +206,10 @@
             fConnection.commit();
 
         }
-        finally {
-            if (stmt != null)
-                stmt.close();
-        }
     }
 
     private void upgradeDB() throws SQLException {
-        Statement stmt = null;
-        try {
-            stmt = fConnection.createStatement();
-
+        try (Statement stmt = fConnection.createStatement();){
             stmt.executeUpdate("create table SUMMARYENTRY (" + //$NON-NLS-1$
                     "VARIATION_ID int not null," + //$NON-NLS-1$
                     "SCENARIO_ID int not null," + //$NON-NLS-1$
@@ -235,17 +228,10 @@
             fConnection.commit();
 
         }
-        finally {
-            if (stmt != null)
-                stmt.close();
-        }
     }
 
     private void addCommentTable() throws SQLException {
-        Statement stmt = null;
-        try {
-            stmt = fConnection.createStatement();
-
+        try (Statement stmt = fConnection.createStatement()){
             stmt.executeUpdate("create table COMMENT (" + //$NON-NLS-1$
                     "ID int unique not null GENERATED ALWAYS AS IDENTITY," + //$NON-NLS-1$
                     "KIND int not null," + //$NON-NLS-1$
@@ -258,17 +244,10 @@
             fConnection.commit();
 
         }
-        finally {
-            if (stmt != null)
-                stmt.close();
-        }
     }
 
     private void addFailureTable() throws SQLException {
-        Statement stmt = null;
-        try {
-            stmt = fConnection.createStatement();
-
+        try (Statement stmt = fConnection.createStatement();){
             stmt.executeUpdate("create table FAILURE (" + //$NON-NLS-1$
                     "VARIATION_ID int not null," + //$NON-NLS-1$
                     "SCENARIO_ID int not null," + //$NON-NLS-1$
@@ -284,25 +263,17 @@
             fConnection.commit();
 
         }
-        finally {
-            if (stmt != null)
-                stmt.close();
-        }
     }
 
     static int create(PreparedStatement stmt) throws SQLException {
         stmt.executeUpdate();
-        ResultSet rs = stmt.getGeneratedKeys();
-        if (rs != null) {
-            try {
+        try (ResultSet rs = stmt.getGeneratedKeys()) {
+            if (rs != null) {
                 if (rs.next()) {
                     BigDecimal idColVar = rs.getBigDecimal(1);
                     return idColVar.intValue();
                 }
             }
-            finally {
-                rs.close();
-            }
         }
         return 0;
     }
@@ -311,10 +282,10 @@
         if (fQueryScenario == null)
             fQueryScenario = fConnection.prepareStatement("select ID from SCENARIO where NAME = ?"); //$NON-NLS-1$
         fQueryScenario.setString(1, scenarioPattern);
-        ResultSet result = fQueryScenario.executeQuery();
-        while (result.next())
-            return result.getInt(1);
-
+        try (ResultSet result = fQueryScenario.executeQuery()) {
+            while (result.next())
+                return result.getInt(1);
+        }
         if (fInsertScenario == null)
             fInsertScenario = fConnection.prepareStatement(
                     "insert into SCENARIO (NAME) values (?)", Statement.RETURN_GENERATED_KEYS); //$NON-NLS-1$
@@ -327,10 +298,10 @@
             fQueryVariation = fConnection.prepareStatement("select ID from VARIATION where KEYVALPAIRS = ?"); //$NON-NLS-1$
         String exactMatchString = variations.toExactMatchString();
         fQueryVariation.setString(1, exactMatchString);
-        ResultSet result = fQueryVariation.executeQuery();
-        while (result.next())
-            return result.getInt(1);
-
+        try (ResultSet result = fQueryVariation.executeQuery()) {
+            while (result.next())
+                return result.getInt(1);
+        }
         if (fInsertVariation == null)
             fInsertVariation = fConnection.prepareStatement(
                     "insert into VARIATION (KEYVALPAIRS) values (?)", Statement.RETURN_GENERATED_KEYS); //$NON-NLS-1$
@@ -438,10 +409,10 @@
         fQuerySummaryEntry.setInt(3, dim_id);
         fQuerySummaryEntry.setShort(4, (short) (isGlobal ? 1 : 0));
         fQuerySummaryEntry.setInt(5, comment_id);
-        ResultSet result = fQuerySummaryEntry.executeQuery();
-        if (result.next() && result.getInt(1) > 0)
-            return;
-
+        try (ResultSet result = fQuerySummaryEntry.executeQuery()) {
+            if (result.next() && result.getInt(1) > 0)
+                return;
+        }
         if (fInsertSummaryEntry == null)
             fInsertSummaryEntry = fConnection
                     .prepareStatement("insert into SUMMARYENTRY (VARIATION_ID, SCENARIO_ID, DIM_ID, IS_GLOBAL, COMMENT_ID) values (?, ?, ?, ?, ?)"); //$NON-NLS-1$
@@ -522,10 +493,10 @@
             fQueryComment = fConnection.prepareStatement("select ID from COMMENT where KIND = ? and TEXT = ?"); //$NON-NLS-1$
         fQueryComment.setInt(1, commentKind);
         fQueryComment.setString(2, comment);
-        ResultSet result = fQueryComment.executeQuery();
-        while (result.next())
-            return result.getInt(1);
-
+        try (ResultSet result = fQueryComment.executeQuery()) {
+            while (result.next())
+                return result.getInt(1);
+        }
         if (fInsertComment == null)
             fInsertComment = fConnection.prepareStatement(
                     "insert into COMMENT (KIND, TEXT) values (?, ?)", Statement.RETURN_GENERATED_KEYS); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/Scenario.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/Scenario.java
index a431b0a..8076ece 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/Scenario.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/db/Scenario.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2004, 2016 IBM Corporation and others. 
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -38,7 +39,7 @@
         private String     fSeriesKey;
         private Set<Dim>        fQueryDimensions;
         private String     fScenarioPattern;
-        private Map<String, Map>        fMessages;
+        private Map<String, Map<String, String>>        fMessages;
 
         SharedState(Variations variations, String scenarioPattern, String seriesKey, Dim[] dimensions) {
             fVariations = variations;
@@ -57,7 +58,7 @@
                 Variations v = (Variations) fVariations.clone();
                 for (String name : names) {
                     v.put(fSeriesKey, name);
-                    Map map = DB.queryFailure(fScenarioPattern, v);
+                    Map<String, String> map = DB.queryFailure(fScenarioPattern, v);
                     fMessages.put(name, map);
                 }
             }
@@ -197,7 +198,7 @@
             start = System.currentTimeMillis();
         ArrayList<StatisticsSession> sessions = new ArrayList<>();
         ArrayList<String> names2 = new ArrayList<>();
-        Set dims = new HashSet();
+        Set<Dim> dims = new HashSet<>();
         for (String fSeriesName : fSeriesNames) {
             v.put(fSharedState.fSeriesKey, fSeriesName);
             DataPoint[] dps = DB.queryDataPoints(v, fScenarioName, fSharedState.fQueryDimensions);
@@ -215,7 +216,7 @@
         fSessions = sessions.toArray(new StatisticsSession[sessions.size()]);
         fSeriesNames = names2.toArray(new String[sessions.size()]);
 
-        fDimensions = (Dim[]) dims.toArray(new Dim[dims.size()]);
+        fDimensions = dims.toArray(new Dim[dims.size()]);
         Arrays.sort(fDimensions, (o1, o2) -> {
             Dim d1 = o1;
             Dim d2 = o2;
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/eval/Evaluator.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/eval/Evaluator.java
index 2f528da..50e15b7 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/eval/Evaluator.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/eval/Evaluator.java
@@ -1,5 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2000, 2016 IBM Corporation and others. 
+ * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
@@ -60,7 +61,7 @@
         String scenarioName = session.getScenarioID();
 
         // determine all dimensions we need
-        HashSet allDimensions = new HashSet();
+        HashSet<Dim> allDimensions = new HashSet<>();
         for (int i = 0; i < fCheckers.length; i++) {
             AssertChecker chk = fCheckers[i];
             Dim[] dims = chk.getDimensions();