From b471bc6b9f2a087e8bb8e3adc6e5d1b32e80db8d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 07 Oct 2009 12:43:38 +0000
Subject: [PATCH] Fix for issue 4271 (control-panel: in remote mode, "Installation Path" is incorrect) Since using File when you have different OS in the control panel and in the managed server can be really problematic, use String instead in the ServerDescriptor object.

---
 opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java b/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
index 3a02c47..af2c227 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -465,9 +465,9 @@
     {
       desc.setOpenDSVersion(
         org.opends.server.util.DynamicConstants.FULL_VERSION_STRING);
-      desc.setInstallPath(Utilities.getServerRootDirectory());
-      desc.setInstancePath(Utilities.getInstanceRootDirectory(
-          Utilities.getServerRootDirectory().getAbsolutePath()));
+      String installPath = Utilities.getInstallPathFromClasspath();
+      desc.setInstallPath(installPath);
+      desc.setInstancePath(Utils.getInstancePathFromClasspath(installPath));
       boolean windowsServiceEnabled = false;
       if (Utilities.isWindows())
       {
@@ -552,9 +552,7 @@
       desc.setAuthenticated(false);
     }
     else if (!isLocal ||
-        Utilities.isServerRunning(
-        Utilities.getInstanceRootDirectory(
-            desc.getInstallPath().getAbsolutePath())))
+        Utilities.isServerRunning(new File(desc.getInstancePath())))
     {
       desc.setStatus(ServerDescriptor.ServerStatus.STARTED);
 
@@ -694,13 +692,13 @@
               rCtx.getSystemInformation(), "installPath");
           if (installPath != null)
           {
-            desc.setInstallPath(new File(installPath));
+            desc.setInstallPath(installPath);
           }
           String instancePath = (String)Utilities.getFirstMonitoringValue(
               rCtx.getSystemInformation(), "instancePath");
           if (instancePath != null)
           {
-            desc.setInstancePath(new File(instancePath));
+            desc.setInstancePath(instancePath);
           }
         }
       }
@@ -1311,8 +1309,8 @@
       else
       {
         // Compare host names and paths
-        File f1 = server.getInstancePath();
-        File f2 = task.getServer().getInstancePath();
+        String f1 = server.getInstancePath();
+        String f2 = task.getServer().getInstancePath();
 
         String host1 = server.getHostname();
         String host2 = task.getServer().getHostname();

--
Gitblit v1.10.0