From 652b7ed3ab5ec5222cb769f1bbc4b06ef0f09c03 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 30 Jan 2008 00:53:22 +0000
Subject: [PATCH] When there is a problem deleting files in the uninstaller, just consider it a warning and inform the user that the problematic file might being used by another process.
---
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java | 79 ++++++++++++++++++++++++++++++++++++---
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallProgressStep.java | 10 ++++-
opendj-sdk/opends/src/messages/messages/admin_tool.properties | 11 +++++
3 files changed, 91 insertions(+), 9 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallProgressStep.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallProgressStep.java
index 50fc7e6..66729d0 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallProgressStep.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallProgressStep.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ * Portions Copyright 2006-2008 Sun Microsystems, Inc.
*/
package org.opends.guitools.uninstaller;
@@ -85,6 +85,11 @@
FINISHED_WITH_ERROR_ON_REMOTE,
/**
+ * Installation finished but not all the files could be deleted.
+ */
+ FINISHED_WITH_ERROR_DELETING,
+
+ /**
* Installation finished with an error.
*/
FINISHED_WITH_ERROR;
@@ -95,7 +100,8 @@
public boolean isLast() {
return this == FINISHED_SUCCESSFULLY ||
this == FINISHED_WITH_ERROR ||
- this == FINISHED_WITH_ERROR_ON_REMOTE;
+ this == FINISHED_WITH_ERROR_ON_REMOTE ||
+ this == FINISHED_WITH_ERROR_DELETING;
}
/**
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index e23b86f..d20f2cf 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ * Portions Copyright 2006-2008 Sun Microsystems, Inc.
*/
package org.opends.guitools.uninstaller;
@@ -91,6 +91,7 @@
private ProgressStep status = UninstallProgressStep.NOT_STARTED;
private boolean runStarted;
private boolean errorOnRemoteOccurred;
+ private boolean errorDeletingOccurred;
private HashMap<ProgressStep, Integer> hmRatio =
new HashMap<ProgressStep, Integer>();
@@ -656,7 +657,7 @@
getFormattedSuccess(successMsg));
Message nonCriticalMsg;
- if (isCli())
+ if (!isCli())
{
nonCriticalMsg =
INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR_ON_REMOTE.get();
@@ -668,6 +669,18 @@
}
hmSummary.put(UninstallProgressStep.FINISHED_WITH_ERROR_ON_REMOTE,
getFormattedWarning(nonCriticalMsg));
+ if (!isCli())
+ {
+ nonCriticalMsg =
+ INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR_DELETING.get();
+ }
+ else
+ {
+ nonCriticalMsg =
+ INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR_DELETING_CLI.get();
+ }
+ hmSummary.put(UninstallProgressStep.FINISHED_WITH_ERROR_DELETING,
+ getFormattedWarning(nonCriticalMsg));
hmSummary.put(UninstallProgressStep.FINISHED_WITH_ERROR,
getFormattedError(
INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR.get()));
@@ -790,8 +803,24 @@
notifyListeners(getTaskSeparator());
}
- deleteExternalDatabaseFiles(dbsToDelete);
- displaySeparator = true;
+ try
+ {
+ deleteExternalDatabaseFiles(dbsToDelete);
+ displaySeparator = true;
+ }
+ catch (ApplicationException ae)
+ {
+ if (ae.getType() == ReturnCode.FILE_SYSTEM_ACCESS_ERROR)
+ {
+ errorDeletingOccurred = true;
+ Message msg = getFormattedWarning(ae.getMessageObject());
+ notifyListeners(msg);
+ }
+ else
+ {
+ throw ae;
+ }
+ }
}
Set<String> logsToDelete =
@@ -803,8 +832,24 @@
notifyListeners(getTaskSeparator());
}
- deleteExternalLogFiles(logsToDelete);
- displaySeparator = true;
+ try
+ {
+ deleteExternalLogFiles(logsToDelete);
+ displaySeparator = true;
+ }
+ catch (ApplicationException ae)
+ {
+ if (ae.getType() == ReturnCode.FILE_SYSTEM_ACCESS_ERROR)
+ {
+ errorDeletingOccurred = true;
+ Message msg = getFormattedWarning(ae.getMessageObject());
+ notifyListeners(msg);
+ }
+ else
+ {
+ throw ae;
+ }
+ }
}
UninstallUserData userData = getUninstallUserData();
@@ -820,13 +865,33 @@
if (somethingToDelete) {
status = UninstallProgressStep.DELETING_INSTALLATION_FILES;
- deleteInstallationFiles(getRatio(status),
+ try
+ {
+ deleteInstallationFiles(getRatio(status),
getRatio(UninstallProgressStep.FINISHED_SUCCESSFULLY));
+ }
+ catch (ApplicationException ae)
+ {
+ if (ae.getType() == ReturnCode.FILE_SYSTEM_ACCESS_ERROR)
+ {
+ errorDeletingOccurred = true;
+ Message msg = getFormattedWarning(ae.getMessageObject());
+ notifyListeners(msg);
+ }
+ else
+ {
+ throw ae;
+ }
+ }
}
if (errorOnRemoteOccurred)
{
status = UninstallProgressStep.FINISHED_WITH_ERROR_ON_REMOTE;
}
+ else if (errorDeletingOccurred)
+ {
+ status = UninstallProgressStep.FINISHED_WITH_ERROR_DELETING;
+ }
else
{
status = UninstallProgressStep.FINISHED_SUCCESSFULLY;
diff --git a/opendj-sdk/opends/src/messages/messages/admin_tool.properties b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
index ceb40bd..48ef973 100644
--- a/opendj-sdk/opends/src/messages/messages/admin_tool.properties
+++ b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
@@ -326,6 +326,17 @@
INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR_ON_REMOTE_CLI=OpenDS was \
successfully uninstalled in the local machine but some error occurred \
updating remote servers.
+INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR_DELETING=<b>OpenDS Uninstall \
+ Succeeded With Warnings</b><br>OpenDS was successfully uninstalled in the \
+ local machine but some error occurred deleting files. Check \
+ 'Details' text area for more information about the files that caused the \
+ problem.<br><br>Verify that there is no other program using those files and \
+ delete them manually.
+INFO_SUMMARY_UNINSTALL_FINISHED_WITH_ERROR_DELETING_CLI=OpenDS was \
+ successfully uninstalled in the local machine but some error occurred \
+ deleting files. Check 'Details' text area for more information about the \
+ files that caused the problem.%n%nVerify that there is no other program \
+ using those files and delete them manually.
INFO_SUMMARY_UNINSTALL_NOT_STARTED=Starting Uninstallation...
INFO_UNDEFINED_PROTOCOL_LABEL=-Unknown-
SEVERE_ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED=%n%nThe graphical Uninstall \
--
Gitblit v1.10.0