diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java index 5f211f539983f2772ba473b2750b6e08d0625d7a..6154d015b7b02ee9bd098f00da9fb24a913f3d1a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java @@ -879,17 +879,23 @@ public final class CurrentAnalysisEditorBean { * The class of the repository to be added. */ public void addRepository(final Class<AbstractRepository> clazz) { - // Create a new instance for the model - final MIRepository repository = this.factory.createRepository(); - repository.setClassname(clazz.getName()); - repository.setName(clazz.getSimpleName()); + try { + // Create a new instance for the model + final MIRepository repository = this.factory.createRepository(); + repository.setClassname(clazz.getName()); + repository.setName(clazz.getSimpleName()); - this.fillProperties(clazz, repository); - synchronized (this) { - // Add it to the project - and to the graph - this.project.getRepositories().add(repository); - this.currentAnalysisEditorGraphBean.addRepository(repository); - this.currentAnalysisEditorGraphBean.refreshGraph(); + this.fillProperties(clazz, repository); + synchronized (this) { + // Add it to the project - and to the graph + this.project.getRepositories().add(repository); + this.currentAnalysisEditorGraphBean.addRepository(repository); + this.currentAnalysisEditorGraphBean.refreshGraph(); + } + } catch (final NoClassDefFoundError ex) { + // This exception can occur if (for example) a class is missing + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured during the creation of the repository. Check the dependencies."); + CurrentAnalysisEditorBean.LOG.error("An error occured during the creation of the repository. Check the dependencies.", ex); } } @@ -900,31 +906,37 @@ public final class CurrentAnalysisEditorBean { * The class of the plugin to be added. This can be both, a filter or a reader. */ public void addPlugin(final Class<AbstractPlugin> clazz) { - // Create a new instance for the model - final MIPlugin plugin; - if (this.classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(clazz)) { - plugin = this.factory.createReader(); - } else { - plugin = this.factory.createFilter(); - } - plugin.setClassname(clazz.getName()); - plugin.setName(clazz.getSimpleName()); + try { + // Create a new instance for the model + final MIPlugin plugin; + if (this.classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(clazz)) { + plugin = this.factory.createReader(); + } else { + plugin = this.factory.createFilter(); + } + plugin.setClassname(clazz.getName()); + plugin.setName(clazz.getSimpleName()); - this.fillProperties(clazz, plugin); - this.fillPorts(clazz, plugin); - this.fillDisplays(clazz, plugin); + this.fillProperties(clazz, plugin); + this.fillPorts(clazz, plugin); + this.fillDisplays(clazz, plugin); - synchronized (this) { - // Add it to the project - this.project.getPlugins().add(plugin); + synchronized (this) { + // Add it to the project + this.project.getPlugins().add(plugin); - // Add the element to the graph - if (plugin instanceof MIReader) { - this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin); - } else { - this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin); + // Add the element to the graph + if (plugin instanceof MIReader) { + this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin); + } else { + this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin); + } + this.currentAnalysisEditorGraphBean.refreshGraph(); } - this.currentAnalysisEditorGraphBean.refreshGraph(); + } catch (final NoClassDefFoundError ex) { + // This exception can occur if (for example) a class is missing + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured during the creation of the plugin. Check the dependencies."); + CurrentAnalysisEditorBean.LOG.error("An error occured during the creation of the plugin. Check the dependencies.", ex); } }