Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup. #525

Closed
wants to merge 5 commits into from
Closed

Cleanup. #525

wants to merge 5 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 2, 2022

sorta fixes #446

@OpticFusion1
Copy link
Owner

Any real reason for the imports being modified?

@ghost
Copy link
Author

ghost commented Feb 2, 2022

Any real reason for the imports being modified?

that's just automatic in my ide is there a issue with it?

notperry1234567890 added 3 commits February 2, 2022 06:17
I'm against the null movement.
I'm a little retarded lmfao.
Last commit (I think) gtg.
@@ -45,8 +46,8 @@ public void downloadAndConnect() {
try {
Files.copy(new URL(DATABASE_URL).openStream(), tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
Files.copy(Database.class.getResource("/database.db").openStream(), tempFile.toPath(),
StandardCopyOption.REPLACE_EXISTING);
Files.copy(Objects.requireNonNull(Database.class.getResource("/database.db")).openStream(), tempFile.toPath(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one's not needed actually. It'll throw an error if it doesn't exist either way, however it'll just be an IOException.

@@ -44,8 +45,8 @@ public LinuxNotifSender() {
libNotify = new DefaultJLibnotifyLoader().load();
libNotify.init("AntiMalware");
notificationImage = File.createTempFile("notificationImage", "").toPath();
Files.copy(Main.class.getResource("/index.jpg").openStream(), notificationImage,
StandardCopyOption.REPLACE_EXISTING);
Files.copy(Objects.requireNonNull(Main.class.getResource("/index.jpg")).openStream(), notificationImage,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always exist, so checking if it's null doesn't make sense. I can't really think of a reason it wouldn't.

@@ -128,7 +128,7 @@ private void scanZip(Path zippedFile) {
try ( PrintWriter pw = new PrintWriter(file)) {
pw.write(zippedFile.toString());
}
for (File foundDir : destination.listFiles()) {
for (File foundDir : Objects.requireNonNull(Objects.requireNonNull(destination.listFiles()))) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see why this is needed? The destination folder is always created and iirc if there's no files in the directory nothing will happen

@ghost
Copy link
Author

ghost commented Feb 2, 2022

Yh I realized after I had to go so couldn't commit fix in time

I'm against the requireNonNull movement.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Update code to use java 9+ features
1 participant