src/com/netscape/admin/dirserv/panel/RestorePanel.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 2b45ed8b705b70ee4860892622cee3faec6b7bcc
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Mon Feb 7 18:25:05 2011 -0800
Bug 387981 - plain files can be chosen on the Restore Directory dialog
https://bugzilla.redhat.com/show_bug.cgi?id=387981
Description: This patch adds 2 checks to RestorePanel:
if the restore path exists or not and
if the path is a directory or not.
When both are true, the OK button is enabled.
diff --git a/src/com/netscape/admin/dirserv/panel/RestorePanel.java
b/src/com/netscape/admin/dirserv/panel/RestorePanel.java
index d510506..9198a9e 100644
--- a/src/com/netscape/admin/dirserv/panel/RestorePanel.java
+++ b/src/com/netscape/admin/dirserv/panel/RestorePanel.java
@@ -250,7 +250,14 @@ public class RestorePanel extends BlankPanel {
if (_tfExport.getText().trim().equals("")) {
setOkay(false);
} else {
- setOkay(true);
+ File f = new File(_tfExport.getText());
+ if (!f.exists()) { // Restore path must exist
+ setOkay(false);
+ } else if (!f.isDirectory()) { // Restore path must be a directory
+ setOkay(false);
+ } else {
+ setOkay(true);
+ }
}
}