* display error message if MediaInfo native library is missing

* include jna in fatjar
This commit is contained in:
Reinhard Pointner 2009-04-05 10:08:00 +00:00
parent 4388f47317
commit 23dc93bf20
2 changed files with 19 additions and 4 deletions

View File

@ -87,6 +87,11 @@
<zipfileset src="${dir.lib}/ehcache.jar">
<include name="**/*.class" />
</zipfileset>
<zipfileset src="${dir.lib}/jna.jar">
<!-- include classes and native libraries -->
<include name="com/sun/jna/**" />
</zipfileset>
</jar>
</target>

View File

@ -9,6 +9,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.SortedMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.CRC32;
import net.sf.ehcache.Cache;
@ -142,10 +144,18 @@ public class EpisodeFormatBindingBean {
public synchronized MediaInfo getMediaInfo() {
if (mediaInfo == null) {
mediaInfo = new MediaInfo();
if (mediaFile == null || !mediaInfo.open(mediaFile)) {
throw new RuntimeException(String.format("Cannot open file: %s", mediaFile));
try {
mediaInfo = new MediaInfo();
if (mediaFile == null || !mediaInfo.open(mediaFile)) {
throw new RuntimeException(String.format("Cannot open file: %s", mediaFile));
}
} catch (UnsatisfiedLinkError e) {
// MediaInfo native library is missing -> notify user
Logger.getLogger("ui").log(Level.SEVERE, e.getMessage(), e);
// rethrow error
throw e;
}
}