Kaydet (Commit) 0b0bc5eb authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove std::bad_alloc -> css::uno::RuntimeException mappings

...that are no longer needed now that the dynamic exception specifications are
gone from C++ UNO, so won't cause std::unexpected any more.

Change-Id: Ie3418658f5a84e6cec1ac48e3413f523f87497fe
Reviewed-on: https://gerrit.libreoffice.org/52641Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 0a4c1fb6
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <new>
#include "com/sun/star/beans/Introspection.hpp" #include "com/sun/star/beans/Introspection.hpp"
#include "com/sun/star/beans/theIntrospection.hpp" #include "com/sun/star/beans/theIntrospection.hpp"
...@@ -205,11 +204,7 @@ namespace CppMain { ...@@ -205,11 +204,7 @@ namespace CppMain {
css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const & context) css::uno::Reference< css::uno::XComponentContext > const & context)
{ {
try { return static_cast< ::cppu::OWeakObject * >(new Service(context));
return static_cast< ::cppu::OWeakObject * >(new Service(context));
} catch (::std::bad_alloc &) {
throw css::uno::RuntimeException("std::bad_alloc");
}
} }
rtl::OUString getImplementationName() { rtl::OUString getImplementationName() {
......
...@@ -18,11 +18,8 @@ ...@@ -18,11 +18,8 @@
#include "sal/config.h" #include "sal/config.h"
#include <new>
#include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
...@@ -60,11 +57,7 @@ namespace CppServer { ...@@ -60,11 +57,7 @@ namespace CppServer {
css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const &) css::uno::Reference< css::uno::XComponentContext > const &)
{ {
try { return static_cast< ::cppu::OWeakObject * >(new Service);
return static_cast< ::cppu::OWeakObject * >(new Service);
} catch (::std::bad_alloc &) {
throw css::uno::RuntimeException("std::bad_alloc");
}
} }
rtl::OUString getImplementationName() { rtl::OUString getImplementationName() {
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
...@@ -60,11 +59,7 @@ namespace CppTest { ...@@ -60,11 +59,7 @@ namespace CppTest {
css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const &) css::uno::Reference< css::uno::XComponentContext > const &)
{ {
try { return static_cast< cppu::OWeakObject * >(new Service);
return static_cast< cppu::OWeakObject * >(new Service);
} catch (std::bad_alloc &) {
throw css::uno::RuntimeException("std::bad_alloc");
}
} }
rtl::OUString getImplementationName() { rtl::OUString getImplementationName() {
......
...@@ -62,67 +62,60 @@ executeLoginDialog( ...@@ -62,67 +62,60 @@ executeLoginDialog(
LoginErrorInfo & rInfo, LoginErrorInfo & rInfo,
OUString const & rRealm) OUString const & rRealm)
{ {
try SolarMutexGuard aGuard;
{
SolarMutexGuard aGuard; bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0;
bool bSavePassword = rInfo.GetCanRememberPassword();
bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0; bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
bool bSavePassword = rInfo.GetCanRememberPassword();
bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials(); LoginFlags nFlags = LoginFlags::NONE;
if (rInfo.GetErrorText().isEmpty())
LoginFlags nFlags = LoginFlags::NONE; nFlags |= LoginFlags::NoErrorText;
if (rInfo.GetErrorText().isEmpty()) if (!bAccount)
nFlags |= LoginFlags::NoErrorText; nFlags |= LoginFlags::NoAccount;
if (!bAccount) if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
nFlags |= LoginFlags::NoAccount; nFlags |= LoginFlags::UsernameReadonly;
if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
nFlags |= LoginFlags::UsernameReadonly; if (!bSavePassword)
nFlags |= LoginFlags::NoSavePassword;
if (!bSavePassword)
nFlags |= LoginFlags::NoSavePassword; if (!bCanUseSysCreds)
nFlags |= LoginFlags::NoUseSysCreds;
if (!bCanUseSysCreds)
nFlags |= LoginFlags::NoUseSysCreds; ScopedVclPtrInstance< LoginDialog > xDialog(pParent, nFlags, rInfo.GetServer(), rRealm);
if (!rInfo.GetErrorText().isEmpty())
ScopedVclPtrInstance< LoginDialog > xDialog(pParent, nFlags, rInfo.GetServer(), rRealm); xDialog->SetErrorText(rInfo.GetErrorText());
if (!rInfo.GetErrorText().isEmpty()) xDialog->SetName(rInfo.GetUserName());
xDialog->SetErrorText(rInfo.GetErrorText()); if (bAccount)
xDialog->SetName(rInfo.GetUserName()); xDialog->ClearAccount();
if (bAccount) else
xDialog->ClearAccount(); xDialog->ClearPassword();
else xDialog->SetPassword(rInfo.GetPassword());
xDialog->ClearPassword();
xDialog->SetPassword(rInfo.GetPassword());
if (bSavePassword) if (bSavePassword)
{ {
std::locale aLocale(Translate::Create("uui")); std::locale aLocale(Translate::Create("uui"));
xDialog->SetSavePasswordText( xDialog->SetSavePasswordText(
Translate::get(rInfo.GetIsRememberPersistent() Translate::get(rInfo.GetIsRememberPersistent()
? RID_SAVE_PASSWORD ? RID_SAVE_PASSWORD
: RID_KEEP_PASSWORD, : RID_KEEP_PASSWORD,
aLocale)); aLocale));
xDialog->SetSavePassword(rInfo.GetIsRememberPassword()); xDialog->SetSavePassword(rInfo.GetIsRememberPassword());
} }
if ( bCanUseSysCreds ) if ( bCanUseSysCreds )
xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() ); xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() );
rInfo.SetResult(xDialog->Execute() == RET_OK ? DialogMask::ButtonsOk : rInfo.SetResult(xDialog->Execute() == RET_OK ? DialogMask::ButtonsOk :
DialogMask::ButtonsCancel); DialogMask::ButtonsCancel);
rInfo.SetUserName(xDialog->GetName()); rInfo.SetUserName(xDialog->GetName());
rInfo.SetPassword(xDialog->GetPassword()); rInfo.SetPassword(xDialog->GetPassword());
rInfo.SetAccount(xDialog->GetAccount()); rInfo.SetAccount(xDialog->GetAccount());
rInfo.SetIsRememberPassword(xDialog->IsSavePassword()); rInfo.SetIsRememberPassword(xDialog->IsSavePassword());
if ( bCanUseSysCreds ) if ( bCanUseSysCreds )
rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() ); rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() );
}
catch (std::bad_alloc const &)
{
throw uno::RuntimeException("out of memory");
}
} }
void getRememberModes( void getRememberModes(
...@@ -405,7 +398,6 @@ executeMasterPasswordDialog( ...@@ -405,7 +398,6 @@ executeMasterPasswordDialog(
task::PasswordRequestMode nMode) task::PasswordRequestMode nMode)
{ {
OString aMaster; OString aMaster;
try
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
...@@ -429,10 +421,6 @@ executeMasterPasswordDialog( ...@@ -429,10 +421,6 @@ executeMasterPasswordDialog(
xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8); xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8);
} }
} }
catch (std::bad_alloc const &)
{
throw uno::RuntimeException("out of memory");
}
sal_uInt8 aKey[RTL_DIGEST_LENGTH_MD5]; sal_uInt8 aKey[RTL_DIGEST_LENGTH_MD5];
// FIXME this is subject to the SHA1-bug tdf#114939 - but this // FIXME this is subject to the SHA1-bug tdf#114939 - but this
...@@ -506,51 +494,43 @@ executePasswordDialog( ...@@ -506,51 +494,43 @@ executePasswordDialog(
bool bIsPasswordToModify, bool bIsPasswordToModify,
bool bIsSimplePasswordRequest ) bool bIsSimplePasswordRequest )
{ {
try SolarMutexGuard aGuard;
{
SolarMutexGuard aGuard;
std::locale aResLocale(Translate::Create("uui")); std::locale aResLocale(Translate::Create("uui"));
if( nMode == task::PasswordRequestMode_PASSWORD_CREATE ) if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
{ {
if (bIsSimplePasswordRequest) if (bIsSimplePasswordRequest)
{
std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode,
aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest));
xDialog->SetMinLen(0);
rInfo.SetResult(xDialog->run() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel);
rInfo.SetPassword(xDialog->GetPassword());
}
else
{
const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length
VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create();
ScopedVclPtr<AbstractPasswordToOpenModifyDialog> const pDialog(
pFact->CreatePasswordToOpenModifyDialog(pParent, nMaxPasswdLen, bIsPasswordToModify));
rInfo.SetResult( pDialog->Execute() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel );
rInfo.SetPassword( pDialog->GetPasswordToOpen() );
rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() );
rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() );
}
}
else // enter password or reenter password
{ {
std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode, std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode,
aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest)); aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest));
xDialog->SetMinLen(0); xDialog->SetMinLen(0);
rInfo.SetResult(xDialog->run() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel); rInfo.SetResult(xDialog->run() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel);
rInfo.SetPassword(bIsPasswordToModify ? OUString() : xDialog->GetPassword()); rInfo.SetPassword(xDialog->GetPassword());
rInfo.SetPasswordToModify(bIsPasswordToModify ? xDialog->GetPassword() : OUString()); }
else
{
const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length
VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create();
ScopedVclPtr<AbstractPasswordToOpenModifyDialog> const pDialog(
pFact->CreatePasswordToOpenModifyDialog(pParent, nMaxPasswdLen, bIsPasswordToModify));
rInfo.SetResult( pDialog->Execute() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel );
rInfo.SetPassword( pDialog->GetPasswordToOpen() );
rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() );
rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() );
} }
} }
catch (std::bad_alloc const &) else // enter password or reenter password
{ {
throw uno::RuntimeException("out of memory", std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode,
uno::Reference< uno::XInterface>()); aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest));
xDialog->SetMinLen(0);
rInfo.SetResult(xDialog->run() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel);
rInfo.SetPassword(bIsPasswordToModify ? OUString() : xDialog->GetPassword());
rInfo.SetPasswordToModify(bIsPasswordToModify ? xDialog->GetPassword() : OUString());
} }
} }
......
...@@ -49,24 +49,17 @@ executeFilterDialog( ...@@ -49,24 +49,17 @@ executeFilterDialog(
uui::FilterNameList const & rFilters, uui::FilterNameList const & rFilters,
OUString & rFilter ) OUString & rFilter )
{ {
try SolarMutexGuard aGuard;
{
SolarMutexGuard aGuard;
ScopedVclPtrInstance< uui::FilterDialog > xDialog(pParent); ScopedVclPtrInstance< uui::FilterDialog > xDialog(pParent);
xDialog->SetURL(rURL); xDialog->SetURL(rURL);
xDialog->ChangeFilters(&rFilters); xDialog->ChangeFilters(&rFilters);
uui::FilterNameListPtr pSelected = rFilters.end(); uui::FilterNameListPtr pSelected = rFilters.end();
if( xDialog->AskForFilter( pSelected ) ) if( xDialog->AskForFilter( pSelected ) )
{
rFilter = pSelected->sInternal;
}
}
catch (std::bad_alloc const &)
{ {
throw uno::RuntimeException("out of memory"); rFilter = pSelected->sInternal;
} }
} }
......
...@@ -73,73 +73,66 @@ handleLockedDocumentRequest_( ...@@ -73,73 +73,66 @@ handleLockedDocumentRequest_(
if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() ) if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
return; return;
try SolarMutexGuard aGuard;
std::locale aResLocale = Translate::Create("uui");
OUString aMessage;
std::vector< OUString > aArguments;
aArguments.push_back( aDocumentURL );
sal_Int32 nResult = RET_CANCEL;
if ( nMode == UUI_DOC_LOAD_LOCK )
{
aArguments.push_back( !aInfo.isEmpty()
? aInfo
: Translate::get( STR_UNKNOWNUSER, aResLocale) );
aArguments.push_back( xRetry.is()
? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale )
: "" );
aMessage = Translate::get(STR_OPENLOCKED_MSG, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is());
nResult = aDialog.run();
}
else if ( nMode == UUI_DOC_SAVE_LOCK )
{ {
SolarMutexGuard aGuard; aArguments.push_back( !aInfo.isEmpty()
std::locale aResLocale = Translate::Create("uui"); ? aInfo
: Translate::get( STR_UNKNOWNUSER,
OUString aMessage; aResLocale ) );
std::vector< OUString > aArguments; aMessage = Translate::get(xRetry.is() ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG,
aArguments.push_back( aDocumentURL ); aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
sal_Int32 nResult = RET_CANCEL; aMessage, aArguments );
if ( nMode == UUI_DOC_LOAD_LOCK )
{ TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is());
aArguments.push_back( !aInfo.isEmpty() nResult = aDialog.run();
? aInfo
: Translate::get( STR_UNKNOWNUSER, aResLocale) );
aArguments.push_back( xRetry.is()
? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale )
: "" );
aMessage = Translate::get(STR_OPENLOCKED_MSG, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is());
nResult = aDialog.run();
}
else if ( nMode == UUI_DOC_SAVE_LOCK )
{
aArguments.push_back( !aInfo.isEmpty()
? aInfo
: Translate::get( STR_UNKNOWNUSER,
aResLocale ) );
aMessage = Translate::get(xRetry.is() ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG,
aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is());
nResult = aDialog.run();
}
else if ( nMode == UUI_DOC_OWN_LOAD_LOCK ||
nMode == UUI_DOC_OWN_SAVE_LOCK )
{
aArguments.push_back( aInfo );
aMessage = Translate::get(nMode == UUI_DOC_OWN_SAVE_LOCK
? STR_ALREADYOPEN_SAVE_MSG
: STR_ALREADYOPEN_MSG,
aResLocale );
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
AlreadyOpenQueryBox aDialog(pParent, aResLocale, aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK);
nResult = aDialog.run();
}
if ( nResult == RET_YES )
xApprove->select();
else if ( nResult == RET_NO )
xDisapprove->select();
else if ( nResult == RET_IGNORE && xRetry.is() )
xRetry->select();
else
xAbort->select();
} }
catch (std::bad_alloc const &) else if ( nMode == UUI_DOC_OWN_LOAD_LOCK ||
nMode == UUI_DOC_OWN_SAVE_LOCK )
{ {
throw uno::RuntimeException("out of memory"); aArguments.push_back( aInfo );
aMessage = Translate::get(nMode == UUI_DOC_OWN_SAVE_LOCK
? STR_ALREADYOPEN_SAVE_MSG
: STR_ALREADYOPEN_MSG,
aResLocale );
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
AlreadyOpenQueryBox aDialog(pParent, aResLocale, aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK);
nResult = aDialog.run();
} }
if ( nResult == RET_YES )
xApprove->select();
else if ( nResult == RET_NO )
xDisapprove->select();
else if ( nResult == RET_IGNORE && xRetry.is() )
xRetry->select();
else
xAbort->select();
} }
void void
...@@ -155,22 +148,15 @@ handleChangedByOthersRequest_( ...@@ -155,22 +148,15 @@ handleChangedByOthersRequest_(
if ( !xApprove.is() || !xAbort.is() ) if ( !xApprove.is() || !xAbort.is() )
return; return;
try SolarMutexGuard aGuard;
{ std::locale aResLocale = Translate::Create("uui");
SolarMutexGuard aGuard; FileChangedQueryBox aDialog(pParent, aResLocale);
std::locale aResLocale = Translate::Create("uui"); sal_Int32 nResult = aDialog.run();
FileChangedQueryBox aDialog(pParent, aResLocale);
sal_Int32 nResult = aDialog.run(); if ( nResult == RET_YES )
xApprove->select();
if ( nResult == RET_YES ) else
xApprove->select(); xAbort->select();
else
xAbort->select();
}
catch (std::bad_alloc const &)
{
throw uno::RuntimeException("out of memory");
}
} }
const sal_uInt16 UUI_DOC_CreateErrDlg = 0; const sal_uInt16 UUI_DOC_CreateErrDlg = 0;
...@@ -191,33 +177,26 @@ handleLockFileProblemRequest_( ...@@ -191,33 +177,26 @@ handleLockFileProblemRequest_(
if ( !xApprove.is() || !xAbort.is() ) if ( !xApprove.is() || !xAbort.is() )
return; return;
try SolarMutexGuard aGuard;
std::locale aResLocale = Translate::Create("uui");
sal_Int32 nResult;
if (nWhichDlg == UUI_DOC_CreateErrDlg)
{ {
SolarMutexGuard aGuard; LockFailedQueryBox aDialog(pParent, aResLocale);
std::locale aResLocale = Translate::Create("uui"); nResult = aDialog.run();
sal_Int32 nResult;
if (nWhichDlg == UUI_DOC_CreateErrDlg)
{
LockFailedQueryBox aDialog(pParent, aResLocale);
nResult = aDialog.run();
}
else
{
LockCorruptQueryBox aDialog(pParent, aResLocale);
nResult = aDialog.run();
}
if ( nResult == RET_OK )
xApprove->select();
else
xAbort->select();
} }
catch (std::bad_alloc const &) else
{ {
throw uno::RuntimeException("out of memory"); LockCorruptQueryBox aDialog(pParent, aResLocale);
nResult = aDialog.run();
} }
if ( nResult == RET_OK )
xApprove->select();
else
xAbort->select();
} }
} // namespace } // namespace
......
...@@ -140,32 +140,25 @@ executeUnknownAuthDialog( ...@@ -140,32 +140,25 @@ executeUnknownAuthDialog(
uno::Reference< uno::XComponentContext > const & xContext, uno::Reference< uno::XComponentContext > const & xContext,
const uno::Reference< security::XCertificate >& rXCert) const uno::Reference< security::XCertificate >& rXCert)
{ {
try SolarMutexGuard aGuard;
{
SolarMutexGuard aGuard;
UnknownAuthDialog aDialog(pParent, rXCert, xContext); UnknownAuthDialog aDialog(pParent, rXCert, xContext);
// Get correct resource string // Get correct resource string
OUString aMessage; OUString aMessage;
std::vector< OUString > aArguments; std::vector< OUString > aArguments;
aArguments.push_back( getContentPart( rXCert->getSubjectName()) ); aArguments.push_back( getContentPart( rXCert->getSubjectName()) );
std::locale aResLocale(Translate::Create("uui")); std::locale aResLocale(Translate::Create("uui"));
ErrorResource aErrorResource(RID_UUI_ERRHDL, aResLocale); ErrorResource aErrorResource(RID_UUI_ERRHDL, aResLocale);
aMessage = Translate::get(STR_UUI_UNKNOWNAUTH_UNTRUSTED, aResLocale); aMessage = Translate::get(STR_UUI_UNKNOWNAUTH_UNTRUSTED, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments ); aMessage, aArguments );
aDialog.setDescriptionText( aMessage ); aDialog.setDescriptionText( aMessage );
return static_cast<bool>(aDialog.run()); return static_cast<bool>(aDialog.run());
}
catch (std::bad_alloc const &)
{
throw uno::RuntimeException("out of memory");
}
} }
enum class SslWarnType { enum class SslWarnType {
...@@ -180,62 +173,55 @@ executeSSLWarnDialog( ...@@ -180,62 +173,55 @@ executeSSLWarnDialog(
SslWarnType failure, SslWarnType failure,
const OUString & hostName ) const OUString & hostName )
{ {
try SolarMutexGuard aGuard;
{
SolarMutexGuard aGuard;
SSLWarnDialog aDialog(pParent, rXCert, xContext); SSLWarnDialog aDialog(pParent, rXCert, xContext);
// Get correct resource string // Get correct resource string
std::vector< OUString > aArguments_1; std::vector< OUString > aArguments_1;
char const * pMessageKey = nullptr; char const * pMessageKey = nullptr;
char const * pTitleKey = nullptr; char const * pTitleKey = nullptr;
switch( failure ) switch( failure )
{ {
case SslWarnType::DOMAINMISMATCH: case SslWarnType::DOMAINMISMATCH:
pMessageKey = STR_UUI_SSLWARN_DOMAINMISMATCH; pMessageKey = STR_UUI_SSLWARN_DOMAINMISMATCH;
pTitleKey = STR_UUI_SSLWARN_DOMAINMISMATCH_TITLE; pTitleKey = STR_UUI_SSLWARN_DOMAINMISMATCH_TITLE;
aArguments_1.push_back( hostName ); aArguments_1.push_back( hostName );
aArguments_1.push_back( aArguments_1.push_back(
getContentPart( rXCert->getSubjectName()) ); getContentPart( rXCert->getSubjectName()) );
aArguments_1.push_back( hostName ); aArguments_1.push_back( hostName );
break; break;
case SslWarnType::EXPIRED: case SslWarnType::EXPIRED:
pMessageKey = STR_UUI_SSLWARN_EXPIRED; pMessageKey = STR_UUI_SSLWARN_EXPIRED;
pTitleKey = STR_UUI_SSLWARN_EXPIRED_TITLE; pTitleKey = STR_UUI_SSLWARN_EXPIRED_TITLE;
aArguments_1.push_back( aArguments_1.push_back(
getContentPart( rXCert->getSubjectName()) ); getContentPart( rXCert->getSubjectName()) );
aArguments_1.push_back( aArguments_1.push_back(
getLocalizedDatTimeStr( xContext, getLocalizedDatTimeStr( xContext,
rXCert->getNotValidAfter() ) ); rXCert->getNotValidAfter() ) );
aArguments_1.push_back( aArguments_1.push_back(
getLocalizedDatTimeStr( xContext, getLocalizedDatTimeStr( xContext,
rXCert->getNotValidAfter() ) ); rXCert->getNotValidAfter() ) );
break; break;
case SslWarnType::INVALID: case SslWarnType::INVALID:
pMessageKey = STR_UUI_SSLWARN_INVALID; pMessageKey = STR_UUI_SSLWARN_INVALID;
pTitleKey = STR_UUI_SSLWARN_INVALID_TITLE; pTitleKey = STR_UUI_SSLWARN_INVALID_TITLE;
break; break;
default: assert(false); default: assert(false);
} }
std::locale aResLocale(Translate::Create("uui")); std::locale aResLocale(Translate::Create("uui"));
OUString aMessage_1 = Translate::get(pMessageKey, aResLocale); OUString aMessage_1 = Translate::get(pMessageKey, aResLocale);
aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments( aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments(
aMessage_1, aArguments_1 ); aMessage_1, aArguments_1 );
aDialog.setDescription1Text( aMessage_1 ); aDialog.setDescription1Text( aMessage_1 );
OUString aTitle = Translate::get(pTitleKey, aResLocale); OUString aTitle = Translate::get(pTitleKey, aResLocale);
aDialog.set_title(aTitle); aDialog.set_title(aTitle);
return static_cast<bool>(aDialog.run()); return static_cast<bool>(aDialog.run());
}
catch (std::bad_alloc const &)
{
throw uno::RuntimeException("out of memory");
}
} }
void void
......
...@@ -861,10 +861,6 @@ UUIInteractionHelper::handleRequest_impl( ...@@ -861,10 +861,6 @@ UUIInteractionHelper::handleRequest_impl(
// Not handled. // Not handled.
return false; return false;
} }
catch (std::bad_alloc const &)
{
throw uno::RuntimeException("out of memory");
}
catch( const uno::RuntimeException& ) catch( const uno::RuntimeException& )
{ {
throw; // allowed to leave here throw; // allowed to leave here
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment