filebot/jdk8.patch

383 lines
14 KiB
Diff
Raw Normal View History

2018-06-19 14:44:48 -04:00
diff --git a/app.properties b/app.properties
2018-07-17 05:26:21 -04:00
index 6a57920d..9b19ebdb 100644
2018-06-19 14:44:48 -04:00
--- a/app.properties
+++ b/app.properties
2018-07-11 11:59:29 -04:00
@@ -35,11 +35,12 @@ link.release.index: https://get.filebot.net/filebot/
2018-06-19 14:44:48 -04:00
# Build
main.class: net.filebot.Main
-jre.version: 10.0.1
+jre.major: 8
+jre.build: 171
# Minimum System Version
-jvm.version: 10
-mac.version: 10.10
+jvm.version: 1.8
+mac.version: 10.8
# Package Information
package.name: filebot
diff --git a/build.xml b/build.xml
2018-07-17 05:26:21 -04:00
index 851cb6ac..18762d77 100644
2018-06-19 14:44:48 -04:00
--- a/build.xml
+++ b/build.xml
2018-06-23 15:14:03 -04:00
@@ -93,9 +93,10 @@
2018-06-19 14:44:48 -04:00
<attribute name="dest" />
<sequential>
<exec executable="powershell" dir="${dir.cache}" failonerror="yes">
+ <env key="PROCESSOR_ARCHITECTURE" value="x86" />
<arg line="get-java" />
</exec>
- <untar src="${dir.cache}/jre-${jre.version}_windows-x64_bin.tar.gz" dest="@{dest}" compression="gzip">
+ <untar src="${dir.cache}/jre-${jre.major}u${jre.build}-windows-i586.tar.gz" dest="@{dest}" compression="gzip">
2018-06-21 07:06:53 -04:00
<patternset refid="pattern.jre" />
<cutdirsmapper dirs="1" />
</untar>
2018-07-17 05:26:21 -04:00
@@ -225,7 +226,7 @@
2018-06-27 12:39:56 -04:00
</manifestclasspath>
2018-06-23 08:12:43 -04:00
<!-- compile -->
2018-06-27 12:39:56 -04:00
- <javac srcdir="${dir.source}" destdir="${dir.build}" release="${jvm.version}" encoding="utf-8" debug="yes" includeAntRuntime="no">
+ <javac srcdir="${dir.source}" destdir="${dir.build}" target="${jvm.version}" source="${jvm.version}" encoding="utf-8" debug="yes" includeAntRuntime="no">
<classpath refid="jar.classpath" />
</javac>
2018-07-17 05:26:21 -04:00
@@ -263,7 +264,7 @@
2018-06-29 07:34:03 -04:00
<fileset dir="${dir.installer}/msi" includes="filebot.exe, filebot.launcher.exe" />
2018-06-21 07:06:53 -04:00
</copy>
<copy todir="${dir.staging}/lib">
- <fileset dir="${dir.lib}/native/win32-x64" />
+ <fileset dir="${dir.lib}/native/win32-x86" />
</copy>
<copy todir="${dir.staging}/jar">
<fileset dir="${dir.dist}/lib" includes="*.jar" />
2018-07-17 05:26:21 -04:00
@@ -294,7 +295,7 @@
2018-06-21 07:06:53 -04:00
<arg line="new /o /pr . /cf priconfig.xml /in ${microsoft.application.name}" />
</exec>
<exec executable="makeappx" dir="${dir.dist}" failonerror="yes">
- <arg line="pack /v /o /d ${dir.staging} /p ${release}_r${revision}_x64.appx" />
+ <arg line="pack /v /o /d ${dir.staging} /p ${release}_r${revision}_x86.appx" />
</exec>
</target>
2018-06-21 07:06:53 -04:00
diff --git a/installer/appx/AppxManifest.xml b/installer/appx/AppxManifest.xml
2018-06-21 07:13:26 -04:00
index 8a8817e9..6af7097d 100644
2018-06-21 07:06:53 -04:00
--- a/installer/appx/AppxManifest.xml
+++ b/installer/appx/AppxManifest.xml
@@ -9,7 +9,7 @@
2018-06-21 07:13:26 -04:00
<Identity
Name="@{microsoft.application.name}"
- ProcessorArchitecture="x64"
+ ProcessorArchitecture="x86"
Publisher="@{microsoft.application.publisher}"
Version="@{application.version}.0"
/>
2018-06-19 14:44:48 -04:00
diff --git a/ivy.xml b/ivy.xml
2018-07-11 11:59:29 -04:00
index f096a963..70bb3b94 100644
2018-06-19 14:44:48 -04:00
--- a/ivy.xml
+++ b/ivy.xml
@@ -25,7 +25,7 @@
<dependency rev="9.20-2.00beta" org="net.sf.sevenzipjbinding" name="sevenzipjbinding-all-platforms" />
<dependency rev="0.6" org="com.optimaize.languagedetector" name="language-detector" />
<dependency rev="0.6.7" org="one.util" name="streamex" />
- <dependency rev="9.0.0" org="org.controlsfx" name="controlsfx" />
+ <dependency rev="8.40.14" org="org.controlsfx" name="controlsfx" />
<dependency rev="3.0.0" org="com.googlecode.lanterna" name="lanterna" />
<dependency rev="2.11.0" org="com.drewnoakes" name="metadata-extractor" />
<dependency rev="1.59" org="org.bouncycastle" name="bcprov-jdk15on" />
diff --git a/source/net/filebot/ResourceManager.java b/source/net/filebot/ResourceManager.java
2018-07-11 11:59:29 -04:00
index 7e393cac..5eb3dadd 100644
2018-06-19 14:44:48 -04:00
--- a/source/net/filebot/ResourceManager.java
+++ b/source/net/filebot/ResourceManager.java
2018-07-11 11:59:29 -04:00
@@ -5,7 +5,6 @@ import static java.util.stream.Collectors.*;
2018-06-19 14:44:48 -04:00
import java.awt.Image;
2018-07-11 11:59:29 -04:00
import java.awt.Toolkit;
2018-06-19 14:44:48 -04:00
-import java.awt.image.BaseMultiResolutionImage;
2018-07-11 11:59:29 -04:00
import java.awt.image.BufferedImage;
2018-06-19 14:44:48 -04:00
import java.net.URL;
2018-07-11 11:59:29 -04:00
import java.util.ArrayList;
@@ -56,22 +55,7 @@ public final class ResourceManager {
2018-06-19 14:44:48 -04:00
private static Image getMultiResolutionImage(URL[] resource) {
try {
2018-07-11 11:59:29 -04:00
- List<BufferedImage> image = new ArrayList<BufferedImage>(resource.length);
- for (URL r : resource) {
- image.add(ImageIO.read(r));
2018-06-19 14:44:48 -04:00
- }
2018-07-11 11:59:29 -04:00
-
- // Windows 10: use @2x image for non-integer scale factors 1.25 / 1.5 / 1.75
- if (PRIMARY_SCALE_FACTOR != 1 && PRIMARY_SCALE_FACTOR != 2) {
- BufferedImage hidpi = image.get(image.size() - 1);
- if (PRIMARY_SCALE_FACTOR < 2) {
- image.add(1, scale(PRIMARY_SCALE_FACTOR, hidpi));
- } else {
- image.add(scale(PRIMARY_SCALE_FACTOR, hidpi));
- }
- }
-
- return new BaseMultiResolutionImage(image.toArray(new Image[0]));
2018-06-19 14:44:48 -04:00
+ return ImageIO.read(resource[0]);
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/source/net/filebot/UserFiles.java b/source/net/filebot/UserFiles.java
index 660c7cef..d551a310 100644
--- a/source/net/filebot/UserFiles.java
+++ b/source/net/filebot/UserFiles.java
@@ -2,7 +2,6 @@ package net.filebot;
import static java.util.Arrays.*;
import static java.util.Collections.*;
-import static java.util.stream.Collectors.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.similarity.Normalization.*;
@@ -16,7 +15,6 @@ import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
@@ -24,6 +22,8 @@ import java.util.logging.Level;
import javax.swing.JFileChooser;
+import com.sun.jna.platform.FileUtils;
+
import net.filebot.platform.mac.MacAppUtilities;
import net.filebot.util.FileUtilities;
import net.filebot.util.FileUtilities.ExtensionFileFilter;
@@ -32,12 +32,10 @@ public class UserFiles {
public static void trash(File file) throws IOException {
// use system trash if possible
- if (Desktop.getDesktop().isSupported(Desktop.Action.MOVE_TO_TRASH)) {
+ if (FileUtils.getInstance().hasTrash()) {
try {
- if (Desktop.getDesktop().moveToTrash(file)) {
- return;
- }
- debug.log(Level.WARNING, message("Failed to move file to trash", file));
+ FileUtils.getInstance().moveToTrash(new File[] { file });
+ return;
} catch (Exception e) {
debug.log(Level.WARNING, e::toString);
}
@@ -50,18 +48,6 @@ public class UserFiles {
}
public static void revealFiles(Collection<File> files) {
- // try to reveal file in folder
- if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE_FILE_DIR)) {
- files.stream().collect(groupingBy(File::getParentFile, LinkedHashMap::new, toList())).forEach((parent, children) -> {
- try {
- Desktop.getDesktop().browseFileDirectory(children.get(children.size() - 1));
- } catch (Exception e) {
- debug.log(Level.WARNING, e::toString);
- }
- });
- return;
- }
-
// if we can't reveal the file in folder, just reveal the parent folder
files.stream().map(it -> it.getParentFile()).distinct().forEach(it -> {
try {
diff --git a/source/net/filebot/mediainfo/MediaInfo.java b/source/net/filebot/mediainfo/MediaInfo.java
2018-07-17 05:26:21 -04:00
index befa2d5f..b6594ee2 100644
2018-06-19 14:44:48 -04:00
--- a/source/net/filebot/mediainfo/MediaInfo.java
+++ b/source/net/filebot/mediainfo/MediaInfo.java
@@ -8,7 +8,6 @@ import static net.filebot.util.RegularExpressions.*;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.lang.ref.Cleaner;
import java.time.Duration;
import java.util.ArrayList;
import java.util.EnumMap;
@@ -27,12 +26,10 @@ import net.filebot.media.MediaCharacteristics;
public class MediaInfo implements MediaCharacteristics {
private Pointer handle;
- private Cleaner.Cleanable cleanable;
public MediaInfo() {
try {
handle = MediaInfoLibrary.INSTANCE.New();
- cleanable = cleaner.register(this, new Finalizer(handle));
} catch (LinkageError e) {
throw new MediaInfoException(e);
}
2018-07-17 05:26:21 -04:00
@@ -229,7 +226,22 @@ public class MediaInfo implements MediaCharacteristics {
2018-06-19 14:44:48 -04:00
@Override
public synchronized void close() {
- cleanable.clean();
+ MediaInfoLibrary.INSTANCE.Close(handle);
+ }
+
+ public synchronized void dispose() {
+ if (handle == null) {
+ return;
+ }
+
+ // delete handle
+ MediaInfoLibrary.INSTANCE.Delete(handle);
+ handle = null;
+ }
+
+ @Override
+ protected void finalize() {
+ dispose();
}
public enum StreamKind {
2018-07-17 05:26:21 -04:00
@@ -314,24 +326,4 @@ public class MediaInfo implements MediaCharacteristics {
2018-06-19 14:44:48 -04:00
}
}
- /**
- * Use {@link Cleaner} instead of Object.finalize()
- */
- private static final Cleaner cleaner = Cleaner.create();
-
- private static class Finalizer implements Runnable {
-
- private Pointer handle;
-
- public Finalizer(Pointer handle) {
- this.handle = handle;
- }
-
- @Override
- public void run() {
- MediaInfoLibrary.INSTANCE.Close(handle);
- MediaInfoLibrary.INSTANCE.Delete(handle);
- }
- }
-
}
diff --git a/source/net/filebot/platform/mac/DropToUnlock.java b/source/net/filebot/platform/mac/DropToUnlock.java
index 6b482847..1d21eca0 100644
--- a/source/net/filebot/platform/mac/DropToUnlock.java
+++ b/source/net/filebot/platform/mac/DropToUnlock.java
@@ -12,7 +12,6 @@ import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
-import java.awt.Desktop;
import java.awt.Dialog.ModalExclusionType;
import java.awt.Dimension;
import java.awt.Font;
@@ -163,7 +162,6 @@ public class DropToUnlock extends JList<File> {
if (model.stream().allMatch(f -> !isLockedFolder(f))) {
dialogCancelled.set(false);
invokeLater(750, () -> dialog.setVisible(false)); // auto-close unlock dialog once all folders have been unlocked
- invokeLater(1000, () -> Desktop.getDesktop().requestForeground(true)); // bring application to foreground now that folders have been unlocked
} else {
model.stream().filter(f -> isLockedFolder(f)).findFirst().ifPresent(f -> {
invokeLater(250, () -> {
diff --git a/source/net/filebot/platform/mac/MacAppUtilities.java b/source/net/filebot/platform/mac/MacAppUtilities.java
index 5fb4de64..7f7e1901 100644
--- a/source/net/filebot/platform/mac/MacAppUtilities.java
+++ b/source/net/filebot/platform/mac/MacAppUtilities.java
@@ -2,12 +2,10 @@ package net.filebot.platform.mac;
import static ca.weblite.objc.util.CocoaUtils.*;
-import java.awt.Desktop;
import java.awt.EventQueue;
import java.awt.SecondaryLoop;
import java.awt.Toolkit;
import java.awt.Window;
-import java.awt.desktop.QuitStrategy;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
@@ -95,20 +93,6 @@ public class MacAppUtilities {
public static void initializeApplication(JMenuBar appMenuBar, Consumer<List<File>> openFileHandler) {
// improved UI defaults
UIManager.put("TitledBorder.border", UIManager.getBorder("InsetBorder.aquaVariant"));
-
- // make sure Application Quit Events get forwarded to normal Window Listeners
- Desktop.getDesktop().setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS);
-
- // set global menu bar
- Desktop.getDesktop().setDefaultMenuBar(appMenuBar);
-
- // set open file handler
- Desktop.getDesktop().setOpenFileHandler(evt -> {
- List<File> files = evt.getFiles();
- if (files.size() > 0) {
- openFileHandler.accept(files);
- }
- });
}
public static boolean isLockedFolder(File folder) {
diff --git a/source/net/filebot/platform/mac/xattr/XAttrUtil.java b/source/net/filebot/platform/mac/xattr/XAttrUtil.java
index 53eb62d9..ad02288e 100644
--- a/source/net/filebot/platform/mac/xattr/XAttrUtil.java
+++ b/source/net/filebot/platform/mac/xattr/XAttrUtil.java
@@ -63,7 +63,7 @@ public class XAttrUtil {
protected static String decodeString(ByteBuffer bb) {
// handle null-terminated String values gracefully
- return UTF_8.decode(bb).codePoints().takeWhile(c -> c != 0).collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString();
+ return UTF_8.decode(bb).codePoints().filter(c -> c != 0).collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString();
}
protected static List<String> decodeStringSequence(ByteBuffer bb) {
diff --git a/source/net/filebot/ui/MainFrame.java b/source/net/filebot/ui/MainFrame.java
index 9d1f086f..a271cc32 100644
--- a/source/net/filebot/ui/MainFrame.java
+++ b/source/net/filebot/ui/MainFrame.java
@@ -12,7 +12,6 @@ import static net.filebot.Settings.*;
import static net.filebot.util.ui.SwingUI.*;
import java.awt.Color;
-import java.awt.Desktop;
import java.awt.Dialog.ModalExclusionType;
import java.awt.Dimension;
import java.awt.FlowLayout;
@@ -220,11 +219,7 @@ public class MainFrame extends JFrame {
selectEnabled = true;
// bring window to front when drag-and-drop operation is in progress
- if (Desktop.getDesktop().isSupported(Desktop.Action.APP_REQUEST_FOREGROUND)) {
- Desktop.getDesktop().requestForeground(true);
- } else {
- SwingUtilities.getWindowAncestor(((DropTarget) dtde.getSource()).getComponent()).toFront();
- }
+ SwingUtilities.getWindowAncestor(((DropTarget) dtde.getSource()).getComponent()).toFront();
});
}
diff --git a/source/net/filebot/ui/rename/CharacterHighlightPainter.java b/source/net/filebot/ui/rename/CharacterHighlightPainter.java
index ffae21d8..414e9c0d 100644
--- a/source/net/filebot/ui/rename/CharacterHighlightPainter.java
+++ b/source/net/filebot/ui/rename/CharacterHighlightPainter.java
@@ -15,7 +15,6 @@ import javax.swing.plaf.TextUI;
import javax.swing.text.BadLocationException;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
-import javax.swing.text.Position.Bias;
import net.filebot.util.ui.GradientStyle;
@@ -36,8 +35,8 @@ class CharacterHighlightPainter implements Highlighter.HighlightPainter {
try {
// determine locations
TextUI mapper = c.getUI();
- Rectangle2D p1 = mapper.modelToView2D(c, offset1, Bias.Backward);
- Rectangle2D p2 = mapper.modelToView2D(c, offset2, Bias.Backward);
+ Rectangle2D p1 = mapper.modelToView(c, offset1);
+ Rectangle2D p2 = mapper.modelToView(c, offset2);
Rectangle2D r = p1.createUnion(p2);
double w = r.getWidth() + 1;