* catch and ignore JUnRar OutOfMemoryErrors

This commit is contained in:
Reinhard Pointner 2009-06-02 17:14:54 +00:00
parent 1640041266
commit 0c698902df
3 changed files with 23 additions and 20 deletions

View File

@ -17,22 +17,19 @@ import net.sourceforge.filebot.ResourceManager;
class LanguageComboBoxCellRenderer implements ListCellRenderer {
private final Border padding = new EmptyBorder(2, 4, 2, 4);
private final Border favoritePadding = new EmptyBorder(0, 6, 0, 6);
private final ListCellRenderer base;
private Border padding = new EmptyBorder(2, 2, 2, 2);
private Border favoritePadding = new EmptyBorder(0, 6, 0, 6);
private ListCellRenderer base;
public LanguageComboBoxCellRenderer(final ListCellRenderer base) {
this.base = base;
this.padding = new CompoundBorder(padding, ((JLabel) base).getBorder());
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel c = (JLabel) base.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@ -58,5 +55,4 @@ class LanguageComboBoxCellRenderer implements ListCellRenderer {
return c;
}
}

View File

@ -6,6 +6,8 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sourceforge.tuned.ByteBufferOutputStream;
@ -37,11 +39,17 @@ class RarArchive implements Archive {
ByteBufferOutputStream buffer = new ByteBufferOutputStream(header.getDataSize());
try {
// write contents to buffer
rar.extractFile(header, buffer);
// add memory file
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) {
throw new IOException(e);

View File

@ -2,9 +2,8 @@
package net.sourceforge.filebot.ui.panel.subtitle;
import static net.sourceforge.filebot.Settings.getApplicationName;
import static net.sourceforge.filebot.Settings.getApplicationVersion;
import static net.sourceforge.filebot.ui.panel.subtitle.LanguageComboBoxModel.ALL_LANGUAGES;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.ui.panel.subtitle.LanguageComboBoxModel.*;
import java.awt.event.ItemEvent;
import java.net.URI;