From 7006ed1a6f29b0fd34d82a8670d42c9d7a21b25e Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 10 May 2016 22:14:52 -0400 Subject: [PATCH] couple tweaks for Mode debugging --- app/src/processing/app/Base.java | 5 +++++ app/src/processing/app/contrib/ModeContribution.java | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 6b4997eba..ee5262510 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -397,13 +397,18 @@ public class Base { contribModes.add(new ModeContribution(this, folder, null)); } catch (NoSuchMethodError nsme) { System.err.println(folder.getName() + " is not compatible with this version of Processing"); + if (DEBUG) nsme.printStackTrace(); } catch (NoClassDefFoundError ncdfe) { System.err.println(folder.getName() + " is not compatible with this version of Processing"); + if (DEBUG) ncdfe.printStackTrace(); } catch (InvocationTargetException ite) { System.err.println(folder.getName() + " could not be loaded and may not compatible with this version of Processing"); + if (DEBUG) ite.printStackTrace(); } catch (IgnorableException ig) { Messages.log(ig.getMessage()); + if (DEBUG) ig.printStackTrace(); } catch (Throwable e) { + System.err.println("Could not load Mode from " + folder); e.printStackTrace(); } } else { diff --git a/app/src/processing/app/contrib/ModeContribution.java b/app/src/processing/app/contrib/ModeContribution.java index ebb36faf2..36598230c 100644 --- a/app/src/processing/app/contrib/ModeContribution.java +++ b/app/src/processing/app/contrib/ModeContribution.java @@ -137,11 +137,11 @@ public class ModeContribution extends LocalContribution { return loader.equals(other.loader) && mode.equals(other.getMode()); } - public String initLoader(Base base, String className) throws Exception { + public String initLoader(Base base, String className) throws Exception { File modeDirectory = new File(folder, getTypeName()); if (modeDirectory.exists()) { - Messages.log("checking mode folder regarding " + className); + Messages.log("checking mode folder regarding class name " + className); // If no class name specified, search the main .jar for the // full name package and mode name. if (className == null) { @@ -170,7 +170,7 @@ public class ModeContribution extends LocalContribution { installedModes.put(m.getClass().getName(), m); } - for(String modeImport: imports){ + for (String modeImport: imports) { if (installedModes.containsKey(modeImport)) { Messages.log("Found mode dependency " + modeImport); File modeFolder = installedModes.get(modeImport).getFolder(); @@ -182,8 +182,9 @@ public class ModeContribution extends LocalContribution { } } } else { - throw new IgnorableException("Dependency mode "+ modeImport + " could not be" - + " found. Can't load " + className); + throw new IgnorableException("Can't load " + className + + " because the import " + modeImport + + " could not be found. "); } } }