summaryrefslogtreecommitdiff
path: root/unoxml/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-10-13 18:18:50 +0200
committerMichael Stahl <mstahl@redhat.com>2014-10-13 19:23:41 +0200
commit8b7f96d257724656ac4a4303b17285be2ed13886 (patch)
tree58e3c0f76b06538a59474448157c827361576267 /unoxml/source
parentb862f6e92357f8d4a8d88072ce5caf44bd6f1c6d (diff)
coverity#707458 Uncaught exception (better fix)
getStatementsGraph_NoLock() cannot throw the exception because of the i_Internal=true parameter, which may confuse Converity; but possibly xIter->nextElement() could throw this in a multi-threaded scenario... Change-Id: I204c0e5b38fee919d6cfe9247bde76b6ea78ed0f
Diffstat (limited to 'unoxml/source')
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index dd0dec63a277..2ce52b71856a 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -359,7 +359,6 @@ public:
virtual beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool > SAL_CALL
getStatementRDFa(uno::Reference< rdf::XMetadatable > const& i_xElement)
throw (uno::RuntimeException, lang::IllegalArgumentException,
- container::NoSuchElementException,
rdf::RepositoryException, std::exception) SAL_OVERRIDE;
virtual uno::Reference< container::XEnumeration > SAL_CALL
getStatementsRDFa(
@@ -1647,7 +1646,6 @@ beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool > SAL_CALL
librdf_Repository::getStatementRDFa(
const uno::Reference< rdf::XMetadatable > & i_xElement)
throw (uno::RuntimeException, lang::IllegalArgumentException,
- container::NoSuchElementException,
rdf::RepositoryException, std::exception)
{
if (!i_xElement.is()) {
@@ -1671,18 +1669,27 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
}
::comphelper::SequenceAsVector< rdf::Statement > ret;
- const uno::Reference<container::XEnumeration> xIter(
- getStatementsGraph_NoLock(0, 0, 0, xXmlId, true) );
- OSL_ENSURE(xIter.is(), "getStatementRDFa: no result?");
- if (!xIter.is()) throw uno::RuntimeException();
- while (xIter->hasMoreElements()) {
- rdf::Statement stmt;
- if (!(xIter->nextElement() >>= stmt)) {
- OSL_FAIL("getStatementRDFa: result of wrong type?");
- } else {
- ret.push_back(stmt);
+ try
+ {
+ const uno::Reference<container::XEnumeration> xIter(
+ getStatementsGraph_NoLock(0, 0, 0, xXmlId, true) );
+ OSL_ENSURE(xIter.is(), "getStatementRDFa: no result?");
+ if (!xIter.is()) throw uno::RuntimeException();
+ while (xIter->hasMoreElements()) {
+ rdf::Statement stmt;
+ if (!(xIter->nextElement() >>= stmt)) {
+ OSL_FAIL("getStatementRDFa: result of wrong type?");
+ } else {
+ ret.push_back(stmt);
+ }
}
}
+ catch (const container::NoSuchElementException& e)
+ {
+ throw lang::WrappedTargetRuntimeException(
+ "librdf_Repository::getStatementRDFa: "
+ "cannot getStatementsGraph", *this, uno::makeAny(e));
+ }
::osl::MutexGuard g(m_aMutex); // don't call i_x* with mutex locked