Copy-Paste
V6060 The ‘params’ reference was utilized before it was verified against null. DomainService.java(49), DomainService.java(46)
public class ServiceAction implements ModelEntity { private String binary; private String host; private ServiceAction(String binary, String host) { this.binary = binary; this.host = host; } public static ServiceAction enable(String binary, String host) { return new ServiceAction(binary, host); } public static ServiceAction disable(String binary, String host) { return new ServiceAction(binary, host); } .... }
Having two identical methods is not a mistake, but the fact that two methods perform the same action is at least strange. Looking at the names of the above methods, we can assume that they should perform the opposite actions. In fact, both methods do the same thing – create and return the ServiceAction object. Most likely, the disable method was created by copying the enable method’s code, but the method’s body remained the same.
Please click here to see more bugs from this project.