mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-14 20:35:09 +00:00
8035310: The line.separator property can be retrieved via public API
Reviewed-by: alexsch, serb
This commit is contained in:
parent
083589648a
commit
aaea8f4c7c
@ -109,8 +109,7 @@ public class BasicOptionPaneUI extends OptionPaneUI {
|
||||
|
||||
|
||||
static {
|
||||
newline = java.security.AccessController.doPrivileged(
|
||||
new GetPropertyAction("line.separator"));
|
||||
newline = System.lineSeparator();
|
||||
if (newline == null) {
|
||||
newline = "\n";
|
||||
}
|
||||
|
||||
@ -141,10 +141,7 @@ public abstract class AbstractWriter {
|
||||
setLineSeparator((String)docNewline);
|
||||
}
|
||||
else {
|
||||
String newline = null;
|
||||
try {
|
||||
newline = System.getProperty("line.separator");
|
||||
} catch (SecurityException se) {}
|
||||
String newline = System.lineSeparator();
|
||||
if (newline == null) {
|
||||
// Should not get here, but if we do it means we could not
|
||||
// find a newline string, use \n in this case.
|
||||
|
||||
@ -317,9 +317,7 @@ public class DefaultEditorKit extends EditorKit {
|
||||
int offs = pos;
|
||||
Object endOfLineProperty = doc.getProperty(EndOfLineStringProperty);
|
||||
if (endOfLineProperty == null) {
|
||||
try {
|
||||
endOfLineProperty = System.getProperty("line.separator");
|
||||
} catch (SecurityException se) { }
|
||||
endOfLineProperty = System.lineSeparator();
|
||||
}
|
||||
String endOfLine;
|
||||
if (endOfLineProperty instanceof String) {
|
||||
|
||||
@ -447,8 +447,7 @@ public final class CompositeFont extends Font2D {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String ls = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("line.separator"));
|
||||
String ls = System.lineSeparator();
|
||||
String componentsStr = "";
|
||||
for (int i=0; i<numSlots; i++) {
|
||||
componentsStr += " Slot["+i+"]="+getSlotFont(i)+ls;
|
||||
|
||||
@ -43,8 +43,7 @@ public class XAWTFormatter extends java.util.logging.Formatter {
|
||||
|
||||
// Line separator string. This is the value of the line.separator
|
||||
// property at the moment that the SimpleFormatter was created.
|
||||
private String lineSeparator = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("line.separator"));
|
||||
private String lineSeparator = System.lineSeparator();
|
||||
|
||||
boolean displayFullRecord = false;
|
||||
boolean useANSI = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user