Merge "Issue #1869 Ensure RecordFactory throws NoPluginException when there is no plugin." into development

Former-commit-id: 38aa364a89d87896c2569026bc7e16a71babd308
This commit is contained in:
Nate Jensen 2013-06-05 13:26:12 -05:00 committed by Gerrit Code Review
commit dc2a278ab5

View file

@ -153,6 +153,15 @@ public class RecordFactory implements IPluginClassMapper {
map.put("dataURI", dataURI);
return map;
} catch (Exception e) {
// if this exception was caused by NoPlugin then throw that so that
// caller knows exactly why this happened.
Throwable cause = e.getCause();
while (cause != null) {
if (cause instanceof NoPluginException) {
throw (NoPluginException) cause;
}
cause = cause.getCause();
}
throw new VizException("Unable to create property map for "
+ dataURI, e);
}
@ -251,7 +260,7 @@ public class RecordFactory implements IPluginClassMapper {
try {
return getPluginClass(pluginName);
} catch (NoPluginException e) {
throw new PluginException(e.getLocalizedMessage());
throw new PluginException(e.getLocalizedMessage(), e);
}
}
}