Needs to be in a privileged block if a SecurityManager is present.