modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
| 8 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
| 17 +++++++---
2 files changed, 20 insertions(+), 5 deletions(-)
New commits:
commit 6c3264cbd00f2dff09143291cc95422a077de7f7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 20 15:17:36 2012 -0400
don't throw NoResultException, just return null
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
index 901e6d9..3071a2d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
@@ -461,6 +461,10 @@ public class PluginGWTServiceImpl extends AbstractGWTServiceImpl
implements Plug
// first load the full original plugin data
ServerPlugin plugin = serverPlugins.getServerPlugin(serverPluginKey);
+ if (plugin == null) {
+ throw new IllegalArgumentException("Unknown plugin key: " +
serverPluginKey);
+ }
+
plugin = serverPlugins.getServerPluginRelationships(plugin);
// now overwrite the config that we want to set and tell the server about it
@@ -490,6 +494,10 @@ public class PluginGWTServiceImpl extends AbstractGWTServiceImpl
implements Plug
// first load the full original plugin data
ServerPlugin plugin = serverPlugins.getServerPlugin(serverPluginKey);
+ if (plugin == null) {
+ throw new IllegalArgumentException("Unknown plugin key: " +
serverPluginKey);
+ }
+
plugin = serverPlugins.getServerPluginRelationships(plugin);
// now overwrite the config that we want to set and tell the server about it
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
index 1f398cf..eb3a080 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
@@ -105,8 +105,12 @@ public class ServerPluginsBean implements ServerPluginsLocal {
public ServerPlugin getServerPlugin(PluginKey key) {
Query query = entityManager.createNamedQuery(ServerPlugin.QUERY_FIND_BY_NAME);
query.setParameter("name", key.getPluginName());
- ServerPlugin plugin = (ServerPlugin) query.getSingleResult();
- return plugin;
+ try {
+ ServerPlugin plugin = (ServerPlugin) query.getSingleResult();
+ return plugin;
+ } catch (NoResultException nre) {
+ return null;
+ }
}
public ServerPlugin getServerPluginRelationships(ServerPlugin plugin) {
@@ -167,6 +171,10 @@ public class ServerPluginsBean implements ServerPluginsLocal {
public ServerPluginDescriptorType getServerPluginDescriptor(PluginKey pluginKey)
throws Exception {
ServerPlugin plugin = getServerPlugin(pluginKey);
+ if (plugin == null) {
+ throw new IllegalArgumentException("Unknown plugin key: " +
pluginKey);
+ }
+
File pluginsDir =
LookupUtil.getServerPluginService().getServerPluginsDirectory();
File pluginJar = new File(pluginsDir, plugin.getPath());
URL url = pluginJar.toURI().toURL();
@@ -431,9 +439,8 @@ public class ServerPluginsBean implements ServerPluginsLocal {
ServerPlugin existingPlugin = null;
boolean newOrUpdated = false;
- try {
- existingPlugin = getServerPlugin(pluginKey);
- } catch (NoResultException nre) {
+ existingPlugin = getServerPlugin(pluginKey);
+ if (existingPlugin == null) {
newOrUpdated = true; // this is expected for new plugins
}
Show replies by date