This rule is Obsolete | |
Synopsis: | User-supplied arrays should be copied before use |
Language: | Java |
Severity Level: | 2 |
Category: | SecurityCodeGuidelines |
Description: |
Constructors and methods receiving arrays should clone objects and store the copy.
This prevents that future changes from the user affect the internal functionality.public class Foo { private String [] x; public void foo (String [] param) { // Don't do this, make a copy of the array at least this.x=param; } } |