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 2008/02/14 12:33:18 UTC

svn commit: r627711 - in /maven/doxia/doxia/trunk: doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java

Author: vsiveton
Date: Thu Feb 14 03:33:14 2008
New Revision: 627711

URL: http://svn.apache.org/viewvc?rev=627711&view=rev
Log:
o fixed ArrayIndexOutOfBoundsException

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java
    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-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java?rev=627711&r1=627710&r2=627711&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java Thu Feb 14 03:33:14 2008
@@ -59,9 +59,12 @@
     /** An indication on if we're in verbatim mode. */
     private boolean verbatimFlag;
 
-    /** Justification of table cells. */
+    /** Alignment of table cells. */
     private int[] cellJustif;
 
+    /** Justification of table cells. */
+    private boolean isCellJustif;
+
     /** Number of cells in a table row. */
     private int cellCount;
 
@@ -132,6 +135,7 @@
     protected void setCellJustif( int[] justif )
     {
         this.cellJustif = justif;
+        this.isCellJustif = true;
     }
 
     /**
@@ -183,6 +187,7 @@
         headFlag = false;
         verbatimFlag = false;
         cellJustif = null;
+        isCellJustif = false;
         cellCount = 0;
         evenTableRow = true;
     }
@@ -708,6 +713,7 @@
     public void tableRows_()
     {
         this.cellJustif = null;
+        this.isCellJustif = false;
 
         this.evenTableRow = true;
     }
@@ -795,7 +801,7 @@
     {
         String justif = null;
 
-        if ( cellJustif != null )
+        if ( cellJustif != null && isCellJustif )
         {
             switch ( cellJustif[cellCount] )
             {
@@ -855,7 +861,10 @@
 
         writeEndTag( t );
 
-        ++cellCount;
+        if ( isCellJustif )
+        {
+            ++cellCount;
+        }
     }
 
     /**

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=627711&r1=627710&r2=627711&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 Thu Feb 14 03:33:14 2008
@@ -67,6 +67,9 @@
     /** Alignment of table cells. */
     private int[] cellJustif;
 
+    /** Justification of table cells. */
+    private boolean isCellJustif;
+
     /** Current table cell. */
     private int cellCount;
 
@@ -623,15 +626,19 @@
     {
         this.tableGrid = grid;
         this.cellJustif = justification;
+        this.isCellJustif = true;
 
         // FOP hack to center the table, see
         // http://xmlgraphics.apache.org/fop/fo.html#fo-center-table-horizon
         writeln( "<fo:table-column column-width=\"proportional-column-width(1)\"/>" );
 
         // TODO: calculate width[i]
-        for ( int i = 0;  i < cellJustif.length; i++ )
+        if ( cellJustif != null )
         {
-            writeln( "<fo:table-column column-width=\"1in\"/>" );
+            for ( int i = 0;  i < cellJustif.length; i++ )
+            {
+                writeln( "<fo:table-column column-width=\"1in\"/>" );
+            }
         }
 
         writeln( "<fo:table-column column-width=\"proportional-column-width(1)\"/>" );
@@ -642,6 +649,7 @@
     public void tableRows_()
     {
         this.cellJustif = null;
+        this.isCellJustif = false;
         writeEndTag( TABLE_BODY_TAG );
     }
 
@@ -694,8 +702,8 @@
     private void tableCell( boolean headerRow )
     {
          String justif = null;
- 
-         if ( cellJustif != null )
+
+         if ( cellJustif != null && isCellJustif )
          {
              switch ( cellJustif[cellCount] )
              {
@@ -711,7 +719,7 @@
                      break;
              }
          }
- 
+
          if ( justif != null )
          {
             // the column-number is needed for the hack to center the table, see tableRows.
@@ -734,7 +742,11 @@
     {
         writeEndTag( BLOCK_TAG );
         writeEndTag( TABLE_CELL_TAG );
-        ++cellCount;
+
+        if ( isCellJustif )
+        {
+            ++cellCount;
+        }
     }
 
     /** {@inheritDoc} */