You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2011/11/18 22:59:23 UTC

svn commit: r1203873 - /cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java

Author: jbellis
Date: Fri Nov 18 21:59:22 2011
New Revision: 1203873

URL: http://svn.apache.org/viewvc?rev=1203873&view=rev
Log:
canonicalize paths exposed through JMX
patch by thobbs; reviewed by jbellis for CASSANDRA-3504

Modified:
    cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java?rev=1203873&r1=1203872&r2=1203873&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java Fri Nov 18 21:59:22 2011
@@ -1463,24 +1463,42 @@ public class StorageService implements I
         return stringify(Gossiper.instance.getUnreachableMembers());
     }
 
+    private static String getCanonicalPath(String filename)
+    {
+        try
+        {
+            return new File(filename).getCanonicalPath();
+        }
+        catch (IOException e)
+        {
+            throw new IOError(e);
+        }
+    }
+
     public String[] getAllDataFileLocations()
     {
-        return DatabaseDescriptor.getAllDataFileLocations();
+        String[] locations = DatabaseDescriptor.getAllDataFileLocations();
+        for (int i = 0; i < locations.length; i++)
+            locations[i] = getCanonicalPath(locations[i]);
+        return locations;
     }
 
     public String[] getAllDataFileLocationsForTable(String table)
     {
-        return DatabaseDescriptor.getAllDataFileLocationsForTable(table);
+        String[] locations = DatabaseDescriptor.getAllDataFileLocationsForTable(table);
+        for (int i = 0; i < locations.length; i++)
+            locations[i] = getCanonicalPath(locations[i]);
+        return locations;
     }
 
     public String getCommitLogLocation()
     {
-        return DatabaseDescriptor.getCommitLogLocation();
+        return getCanonicalPath(DatabaseDescriptor.getCommitLogLocation());
     }
 
     public String getSavedCachesLocation()
     {
-        return DatabaseDescriptor.getSavedCachesLocation();
+        return getCanonicalPath(DatabaseDescriptor.getSavedCachesLocation());
     }
 
     private List<String> stringify(Iterable<InetAddress> endpoints)