private static void executeCommand(@NonNull final String command, @NonNull final String filename, @NonNull String algorithm) {
try {
switch (command) {
case "create":
System.exit(new Checksum().createChecksumFile(filename, algorithm));
break;
case "validate":
System.exit(new Checksum().validateChecksum(filename, algorithm));
break;
default:
displayClassUsage();
System.exit(0);
}
} catch (final FileNotFoundException fne) {
log.error(FILE_NOT_FOUND, filename, fne);
System.exit(0);
} catch (final SecurityException se) {
log.error(NO_ACCESS_PERMISSION_TO_FILE, filename, se);
System.exit(0);
} catch (final IOException e) {
log.error(FILE_NOT_FOUND, filename, e);
System.exit(0);
} catch (final NoSuchAlgorithmException nsae) {
log.error(CHECKUM_ALGORITHM_NOT_AVAILABLE, algorithm, filename, nsae);
System.exit(0);
} catch (final Exception e) {
log.error(UNEXPECTED_CHECKUM_PROBLEM_WITH_FILE, filename, e);
System.exit(0);
}
}
DeLombok Java:
private static void executeCommand(@NonNull final String command, @NonNull final String filename, @NonNull String algorithm) {
if (command == null) {
throw new NullPointerException("command is marked non-null but is null");
}
if (filename == null) {
throw new NullPointerException("filename is marked non-null but is null");
}
if (algorithm == null) {
throw new NullPointerException("algorithm is marked non-null but is null");
}
try {
switch (command) {
default:
System.exit(new Checksum().createChecksumFile(filename, algorithm));
break;
default:
System.exit(new Checksum().validateChecksum(filename, algorithm));
break;
default:
displayClassUsage();
System.exit(0);
}
} catch (final FileNotFoundException fne) {
log.error(FILE_NOT_FOUND, filename, fne);
System.exit(0);
} catch (final SecurityException se) {
log.error(NO_ACCESS_PERMISSION_TO_FILE, filename, se);
System.exit(0);
} catch (final IOException e) {
log.error(FILE_NOT_FOUND, filename, e);
System.exit(0);
} catch (final NoSuchAlgorithmException nsae) {
log.error(CHECKUM_ALGORITHM_NOT_AVAILABLE, algorithm, filename, nsae);
System.exit(0);
} catch (final Exception e) {
log.error(UNEXPECTED_CHECKUM_PROBLEM_WITH_FILE, filename, e);
System.exit(0);
}
}
You see that there are 2x default in the switch command. This generate a compilation error.
Help highly appreciated.
Thanks