Could somebody explain to me why I can't catch the RuntimeException when initializing an ArcGIS Runtime Licence ?I'm using following code, which fire a RuntimeException on ArcGISRuntime.initialize(), but it's not catched, and only way to know that Licence is not valid, is by checking with ArcGISRuntime.isLicensed() :public class Main{
public static void main(String[] args)throws Exception {
if (initializeLicenceArcGIS()) {
if (ArcGISRuntime.isLicensed()) {
InitializeApplication.main(args);
}
else {
-> end up here !!
JOptionPane.showMessageDialog(null, "ArcGIS Licence is not initialized !", "Initialize Application", JOptionPane.ERROR_MESSAGE);
}
}
}
private static boolean initializeLicenceArcGIS() {
try
{
ArcGISRuntime.setLicense("No Licence Available");
ArcGISRuntime.initialize(); (-> see Console out print below)
return true; (-> continu here and return true with invalid licence)
} catch (RuntimeException e) {
-> never catch here ??
JOptionPane.showMessageDialog(null, "Error when licencing ArcGIS: " + e.getMessage(), "Initialize Application", JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error when licencing ArcGIS: " + e.getMessage(), "Initialize Application", JOptionPane.ERROR_MESSAGE);
return false;
}
}
}
in Debug, the code line "ArcGISRuntime.initialize();" fire following exception in my Console, but program continu on line "return true;".Finally "ArcGISRuntime.isLicensed()" return "false", but I would prefer to catch the RuntimeException in order to get the error message !java.lang.RuntimeException: License error with ArcGISRuntime. Main license is invalid.
at com.esri.runtime.ArcGISRuntime.nativeInitLicenses(Native Method)
at com.esri.runtime.ArcGISRuntime.e(Unknown Source)
at com.esri.runtime.ArcGISRuntime.initialize(Unknown Source)
at com.example.forum.initialize.Main.initializeLicenceArcGIS(Main.java:24)
at com.example.forum.initialize.Main.main(Main.java:9)
Any ideas ?