diff --git a/.classpath b/.classpath
index 8336886e..31d9eb0a 100644
--- a/.classpath
+++ b/.classpath
@@ -8,7 +8,7 @@
-
+
diff --git a/source/net/filebot/CacheType.java b/source/net/filebot/CacheType.java
index 241ac7a8..914703ab 100644
--- a/source/net/filebot/CacheType.java
+++ b/source/net/filebot/CacheType.java
@@ -24,6 +24,7 @@ public enum CacheType {
this.diskPersistent = diskPersistent;
}
+ @SuppressWarnings("deprecation")
CacheConfiguration getConfiguration(String name) {
// Strategy.LOCALTEMPSWAP is not restartable so we can't but use the deprecated disk persistent code (see http://stackoverflow.com/a/24623527/1514467)
return new CacheConfiguration().name(name).maxEntriesLocalHeap(diskPersistent ? 200 : 0).maxEntriesLocalDisk(0).eternal(false).timeToLiveSeconds(timeToLiveSeconds).timeToIdleSeconds(timeToLiveSeconds).overflowToDisk(diskPersistent).diskPersistent(diskPersistent);
diff --git a/source/net/filebot/archive/ArchiveOpenVolumeCallback.java b/source/net/filebot/archive/ArchiveOpenVolumeCallback.java
index c8688227..be3cbc9b 100644
--- a/source/net/filebot/archive/ArchiveOpenVolumeCallback.java
+++ b/source/net/filebot/archive/ArchiveOpenVolumeCallback.java
@@ -1,7 +1,5 @@
-
package net.filebot.archive;
-
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -16,7 +14,6 @@ import net.sf.sevenzipjbinding.PropID;
import net.sf.sevenzipjbinding.SevenZipException;
import net.sf.sevenzipjbinding.impl.RandomAccessFileInStream;
-
class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveOpenCallback, Closeable {
/**
@@ -29,10 +26,8 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
*/
private String name;
-
/**
- * This method should at least provide the name of the last
- * opened volume (propID=PropID.NAME).
+ * This method should at least provide the name of the last opened volume (propID=PropID.NAME).
*
* @see IArchiveOpenVolumeCallback#getProperty(PropID)
*/
@@ -41,16 +36,13 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
switch (propID) {
case NAME:
return name;
+ default:
+ return null;
}
- return null;
}
-
/**
- * The name of the required volume will be calculated out of the
- * name of the first volume and a volume index. In case of RAR file,
- * the substring ".partNN." in the name of the volume file will
- * indicate a volume with id NN. For example:
+ * The name of the required volume will be calculated out of the name of the first volume and a volume index. In case of RAR file, the substring ".partNN." in the name of the volume file will indicate a volume with id NN. For example:
*
*
test.rar - single part archive or multi-part archive with a single volume
*
test.part23.rar - 23-th part of a multi-part archive
@@ -85,7 +77,7 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
} catch (FileNotFoundException fileNotFoundException) {
// Required volume doesn't exist. This happens if the volume:
// 1. never exists. 7-Zip doesn't know how many volumes should
- // exist, so it have to try each volume.
+ // exist, so it have to try each volume.
// 2. should be there, but doesn't. This is an error case.
// Since normal and error cases are possible,
@@ -96,7 +88,6 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
}
}
-
/**
* Close all opened streams
*/
@@ -107,12 +98,10 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
}
}
-
@Override
public void setCompleted(Long files, Long bytes) throws SevenZipException {
}
-
@Override
public void setTotal(Long files, Long bytes) throws SevenZipException {
}
diff --git a/source/net/filebot/archive/SevenZipExecutable.java b/source/net/filebot/archive/SevenZipExecutable.java
index 218e9f03..e4c2d13b 100644
--- a/source/net/filebot/archive/SevenZipExecutable.java
+++ b/source/net/filebot/archive/SevenZipExecutable.java
@@ -1,6 +1,8 @@
package net.filebot.archive;
import static java.nio.charset.StandardCharsets.*;
+import static java.util.Arrays.*;
+import static net.filebot.Logging.*;
import java.io.File;
import java.io.FileFilter;
@@ -40,21 +42,20 @@ public class SevenZipExecutable implements ArchiveExtractor {
protected CharSequence execute(String... command) throws IOException {
Process process = new ProcessBuilder(command).redirectError(Redirect.INHERIT).start();
- ByteBufferOutputStream bb = new ByteBufferOutputStream(8 * 1024);
- bb.transferFully(process.getInputStream());
+ try (ByteBufferOutputStream bb = new ByteBufferOutputStream(8 * 1024)) {
+ bb.transferFully(process.getInputStream());
- try {
int returnCode = process.waitFor();
- CharSequence output = UTF_8.decode(bb.getByteBuffer());
+ String output = UTF_8.decode(bb.getByteBuffer()).toString();
// DEBUG
- // System.out.println("Execute: " + Arrays.asList(command));
- // System.out.println(output);
+ debug.fine(format("Execute: %s", asList(command)));
+ debug.finest(output);
if (returnCode == 0) {
return output;
} else {
- throw new IOException(String.format("%s failed with exit code %d: %s", get7zCommand(), returnCode, output.toString().replaceAll("\\s+", " ").trim()));
+ throw new IOException(String.format("%s failed with exit code %d: %s", get7zCommand(), returnCode, output.replaceAll("\\s+", " ").trim()));
}
} catch (InterruptedException e) {
throw new IOException(String.format("%s timed out", get7zCommand()), e);
diff --git a/source/net/filebot/cli/GroovyPad.java b/source/net/filebot/cli/GroovyPad.java
index 7fc9b359..67e36dd5 100644
--- a/source/net/filebot/cli/GroovyPad.java
+++ b/source/net/filebot/cli/GroovyPad.java
@@ -16,12 +16,10 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.util.HashMap;
-import java.util.concurrent.TimeUnit;
import javax.script.Bindings;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
-import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JFrame;
diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java
index 043f4d4c..2b7490d6 100644
--- a/source/net/filebot/format/MediaBindingBean.java
+++ b/source/net/filebot/format/MediaBindingBean.java
@@ -27,9 +27,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
-import java.util.Scanner;
import java.util.Set;
import java.util.SortedSet;
+import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
@@ -301,7 +301,7 @@ public class MediaBindingBean {
String codec = getMediaInfo(StreamKind.Video, 0, "Encoded_Library_Name", "Encoded_Library/Name", "CodecID/Hint", "Format");
// get first token (e.g. DivX 5 => DivX)
- return new Scanner(codec).next();
+ return new StringTokenizer(codec).nextToken();
}
@Define("ac")
diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java
index 2e890423..11792a46 100644
--- a/source/net/filebot/media/MediaDetection.java
+++ b/source/net/filebot/media/MediaDetection.java
@@ -512,7 +512,7 @@ public class MediaDetection {
for (CollationKey[] name : names) {
IndexEntry bestMatch = null;
for (IndexEntry it : index) {
- CollationKey[] commonName = nameMatcher.matchFirstCommonSequence(name, it.getLenientKey());
+ CollationKey[] commonName = nameMatcher.matchFirstCommonSequence(new CollationKey[][] { name, it.getLenientKey() });
if (commonName != null && commonName.length >= it.getLenientKey().length && (bestMatch == null || commonName.length > bestMatch.getLenientKey().length)) {
bestMatch = it;
}
@@ -871,9 +871,9 @@ public class MediaDetection {
for (IndexEntry movie : getMovieIndex()) {
for (CollationKey[] name : names) {
- CollationKey[] commonName = nameMatcher.matchFirstCommonSequence(name, movie.getLenientKey());
+ CollationKey[] commonName = nameMatcher.matchFirstCommonSequence(new CollationKey[][] { name, movie.getLenientKey() });
if (commonName != null && commonName.length >= movie.getLenientKey().length) {
- CollationKey[] strictCommonName = nameMatcher.matchFirstCommonSequence(name, movie.getStrictKey());
+ CollationKey[] strictCommonName = nameMatcher.matchFirstCommonSequence(new CollationKey[][] { name, movie.getStrictKey() });
if (strictCommonName != null && strictCommonName.length >= movie.getStrictKey().length) {
// prefer strict match
matchMap.put(movie.getObject(), movie.getStrictName());
@@ -998,7 +998,7 @@ public class MediaDetection {
for (Movie movie : options) {
for (String alias : movie.getEffectiveNames()) {
CollationKey[] movieSeq = HighPerformanceMatcher.prepare(normalizePunctuation(alias));
- CollationKey[] commonSeq = nameMatcher.matchFirstCommonSequence(nameSeq, movieSeq);
+ CollationKey[] commonSeq = nameMatcher.matchFirstCommonSequence(new CollationKey[][] { nameSeq, movieSeq });
if (commonSeq != null && commonSeq.length >= movieSeq.length) {
movies.add(movie);
diff --git a/source/net/filebot/similarity/CommonSequenceMatcher.java b/source/net/filebot/similarity/CommonSequenceMatcher.java
index c7c3e1fe..b9e33ea2 100644
--- a/source/net/filebot/similarity/CommonSequenceMatcher.java
+++ b/source/net/filebot/similarity/CommonSequenceMatcher.java
@@ -41,7 +41,7 @@ public class CommonSequenceMatcher {
return synth(matchFirstCommonSequence(words));
}
- public > E[] matchFirstCommonSequence(E[]... names) {
+ public > E[] matchFirstCommonSequence(E[][] names) {
E[] common = null;
for (E[] words : names) {
diff --git a/source/net/filebot/ui/FileBotList.java b/source/net/filebot/ui/FileBotList.java
index 39a3042b..d33d5d13 100644
--- a/source/net/filebot/ui/FileBotList.java
+++ b/source/net/filebot/ui/FileBotList.java
@@ -55,7 +55,7 @@ public class FileBotList extends JComponent {
public void setModel(EventList model) {
this.model = model;
- list.setModel(new EventListModel(model));
+ list.setModel(new EventListModel(model));
}
public JList getListComponent() {
@@ -110,15 +110,16 @@ public class FileBotList extends JComponent {
@Override
public void actionPerformed(ActionEvent e) {
int index = list.getSelectedIndex();
- Object values[] = list.getSelectedValues();
- for (Object value : values)
+ for (Object value : list.getSelectedValuesList()) {
getModel().remove(value);
+ }
int maxIndex = list.getModel().getSize() - 1;
- if (index > maxIndex)
+ if (index > maxIndex) {
index = maxIndex;
+ }
list.setSelectedIndex(index);
}
diff --git a/source/net/filebot/ui/SelectButtonTextField.java b/source/net/filebot/ui/SelectButtonTextField.java
index 0e616242..973cd638 100644
--- a/source/net/filebot/ui/SelectButtonTextField.java
+++ b/source/net/filebot/ui/SelectButtonTextField.java
@@ -40,7 +40,7 @@ public class SelectButtonTextField extends JComponent {
private SelectButton selectButton = new SelectButton();
- private JComboBox editor = new JComboBox();
+ private JComboBox