Skip to content

Commit 156811a

Browse files
committed
Replace identifier() method by mere name() method
1 parent dddc206 commit 156811a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/main/java/org/cryptomator/cryptofs/health/api/HealthCheck.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ static Collection<HealthCheck> allChecks() {
2323
}
2424

2525
/**
26-
* @return A unique name for this check (that might be used as a translation key)
26+
* @return A human readable name for this check
2727
*/
28-
default String identifier() {
29-
return getClass().getCanonicalName();
28+
default String name() {
29+
var canonicalName = getClass().getCanonicalName();
30+
return canonicalName.substring(canonicalName.lastIndexOf('.')+1);
3031
}
3132

3233
/**
@@ -61,7 +62,7 @@ default Stream<DiagnosticResult> check(Path pathToVault, VaultConfig config, Mas
6162
try {
6263
check(pathToVault, config, masterkey, cryptor, resultSpliterator);
6364
} catch (TransferSpliterator.TransferClosedException e) {
64-
LoggerFactory.getLogger(HealthCheck.class).debug("{} cancelled.", identifier());
65+
LoggerFactory.getLogger(HealthCheck.class).debug("{} cancelled.", name());
6566
} finally {
6667
resultSpliterator.close();
6768
}

src/main/java/org/cryptomator/cryptofs/health/dirid/DirIdCheck.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public class DirIdCheck implements HealthCheck {
3030

3131
private static final Logger LOG = LoggerFactory.getLogger(DirIdCheck.class);
3232
private static final int MAX_TRAVERSAL_DEPTH = 4; // d/2/30/Fo0==.c9r/dir.c9r
33+
private static final String CHECK_NAME = "Directory Check";
34+
35+
@Override
36+
public String name() {
37+
return CHECK_NAME;
38+
}
3339

3440
@Override
3541
public void check(Path pathToVault, VaultConfig config, Masterkey masterkey, Cryptor cryptor, Consumer<DiagnosticResult> resultCollector) {

src/test/java/org/cryptomator/cryptofs/health/api/HealthCheckIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void main(String[] args) throws IOException, NoSuchAlgorithmExcept
4242
var cryptor = CryptorProvider.forScheme(verifiedCfg.getCipherCombo()).provide(masterkey, SecureRandom.getInstanceStrong());
4343
var executor = Executors.newSingleThreadExecutor();
4444
HealthCheck.allChecks().forEach(check -> {
45-
System.out.println("Running " + check.identifier());
45+
System.out.println("Running " + check.name());
4646
var results = check.check(p, verifiedCfg, masterkey, cryptor, executor);
4747
results.forEach(System.out::println);
4848
});

0 commit comments

Comments
 (0)