1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-22 15:58:52 -05:00

Make sure things work and compile with JDK8

This commit is contained in:
Reinhard Pointner 2018-12-01 23:47:27 +07:00
parent cf3bc3802b
commit fa491ce4c8
2 changed files with 5 additions and 8 deletions

View File

@ -18,8 +18,6 @@ import java.awt.Window;
import java.awt.datatransfer.DataFlavor;
import java.awt.event.ActionEvent;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@ -265,13 +263,13 @@ class RenameAction extends AbstractAction {
String clip = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
String psm = findClearSignMessage(clip);
Path tmp = Files.createTempFile("clip", ".txt");
Files.writeString(tmp, psm, UTF_8);
File tmp = File.createTempFile("clip", ".txt");
writeFile(psm.getBytes(UTF_8), tmp);
configureLicense(tmp.toFile());
configureLicense(tmp);
SwingEventBus.getInstance().post(LICENSE);
Files.delete(tmp);
tmp.delete();
} catch (Exception e) {
log.info("The clipboard does not contain a license key. Please select and copy the license key first.");
debug.log(Level.WARNING, e, e::getMessage);

View File

@ -6,7 +6,6 @@ import static net.filebot.util.RegularExpressions.*;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
@ -72,7 +71,7 @@ public class PGP {
}
public static String findClearSignMessage(File file) throws IOException {
try (Scanner scanner = new Scanner(new FileInputStream(file), UTF_8)) {
try (Scanner scanner = new Scanner(file, UTF_8)) {
Optional<MatchResult> match = scanner.findAll(PGP_SIGNED_MESSAGE).findFirst();
if (match.isPresent()) {
return match.get().group();