Improve some error handling on class name searching

define_list_fix
iwgeric 9 years ago
parent b7b1947486
commit fd98c6b8f0
  1. 5
      jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/MainActivity.java

@ -287,7 +287,7 @@ public class MainActivity extends AppCompatActivity implements OnItemClickListen
private boolean checkClassType(String className) { private boolean checkClassType(String className) {
boolean include = true; boolean include = true;
try { try {
Class<?> clazz = (Class<?>)Class.forName(className); Class<?> clazz = (Class<?>) Class.forName(className);
if (Application.class.isAssignableFrom(clazz)) { if (Application.class.isAssignableFrom(clazz)) {
Log.i(TAG, "Class " + className + " is a jME Application"); Log.i(TAG, "Class " + className + " is a jME Application");
} else { } else {
@ -295,6 +295,9 @@ public class MainActivity extends AppCompatActivity implements OnItemClickListen
Log.i(TAG, "Skipping Class " + className + ". Not a jME Application"); Log.i(TAG, "Skipping Class " + className + ". Not a jME Application");
} }
} catch (NoClassDefFoundError ncdf) {
include = false;
Log.i(TAG, "Skipping Class " + className + ". No Class Def found.");
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
include = false; include = false;
Log.i(TAG, "Skipping Class " + className + ". Class not found."); Log.i(TAG, "Skipping Class " + className + ". Class not found.");

Loading…
Cancel
Save