Use System.lineSeparator()
Benefit of this way rather than System.getProperty("line.separator") is
that there are no security checks.
Change-Id: I4ca3bae0c8c1b109fb1bdd037f4e893470b2d322
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java
index 4e69a01..f0cf130 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java
@@ -284,13 +284,13 @@
private String compileFileContent(Object[] els) {
StringBuilder b = new StringBuilder();
- b.append("package " + clazz.packageFragment.getElementName() + ";" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- b.append(System.getProperty("line.separator")); //$NON-NLS-1$
- b.append("public class " + clazz.name + " {" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ b.append("package " + clazz.packageFragment.getElementName() + ";" + System.lineSeparator()); //$NON-NLS-1$ //$NON-NLS-2$
+ b.append(System.lineSeparator());
+ b.append("public class " + clazz.name + " {" + System.lineSeparator()); //$NON-NLS-1$ //$NON-NLS-2$
for (Object o : els) {
Entry e = (Entry) o;
- b.append("\tpublic static final String " + e.idFieldKey + " = \"" + e.elementId + "\";" + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ b.append("\tpublic static final String " + e.idFieldKey + " = \"" + e.elementId + "\";" + System.lineSeparator()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}
b.append("}"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java
index d28eccc..d07628c 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java
@@ -223,10 +223,10 @@
try {
IFile f = getBasePropertyFile();
- StringBuilder b = new StringBuilder(System.getProperty("line.separator")); //$NON-NLS-1$
+ StringBuilder b = new StringBuilder(System.lineSeparator());
for (Object o : els) {
Entry e = (Entry) o;
- b.append(e.key + " = " + e.value + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$
+ b.append(e.key + " = " + e.value + System.lineSeparator()); //$NON-NLS-1$
}
try (ByteArrayInputStream stream = new ByteArrayInputStream(b.toString().getBytes())) {