[Libreoffice-commits] .: writerfilter/inc

David Tardon dtardon at kemper.freedesktop.org
Wed Jan 12 03:21:56 PST 2011


 writerfilter/inc/resourcemodel/TableManager.hxx |   52 +++++++++++++++---------
 1 file changed, 34 insertions(+), 18 deletions(-)

New commits:
commit 5b4d2b22d075607391a8dc934f5c350d9958aa74
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Jan 12 12:01:42 2011 +0100

    rhbz#659394 avoid mangling internal state in case of UNO exception

diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx
index 86b2d62..cae1fa8 100644
--- a/writerfilter/inc/resourcemodel/TableManager.hxx
+++ b/writerfilter/inc/resourcemodel/TableManager.hxx
@@ -40,6 +40,10 @@
 #include "util.hxx"
 #include "TagLogger.hxx"
 
+#if OSL_DEBUG_LEVEL > 0
+#   include <rtl/strbuf.hxx>
+#endif
+
 namespace writerfilter
 {
 
@@ -967,34 +971,46 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable()
 
     if (mpTableDataHandler.get() != NULL)
     {
-        typename TableData<T, PropertiesPointer>::Pointer_t
-            pTableData = mTableDataStack.top();
+        try
+        {
+            typename TableData<T, PropertiesPointer>::Pointer_t
+                pTableData = mTableDataStack.top();
 
-        unsigned int nRows = pTableData->getRowCount();
+            unsigned int nRows = pTableData->getRowCount();
 
-        mpTableDataHandler->startTable(nRows, pTableData->getDepth(), getTableProps());
+            mpTableDataHandler->startTable(nRows, pTableData->getDepth(), getTableProps());
 
-        for (unsigned int nRow = 0; nRow < nRows; ++nRow)
-        {
-            typename RowData<T, PropertiesPointer>::Pointer_t pRowData = pTableData->getRow(nRow);
+            for (unsigned int nRow = 0; nRow < nRows; ++nRow)
+            {
+                typename RowData<T, PropertiesPointer>::Pointer_t pRowData = pTableData->getRow(nRow);
 
-            unsigned int nCells = pRowData->getCellCount();
+                unsigned int nCells = pRowData->getCellCount();
 
-            mpTableDataHandler->startRow(nCells, pRowData->getProperties());
+                mpTableDataHandler->startRow(nCells, pRowData->getProperties());
 
-            for (unsigned int nCell = 0; nCell < nCells; ++nCell)
-            {
-                mpTableDataHandler->startCell
-                    (pRowData->getCellStart(nCell),
-                     pRowData->getCellProperties(nCell));
+                for (unsigned int nCell = 0; nCell < nCells; ++nCell)
+                {
+                    mpTableDataHandler->startCell
+                        (pRowData->getCellStart(nCell),
+                        pRowData->getCellProperties(nCell));
+
+                    mpTableDataHandler->endCell(pRowData->getCellEnd(nCell));
+                }
 
-                mpTableDataHandler->endCell(pRowData->getCellEnd(nCell));
+                mpTableDataHandler->endRow();
             }
 
-            mpTableDataHandler->endRow();
+            mpTableDataHandler->endTable();
+        }
+        catch (uno::Exception const& e)
+        {
+            (void) e;
+#if OSL_DEBUG_LEVEL > 0
+            rtl::OStringBuffer aBuf("resolving of current table failed with: ");
+            aBuf.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
+            OSL_ENSURE(false, aBuf.getStr());
+#endif
         }
-
-        mpTableDataHandler->endTable();
     }
     resetTableProps();
     clearData();


More information about the Libreoffice-commits mailing list