Accepted answer
Score: 32

It is just getting a system property. Retrieving 9 system properties requires permissions which 8 the calling code may not have. The doPrivileged asserts 7 the privileges of the calling class irrespective 6 of how it was called. Clearly, doPrivileged is something 5 you need to be careful with.

The code quoted 4 is the equivalent of:

String lineSeparator = java.security.AccessController.doPrivileged(
    new java.security.PrivilegedAction<String>() {
        public String run() {
            return System.getProperty("line.separator");

(Don't you just love 3 the conciseness of Java's syntax?)

Without 2 asserting privileges, this can be rewritten 1 as:

String lineSeparator = System.getProperty("line.separator");

More Related questions