mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 23:05:03 -05:00
* make sure to gracefully ignore all cache errors
This commit is contained in:
parent
fa6909ddfe
commit
30f05c1f9c
@ -5,6 +5,8 @@ package net.sourceforge.filebot;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
@ -77,10 +79,14 @@ public final class ResourceManager {
|
|||||||
|
|
||||||
|
|
||||||
private static <T> T probeCache(String name, Class<T> type) {
|
private static <T> T probeCache(String name, Class<T> type) {
|
||||||
Element entry = cache.get(type.getName() + ":" + name);
|
try {
|
||||||
|
Element entry = cache.get(type.getName() + ":" + name);
|
||||||
|
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
return type.cast(entry.getObjectValue());
|
return type.cast(entry.getObjectValue());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(ResourceManager.class.getName()).log(Level.WARNING, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -88,7 +94,11 @@ public final class ResourceManager {
|
|||||||
|
|
||||||
|
|
||||||
private static <T> T populateCache(String name, Class<? super T> type, T value) {
|
private static <T> T populateCache(String name, Class<? super T> type, T value) {
|
||||||
cache.put(new Element(type.getName() + ":" + name, value));
|
try {
|
||||||
|
cache.put(new Element(type.getName() + ":" + name, value));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(ResourceManager.class.getName()).log(Level.WARNING, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user