mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-16 06:15:02 -05:00
* catch and ignore JUnRar OutOfMemoryErrors
This commit is contained in:
parent
1640041266
commit
0c698902df
@ -17,25 +17,22 @@ import net.sourceforge.filebot.ResourceManager;
|
|||||||
|
|
||||||
class LanguageComboBoxCellRenderer implements ListCellRenderer {
|
class LanguageComboBoxCellRenderer implements ListCellRenderer {
|
||||||
|
|
||||||
private final Border padding = new EmptyBorder(2, 4, 2, 4);
|
private Border padding = new EmptyBorder(2, 2, 2, 2);
|
||||||
|
|
||||||
private final Border favoritePadding = new EmptyBorder(0, 6, 0, 6);
|
|
||||||
|
|
||||||
private final ListCellRenderer base;
|
|
||||||
|
|
||||||
|
private Border favoritePadding = new EmptyBorder(0, 6, 0, 6);
|
||||||
|
|
||||||
|
private ListCellRenderer base;
|
||||||
|
|
||||||
|
|
||||||
public LanguageComboBoxCellRenderer(final ListCellRenderer base) {
|
public LanguageComboBoxCellRenderer(final ListCellRenderer base) {
|
||||||
this.base = base;
|
this.base = base;
|
||||||
|
this.padding = new CompoundBorder(padding, ((JLabel) base).getBorder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
JLabel c = (JLabel)base.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
JLabel c = (JLabel) base.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||||
|
|
||||||
Language language = (Language) value;
|
Language language = (Language) value;
|
||||||
c.setText(language.getName());
|
c.setText(language.getName());
|
||||||
@ -58,5 +55,4 @@ class LanguageComboBoxCellRenderer implements ListCellRenderer {
|
|||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import java.io.IOException;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.sourceforge.tuned.ByteBufferOutputStream;
|
import net.sourceforge.tuned.ByteBufferOutputStream;
|
||||||
|
|
||||||
@ -37,11 +39,17 @@ class RarArchive implements Archive {
|
|||||||
|
|
||||||
ByteBufferOutputStream buffer = new ByteBufferOutputStream(header.getDataSize());
|
ByteBufferOutputStream buffer = new ByteBufferOutputStream(header.getDataSize());
|
||||||
|
|
||||||
|
try {
|
||||||
// write contents to buffer
|
// write contents to buffer
|
||||||
rar.extractFile(header, buffer);
|
rar.extractFile(header, buffer);
|
||||||
|
|
||||||
// add memory file
|
// add memory file
|
||||||
vfs.put(header.getFileNameString(), buffer.getByteBuffer());
|
vfs.put(header.getFileNameString(), buffer.getByteBuffer());
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
// ignore, there seems to be bug with JUnRar allocating lots of memory for no apparent reason
|
||||||
|
// @see https://sourceforge.net/forum/forum.php?thread_id=2773018&forum_id=706772
|
||||||
|
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Cannot extract " + header.getFileNameString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (RarException e) {
|
} catch (RarException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
package net.sourceforge.filebot.ui.panel.subtitle;
|
package net.sourceforge.filebot.ui.panel.subtitle;
|
||||||
|
|
||||||
|
|
||||||
import static net.sourceforge.filebot.Settings.getApplicationName;
|
import static net.sourceforge.filebot.Settings.*;
|
||||||
import static net.sourceforge.filebot.Settings.getApplicationVersion;
|
import static net.sourceforge.filebot.ui.panel.subtitle.LanguageComboBoxModel.*;
|
||||||
import static net.sourceforge.filebot.ui.panel.subtitle.LanguageComboBoxModel.ALL_LANGUAGES;
|
|
||||||
|
|
||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
Loading…
Reference in New Issue
Block a user