Bug 477007 - Do not use white space in XML

Switch the opt-out useWhitespace to opt-in ignoreWhitespace.

Change-Id: If971295794f033041284016fbc64795c1448a4ef
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
index 0922d3c..a31a751 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
@@ -7,7 +7,7 @@
  *  https://www.eclipse.org/legal/epl-2.0/
  *
  *  SPDX-License-Identifier: EPL-2.0
- * 
+ *
  *  Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
@@ -22,7 +22,7 @@
 
 public class XMLWriter implements XMLConstants {
 
-	static final boolean useWhitespace = Boolean.getBoolean("p2.useWhitespace"); //$NON-NLS-1$
+	static final boolean ignoreWhitespace = Boolean.getBoolean("p2.ignoreWhitespace"); //$NON-NLS-1$
 
 	public static class ProcessingInstruction {
 
@@ -84,7 +84,7 @@
 		if (this.open) {
 			println('>');
 		}
-		if (useWhitespace) {
+		if (!ignoreWhitespace) {
 			indent();
 		}
 		print('<');
@@ -312,23 +312,23 @@
 	}
 
 	private void println(char c) {
-		if (useWhitespace) {
-			this.pw.println(c);
-		} else {
+		if (ignoreWhitespace) {
 			this.pw.print(c);
+		} else {
+			this.pw.println(c);
 		}
 	}
 
 	private void println(String s) {
-		if (useWhitespace) {
-			this.pw.println(s);
-		} else {
+		if (ignoreWhitespace) {
 			this.pw.print(s);
+		} else {
+			this.pw.println(s);
 		}
 	}
 
 	private void println() {
-		if (useWhitespace) {
+		if (!ignoreWhitespace) {
 			this.pw.println();
 		}
 	}
@@ -345,7 +345,7 @@
 		if (s.length() == 0) {
 			println();
 		} else {
-			if (useWhitespace) {
+			if (!ignoreWhitespace) {
 				indent();
 			}
 			println(escape ? escape(s) : s);
@@ -353,7 +353,7 @@
 	}
 
 	private void indent() {
-		if (useWhitespace) {
+		if (!ignoreWhitespace) {
 			for (int i = this.elements.size(); i > 0; i -= 1) {
 				print(this.indent);
 			}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
index d096cb4..66a64c7 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
@@ -25,7 +25,7 @@
 public class XMLWriter extends PrintWriter {
 	protected int tab;
 
-	static final boolean useWhitespace = Boolean.getBoolean("p2.useWhitespace"); //$NON-NLS-1$
+	static final boolean ignoreWhitespace = Boolean.getBoolean("p2.ignoreWhitespace"); //$NON-NLS-1$
 
 	/* constants */
 	protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
@@ -71,9 +71,9 @@
 				sb.append("\""); //$NON-NLS-1$
 			}
 		sb.append(">"); //$NON-NLS-1$
-		if (shouldTab && useWhitespace)
+		if (shouldTab && !ignoreWhitespace)
 			printTabulation();
-		if (newLine && useWhitespace)
+		if (newLine && !ignoreWhitespace)
 			println(sb.toString());
 		else
 			print(sb.toString());
@@ -110,16 +110,16 @@
 		// Encode special XML characters into the equivalent character references.
 		// These five are defined by default for all XML documents.
 		switch (c) {
-			case '<' :
-				return "lt"; //$NON-NLS-1$
-			case '>' :
-				return "gt"; //$NON-NLS-1$
-			case '"' :
-				return "quot"; //$NON-NLS-1$
-			case '\'' :
-				return "apos"; //$NON-NLS-1$
-			case '&' :
-				return "amp"; //$NON-NLS-1$
+		case '<':
+			return "lt"; //$NON-NLS-1$
+		case '>':
+			return "gt"; //$NON-NLS-1$
+		case '"':
+			return "quot"; //$NON-NLS-1$
+		case '\'':
+			return "apos"; //$NON-NLS-1$
+		case '&':
+			return "amp"; //$NON-NLS-1$
 		}
 		return null;
 	}