Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2020-08-13 03:39:46 -0400
committerAlexander Kurtakov2020-08-13 03:39:46 -0400
commit9834b0e8ea73543e7235c923301ee653e0e64f5d (patch)
tree242e4dd3c77968e3aa06eb6de4ace78d3e8d0a3d
parent863cf23d5d9a289f424776e12247331a273813d9 (diff)
downloadrt.equinox.p2-9834b0e8ea73543e7235c923301ee653e0e64f5d.tar.gz
rt.equinox.p2-9834b0e8ea73543e7235c923301ee653e0e64f5d.tar.xz
rt.equinox.p2-9834b0e8ea73543e7235c923301ee653e0e64f5d.zip
Switch the opt-out useWhitespace to opt-in ignoreWhitespace. Change-Id: If971295794f033041284016fbc64795c1448a4ef Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java26
2 files changed, 25 insertions, 25 deletions
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 0922d3ce9..a31a7515d 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 @@ import org.eclipse.equinox.p2.metadata.Version;
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 @@ public class XMLWriter implements XMLConstants {
if (this.open) {
println('>');
}
- if (useWhitespace) {
+ if (!ignoreWhitespace) {
indent();
}
print('<');
@@ -312,23 +312,23 @@ public class XMLWriter implements XMLConstants {
}
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 @@ public class XMLWriter implements XMLConstants {
if (s.length() == 0) {
println();
} else {
- if (useWhitespace) {
+ if (!ignoreWhitespace) {
indent();
}
println(escape ? escape(s) : s);
@@ -353,7 +353,7 @@ public class XMLWriter implements XMLConstants {
}
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 d096cb415..66a64c7de 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 @@ import java.util.Map;
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 @@ public class XMLWriter extends PrintWriter {
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 @@ public class XMLWriter extends PrintWriter {
// 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;
}

Back to the top