TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  SecurityCodeGuidelines1Checked automatically with code checker

This rule is Obsolete
Synopsis:Don't return an internal array directly.
Language:Java
Severity Level:2
Category:SecurityCodeGuidelines


Description:
Exposing internal arrays directly allows the user to modify some code that could be critical. It is safer to return a copy of the array.
public class SecureSystem {
  UserData [] ud;
  public UserData [] getUserData() {
      // Don't return directly the internal array, return a copy
      return ud;
  }
}