Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#CCCCFF
public Node updateNode(int id, int newValue) throws NodeNotFoundException {
  Node current = root;
  while(current != null){
    if(current.getId() == id){
      current.setValue(newValue);
      return current;
    }
    current = current.next;
  }	
  throw new NodeNotFoundException();
}

Applicability

Failure to provide appropriate feedback through return values, error codes, and exceptions can lead to inconsistent object state and unexpected program behavior.

Related Guidelines

ID 393, "Return of Wrong Status Code"CWE ID 389, "Error Conditions, Return Values, Status Codes"
[MITRE 2009]CWE -389, Error conditions, return values, status codes
CWE-393, Return of wrong status code

Bibliography

 

...