You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2009/08/24 14:06:21 UTC
svn commit: r807170 -
/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Author: vsiveton
Date: Mon Aug 24 12:06:21 2009
New Revision: 807170
URL: http://svn.apache.org/viewvc?rev=807170&view=rev
Log:
DOXIA-364: Guarantee the state of sinks and parsers impl
o impl init() method from r807164
o use final fields
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=807170&r1=807169&r2=807170&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java Mon Aug 24 12:06:21 2009
@@ -89,9 +89,9 @@
/** figure flag. */
private boolean inFigure;
- private String encoding;
+ private final String encoding;
- private String languageId;
+ private final String languageId;
/** Stack of drawing borders on table cells. */
private final LinkedList tableGridStack;
@@ -139,6 +139,21 @@
*/
protected FoSink( Writer writer, String encoding )
{
+ this( writer, encoding, null );
+ }
+
+ /**
+ * Constructor, initialize the Writer and tells which encoding and languageId are used.
+ *
+ * @param writer not null writer to write the result.
+ * @param encoding the encoding used, that should be written to the generated HTML content
+ * if not <code>null</code>.
+ * @param languageId language identifier for the root element as defined by
+ * <a href="ftp://ftp.isi.edu/in-notes/bcp/bcp47.txt">IETF BCP 47</a>, Tags for the Identification of Languages;
+ * in addition, the empty string may be specified.
+ */
+ protected FoSink( Writer writer, String encoding, String languageId )
+ {
if ( writer == null )
{
throw new NullPointerException( "Null writer in FO Sink!" );
@@ -146,6 +161,7 @@
this.out = new PrintWriter( writer );
this.encoding = encoding;
+ this.languageId = languageId;
this.config = new FoConfiguration();
this.listStack = new Stack();
@@ -161,23 +177,6 @@
setNameSpace( "fo" );
}
- /**
- * Constructor, initialize the Writer and tells which encoding and languageId are used.
- *
- * @param writer not null writer to write the result.
- * @param encoding the encoding used, that should be written to the generated HTML content
- * if not <code>null</code>.
- * @param languageId language identifier for the root element as defined by
- * <a href="ftp://ftp.isi.edu/in-notes/bcp/bcp47.txt">IETF BCP 47</a>, Tags for the Identification of Languages;
- * in addition, the empty string may be specified.
- */
- protected FoSink( Writer writer, String encoding, String languageId )
- {
- this( writer, encoding );
-
- this.languageId = languageId;
- }
-
// TODO add FOP compliance mode?
/**
@@ -199,6 +198,8 @@
/** {@inheritDoc} */
public void head( SinkEventAttributes attributes )
{
+ init();
+
startPageSequence( "0", null, null );
}
@@ -1366,15 +1367,7 @@
this.warnMessages = null;
}
- this.listStack.clear();
- this.tableGridStack.clear();
- this.cellJustifStack.clear();
- this.isCellJustifStack.clear();
- this.cellCountStack.clear();
- this.tableContentWriterStack.clear();
- this.tableCaptionWriterStack.clear();
- this.tableCaptionXMLWriterStack.clear();
- this.tableCaptionStack.clear();
+ init();
}
/**
@@ -1817,4 +1810,27 @@
set.add( msg );
warnMessages.put( key, set );
}
+
+ /** {@inheritDoc} */
+ protected void init()
+ {
+ super.init();
+
+ this.listStack.clear();
+ this.tableGridStack.clear();
+ this.cellJustifStack.clear();
+ this.isCellJustifStack.clear();
+ this.cellCountStack.clear();
+ this.tableContentWriterStack.clear();
+ this.tableCaptionWriterStack.clear();
+ this.tableCaptionXMLWriterStack.clear();
+ this.tableCaptionStack.clear();
+
+ this.section = 0;
+ this.subsection = 0;
+ this.subsubsection = 0;
+ this.verbatim = false;
+ this.inFigure = false;
+ this.warnMessages = null;
+ }
}
\ No newline at end of file