Skip to content

Commit 6bacc16

Browse files
committed
chore: Clean up code
1 parent 744613f commit 6bacc16

File tree

6 files changed

+6
-21
lines changed

6 files changed

+6
-21
lines changed

src/main/java/com/github/exadmin/cyberferret/async/RunnableCheckOnlineDictionary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public RunnableCheckOnlineDictionary(boolean isCLIMode) {
2424
}
2525

2626
@Override
27-
protected void _run() throws Exception {
27+
protected void _run() {
2828
logInfo("Checking if new online dictionary exists");
2929

3030
String prefix = "";

src/main/java/com/github/exadmin/cyberferret/async/RunnableScanner.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public class RunnableScanner extends ARunnable {
2828
private Map<String, Pattern> sigMap = null;
2929
private Map<String, String> allowedSignaturesMap = null;
3030
private Map<String, List<String>> excludeExtMap = null;
31-
private FxCallback fxCallback = (type, message) -> {
32-
logInfo(message);
33-
};
31+
private FxCallback fxCallback = (type, message) -> logInfo(message);
3432
private boolean isAnySignatureFound = false;
3533
private List<Path> stagedFiles;
3634

src/main/java/com/github/exadmin/cyberferret/async/RunnableSigsLoader.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.github.exadmin.cyberferret.async;
22

3-
import org.slf4j.Logger;
4-
import org.slf4j.LoggerFactory;
5-
63
import java.io.IOException;
74
import java.io.InputStream;
85
import java.util.*;
@@ -46,7 +43,7 @@ public boolean isReady() {
4643
}
4744

4845
@Override
49-
public void _run() throws Exception {
46+
public void _run() {
5047
isReady.set(false);
5148

5249
if (inputStream == null) throw new IllegalStateException("InputStream was not set before running action");

src/main/java/com/github/exadmin/cyberferret/fxui/SceneBuilder.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ protected Tab createAnalyzerTab(TabPane tabPane) {
8787
TitledPane tpConsole = createLogsPane();
8888

8989
VBox vBox = new VBox();
90-
// Pane wrapper = new StackPane(vBox);
91-
// tab.setContent(wrapper);
9290
tab.setContent(vBox);
9391

9492
Accordion accordion = new Accordion();
@@ -465,8 +463,6 @@ private HBox buildOnlineSignatureLoader(Stage primaryStage) {
465463
Button btnCheckUpdates = new Button("Download");
466464
Button btnDecrypt = new Button("Decrypt");
467465
Button btnApply = new Button("Load decrypted");
468-
// Label lbSalt = new Label("Salt");
469-
// TextField tfSalt = new PasswordField();
470466

471467
HBox hBox = new HBox();
472468
hBox.setSpacing(8);
@@ -477,8 +473,6 @@ private HBox buildOnlineSignatureLoader(Stage primaryStage) {
477473

478474
hBox.getChildren().add(lbPassw);
479475
hBox.getChildren().add(tfPassword);
480-
// hBox.getChildren().add(lbSalt);
481-
// hBox.getChildren().add(tfSalt);
482476
hBox.getChildren().add(new Separator(Orientation.VERTICAL));
483477

484478
hBox.getChildren().add(btnDecrypt);
@@ -495,9 +489,6 @@ private HBox buildOnlineSignatureLoader(Stage primaryStage) {
495489
tfPassword.textProperty().addListener((bean, oldValue, newValue) -> PASSWORD.setValue(newValue));
496490
tfPassword.textProperty().setValue(PASSWORD.getValue());
497491

498-
// tfSalt.textProperty().addListener((bean, oldValue, newValue) -> SALT.setValue(newValue));
499-
// tfSalt.textProperty().setValue(SALT.getValue());
500-
501492
btnCheckUpdates.setOnAction((event) -> {
502493
ARunnable runnable = new RunnableCheckOnlineDictionary(false);
503494
runnable.setBeforeStart(() -> btnCheckUpdates.setDisable(true));
@@ -521,7 +512,7 @@ private HBox buildOnlineSignatureLoader(Stage primaryStage) {
521512
String encryptedBody = FileUtils.readFile(DICTIONARY_FILE_PATH_ENCRYPTED);
522513
String decryptedBody = PasswordBasedEncryption.decrypt(encryptedBody, tfPassword.getText());
523514

524-
if (decryptedBody != null && !decryptedBody.isEmpty()) {
515+
if (!decryptedBody.isEmpty()) {
525516
FileUtils.saveToFile(decryptedBody, FxConstants.DICTIONARY_FILE_PATH_DECRYPTED);
526517
log.info("New decrypted dictionary cache-file was successfully created at {}", fileDecrypted);
527518
}

src/main/java/com/github/exadmin/cyberferret/logging/HandyLogging.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class HandyLogging {
1313

1414
protected volatile Logger logger;
1515
protected boolean printToConsole = false;
16-
protected int loggingLevel = LEVEL_INFO;
16+
protected final int loggingLevel = LEVEL_INFO;
1717

1818
public void setPrintToConsole(boolean printToConsole) {
1919
this.printToConsole = printToConsole;

src/main/java/com/github/exadmin/cyberferret/utils/ConsoleUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public static String format(String msg, Object... binds) {
5959
if (bindIndex < binds.length) {
6060
// probably rest binds are exception-instances
6161
for (int i = bindIndex; i < binds.length; i++) {
62-
if (binds[i] instanceof Throwable) {
63-
Throwable throwable = (Throwable) binds[i];
62+
if (binds[i] instanceof Throwable throwable) {
6463
throwable.printStackTrace();
6564
return result.toString();
6665
}

0 commit comments

Comments
 (0)