...
Code Block |
---|
|
File someFile = new File(""someFileName.txt"");
// do something with someFile
someFile.delete();
|
...
Code Block |
---|
|
File someFile = new File(""someFileName.txt"");
// do something with someFile
if (!someFile.delete()) {
// handle the fact that the file has not been deleted
}
|
...
Code Block |
---|
|
public class Ignore {
public static void main(String[] args) {
String original = "insecure";"insecure";
original.replace( 'i', '9' );
System.out.println(original);
}
}
|
...
Code Block |
---|
|
public class DoNotIgnore {
public static void main(String[] args) {
String original = "insecure";"insecure";
original = original.replace( 'i', '9' );
System.out.println(original);
}
}
|
...
Wiki Markup |
---|
\[[API 06|AA. Java References#API 06]\] method [delete()|http://java.sun.com/javase/6/docs/api/java/io/File.html#delete()]
\[[API 06|AA. Java References#API 06]\] method [replace()|http://java.sun.com/javase/6/docs/api/java/lang/String.html#replace(char,%20char)]
\[[Green 08|AA. Java References#Green 08]\] [""String.replace""|http://mindprod.com/jgloss/gotchas.html]
\[[Pugh 09|AA. Java References#Pugh 09]\] misusing putIfAbsent
\[[MITRE 09|AA. Java References#MITRE 09]\] [CWE ID 252|http://cwe.mitre.org/data/definitions/252.html] ""Unchecked Return Value"" |
...
EXP01-J. Ensure a null pointer is not dereferenced 04. Expressions (EXP) EXP03-J. Do not compare String objects using equality or relational operators