From cfb5767d9216efaf0c1738b5ce1ae243630fd8f5 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Mon, 30 Apr 2007 21:31:38 +0000
Subject: [PATCH] This commit is mainly intended to prevent the sort of false positives that occur when the upgrader assumes the server has been upgraded properly but leaves the server in a corrupt state (see issues 1546 and 1559). The following changes are introduced:
---
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeOracle.java | 36 ++++++++++++++++--------------------
1 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeOracle.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeOracle.java
index 3ea00eb..7f2e2cc 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeOracle.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeOracle.java
@@ -28,6 +28,7 @@
package org.opends.quicksetup.upgrader;
import org.opends.quicksetup.i18n.ResourceProvider;
+import org.opends.quicksetup.BuildInformation;
/**
* This class can answer questions important upgrade/reversion questions
@@ -35,18 +36,18 @@
*/
public class UpgradeOracle {
- private Integer currentVersion;
- private Integer newVersion;
+ private BuildInformation currentBuildInfo;
+ private BuildInformation newBuildInfo;
/**
* Creates a new instance that can analyze a hypothetical upgrade/reversion
* operation from one version to another.
- * @param currentVersion Integer representing the current version
- * @param newVersion Integer representing the proposed next version
+ * @param current BuildInformation representing the current version
+ * @param neu BuildInformation representing the proposed next version
*/
- public UpgradeOracle(Integer currentVersion, Integer newVersion) {
- this.currentVersion = currentVersion;
- this.newVersion = newVersion;
+ public UpgradeOracle(BuildInformation current, BuildInformation neu) {
+ this.currentBuildInfo = current;
+ this.newBuildInfo = neu;
}
/**
@@ -56,7 +57,7 @@
* false indicates that this would be a reversion.
*/
public boolean isUpgrade() {
- return newVersion > currentVersion;
+ return currentBuildInfo.compareTo(newBuildInfo) < 0;
}
/**
@@ -66,7 +67,7 @@
* false indicates that this would be an upgrade.
*/
public boolean isReversion() {
- return newVersion < currentVersion;
+ return currentBuildInfo.compareTo(newBuildInfo) < 0;
}
/**
@@ -76,14 +77,7 @@
* an operation will succeed
*/
public boolean isSupported() {
- boolean supported;
- if (// newVersion.equals(currentVersion) || // support this for reinstall?
- newVersion < 1565) {
- supported = false;
- }else {
- supported = true;
- }
- return supported;
+ return isUpgrade();
}
/**
@@ -95,8 +89,8 @@
*/
public String getSummaryMessage() {
String msg;
- String[] args = { currentVersion.toString(),
- newVersion.toString() };
+ String[] args = { currentBuildInfo.toString(),
+ currentBuildInfo.toString() };
ResourceProvider rp = ResourceProvider.getInstance();
if (isSupported()) {
if (isUpgrade()) {
@@ -109,8 +103,10 @@
} else {
if (isUpgrade()) {
msg = rp.getMsg("upgrade-hypothetical-upgrade-failure", args);
- } else {
+ } else if (isReversion()) {
msg = rp.getMsg("upgrade-hypothetical-reversion-failure", args);
+ } else {
+ msg = rp.getMsg("upgrade-hypothetical-versions-the-same", args);
}
}
return msg;
--
Gitblit v1.10.0