Findbugs : NP_NULL_PARAM_DEREF_NONVIRTUAL fixed
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/091694ce Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/091694ce Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/091694ce Branch: refs/heads/master Commit: 091694ceb2a546860f3259d9d562601790ee4e8b Parents: 26b3214 Author: Hugo Trippaers <[email protected]> Authored: Mon Feb 10 21:25:21 2014 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Fri Feb 14 18:37:45 2014 +0100 ---------------------------------------------------------------------- .../cloud/agent/api/routing/SetStaticRouteAnswer.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/091694ce/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java index abdcba8..cf2b952 100644 --- a/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java +++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.agent.api.routing; +import java.util.Arrays; + import com.cloud.agent.api.Answer; public class SetStaticRouteAnswer extends Answer { @@ -26,11 +28,16 @@ public class SetStaticRouteAnswer extends Answer { public SetStaticRouteAnswer(SetStaticRouteCommand cmd, boolean success, String[] results) { super(cmd, success, null); - assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length"; - this.results = results; + if (results != null) { + assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length"; + this.results = Arrays.copyOf(results, results.length); + } } public String[] getResults() { - return results; + if (results != null) { + return Arrays.copyOf(results, results.length); + } + return null; } }
