From 5b7d847c2dd1e33dd002aa22492a27c56d6b4d4f Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Fri, 7 Sep 2012 18:34:30 +0200 Subject: [PATCH] Corrected some code --- .../beans/view/ClassAndMethodContainer.java | 9 ++- .../beans/view/CurrentAnalysisEditorBean.java | 67 ++++++++++++++++--- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java index 2fb36790..7bf0e689 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java @@ -92,10 +92,17 @@ public final class ClassAndMethodContainer { this.repositoryPortNameMethod = this.repositoryPortAnnotationClass.getMethod("name", new Class<?>[0]); this.propertyNameMethod = this.propertyAnnotationClass.getMethod("name", new Class<?>[0]); this.propertyDefaultValueMethod = this.propertyAnnotationClass.getMethod("defaultValue", new Class<?>[0]); - } catch (final ReflectiveOperationException ex) { + } catch (final ClassNotFoundException ex) { + ClassAndMethodContainer.LOG.error("An error occured while loading the classes and methods.", ex); + throw new ProjectLoadException(); + } catch (final NoSuchMethodException ex) { + ClassAndMethodContainer.LOG.error("An error occured while loading the classes and methods.", ex); + throw new ProjectLoadException(); + } catch (final SecurityException ex) { ClassAndMethodContainer.LOG.error("An error occured while loading the classes and methods.", ex); throw new ProjectLoadException(); } + } public Class<?> getAbstractFilterPluginClass() { 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 2f993716..be7547bd 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 @@ -22,6 +22,7 @@ package kieker.webgui.beans.view; import java.io.IOException; import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.MalformedURLException; @@ -399,7 +400,13 @@ public final class CurrentAnalysisEditorBean { } else { return (String) this.classAndMethodContainer.getPluginDescriptionMethod().invoke(annotationPlugin, new Object[0]); } - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + return "No description available"; + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + return "No description available"; + } catch (final InvocationTargetException ex) { CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); return "No description available"; } @@ -431,7 +438,11 @@ public final class CurrentAnalysisEditorBean { result.add(property); } - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + } catch (final InvocationTargetException ex) { CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); } return result; @@ -480,7 +491,11 @@ public final class CurrentAnalysisEditorBean { } } - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + } catch (final InvocationTargetException ex) { CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); } return result; @@ -505,7 +520,11 @@ public final class CurrentAnalysisEditorBean { result.add(rPort); } } - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); + } catch (final InvocationTargetException ex) { CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); } return result; @@ -644,7 +663,7 @@ public final class CurrentAnalysisEditorBean { } return true; - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the displays of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); return false; @@ -652,6 +671,14 @@ public final class CurrentAnalysisEditorBean { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the displays of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); return false; + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the displays of the plugin.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); + return false; + } catch (final InvocationTargetException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the displays of the plugin.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the displays of the plugin."); + return false; } } } @@ -699,7 +726,7 @@ public final class CurrentAnalysisEditorBean { return true; - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the ports of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); return false; @@ -707,6 +734,14 @@ public final class CurrentAnalysisEditorBean { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the ports of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); return false; + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the ports of the plugin.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); + return false; + } catch (final InvocationTargetException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the ports of the plugin.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); + return false; } } } @@ -736,7 +771,7 @@ public final class CurrentAnalysisEditorBean { } return true; - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the repository.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); return false; @@ -744,6 +779,14 @@ public final class CurrentAnalysisEditorBean { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the repository.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); return false; + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the repository.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); + return false; + } catch (final InvocationTargetException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the repository.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); + return false; } } @@ -772,7 +815,7 @@ public final class CurrentAnalysisEditorBean { } return true; - } catch (final ReflectiveOperationException ex) { + } catch (final IllegalAccessException ex) { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); return false; @@ -780,6 +823,14 @@ public final class CurrentAnalysisEditorBean { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); return false; + } catch (final IllegalArgumentException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the plugin.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); + return false; + } catch (final InvocationTargetException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the plugin.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); + return false; } } -- GitLab