From fa491ce4c866dea9a379524a5983fcefe120e4f2 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 1 Dec 2018 23:47:27 +0700 Subject: [PATCH] Make sure things work and compile with JDK8 --- source/net/filebot/ui/rename/RenameAction.java | 10 ++++------ source/net/filebot/util/PGP.java | 3 +-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/source/net/filebot/ui/rename/RenameAction.java b/source/net/filebot/ui/rename/RenameAction.java index 5d030cc6..05b516b8 100644 --- a/source/net/filebot/ui/rename/RenameAction.java +++ b/source/net/filebot/ui/rename/RenameAction.java @@ -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); diff --git a/source/net/filebot/util/PGP.java b/source/net/filebot/util/PGP.java index e644efa6..b2c59b7d 100644 --- a/source/net/filebot/util/PGP.java +++ b/source/net/filebot/util/PGP.java @@ -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 match = scanner.findAll(PGP_SIGNED_MESSAGE).findFirst(); if (match.isPresent()) { return match.get().group();