summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-10 18:55:35 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-10 18:55:35 +0200
commite5ca1f73a08a05c957b73929cafa748ba82a033c (patch)
treeb34e05732d53057a9f619d9f9dda4e96a1dc7eb5 /desktop
parent177afb1ec39d3ac9c66c7dfdc51ef9ad22e7b752 (diff)
Clean up uses of Any::getValue() in desktop
Change-Id: I20cc2dba64a07012c7d03ab5d2aca56dd8cfb042
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index a440d9ed1722..d3598f3adf04 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/TypeClass.hpp>
+#include <o3tl/any.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
@@ -562,8 +563,8 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
OUString text;
if ( rStatus.hasValue() && !( rStatus >>= text) )
{
- if ( rStatus.getValueTypeClass() == uno::TypeClass_EXCEPTION )
- text = static_cast< uno::Exception const *>( rStatus.getValue() )->Message;
+ if ( auto e = o3tl::tryAccess<uno::Exception>(rStatus) )
+ text = e->Message;
if ( text.isEmpty() )
text = ::comphelper::anyToString( rStatus ); // fallback
@@ -800,11 +801,13 @@ void ExtensionCmdQueue::Thread::execute()
uno::Any exc( ::cppu::getCaughtException() );
OUString msg;
deployment::DeploymentException dpExc;
- if ((exc >>= dpExc) &&
- dpExc.Cause.getValueTypeClass() == uno::TypeClass_EXCEPTION)
+ if (exc >>= dpExc)
{
- // notify error cause only:
- msg = static_cast< uno::Exception const * >( dpExc.Cause.getValue() )->Message;
+ if (auto e = o3tl::tryAccess<uno::Exception>(dpExc.Cause))
+ {
+ // notify error cause only:
+ msg = e->Message;
+ }
}
if (msg.isEmpty()) // fallback for debugging purposes
msg = ::comphelper::anyToString(exc);