From b1994018d9cb7d26571157270d5296ac3a368b7c Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 10 Dec 2015 16:32:08 +0000
Subject: [PATCH] OPENDJ-2522 rpm: error message in logs when uninstalling after an upgrade
---
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java | 44 +++++++++++++++++---------------------------
1 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
index 54aaca1..10816c9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
@@ -945,39 +945,24 @@
}
}
- BufferedReader reader;
- try
- {
- reader = new BufferedReader(new FileReader(instancePathFileName));
- }
- catch (Exception e)
- {
- return installPath;
- }
-
// Read the first line and close the file.
- String line;
- try
+ try (BufferedReader reader = new BufferedReader(new FileReader(instancePathFileName)))
{
- line = reader.readLine();
+ String line = reader.readLine();
File instanceLoc = new File(line.trim());
if (instanceLoc.isAbsolute())
{
- return instanceLoc.getAbsolutePath();
+ return getCanonicalPath(instanceLoc);
}
else
{
- return new File(installPath + File.separator + instanceLoc.getPath()).getAbsolutePath();
+ return getCanonicalPath(new File(installPath + File.separator + instanceLoc.getPath()));
}
}
catch (Exception e)
{
return installPath;
}
- finally
- {
- StaticUtils.close(reader);
- }
}
/**
@@ -1997,14 +1982,7 @@
if (installDir == null)
{
File f = org.opends.quicksetup.Installation.getLocal().getRootDirectory();
- try
- {
- installDir = f.getCanonicalPath();
- }
- catch (Throwable t)
- {
- installDir = f.getAbsolutePath();
- }
+ installDir = getCanonicalPath(f);
if (installDir.lastIndexOf(File.separatorChar) != installDir.length() - 1)
{
installDir += File.separatorChar;
@@ -2014,6 +1992,18 @@
return installDir;
}
+ private static String getCanonicalPath(File f)
+ {
+ try
+ {
+ return f.getCanonicalPath();
+ }
+ catch (IOException t)
+ {
+ return f.getAbsolutePath();
+ }
+ }
+
private static List<String> getDsReplicationEquivalentCommandLine(String subcommand, UserData userData,
Set<String> baseDNs, ServerDescriptor server)
{
--
Gitblit v1.10.0