From 525c30003463904cee2a73ed2ddb614726de986e Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 04 Jul 2008 12:33:27 +0000
Subject: [PATCH] Fix for issue 3450 (upgrade command should refuse to upgrade to the same version)

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java |   10 ++++++++--
 opendj-sdk/opends/src/messages/messages/quicksetup.properties                 |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/quicksetup.properties b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
index 95d3a95..c42967d 100644
--- a/opendj-sdk/opends/src/messages/messages/quicksetup.properties
+++ b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
@@ -1213,6 +1213,8 @@
 INFO_REVERSION_ORACLE_UNSUPPORTED=Reversion not supported from version %s to \
  version %s is not supported.  To upgrade You must uninstall the current \
  server, install the new server, and manually migrate your data: %s
+INFO_UPGRADE_ORACLE_SAME_VERSION=The current version and the version of the \
+ binaries to upgrade to are the same (%s)
 INFO_REVERSION_TYPE_PROMPT=How would you like to specify the archive used \
  to revert this instance?
 INFO_REVERSION_TYPE_PROMPT_RECENT=Use the most recent versioned archive
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 5c5e070..1ccee21 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -1546,12 +1546,18 @@
 
   private void initialize() throws ApplicationException {
     try {
+      BuildInformation fromVersion = getCurrentBuildInformation();
+      BuildInformation toVersion = getStagedBuildInformation();
+      if (fromVersion.equals(toVersion))
+      {
+        throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
+            INFO_UPGRADE_ORACLE_SAME_VERSION.get(
+                fromVersion.toString()), null);
+      }
       if (getInstallation().getStatus().isServerRunning()) {
         new ServerController(getInstallation()).stopServer(true);
       }
 
-      BuildInformation fromVersion = getCurrentBuildInformation();
-      BuildInformation toVersion = getStagedBuildInformation();
       this.historicalOperationId =
               writeInitialHistoricalRecord(fromVersion, toVersion);
 

--
Gitblit v1.10.0