...
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 */ } } |
...