Skip to content

Commit

Permalink
weblocopener-57: Fixed classes
Browse files Browse the repository at this point in the history
  • Loading branch information
benchdoos committed Oct 29, 2023
1 parent f6d2f0f commit cd5def2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<mockito-junit-jupiter.version>4.5.1</mockito-junit-jupiter.version>
<junit-jupiter.version>5.9.2</junit-jupiter.version>
<easy-random.version>5.0.0</easy-random.version>
<assertj-core.version>3.24.2</assertj-core.version>
</properties>

<scm>
Expand Down Expand Up @@ -534,6 +535,12 @@
<version>${easy-random.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>


</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections4.CollectionUtils;
import org.assertj.core.util.Files;

import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -136,7 +136,7 @@ public void startUpdate(AppVersion appVersion) throws IOException {
}
}
} else {
Files.delete(installerFile);
Files.delete(installerFile.toPath());
updateAndInstall(installerAsset, installerFile);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@

package com.github.benchdoos.weblocopener.utils;

import static com.github.benchdoos.weblocopener.core.ApplicationConstants.UPDATE_PATH_FILE;

import com.github.benchdoos.weblocopener.update.impl.UnixUpdater;
import com.github.benchdoos.weblocopener.update.impl.WindowsUpdater;
import com.github.benchdoos.weblocopenercore.utils.system.OS;
import java.io.File;
import lombok.experimental.UtilityClass;
import lombok.extern.log4j.Log4j2;
import org.assertj.core.util.Files;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

import static com.github.benchdoos.weblocopener.core.ApplicationConstants.UPDATE_PATH_FILE;

@UtilityClass
@Log4j2
Expand Down Expand Up @@ -52,8 +54,12 @@ private static void checkAndDeleteInstaller(final File file) {
}

if (toDelete) {
Files.delete(file);
log.info("Setup file was deleted: {}", file);
try {
Files.delete(file.toPath());
log.info("Setup file was deleted: {}", file);
} catch (final IOException e) {
log.error("Could not delete file: {}", file, e);
}
}
}
}

0 comments on commit cd5def2

Please sign in to comment.