Issue #2919 fix windows error due to gempak library missing
Former-commit-id: 5a2ba132d9e32ce8a018f35ba2524881e5276120
This commit is contained in:
parent
d23acbdd48
commit
747ac58166
2 changed files with 32 additions and 3 deletions
|
@ -26,6 +26,7 @@ gov.noaa.nws.ncep.viz.rsc.idft
|
||||||
gov.noaa.nws.ncep.viz.rsc.intlsig
|
gov.noaa.nws.ncep.viz.rsc.intlsig
|
||||||
gov.noaa.nws.ncep.viz.rsc.lightning
|
gov.noaa.nws.ncep.viz.rsc.lightning
|
||||||
gov.noaa.nws.ncep.viz.rsc.mosaic
|
gov.noaa.nws.ncep.viz.rsc.mosaic
|
||||||
|
gov.noaa.nws.ncep.viz.rsc.ncgrid
|
||||||
gov.noaa.nws.ncep.viz.rsc.ncscat
|
gov.noaa.nws.ncep.viz.rsc.ncscat
|
||||||
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
|
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
|
||||||
gov.noaa.nws.ncep.viz.rsc.plotdata
|
gov.noaa.nws.ncep.viz.rsc.plotdata
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package gov.noaa.nws.ncep.viz.gempak.nativelib;
|
package gov.noaa.nws.ncep.viz.gempak.nativelib;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.FileLocator;
|
import org.eclipse.core.runtime.FileLocator;
|
||||||
|
@ -10,20 +11,47 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility to load a specific native library
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- ----------- -----------------------------------------
|
||||||
|
* --/--/---- Initial Creation
|
||||||
|
* Mar 20, 2014 2919 njensen Safety checks, better error messages
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class LibraryLoader {
|
public class LibraryLoader {
|
||||||
|
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(LibraryLoader.class);
|
.getHandler(LibraryLoader.class);
|
||||||
|
|
||||||
public static void load(String libName) {
|
public static void load(String libName) {
|
||||||
URL url = null;
|
URL url = null;
|
||||||
|
Path path = null;
|
||||||
try {
|
try {
|
||||||
Bundle b = Activator.getDefault().getBundle();
|
Bundle b = Activator.getDefault().getBundle();
|
||||||
url = FileLocator.find(b, new Path(System.mapLibraryName(libName)),
|
path = new Path(System.mapLibraryName(libName));
|
||||||
null);
|
url = FileLocator.find(b, path, null);
|
||||||
|
if (url == null) {
|
||||||
|
throw new FileNotFoundException("Unable to locate "
|
||||||
|
+ path.toString());
|
||||||
|
}
|
||||||
url = FileLocator.resolve(url);
|
url = FileLocator.resolve(url);
|
||||||
System.load(url.getPath());
|
System.load(url.getPath());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "Could not Load native Library: " + url.getFile();
|
String msg = "Could not load native Library: ";
|
||||||
|
if (url != null) {
|
||||||
|
msg += url.getFile();
|
||||||
|
} else {
|
||||||
|
msg += path.toString();
|
||||||
|
}
|
||||||
statusHandler.handle(Priority.PROBLEM, msg, e);
|
statusHandler.handle(Priority.PROBLEM, msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue