...
Code Block | ||
---|---|---|
| ||
public void readSensitiveFile() { try { SecurityManager sm = System.getSecurityManager(); if(sm != null) { // Check if file can be read sm.checkRead(""/temp/tempFile""); } // Access the file } catch (SecurityException se) { // Log exception } } |
...
Code Block | ||
---|---|---|
| ||
public final void readSensitiveFile() { try { SecurityManager sm = System.getSecurityManager(); if(sm != null) { // check if file can be read sm.checkRead(""/temp/tempFile""); } // Access the file } catch (SecurityException se) { // Log exception } } |
...
Code Block | ||
---|---|---|
| ||
private void readSensitiveFile() { try { SecurityManager sm = System.getSecurityManager(); if(sm != null) { // check if file can be read sm.checkRead(""/temp/tempFile""); } // Access the file } catch (SecurityException se) { // Log exception } } |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
Wiki Markup |
---|
\[[Ware 08|AA. Java References#Ware 08]\] |
...
MET05-J. Validate method parameters 12. Methods (MET) MET30-J. Follow the general contract while overriding the equals method