Bug 455656 - Error in performance results analysis, if more recent build
exists in database. 
diff --git a/bundles/org.eclipse.test.performance.ui/performanceui.jar b/bundles/org.eclipse.test.performance.ui/performanceui.jar
index b1dd970..90d8b54 100644
--- a/bundles/org.eclipse.test.performance.ui/performanceui.jar
+++ b/bundles/org.eclipse.test.performance.ui/performanceui.jar
Binary files differ
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
index 2da6cc6..702faf0 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
@@ -670,6 +670,10 @@
 		if (n < buildsSize) {
 			System.arraycopy(this.allBuildNames, 0, this.allBuildNames = new String[n], 0, n);
 		}
+		// there are times when the build we want to analyze is not the "last build", 
+		// such as there may have be subsequent builds, already. 
+		// so, we only compute this "default behavior" if lastBuild has not been set yet.
+		// 
 		int idx = n-1;
 		String lastBuild = this.allBuildNames[idx--];
 		while (idx > 0 && lastBuild.startsWith(DB_Results.getDbBaselinePrefix())) {
@@ -677,6 +681,7 @@
 		}
 		this.needToUpdateLocalFile = this.name == null || Util.getBuildDate(lastBuild).compareTo(Util.getBuildDate(this.name)) > 0;
 		this.name = lastBuild;
+		
 		if (this.baselineName != null) {
 			String lastBuildDate = Util.getBuildDate(lastBuild);
 			if (Util.getBuildDate(this.baselineName).compareTo(lastBuildDate) > 0) {
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
index b658a94..ff1214a 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
@@ -999,12 +999,18 @@
 			}
 		}
 	}
+	
+	// must set our known "last build" (that we are interested in) before
+	// 'getAllBuildNames' is called, else it may set "name" to some later 
+	// build we are not interested in analyzing yet.
+    this.performanceResults.setLastBuildName(buildName);
 
 	// Verify that build is known
 	String[] builds = this.performanceResults.getAllBuildNames();
 	if (builds == null || builds.length == 0) {
 		System.err.println("Cannot connect to database to generate results build '"+buildName+"'");
-		System.exit(1);
+		// TODO: changed a system.exit to this exception ... but, there might be better choices?
+		throw new IllegalStateException("Cannot connect to database to generate results build '"+buildName+"'");
 	}
 	if (Arrays.binarySearch(builds, buildName, Util.BUILD_DATE_COMPARATOR) < 0) {
 		throw new RuntimeException("No results in database for build '"+buildName+"'");
@@ -1028,12 +1034,17 @@
 	// Init current build prefixes if not set
 	if (this.currentBuildPrefixes == null) {
 		this.currentBuildPrefixes = new ArrayList();
-		if (buildName.charAt(0) == 'M') {
+		char buildType = buildName.charAt(0);
+		if (buildType == 'M') {
 			this.currentBuildPrefixes.add("M");
-		} else {
+		} else if (buildType == 'N') {
 			this.currentBuildPrefixes.add("N");
+		} else if (buildType == 'I') {
+		    this.currentBuildPrefixes.add("I");
+		} else {
+		    // TODO: may want to throw error here? 
+		    this.currentBuildPrefixes.add("?");
 		}
-		this.currentBuildPrefixes.add("I");
 	}
 }