From 473c3d33c31fb96952d5dcc3539153eaa25be79a Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 2 Nov 2010 16:05:13 -0700 Subject: [PATCH] bug 6870: during updating of pf rules, it is possible one might try to update a non existing rule via the api cmd. hitherto, we were returning a null which was assumed as a success by the cmd api, which failed with a npe. instead, we ought to throw back an error since we did not find any rule to be updated. i am checking in the same change. this also will fix the npe. status 6870: resolved fixed --- server/src/com/cloud/server/ManagementServerImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index b3a498b5974..e747e9a58cb 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -3210,8 +3210,10 @@ public class ManagementServerImpl implements ManagementServer { _firewallRulesDao.update(fwRule.getId(), fwRule); _networkMgr.updateFirewallRule(fwRule, oldPrivateIP, oldPrivatePort); return fwRule; + }else{ + s_logger.warn("Unable to find the rule to be updated for public ip:public port"+publicIp+":"+publicPort+ "private ip:private port:"+privateIp+":"+privatePort); + throw new InvalidParameterValueException("Unable to find the rule to be updated for public ip:public port"+publicIp+":"+publicPort+ " private ip:private port:"+privateIp+":"+privatePort); } - return null; } @Override