You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2020/12/08 14:29:15 UTC
[tomee] branch master updated: TOMEE-2938 copy/paste from Xalan
project patched
This is an automated email from the ASF dual-hosted git repository.
jlmonteiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/master by this push:
new acb0399 TOMEE-2938 copy/paste from Xalan project patched
acb0399 is described below
commit acb039988b05346fc4b3a218d57fae4b4fd92310
Author: Jean-Louis Monteiro <jl...@tomitribe.com>
AuthorDate: Tue Dec 8 15:29:00 2020 +0100
TOMEE-2938 copy/paste from Xalan project patched
---
.../org/apache/xml/serializer/ToHTMLStream.java | 23 +++++++++++---------
.../java/org/apache/xml/serializer/ToStream.java | 25 +++++++++++-----------
2 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToHTMLStream.java b/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToHTMLStream.java
index 9602d8e..eb150be 100644
--- a/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToHTMLStream.java
+++ b/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToHTMLStream.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
/*
- * $Id: ToHTMLStream.java 1225444 2011-12-29 05:52:39Z mrglavas $
+ * $Id$
*/
package org.apache.xml.serializer;
@@ -1289,10 +1289,10 @@ public class ToHTMLStream extends ToStream
{
writer.write(ch);
}
- else if (Encodings.isHighUTF16Surrogate(ch)) {
+ else if (Encodings.isHighUTF16Surrogate(ch))
+ {
writeUTF16Surrogate(ch, chars, i, end);
- i++;
- // two input characters processed
+ i++; // two input characters processed
// this increments by one and the for()
// loop itself increments by another one.
}
@@ -1442,17 +1442,18 @@ public class ToHTMLStream extends ToStream
{
i = pos - 1;
}
- else if (Encodings.isHighUTF16Surrogate(ch)) {
+ else if (Encodings.isHighUTF16Surrogate(ch))
+ {
+
writeUTF16Surrogate(ch, chars, i, end);
- i++;
- // two input characters processed
+ i++; // two input characters processed
// this increments by one and the for()
// loop itself increments by another one.
+ } else {
// The next is kind of a hack to keep from escaping in the case
// of Shift_JIS and the like.
- }
- else {
+
/*
else if ((ch < m_maxCharacter) && (m_maxCharacter == 0xFFFF)
&& (ch != 160))
@@ -2344,11 +2345,13 @@ public class ToHTMLStream extends ToStream
}
/**
- * Get the length of the longest key used in the table.
+ * Get the length of the longest key used in the table.
*/
public int getLongestKeyLength()
{
return m_charBuffer.length;
}
}
+
+
}
diff --git a/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToStream.java b/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToStream.java
index f54a03c..d7bb6e3 100644
--- a/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToStream.java
+++ b/tomee/tomee-webapp/src/patch/java/org/apache/xml/serializer/ToStream.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
/*
- * $Id: ToStream.java 1225444 2011-12-29 05:52:39Z mrglavas $
+ * $Id$
*/
package org.apache.xml.serializer;
@@ -1600,25 +1600,23 @@ abstract public class ToStream extends SerializerBase
// just leave it get added on to the clean characters
}
- else if (Encodings.isHighUTF16Surrogate(ch) &&
- i < end - 1 &&
- Encodings.isLowUTF16Surrogate(chars[i + 1])) {
+ else if (Encodings.isHighUTF16Surrogate(ch) && i < end-1 && Encodings.isLowUTF16Surrogate(chars[i+1])) {
// So, this is a (valid) surrogate pair
- if (!m_encodingInfo.isInEncoding(ch, chars[i + 1])) {
- int codepoint = Encodings.toCodePoint(ch, chars[i + 1]);
+ if (! m_encodingInfo.isInEncoding(ch, chars[i+1])) {
+ int codepoint = Encodings.toCodePoint(ch, chars[i+1]);
writeOutCleanChars(chars, i, lastDirtyCharProcessed);
writer.write("&#");
writer.write(Integer.toString(codepoint));
writer.write(';');
- lastDirtyCharProcessed = i + 1;
+ lastDirtyCharProcessed = i+1;
}
i++; // skip the low surrogate, too
}
else {
- // This is a fallback plan, we should never get here
- // but if the character wasn't previously handled
- // (i.e. isn't in the encoding, etc.) then what
- // should we do? We choose to write out an entity
+ // This is a fallback plan, we get here if the
+ // encoding doesn't contain ch and it's not part
+ // of a surrogate pair
+ // The right thing is to write out an entity
writeOutCleanChars(chars, i, lastDirtyCharProcessed);
writer.write("&#");
writer.write(Integer.toString(ch));
@@ -2184,9 +2182,10 @@ abstract public class ToStream extends SerializerBase
// just write it out
writer.write(ch);
}
- else if (Encodings.isHighUTF16Surrogate(ch)) {
+ else if (Encodings.isHighUTF16Surrogate(ch))
+ {
writeUTF16Surrogate(ch, stringChars, i, len);
- i++; // process two input characters
+ i++ ; // process two input characters
}
else {
// This is a fallback plan, we should never get here