summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2011-01-12 12:01:42 +0100
committerDavid Tardon <dtardon@redhat.com>2011-01-12 12:21:45 +0100
commit09527e934aedd2e177a682c43efaa4c20ab717df (patch)
treea4aa9066416117fc99b84f8b9b6809ccd61b9b69
parentaab5e57ea41687a8bdee69498849e74b39354a13 (diff)
rhbz#659394 avoid mangling internal state in case of UNO exception
-rw-r--r--writerfilter/inc/resourcemodel/TableManager.hxx52
1 files changed, 34 insertions, 18 deletions
diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx
index 847c99b4e69e..603ac1a551dc 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();