From ef601e2f25021d9b861b231dcb100738f7e1b989 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 13 Jan 2020 10:03:18 +0100 Subject: Use System.lineSeparator() Benefit of this way rather than System.getProperty("line.separator") is that there are no security checks. Change-Id: Ib14dc56626a541a2bace31952281cfbb6e0a9a00 Signed-off-by: Lars Vogel --- .../core/org/eclipse/debug/internal/core/LaunchManager.java | 2 +- .../src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java | 2 +- .../memory/renderings/CopyTableRenderingToClipboardAction.java | 6 +++--- org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java index a5ad21310..295145c1b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java @@ -780,7 +780,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe String line = reader.readLine(); String key = null; String value = null; - String newLine = System.getProperty("line.separator"); //$NON-NLS-1$ + String newLine = System.lineSeparator(); while (line != null) { int func = line.indexOf("=()"); //$NON-NLS-1$ if (func > 0) { diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java index 526d26374..9f29c7df0 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java @@ -367,7 +367,7 @@ public final class IOConsoleTestUtil { */ public IOConsoleTestUtil enter() { // Note: newline will be replaced by - // System.getProperty("line.separator") so do not assume document length + // System.lineSeparator() so do not assume document length // will increase by 1 insertTyping("\n"); return this; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java index 2ec3f8297..e500c7ff5 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java @@ -75,7 +75,7 @@ public class CopyTableRenderingToClipboardAction extends Action // get title of view tab String label = fRendering.getLabel(); tableContents.append(label); - tableContents.append(System.getProperty("line.separator")); //$NON-NLS-1$ + tableContents.append(System.lineSeparator()); tableContents.append(COLUMN_SEPERATOR); int charsPerByte = fRendering.getNumCharsPerByte(); @@ -135,7 +135,7 @@ public class CopyTableRenderingToClipboardAction extends Action tableContents.append(COLUMN_SEPERATOR); } - tableContents.append(System.getProperty("line.separator")); //$NON-NLS-1$ + tableContents.append(System.lineSeparator()); StringBuilder temp; //get the column contents from all the rows @@ -157,7 +157,7 @@ public class CopyTableRenderingToClipboardAction extends Action tableContents.append(temp); } - tableContents.append(System.getProperty("line.separator")); //$NON-NLS-1$ + tableContents.append(System.lineSeparator()); } return tableContents.toString(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java index 9b1311656..ae81f0b27 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java @@ -712,7 +712,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { MultipleInputDialog dialog = new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_11); dialog.addTextField(NAME_LABEL, originalName, false); - if (value != null && value.contains(System.getProperty("line.separator"))) { //$NON-NLS-1$ + if (value != null && value.contains(System.lineSeparator())) { dialog.addMultilinedVariablesField(VALUE_LABEL, value, true); } else { dialog.addVariablesField(VALUE_LABEL, value, true); -- cgit v1.2.3