1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 08:25:02 -04:00

Improved error message (e.g. n00bs using the same file for filebot logging and shell IO redirection)

This commit is contained in:
Reinhard Pointner 2016-04-16 21:41:13 +00:00
parent cfe7fc69a3
commit 4c85678975

View File

@ -57,8 +57,8 @@ import net.filebot.ui.PanelBuilder;
import net.filebot.ui.SinglePanelFrame; import net.filebot.ui.SinglePanelFrame;
import net.filebot.ui.transfer.FileTransferable; import net.filebot.ui.transfer.FileTransferable;
import net.filebot.util.PreferencesMap.PreferencesEntry; import net.filebot.util.PreferencesMap.PreferencesEntry;
import net.filebot.util.ui.SwingEventBus;
import net.filebot.util.TeePrintStream; import net.filebot.util.TeePrintStream;
import net.filebot.util.ui.SwingEventBus;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
public class Main { public class Main {
@ -465,10 +465,12 @@ public class Main {
// open file channel and lock // open file channel and lock
FileChannel logChannel = FileChannel.open(logFile.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.APPEND); FileChannel logChannel = FileChannel.open(logFile.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.APPEND);
if (args.logLock) { if (args.logLock) {
if (args.getLogLevel() == Level.ALL) { try {
log.config("Locking " + logFile); log.config("Locking " + logFile);
}
logChannel.lock(); logChannel.lock();
} catch (Exception e) {
throw new IOException("Failed to acquire lock: " + logFile, e);
}
} }
OutputStream out = Channels.newOutputStream(logChannel); OutputStream out = Channels.newOutputStream(logChannel);