Huawei Cloud

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.