Use System.lineSeparator()

Benefit of this way rather than System.getProperty("line.separator") is
that there are no security checks.

Change-Id: I2807af3be704e02cb541da6b579214cb13d6194e
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
index 3705a86..701fb34 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
@@ -176,7 +176,7 @@
 	private static final String QUERY_SEPARATOR = "Q:"; //$NON-NLS-1$
 	private static final String QUERY_SEPARATOR_SMALL = "q:"; //$NON-NLS-1$
 
-	public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+	public static final String LINE_SEPARATOR = System.lineSeparator();
 
 	private static void getURIs(List<URI> uris, String spec) throws CoreException {
 		if (spec == null)
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java
index 22c5b13..caf6b4c 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java
@@ -31,7 +31,7 @@
 public class IUListFormatter {
 
 	private static final String PREFIX = "${"; //$NON-NLS-1$
-	private static final String LINE_SEP = System.getProperty("line.separator"); //$NON-NLS-1$
+	private static final String LINE_SEP = System.lineSeparator();
 
 	private String formatString;
 	private Collection<String> properties;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
index 20bf19e..f4472ab 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
@@ -26,7 +26,7 @@
 import org.eclipse.osgi.service.debug.DebugOptions;
 
 public class DebugHelper {
-	public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+	public static final String LINE_SEPARATOR = System.lineSeparator();
 
 	public static final boolean DEBUG_PROFILE_REGISTRY;
 	public static final boolean DEBUG_ENGINE;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java
index 9bd77d3..460955b 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java
@@ -22,7 +22,7 @@
 public class FileMirrorLog implements IArtifactMirrorLog {
 
 	private static final String INDENT = "\t"; //$NON-NLS-1$
-	private static final String SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+	private static final String SEPARATOR = System.lineSeparator();
 	private BufferedWriter out;
 	private boolean consoleMessage = false;
 	private int minSeverity = IStatus.OK;
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
index 3cef71c..bb42288 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
@@ -21,7 +21,7 @@
 import org.eclipse.osgi.service.debug.DebugOptions;
 
 public class DebugHelper {
-	public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+	public static final String LINE_SEPARATOR = System.lineSeparator();
 
 	public static final boolean DEBUG_REPOSITORY_CREDENTIALS;
 	public static final boolean DEBUG_REPOSITORY_TRANSPORT;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java
index e2c8f20..847eaa6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java
@@ -14,9 +14,16 @@
 package org.eclipse.equinox.p2.tests.director;
 
 import static java.util.Arrays.asList;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.replay;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import junit.framework.TestCase;
 import org.easymock.IAnswer;
 import org.eclipse.equinox.internal.p2.director.app.IUListFormatter;
@@ -37,7 +44,7 @@
 				createIU("iu1", "1.0.0", "name", null), //
 				createIU("iu2", "2.0.0", "name2", null)//
 		));
-		assertEquals("iu1=1.0.0,name" + System.getProperty("line.separator") + "iu2=2.0.0,name2", result);
+		assertEquals("iu1=1.0.0,name" + System.lineSeparator() + "iu2=2.0.0,name2", result);
 	}
 
 	public void testFormat_UnknownFormatOption() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java
index e1d2c2a..d4b13da 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java
@@ -27,7 +27,7 @@
 import org.eclipse.ui.swt.IFocusService;
 
 public class CopyUtils {
-	public static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
+	public static final String NEWLINE = System.lineSeparator();
 	public static final String DELIMITER = "\t"; //$NON-NLS-1$
 	private static final String NESTING_INDENT = "  "; //$NON-NLS-1$
 
@@ -46,8 +46,9 @@
 	}
 
 	/**
-	 * Install a copy popup menu on the specified control and activate the copy handler for the control when
-	 * the control has focus.  The handler will be deactivated when the control is disposed.
+	 * Install a copy popup menu on the specified control and activate the copy
+	 * handler for the control when the control has focus. The handler will be
+	 * deactivated when the control is disposed.
 	 *
 	 * @param copyable the copyable that will perform the copy
 	 * @param control  the control on which to install the menu and handler
@@ -58,18 +59,21 @@
 		new CopyPopup(copyable, control);
 		if (fs != null && hs != null) {
 			fs.addFocusTracker(control, CONTROL_ID);
-			final IHandlerActivation handlerActivation = hs.activateHandler(CopyHandler.ID, new CopyHandler(copyable), new Expression() {
-				@Override
-				public EvaluationResult evaluate(IEvaluationContext context) {
-					return context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME) == control ? EvaluationResult.TRUE : EvaluationResult.FALSE;
-				}
+			final IHandlerActivation handlerActivation = hs.activateHandler(CopyHandler.ID, new CopyHandler(copyable),
+					new Expression() {
+						@Override
+						public EvaluationResult evaluate(IEvaluationContext context) {
+							return context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME) == control
+									? EvaluationResult.TRUE
+									: EvaluationResult.FALSE;
+						}
 
-				@Override
-				public void collectExpressionInfo(final ExpressionInfo info) {
-					info.addVariableNameAccess(ISources.ACTIVE_FOCUS_CONTROL_NAME);
-				}
+						@Override
+						public void collectExpressionInfo(final ExpressionInfo info) {
+							info.addVariableNameAccess(ISources.ACTIVE_FOCUS_CONTROL_NAME);
+						}
 
-			});
+					});
 			control.addDisposeListener(e -> hs.deactivateHandler(handlerActivation));
 		}
 	}