Skip to content

Commit 56f4914

Browse files
committed
chore: Improvements made by Codex
1 parent 0fb1ede commit 56f4914

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/main/java/com/github/exadmin/cyberferret/CyberFerretApp.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
public class CyberFerretApp extends Application {
1919
private static final Logger log = LoggerFactory.getLogger(CyberFerretApp.class);
2020
private static final String APPLICATION_PERSISTENT_CONTEXT_FILENAME = "app.properties";
21+
private static final String VERSION_PROPERTIES_RESOURCE = "/version.properties";
2122

2223
@Override
2324
public void start(Stage stage) {
@@ -54,13 +55,17 @@ public static void main(String[] args) {
5455

5556
private String loadApplicationVersion() {
5657
Properties props = new Properties();
57-
try (InputStream input = getClass().getResourceAsStream("/version.properties")) {
58+
try (InputStream input = getClass().getResourceAsStream(VERSION_PROPERTIES_RESOURCE)) {
59+
if (input == null) {
60+
log.error("Resource {} is not found on the classpath", VERSION_PROPERTIES_RESOURCE);
61+
return "UNDEFINED";
62+
}
5863
props.load(input);
5964
return props.getProperty("application.version");
60-
} catch (IOException | NullPointerException ex) {
61-
log.error("Error while loading {}", "/version.properties", ex);
65+
} catch (IOException ex) {
66+
log.error("Error while loading {}", VERSION_PROPERTIES_RESOURCE, ex);
6267
}
6368

6469
return "UNDEFINED";
6570
}
66-
}
71+
}

src/main/java/com/github/exadmin/cyberferret/CyberFerretCLI.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.nio.file.Files;
1212
import java.nio.file.Path;
1313
import java.util.List;
14+
import java.util.Locale;
1415
import java.util.function.Predicate;
1516
import java.util.stream.Stream;
1617

@@ -65,7 +66,7 @@ public static void main(String[] args) throws Exception {
6566
log.warn("***** *****");
6667

6768
// check if next directory is a fork - to skip it
68-
String subDirName = subDir.getFileName().toString().toLowerCase();
69+
String subDirName = subDir.getFileName().toString().toLowerCase(Locale.ROOT);
6970
if (FORKED_REPOSITORIES.contains(subDirName)) {
7071
log.info("Skipping forked repository {}", subDirName);
7172
continue;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ private void scan(FoundPathItem pathItem, Path rootDir, ExcludeFileModel exclude
225225
Path filePath = pathItem.getFilePath();
226226
String fileBody;
227227
try {
228-
System.out.println("Reading file " + filePath);
229-
230228
log.info("Reading file {}", filePath);
231229
fileBody = FileUtils.readFile(filePath);
232230
} catch (IOException ex) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import java.io.IOException;
1212
import java.nio.file.Path;
13+
import java.util.Locale;
1314

1415
/**
1516
* Utility class for extracting metadata from image files (PNG, JPEG, etc.)
@@ -104,7 +105,7 @@ public static boolean isSupportedImageFormat(String extension) {
104105
return false;
105106
}
106107

107-
String ext = extension.toLowerCase();
108+
String ext = extension.toLowerCase(Locale.ROOT);
108109
return ext.equals("png") ||
109110
ext.equals("jpg") ||
110111
ext.equals("jpeg") ||

0 commit comments

Comments
 (0)