This is an automated email from the ASF dual-hosted git repository.

jmckenzie pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f4f04fbac0 Fix checkstyle failures on JDK8 introduced by 
CASSANDRA-17777
f4f04fbac0 is described below

commit f4f04fbac0eaa247dd028ddcb5a4e36dd8cd11ba
Author: Josh McKenzie <[email protected]>
AuthorDate: Fri Aug 5 07:29:02 2022 -0400

    Fix checkstyle failures on JDK8 introduced by CASSANDRA-17777
    
    Patch by Josh McKenzie; reviewed by Marcus Eriksson for CASSANDRA-17777
---
 src/java/org/apache/cassandra/service/StartupChecks.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/java/org/apache/cassandra/service/StartupChecks.java 
b/src/java/org/apache/cassandra/service/StartupChecks.java
index c313ac8f0c..c099045537 100644
--- a/src/java/org/apache/cassandra/service/StartupChecks.java
+++ b/src/java/org/apache/cassandra/service/StartupChecks.java
@@ -571,7 +571,7 @@ public class StartupChecks
 
                 public FileVisitResult preVisitDirectory(Path dir, 
BasicFileAttributes attrs) throws IOException
                 {
-                    String[] nameParts = 
dir.toFile().getCanonicalPath().split(java.io.File.separator);
+                    String[] nameParts = FileUtils.getCanonicalPath(new 
File(dir)).split(java.io.File.separator);
                     if (nameParts.length >= 2)
                     {
                         String tablePart = nameParts[nameParts.length - 1];
@@ -584,20 +584,22 @@ public class StartupChecks
                         // which were removed in various major version 
upgrades (e.g system.Versions in 1.2)
                         if 
(ksPart.equals(SchemaConstants.SYSTEM_KEYSPACE_NAME) && 
!SystemKeyspace.ALL_TABLE_NAMES.contains(tablePart))
                         {
+                            String canonicalPath = 
FileUtils.getCanonicalPath(new File(dir));
+
                             // We can have snapshots of our system tables or 
snapshots created with a -t tag of "system" that would trigger
                             // this potential warning, so we warn more softly 
in the case that it's probably a snapshot.
-                            if 
(dir.toFile().getCanonicalPath().contains("snapshot"))
+                            if (canonicalPath.contains("snapshot"))
                             {
                                 logger.info("Found unknown system directory 
{}.{} at {} that contains the word snapshot. " +
                                             "This may be left over from a 
previous version of Cassandra or may be normal. " +
                                             " Consider removing after 
inspection if determined to be unnecessary.",
-                                            ksPart, tablePart, 
dir.toFile().getCanonicalPath());
+                                            ksPart, tablePart, canonicalPath);
                             }
                             else
                             {
                                 logger.warn("Found unknown system directory 
{}.{} at {} - this is likely left over from a previous " +
                                             "version of Cassandra and should 
be removed after inspection.",
-                                            ksPart, tablePart, 
dir.toFile().getCanonicalPath());
+                                            ksPart, tablePart, canonicalPath);
                             }
                             return FileVisitResult.SKIP_SUBTREE;
                         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to