Findbugs : NP_NULL_PARAM_DEREF_NONVIRTUAL fixed

This commit is contained in:
Hugo Trippaers 2014-02-10 21:25:21 +01:00
parent 26b32141a8
commit 091694ceb2

View File

@ -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;
}
}