Fixes to various serializer reset() methods for fields that were
newer and forgotten. Fix for XALANJ-2279
diff --git a/src/org/apache/xml/serializer/SerializerBase.java b/src/org/apache/xml/serializer/SerializerBase.java
index 55d170e..ef5e080 100644
--- a/src/org/apache/xml/serializer/SerializerBase.java
+++ b/src/org/apache/xml/serializer/SerializerBase.java
@@ -1247,23 +1247,30 @@
private void resetSerializerBase()
{
this.m_attributes.clear();
- this.m_StringOfCDATASections = null;
- this.m_elemContext = new ElemContext();
+ this.m_CdataElems = null;
+ this.m_cdataTagOpen = false;
+ this.m_docIsEmpty = true;
this.m_doctypePublic = null;
this.m_doctypeSystem = null;
this.m_doIndent = false;
+ this.m_elemContext = new ElemContext();
this.m_indentAmount = 0;
this.m_inEntityRef = false;
this.m_inExternalDTD = false;
this.m_mediatype = null;
this.m_needToCallStartDocument = true;
this.m_needToOutputDocTypeDecl = false;
+ if (m_OutputProps != null)
+ this.m_OutputProps.clear();
+ if (m_OutputPropsDefault != null)
+ this.m_OutputPropsDefault.clear();
if (this.m_prefixMap != null)
this.m_prefixMap.reset();
this.m_shouldNotWriteXMLHeader = false;
this.m_sourceLocator = null;
this.m_standalone = null;
this.m_standaloneWasSpecified = false;
+ this.m_StringOfCDATASections = null;
this.m_tracer = null;
this.m_transformer = null;
this.m_version = null;
diff --git a/src/org/apache/xml/serializer/ToHTMLSAXHandler.java b/src/org/apache/xml/serializer/ToHTMLSAXHandler.java
index 693d62f..3df972d 100644
--- a/src/org/apache/xml/serializer/ToHTMLSAXHandler.java
+++ b/src/org/apache/xml/serializer/ToHTMLSAXHandler.java
@@ -738,6 +738,7 @@
*/
private void resetToHTMLSAXHandler()
{
+ this.m_dtdHandled = false;
this.m_escapeSetting = false;
}
}
diff --git a/src/org/apache/xml/serializer/ToHTMLStream.java b/src/org/apache/xml/serializer/ToHTMLStream.java
index ced4806..35d3ac5 100644
--- a/src/org/apache/xml/serializer/ToHTMLStream.java
+++ b/src/org/apache/xml/serializer/ToHTMLStream.java
@@ -2012,16 +2012,16 @@
boolean ret = super.reset();
if (!ret)
return false;
- initToHTMLStream();
+ resetToHTMLStream();
return true;
}
- private void initToHTMLStream()
+ private void resetToHTMLStream()
{
-// m_elementDesc = null;
+ // m_htmlcharInfo remains unchanged
+ // m_htmlInfo = null; // Don't reset
m_inBlockElem = false;
m_inDTD = false;
-// m_isRawStack.clear();
m_omitMetaTag = false;
m_specialEscapeURLs = true;
}
diff --git a/src/org/apache/xml/serializer/ToStream.java b/src/org/apache/xml/serializer/ToStream.java
index 4ac93d1..18f5bd0 100644
--- a/src/org/apache/xml/serializer/ToStream.java
+++ b/src/org/apache/xml/serializer/ToStream.java
@@ -105,14 +105,16 @@
protected boolean m_isprevtext = false;
+ private static final char[] s_systemLineSep =
+ System.getProperty("line.separator").toCharArray();
/**
* The system line separator for writing out line breaks.
* The default value is from the system property,
* but this value can be set through the xsl:output
* extension attribute xalan:line-separator.
*/
- protected char[] m_lineSep =
- System.getProperty("line.separator").toCharArray();
+ protected char[] m_lineSep = s_systemLineSep;
+
/**
* True if the the system line separator is to be used.
@@ -3262,27 +3264,26 @@
*
*/
// this.m_charInfo = null; // don't set to null
-
this.m_disableOutputEscapingStates.clear();
+ // this.m_encodingInfo = null; // don't set to null
this.m_escaping = true;
// Leave m_format alone for now - Brian M.
// this.m_format = null;
+ this.m_expandDTDEntities = true;
this.m_inDoctype = false;
this.m_ispreserve = false;
- this.m_ispreserve = false;
this.m_isprevtext = false;
this.m_isUTF8 = false; // ?? used anywhere ??
+ this.m_lineSep = s_systemLineSep;
+ this.m_lineSepLen = s_systemLineSep.length;
+ this.m_lineSepUse = true;
+ // this.m_outputStream = null; // Don't reset it may be re-used
this.m_preserves.clear();
this.m_shouldFlush = true;
this.m_spaceBeforeClose = false;
this.m_startNewLine = false;
- this.m_lineSepUse = true;
- // DON'T SET THE WRITER TO NULL, IT MAY BE REUSED !!
- // this.m_writer = null;
- this.m_expandDTDEntities = true;
this.m_writer_set_by_user = false;
-
}
/**