Use exception ctors, instead of setting members later
Avoids overwriting source location in message Change-Id: Ia0290c7dd1ab3ea1357712a27ecab75c7b583dd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157893 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -66,8 +66,7 @@ SQLExceptionInfo::SQLExceptionInfo(const css::sdb::SQLContext& _rError)
|
||||
|
||||
SQLExceptionInfo::SQLExceptionInfo( const OUString& _rSimpleErrorMessage )
|
||||
{
|
||||
SQLException aError;
|
||||
aError.Message = _rSimpleErrorMessage;
|
||||
SQLException aError(_rSimpleErrorMessage, {}, {}, 0, {});
|
||||
m_aContent <<= aError;
|
||||
implDetermineType();
|
||||
}
|
||||
@@ -177,11 +176,7 @@ SQLExceptionInfo::operator const css::sdb::SQLContext*() const
|
||||
|
||||
void SQLExceptionInfo::prepend( const OUString& _rErrorMessage )
|
||||
{
|
||||
SQLException aException;
|
||||
aException.Message = _rErrorMessage;
|
||||
aException.ErrorCode = 0;
|
||||
aException.SQLState = "S1000";
|
||||
aException.NextException = m_aContent;
|
||||
SQLException aException(_rErrorMessage, {}, "S1000", 0, m_aContent);
|
||||
m_aContent <<= aException;
|
||||
|
||||
m_eType = TYPE::SQLException;
|
||||
@@ -194,24 +189,19 @@ Any SQLExceptionInfo::createException(TYPE eType, const OUString& rErrorMessage,
|
||||
switch (eType)
|
||||
{
|
||||
case TYPE::SQLException:
|
||||
aAppend <<= SQLException();
|
||||
aAppend <<= SQLException(rErrorMessage, {}, rSQLState, nErrorCode, {});
|
||||
break;
|
||||
case TYPE::SQLWarning:
|
||||
aAppend <<= SQLWarning();
|
||||
aAppend <<= SQLWarning(rErrorMessage, {}, rSQLState, nErrorCode, {});
|
||||
break;
|
||||
case TYPE::SQLContext:
|
||||
aAppend <<= SQLContext();
|
||||
aAppend <<= SQLContext(rErrorMessage, {}, rSQLState, nErrorCode, {}, {});
|
||||
break;
|
||||
default:
|
||||
TOOLS_WARN_EXCEPTION("connectivity.commontools", "SQLExceptionInfo::createException: invalid exception type: this will crash!");
|
||||
break;
|
||||
}
|
||||
|
||||
SQLException& pAppendException = const_cast<SQLException &>(*o3tl::forceAccess<SQLException>(aAppend));
|
||||
pAppendException.Message = rErrorMessage;
|
||||
pAppendException.SQLState = rSQLState;
|
||||
pAppendException.ErrorCode = nErrorCode;
|
||||
|
||||
return aAppend;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,11 +215,7 @@ namespace dbtools::param
|
||||
}
|
||||
catch( SQLException& e )
|
||||
{
|
||||
WrappedTargetException aExceptionWrapper;
|
||||
aExceptionWrapper.Context = e.Context;
|
||||
aExceptionWrapper.Message = e.Message;
|
||||
aExceptionWrapper.TargetException <<= e;
|
||||
throw aExceptionWrapper;
|
||||
throw WrappedTargetException(e.Message, e.Context, css::uno::Any(e));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -142,12 +142,11 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
|
||||
Exception aLoaderError;
|
||||
OSL_VERIFY( aLoaderException >>= aLoaderError );
|
||||
|
||||
SQLException aDetailException;
|
||||
aDetailException.Message = m_aResources.getResourceStringWithSubstitution(
|
||||
STR_LOAD_FILE_ERROR_MESSAGE,
|
||||
"$exception_type$", aLoaderException.getValueTypeName(),
|
||||
"$error_message$", aLoaderError.Message
|
||||
);
|
||||
SQLException aDetailException(m_aResources.getResourceStringWithSubstitution(
|
||||
STR_LOAD_FILE_ERROR_MESSAGE, "$exception_type$",
|
||||
aLoaderException.getValueTypeName(),
|
||||
"$error_message$", aLoaderError.Message),
|
||||
{}, {}, 0, {});
|
||||
aErrorDetails <<= aDetailException;
|
||||
}
|
||||
|
||||
|
||||
@@ -413,17 +413,13 @@ const Sequence< sal_Int8 > & OConnection::getUnoTunnelId()
|
||||
|
||||
void OConnection::throwUrlNotValid(const OUString & _rsUrl,const OUString & _rsMessage)
|
||||
{
|
||||
SQLException aError;
|
||||
aError.Message = getResources().getResourceStringWithSubstitution(
|
||||
STR_NO_VALID_FILE_URL,
|
||||
"$URL$", _rsUrl
|
||||
);
|
||||
|
||||
aError.SQLState = "S1000";
|
||||
aError.ErrorCode = 0;
|
||||
aError.Context = static_cast< XConnection* >(this);
|
||||
XConnection* context = this;
|
||||
css::uno::Any next;
|
||||
if (!_rsMessage.isEmpty())
|
||||
aError.NextException <<= SQLException(_rsMessage, aError.Context, OUString(), 0, Any());
|
||||
next <<= SQLException(_rsMessage, context, OUString(), 0, Any());
|
||||
SQLException aError(
|
||||
getResources().getResourceStringWithSubstitution(STR_NO_VALID_FILE_URL, "$URL$", _rsUrl),
|
||||
context, "S1000", 0, next);
|
||||
|
||||
throw aError;
|
||||
}
|
||||
|
||||
@@ -524,12 +524,8 @@ Any SAL_CALL java_sql_Connection::getWarnings( )
|
||||
SQLException aAsException( java_sql_SQLWarning( warn_base, *this ) );
|
||||
|
||||
// translate to warning
|
||||
SQLWarning aWarning;
|
||||
aWarning.Context = aAsException.Context;
|
||||
aWarning.Message = aAsException.Message;
|
||||
aWarning.SQLState = aAsException.SQLState;
|
||||
aWarning.ErrorCode = aAsException.ErrorCode;
|
||||
aWarning.NextException = aAsException.NextException;
|
||||
SQLWarning aWarning(aAsException.Message, aAsException.Context, aAsException.SQLState,
|
||||
aAsException.ErrorCode, aAsException.NextException);
|
||||
|
||||
return Any( aWarning );
|
||||
}
|
||||
|
||||
@@ -190,8 +190,7 @@ void Table::rename( const OUString& newName )
|
||||
}
|
||||
catch( css::sdbc::SQLException &e )
|
||||
{
|
||||
OUString buf( e.Message + "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
|
||||
e.Message = buf;
|
||||
e.Message += "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)";
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,8 +126,7 @@ void View::rename( const OUString& newName )
|
||||
}
|
||||
catch( css::sdbc::SQLException &e )
|
||||
{
|
||||
OUString buf( e.Message + "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
|
||||
e.Message = buf;
|
||||
e.Message += "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)";
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
@@ -307,8 +307,9 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
|
||||
OUString sErrorMessage( DBA_RES( RID_STR_FILE_DOES_NOT_EXIST ) );
|
||||
::svt::OFileNotation aTransformer( _sURL );
|
||||
|
||||
SQLException aError;
|
||||
aError.Message = sErrorMessage.replaceAll( "$file$", aTransformer.get( ::svt::OFileNotation::N_SYSTEM ) );
|
||||
SQLException aError(sErrorMessage.replaceAll(
|
||||
"$file$", aTransformer.get(::svt::OFileNotation::N_SYSTEM)),
|
||||
{}, {}, 0, {});
|
||||
|
||||
throw WrappedTargetException( _sURL, *this, Any( aError ) );
|
||||
}
|
||||
|
||||
@@ -766,9 +766,9 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
|
||||
OUString sMessage = DBA_RES(pExceptionMessageId)
|
||||
.replaceAll("$name$", m_pImpl->m_sConnectURL);
|
||||
|
||||
SQLContext aContext;
|
||||
aContext.Message = DBA_RES(RID_STR_CONNECTION_REQUEST).
|
||||
replaceFirst("$name$", m_pImpl->m_sConnectURL);
|
||||
SQLContext aContext(
|
||||
DBA_RES(RID_STR_CONNECTION_REQUEST).replaceFirst("$name$", m_pImpl->m_sConnectURL),
|
||||
{}, {}, 0, {}, {});
|
||||
|
||||
throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), Any( aContext ) );
|
||||
}
|
||||
|
||||
@@ -1566,9 +1566,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
|
||||
Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName);
|
||||
if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() )
|
||||
{
|
||||
css::io::WrongFormatException aWFE;
|
||||
aWFE.Message = DBA_RES( RID_STR_MISSING_EXTENSION );
|
||||
throw aWFE;
|
||||
throw css::io::WrongFormatException(DBA_RES(RID_STR_MISSING_EXTENSION));
|
||||
}
|
||||
}
|
||||
if ( !aClassID.hasElements() )
|
||||
|
||||
@@ -2520,11 +2520,8 @@ void OApplicationController::OnFirstControllerConnected()
|
||||
if ( Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly() )
|
||||
return;
|
||||
|
||||
SQLWarning aWarning;
|
||||
aWarning.Message = DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS);
|
||||
SQLException aDetail;
|
||||
aDetail.Message = DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS_DETAIL);
|
||||
aWarning.NextException <<= aDetail;
|
||||
SQLException aDetail(DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS_DETAIL), {}, {}, 0, {});
|
||||
SQLWarning aWarning(DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS), {}, {}, 0, css::uno::Any(aDetail));
|
||||
|
||||
Reference< XExecutableDialog > xDialog = ErrorMessageDialog::create( getORB(), "", nullptr, Any( aWarning ) );
|
||||
xDialog->execute();
|
||||
|
||||
@@ -702,15 +702,12 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
|
||||
{
|
||||
if ( !lcl_handle( xHandler, aError ) )
|
||||
{
|
||||
InteractiveIOException aRequest;
|
||||
aRequest.Classification = InteractionClassification_ERROR;
|
||||
if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) )
|
||||
// assume saving the document failed
|
||||
aRequest.Code = IOErrorCode_CANT_WRITE;
|
||||
else
|
||||
aRequest.Code = IOErrorCode_GENERAL;
|
||||
aRequest.Message = e.Message;
|
||||
aRequest.Context = e.Context;
|
||||
css::ucb::IOErrorCode code
|
||||
= aError.isExtractableTo(::cppu::UnoType<IOException>::get())
|
||||
? IOErrorCode_CANT_WRITE // assume saving the document failed
|
||||
: IOErrorCode_GENERAL;
|
||||
InteractiveIOException aRequest(e.Message, e.Context,
|
||||
InteractionClassification_ERROR, code);
|
||||
lcl_handle( xHandler, Any( aRequest ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,11 +565,10 @@ OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const SQLExceptionInfo& rE
|
||||
|
||||
OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage, MessBoxStyle nStyle, MessageType eType, const ::dbtools::SQLExceptionInfo* pAdditionalErrorInfo )
|
||||
{
|
||||
SQLContext aError;
|
||||
aError.Message = rTitle;
|
||||
aError.Details = rMessage;
|
||||
css::uno::Any next;
|
||||
if (pAdditionalErrorInfo)
|
||||
aError.NextException = pAdditionalErrorInfo->get();
|
||||
next = pAdditionalErrorInfo->get();
|
||||
SQLContext aError(rTitle, {}, {}, 0, next, rMessage);
|
||||
|
||||
m_pImpl.reset(new SQLMessageBox_Impl(SQLExceptionInfo(aError)));
|
||||
|
||||
|
||||
@@ -842,8 +842,7 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, weld::Button&, void)
|
||||
{
|
||||
|
||||
OUString sMsg(DBA_RES(STR_TABLEDESIGN_NO_PRIM_KEY));
|
||||
SQLContext aError;
|
||||
aError.Message = sMsg;
|
||||
SQLContext aError(sMsg, {}, {}, 0, {}, {});
|
||||
::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( Any( aError ) ) );
|
||||
::rtl::Reference xYes = new ::comphelper::OInteractionApprove;
|
||||
xRequest->addContinuation( xYes );
|
||||
|
||||
@@ -159,9 +159,7 @@ namespace dbaui
|
||||
sMessage = sMessage.replaceFirst( "$buttontext$", GetStandardText( StandardButtonType::More ) );
|
||||
sMessage = removeMnemonicFromString( sMessage );
|
||||
|
||||
SQLWarning aContext;
|
||||
aContext.Message = sMessage;
|
||||
aContext.NextException = aWarnings;
|
||||
SQLWarning aContext(sMessage, {}, {}, 0, aWarnings);
|
||||
aInfo = aContext;
|
||||
}
|
||||
xConnectionWarnings->clearWarnings();
|
||||
@@ -176,10 +174,7 @@ namespace dbaui
|
||||
{
|
||||
if ( !m_sContextInformation.isEmpty() )
|
||||
{
|
||||
SQLException aError;
|
||||
aError.Message = m_sContextInformation;
|
||||
aError.NextException = aInfo.get();
|
||||
|
||||
SQLException aError(m_sContextInformation, {}, {}, 0, aInfo.get());
|
||||
aInfo = aError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,8 @@ namespace dbaui
|
||||
{
|
||||
void lcl_fillNameExistsError( std::u16string_view _rObjectName, SQLExceptionInfo& _out_rErrorToDisplay )
|
||||
{
|
||||
SQLException aError;
|
||||
OUString sErrorMessage = DBA_RES(STR_NAMED_OBJECT_ALREADY_EXISTS);
|
||||
aError.Message = sErrorMessage.replaceAll("$#$", _rObjectName);
|
||||
SQLException aError(sErrorMessage.replaceAll("$#$", _rObjectName), {}, {}, 0, {});
|
||||
_out_rErrorToDisplay = aError;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,16 +303,13 @@ namespace dbaui
|
||||
OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC);
|
||||
sMessage = sMessage.replaceFirst("$file$",_rLinkName);
|
||||
|
||||
css::sdbc::SQLException aSQLException;
|
||||
aSQLException.Message = sMessage;
|
||||
css::sdbc::SQLException aSQLException(sMessage, {}, {}, 0, {});
|
||||
aInfo = dbtools::SQLExceptionInfo(aSQLException);
|
||||
}
|
||||
}
|
||||
catch(const css::io::WrongFormatException &e)
|
||||
{
|
||||
css::sdbc::SQLException aSQLException;
|
||||
aSQLException.Message = e.Message;
|
||||
aSQLException.Context = e.Context;
|
||||
css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {});
|
||||
aInfo = dbtools::SQLExceptionInfo(aSQLException);
|
||||
|
||||
// more like a hack, insert an empty message
|
||||
@@ -330,9 +327,7 @@ namespace dbaui
|
||||
css::sdbc::SQLException a;
|
||||
if ( !(aAny >>= a) || (a.ErrorCode != dbtools::ParameterInteractionCancelled) )
|
||||
{
|
||||
css::sdbc::SQLException aSQLException;
|
||||
aSQLException.Message = e.Message;
|
||||
aSQLException.Context = e.Context;
|
||||
css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {});
|
||||
aInfo = dbtools::SQLExceptionInfo(aSQLException);
|
||||
|
||||
// more like a hack, insert an empty message
|
||||
|
||||
@@ -614,11 +614,9 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
|
||||
|
||||
void OQueryController::impl_showAutoSQLViewError( const css::uno::Any& _rErrorDetails )
|
||||
{
|
||||
SQLContext aErrorContext;
|
||||
aErrorContext.Message = lcl_getObjectResourceString( STR_ERROR_PARSING_STATEMENT, m_nCommandType );
|
||||
aErrorContext.Context = *this;
|
||||
aErrorContext.Details = lcl_getObjectResourceString( STR_INFO_OPENING_IN_SQL_VIEW, m_nCommandType );
|
||||
aErrorContext.NextException = _rErrorDetails;
|
||||
SQLContext aErrorContext(
|
||||
lcl_getObjectResourceString(STR_ERROR_PARSING_STATEMENT, m_nCommandType), *this, {}, 0,
|
||||
_rErrorDetails, lcl_getObjectResourceString(STR_INFO_OPENING_IN_SQL_VIEW, m_nCommandType));
|
||||
showError( aErrorContext );
|
||||
}
|
||||
|
||||
|
||||
@@ -1164,15 +1164,11 @@ void OTableController::alterColumns()
|
||||
}
|
||||
catch (const SQLException&)
|
||||
{
|
||||
const auto caughtException = ::cppu::getCaughtException();
|
||||
OUString sError( DBA_RES( STR_TABLEDESIGN_COULD_NOT_DROP_COL ) );
|
||||
sError = sError.replaceFirst( "$column$", rColumnName );
|
||||
|
||||
SQLException aNewException;
|
||||
aNewException.Message = sError;
|
||||
aNewException.SQLState = "S1000";
|
||||
aNewException.NextException = ::cppu::getCaughtException();
|
||||
|
||||
throw aNewException;
|
||||
throw SQLException(sError, {}, "S1000", 0, caughtException);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,24 +1011,20 @@ bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _r
|
||||
|
||||
try
|
||||
{
|
||||
SQLContext aError;
|
||||
aError.Context = *this;
|
||||
aError.Message = DBA_RES(STR_ERROR_OCCURRED_WHILE_COPYING);
|
||||
|
||||
css::uno::Any next;
|
||||
::dbtools::SQLExceptionInfo aInfo( _rEvent.Error );
|
||||
if ( aInfo.isValid() )
|
||||
aError.NextException = _rEvent.Error;
|
||||
next = _rEvent.Error;
|
||||
else
|
||||
{
|
||||
// a non-SQL exception happened
|
||||
Exception aException;
|
||||
OSL_VERIFY( _rEvent.Error >>= aException );
|
||||
SQLContext aContext;
|
||||
aContext.Context = aException.Context;
|
||||
aContext.Message = aException.Message;
|
||||
aContext.Details = _rEvent.Error.getValueTypeName();
|
||||
aError.NextException <<= aContext;
|
||||
SQLContext aContext(aException.Message, aException.Context, {}, 0, {},
|
||||
_rEvent.Error.getValueTypeName());
|
||||
next <<= aContext;
|
||||
}
|
||||
SQLContext aError(DBA_RES(STR_ERROR_OCCURRED_WHILE_COPYING), *this, {}, 0, next, {});
|
||||
|
||||
::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( Any( aError ) ) );
|
||||
|
||||
|
||||
@@ -558,10 +558,10 @@ namespace abp
|
||||
if ( aException.Message.isEmpty() )
|
||||
{
|
||||
// prepend some context info
|
||||
SQLContext aDetailedError;
|
||||
aDetailedError.Message = compmodule::ModuleRes(RID_STR_NOCONNECTION);
|
||||
aDetailedError.Details = compmodule::ModuleRes(RID_STR_PLEASECHECKSETTINGS);
|
||||
aDetailedError.NextException = aError;
|
||||
SQLContext aDetailedError(compmodule::ModuleRes(RID_STR_NOCONNECTION), // message
|
||||
{}, {}, 0,
|
||||
aError, // next exception
|
||||
compmodule::ModuleRes(RID_STR_PLEASECHECKSETTINGS)); // details
|
||||
// handle (aka display) the new context info
|
||||
xInteractions->handle( new OInteractionRequest( Any( aDetailedError ) ) );
|
||||
}
|
||||
|
||||
@@ -575,9 +575,8 @@ namespace dbp
|
||||
{ // an SQLException (or derivee) was thrown ...
|
||||
|
||||
// prepend an extra SQLContext explaining what we were doing
|
||||
SQLContext aContext;
|
||||
aContext.Message = compmodule::ModuleRes(RID_STR_COULDNOTOPENTABLE);
|
||||
aContext.NextException = aSQLException;
|
||||
SQLContext aContext(compmodule::ModuleRes(RID_STR_COULDNOTOPENTABLE), {}, {}, 0,
|
||||
aSQLException, {});
|
||||
|
||||
// create an interaction handler to display this exception
|
||||
Reference< XInteractionHandler > xHandler = getInteractionHandler(m_xAssistant.get());
|
||||
|
||||
@@ -2422,9 +2422,7 @@ namespace pcr
|
||||
if ( aParser.GetProtocol() != INetProtocol::NotValid )
|
||||
sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
|
||||
OUString sInfo(PcrRes(RID_STR_UNABLETOCONNECT).replaceAll("$name$", sDataSourceName));
|
||||
SQLContext aContext;
|
||||
aContext.Message = sInfo;
|
||||
aContext.NextException = aError.get();
|
||||
SQLContext aContext(sInfo, {}, {}, 0, aError.get(), {});
|
||||
impl_displaySQLError_nothrow( aContext );
|
||||
}
|
||||
|
||||
|
||||
@@ -414,9 +414,7 @@ namespace pcr
|
||||
sErrorMessage = sErrorMessage.replaceFirst("#", sCommand);
|
||||
}
|
||||
|
||||
SQLContext aContext;
|
||||
aContext.Message = sErrorMessage;
|
||||
aContext.NextException = aErrorInfo.get();
|
||||
SQLContext aContext(sErrorMessage, {}, {}, 0, aErrorInfo.get(), {});
|
||||
::dbtools::showError(aContext, m_xDialog->GetXWindow(), m_xContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -515,9 +515,7 @@ namespace frm
|
||||
if ( !aPredicateInput.normalizePredicateString( aNewText, m_xField, &sErrorMessage ) )
|
||||
{
|
||||
// display the error and outta here
|
||||
SQLContext aError;
|
||||
aError.Message = ResourceManager::loadString(RID_STR_SYNTAXERROR);
|
||||
aError.Details = sErrorMessage;
|
||||
SQLContext aError(ResourceManager::loadString(RID_STR_SYNTAXERROR), {}, {}, 0, {}, sErrorMessage);
|
||||
displayException( aError );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -243,10 +243,7 @@ namespace xforms
|
||||
OUString sErrorMessage;
|
||||
if ( !checkPropertySanity( _nHandle, _rConvertedValue, sErrorMessage ) )
|
||||
{
|
||||
IllegalArgumentException aException;
|
||||
aException.Message = sErrorMessage;
|
||||
aException.Context = *this;
|
||||
throw aException;
|
||||
throw IllegalArgumentException(sErrorMessage, *this, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -943,8 +943,7 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
|
||||
{
|
||||
buf.append( ", no traceback available\n" );
|
||||
}
|
||||
RuntimeException e;
|
||||
e.Message = buf.makeStringAndClear();
|
||||
RuntimeException e(buf.makeStringAndClear());
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
fprintf( stderr, "Python exception: %s\n",
|
||||
OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr() );
|
||||
|
||||
@@ -2851,9 +2851,7 @@ uno::Reference<frame::XModel> OReportController::executeReport()
|
||||
dbtools::SQLExceptionInfo aInfo;
|
||||
if ( !bEnabled )
|
||||
{
|
||||
sdb::SQLContext aFirstMessage;
|
||||
OUString sInfo = RptResId( pErrorId );
|
||||
aFirstMessage.Message = sInfo;
|
||||
sdb::SQLContext aFirstMessage(RptResId(pErrorId), {}, {}, 0, {}, {});
|
||||
aInfo = aFirstMessage;
|
||||
if ( isEditable() )
|
||||
{
|
||||
@@ -2898,29 +2896,25 @@ uno::Reference<frame::XModel> OReportController::executeReport()
|
||||
{
|
||||
uno::Any aCaughtException( ::cppu::getCaughtException() );
|
||||
|
||||
// our first message says: we caught an exception
|
||||
sdb::SQLContext aFirstMessage;
|
||||
OUString sInfo(RptResId(RID_STR_CAUGHT_FOREIGN_EXCEPTION));
|
||||
sInfo = sInfo.replaceAll("$type$", aCaughtException.getValueTypeName());
|
||||
aFirstMessage.Message = sInfo;
|
||||
|
||||
// our second message: the message of the exception we caught
|
||||
sdbc::SQLException aSecondMessage;
|
||||
aSecondMessage.Message = e.Message;
|
||||
aSecondMessage.Context = e.Context;
|
||||
|
||||
// maybe our third message: the message which is wrapped in the exception we caught
|
||||
sdbc::SQLException aThirdMessage;
|
||||
lang::WrappedTargetException aWrapped;
|
||||
if ( aCaughtException >>= aWrapped )
|
||||
css::uno::Any aOptThirdMessage;
|
||||
if (lang::WrappedTargetException aWrapped; aCaughtException >>= aWrapped)
|
||||
{
|
||||
sdbc::SQLException aThirdMessage;
|
||||
aThirdMessage.Message = aWrapped.Message;
|
||||
aThirdMessage.Context = aWrapped.Context;
|
||||
if ( !aThirdMessage.Message.isEmpty() )
|
||||
aOptThirdMessage <<= aThirdMessage;
|
||||
}
|
||||
|
||||
if ( !aThirdMessage.Message.isEmpty() )
|
||||
aSecondMessage.NextException <<= aThirdMessage;
|
||||
aFirstMessage.NextException <<= aSecondMessage;
|
||||
|
||||
// our second message: the message of the exception we caught
|
||||
sdbc::SQLException aSecondMessage(e.Message, e.Context, {}, 0, aOptThirdMessage);
|
||||
|
||||
// our first message says: we caught an exception
|
||||
OUString sInfo(RptResId(RID_STR_CAUGHT_FOREIGN_EXCEPTION));
|
||||
sInfo = sInfo.replaceAll("$type$", aCaughtException.getValueTypeName());
|
||||
sdb::SQLContext aFirstMessage(sInfo, {}, {}, 0, css::uno::Any(aSecondMessage), {});
|
||||
|
||||
aInfo = aFirstMessage;
|
||||
}
|
||||
|
||||
@@ -1158,15 +1158,11 @@ void SAXWriter::startElement(const OUString& aName, const Reference<XAttributeLi
|
||||
{
|
||||
if (!m_bDocStarted)
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "startElement called before startDocument";
|
||||
throw except;
|
||||
throw SAXException("startElement called before startDocument", {}, {});
|
||||
}
|
||||
if (m_bIsCDATA)
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "startElement call not allowed with CDATA sections";
|
||||
throw except;
|
||||
throw SAXException("startElement call not allowed with CDATA sections", {}, {});
|
||||
}
|
||||
|
||||
sal_Int32 nLength(0);
|
||||
@@ -1210,15 +1206,12 @@ void SAXWriter::startElement(const OUString& aName, const Reference<XAttributeLi
|
||||
|
||||
if (eRet == SAX_WARNING)
|
||||
{
|
||||
SAXInvalidCharacterException except;
|
||||
except.Message = "Invalid character during XML-Export in an attribute value";
|
||||
throw except;
|
||||
throw SAXInvalidCharacterException(
|
||||
"Invalid character during XML-Export in an attribute value", {}, {});
|
||||
}
|
||||
else if (eRet == SAX_ERROR)
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "Invalid character during XML-Export";
|
||||
throw except;
|
||||
throw SAXException("Invalid character during XML-Export", {}, {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1262,9 +1255,7 @@ void SAXWriter::endElement(const OUString& aName)
|
||||
|
||||
if (!bRet)
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "Invalid character during XML-Export";
|
||||
throw except;
|
||||
throw SAXException("Invalid character during XML-Export", {}, {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1272,9 +1263,7 @@ void SAXWriter::characters(const OUString& aChars)
|
||||
{
|
||||
if (!m_bDocStarted)
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "characters method called before startDocument";
|
||||
throw except;
|
||||
throw SAXException("characters method called before startDocument", {}, {});
|
||||
}
|
||||
|
||||
bool bThrowException(false);
|
||||
@@ -1314,9 +1303,7 @@ void SAXWriter::characters(const OUString& aChars)
|
||||
}
|
||||
if (bThrowException)
|
||||
{
|
||||
SAXInvalidCharacterException except;
|
||||
except.Message = "Invalid character during XML-Export";
|
||||
throw except;
|
||||
throw SAXInvalidCharacterException("Invalid character during XML-Export", {}, {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,9 +1344,7 @@ void SAXWriter::processingInstruction(const OUString& aTarget, const OUString& a
|
||||
|
||||
if (!m_pSaxWriterHelper->processingInstruction(aTarget, aData))
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "Invalid character during XML-Export";
|
||||
throw except;
|
||||
throw SAXException("Invalid character during XML-Export", {}, {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1391,9 +1376,7 @@ void SAXWriter::endCDATA()
|
||||
{
|
||||
if (!m_bDocStarted || !m_bIsCDATA)
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "endCDATA was called without startCDATA";
|
||||
throw except;
|
||||
throw SAXException("endCDATA was called without startCDATA", {}, {});
|
||||
}
|
||||
|
||||
sal_Int32 nPrefix = getIndentPrefixLength(3);
|
||||
@@ -1427,9 +1410,7 @@ void SAXWriter::comment(const OUString& sComment)
|
||||
|
||||
if (!m_pSaxWriterHelper->comment(sComment))
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "Invalid character during XML-Export";
|
||||
throw except;
|
||||
throw SAXException("Invalid character during XML-Export", {}, {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1467,9 +1448,7 @@ void SAXWriter::unknown(const OUString& sString)
|
||||
|
||||
if (!m_pSaxWriterHelper->writeString(sString, false, false))
|
||||
{
|
||||
SAXException except;
|
||||
except.Message = "Invalid character during XML-Export";
|
||||
throw except;
|
||||
throw SAXException("Invalid character during XML-Export", {}, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -488,18 +488,14 @@ mkException( OUString const & i_rMessage,
|
||||
ucb::IOErrorCode const i_ErrorCode,
|
||||
OUString const & i_rUri, OUString const & i_rResource)
|
||||
{
|
||||
ucb::InteractiveAugmentedIOException iaioe;
|
||||
iaioe.Message = i_rMessage;
|
||||
iaioe.Classification = task::InteractionClassification_ERROR;
|
||||
iaioe.Code = i_ErrorCode;
|
||||
|
||||
const beans::PropertyValue uriProp("Uri",
|
||||
-1, uno::Any(i_rUri), static_cast<beans::PropertyState>(0));
|
||||
const beans::PropertyValue rnProp(
|
||||
"ResourceName",
|
||||
-1, uno::Any(i_rResource), static_cast<beans::PropertyState>(0));
|
||||
iaioe.Arguments = { uno::Any(uriProp), uno::Any(rnProp) };
|
||||
return iaioe;
|
||||
return ucb::InteractiveAugmentedIOException(i_rMessage, {},
|
||||
task::InteractionClassification_ERROR, i_ErrorCode,
|
||||
{ uno::Any(uriProp), uno::Any(rnProp) });
|
||||
}
|
||||
|
||||
/** error handling policy.
|
||||
|
||||
@@ -603,17 +603,13 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
|
||||
}
|
||||
TYPELIB_DANGER_RELEASE( pReturnType );
|
||||
|
||||
InvocationTargetException aExc;
|
||||
aExc.Context = *o3tl::doAccess<Reference<XInterface>>(rObj);
|
||||
aExc.Message = "exception occurred during invocation!";
|
||||
uno_any_destruct(
|
||||
&aExc.TargetException,
|
||||
uno_any_destruct(&aRet,
|
||||
reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
|
||||
uno_type_copyAndConvertData(
|
||||
&aExc.TargetException, pUnoExc, cppu::UnoType<Any>::get().getTypeLibType(),
|
||||
uno_type_copyAndConvertData(&aRet, pUnoExc, cppu::UnoType<Any>::get().getTypeLibType(),
|
||||
getReflection()->getUno2Cpp().get() );
|
||||
uno_any_destruct( pUnoExc, nullptr );
|
||||
throw aExc;
|
||||
throw InvocationTargetException("exception occurred during invocation!",
|
||||
*o3tl::doAccess<Reference<XInterface>>(rObj), aRet);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -639,10 +639,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
|
||||
}
|
||||
else
|
||||
{
|
||||
CannotConvertException aExc;
|
||||
aExc.Context = *this;
|
||||
aExc.Message = "invocation type mismatch!";
|
||||
throw aExc;
|
||||
throw CannotConvertException("invocation type mismatch!", *this, {}, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,10 +672,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
|
||||
return aRet;
|
||||
}
|
||||
|
||||
RuntimeException aExc;
|
||||
aExc.Context = *this;
|
||||
aExc.Message = "invocation lacking of introspection access!";
|
||||
throw aExc;
|
||||
throw RuntimeException("invocation lacking of introspection access!", *this);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -687,8 +687,7 @@ Any OServiceManager::getPropertyValue(const OUString& PropertyName)
|
||||
}
|
||||
else
|
||||
{
|
||||
UnknownPropertyException except;
|
||||
except.Message = "ServiceManager : unknown property " + PropertyName;
|
||||
UnknownPropertyException except("ServiceManager : unknown property " + PropertyName, {});
|
||||
throw except;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2971,8 +2971,7 @@ bool DbFilterField::commitControl()
|
||||
else
|
||||
{
|
||||
|
||||
SQLException aError;
|
||||
aError.Message = aErrorMsg;
|
||||
SQLException aError(aErrorMsg, {}, {}, 0, {});
|
||||
displayException(aError, VCLUnoHelper::GetInterface(m_pWindow->GetParent()));
|
||||
// TODO: transport the title
|
||||
|
||||
|
||||
@@ -1151,9 +1151,7 @@ IMPL_LINK(FmFilterNavigator, EditedEntryHdl, const IterString&, rIterString, boo
|
||||
else
|
||||
{
|
||||
// display the error and return sal_False
|
||||
SQLContext aError;
|
||||
aError.Message = SvxResId(RID_STR_SYNTAXERROR);
|
||||
aError.Details = aErrorMsg;
|
||||
SQLContext aError(SvxResId(RID_STR_SYNTAXERROR), {}, {}, 0, {}, aErrorMsg);
|
||||
displayException(aError, VCLUnoHelper::GetInterface(m_xTopLevel));
|
||||
|
||||
return false;
|
||||
|
||||
@@ -3524,9 +3524,7 @@ namespace
|
||||
void displayErrorSetFocus(const OUString& _rMessage, const Reference<XControl>& _rxFocusControl,
|
||||
const css::uno::Reference<css::awt::XWindow>& rDialogParent)
|
||||
{
|
||||
SQLContext aError;
|
||||
aError.Message = SvxResId(RID_STR_WRITEERROR);
|
||||
aError.Details = _rMessage;
|
||||
SQLContext aError(SvxResId(RID_STR_WRITEERROR), {}, {}, 0, {}, _rMessage);
|
||||
displayException(aError, rDialogParent);
|
||||
|
||||
if ( _rxFocusControl.is() )
|
||||
@@ -3926,11 +3924,8 @@ sal_Bool SAL_CALL FormController::confirmDelete(const RowChangeEvent& aEvent)
|
||||
rtl::Reference<OInteractionDisapprove> pDisapprove = new OInteractionDisapprove;
|
||||
|
||||
// the request
|
||||
SQLWarning aWarning;
|
||||
aWarning.Message = sTitle;
|
||||
SQLWarning aDetails;
|
||||
aDetails.Message = SvxResId(RID_STR_DELETECONFIRM);
|
||||
aWarning.NextException <<= aDetails;
|
||||
SQLWarning aDetails(SvxResId(RID_STR_DELETECONFIRM), {}, {}, 0, {});
|
||||
SQLWarning aWarning(sTitle, {}, {}, 0, css::uno::Any(aDetails));
|
||||
|
||||
rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest( Any( aWarning ) );
|
||||
|
||||
|
||||
@@ -338,14 +338,14 @@ namespace svx
|
||||
}
|
||||
catch ( const SQLException& )
|
||||
{
|
||||
m_xFormOperations->getController()->removeSQLErrorListener( const_cast< FormControllerHelper* >(this) );
|
||||
aError = ::cppu::getCaughtException();
|
||||
m_xFormOperations->getController()->removeSQLErrorListener( const_cast< FormControllerHelper* >(this) );
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
aError = ::cppu::getCaughtException();
|
||||
m_xFormOperations->getController()->removeSQLErrorListener( const_cast< FormControllerHelper* >(this) );
|
||||
SQLException aFallbackError;
|
||||
aFallbackError.Message = ::comphelper::anyToString( ::cppu::getCaughtException() );
|
||||
SQLException aFallbackError(::comphelper::anyToString(aError), {}, {}, 0, {});
|
||||
aError <<= aFallbackError;
|
||||
}
|
||||
|
||||
|
||||
@@ -1005,7 +1005,8 @@ static bool raiseOnewayException( const Reference < XBridgeTest > & xLBT )
|
||||
bReturn = (
|
||||
#if OSL_DEBUG_LEVEL == 0
|
||||
// java stack traces trash Message
|
||||
e.Message == STRING_TEST_CONSTANT &&
|
||||
// The message might also contain source location
|
||||
e.Message.indexOf(STRING_TEST_CONSTANT) >= 0 &&
|
||||
#endif
|
||||
xLBT->getInterface() == e.Context &&
|
||||
x == e.Context );
|
||||
|
||||
@@ -682,19 +682,16 @@ void Test_Impl::setValues( sal_Bool bBool,
|
||||
|
||||
::test::testtools::bridgetest::TestDataElements Test_Impl::raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xContext )
|
||||
{
|
||||
IllegalArgumentException aExc;
|
||||
aExc.ArgumentPosition = nArgumentPos;
|
||||
aExc.Message = _aData.String = rMsg;
|
||||
aExc.Context = _aData.Interface = xContext;
|
||||
throw aExc;
|
||||
_aData.String = rMsg;
|
||||
_aData.Interface = xContext;
|
||||
throw IllegalArgumentException(rMsg, xContext, nArgumentPos);
|
||||
}
|
||||
|
||||
void Test_Impl::raiseRuntimeExceptionOneway( const OUString & rMsg, const Reference< XInterface > & xContext )
|
||||
{
|
||||
RuntimeException aExc;
|
||||
aExc.Message = _aData.String = rMsg;
|
||||
aExc.Context = _aData.Interface = xContext;
|
||||
throw aExc;
|
||||
_aData.String = rMsg;
|
||||
_aData.Interface = xContext;
|
||||
throw RuntimeException(rMsg, xContext);
|
||||
}
|
||||
|
||||
static void dothrow2(const RuntimeException& e)
|
||||
@@ -745,9 +742,7 @@ sal_Int32 Test_Impl::getRuntimeException()
|
||||
|
||||
void Test_Impl::setRuntimeException( sal_Int32 )
|
||||
{
|
||||
RuntimeException aExc;
|
||||
aExc.Message = _aData.String;
|
||||
aExc.Context = _aData.Interface;
|
||||
RuntimeException aExc(_aData.String, _aData.Interface);
|
||||
throwException( Any( aExc ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -39,9 +39,7 @@ void VCLXWindow::SetSystemParent_Impl(const css::uno::Any& rHandle)
|
||||
VclPtr<vcl::Window> pWindow = GetWindow();
|
||||
if (pWindow->GetType() != WindowType::WORKWINDOW)
|
||||
{
|
||||
css::uno::RuntimeException aException;
|
||||
aException.Message = "not a work window";
|
||||
throw aException;
|
||||
throw css::uno::RuntimeException("not a work window");
|
||||
}
|
||||
|
||||
// use sal_Int64 here to accommodate all int types
|
||||
@@ -67,9 +65,7 @@ void VCLXWindow::SetSystemParent_Impl(const css::uno::Any& rHandle)
|
||||
}
|
||||
if (bThrow)
|
||||
{
|
||||
css::uno::RuntimeException aException;
|
||||
aException.Message = "incorrect window handle type";
|
||||
throw aException;
|
||||
throw css::uno::RuntimeException("incorrect window handle type");
|
||||
}
|
||||
// create system parent data
|
||||
SystemParentData aSysParentData;
|
||||
|
||||
@@ -1074,10 +1074,7 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer
|
||||
::osl::ClearableMutexGuard aGuard( GetMutex() );
|
||||
if ( !mxModel.is() )
|
||||
{
|
||||
RuntimeException aException;
|
||||
aException.Message = "createPeer: no model!";
|
||||
aException.Context = static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this));
|
||||
throw aException;
|
||||
throw RuntimeException("createPeer: no model!", getXWeak());
|
||||
}
|
||||
|
||||
if( getPeer().is() )
|
||||
|
||||
@@ -546,17 +546,13 @@ namespace fileaccess {
|
||||
else if( errorCode == TASKHANDLING_NOREPLACE_FOR_WRITE )
|
||||
// Overwrite = false and file exists
|
||||
{
|
||||
NameClashException excep;
|
||||
excep.Name = getTitle(aUncPath);
|
||||
excep.Classification = InteractionClassification_ERROR;
|
||||
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
|
||||
excep.Message = "file exists and overwrite forbidden";
|
||||
NameClashException excep("file exists and overwrite forbidden",
|
||||
Reference<XInterface>(xComProc, UNO_QUERY),
|
||||
InteractionClassification_ERROR, OUString(getTitle(aUncPath)));
|
||||
cancelCommandExecution( Any(excep), xEnv );
|
||||
}
|
||||
else if( errorCode == TASKHANDLING_INVALID_NAME_MKDIR )
|
||||
{
|
||||
InteractiveAugmentedIOException excep;
|
||||
excep.Code = IOErrorCode_INVALID_CHARACTER;
|
||||
PropertyValue prop;
|
||||
prop.Name = "ResourceName";
|
||||
prop.Handle = -1;
|
||||
@@ -566,10 +562,9 @@ namespace fileaccess {
|
||||
rtl_UriDecodeWithCharset,
|
||||
RTL_TEXTENCODING_UTF8));
|
||||
prop.Value <<= aClashingName;
|
||||
excep.Arguments = { Any(prop) };
|
||||
excep.Classification = InteractionClassification_ERROR;
|
||||
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
|
||||
excep.Message = "the name contained invalid characters";
|
||||
InteractiveAugmentedIOException excep(
|
||||
"the name contained invalid characters", Reference<XInterface>(xComProc, UNO_QUERY),
|
||||
InteractionClassification_ERROR, IOErrorCode_INVALID_CHARACTER, { Any(prop) });
|
||||
if(isHandled)
|
||||
throw excep;
|
||||
cancelCommandExecution( Any(excep), xEnv );
|
||||
@@ -583,11 +578,8 @@ namespace fileaccess {
|
||||
}
|
||||
else if( errorCode == TASKHANDLING_FOLDER_EXISTS_MKDIR )
|
||||
{
|
||||
NameClashException excep;
|
||||
excep.Name = getTitle(aUncPath);
|
||||
excep.Classification = InteractionClassification_ERROR;
|
||||
excep.Context = xComProc;
|
||||
excep.Message = "folder exists and overwrite forbidden";
|
||||
NameClashException excep("folder exists and overwrite forbidden", xComProc,
|
||||
InteractionClassification_ERROR, OUString(getTitle(aUncPath)));
|
||||
if(isHandled)
|
||||
throw excep;
|
||||
cancelCommandExecution( Any(excep), xEnv );
|
||||
@@ -835,21 +827,18 @@ namespace fileaccess {
|
||||
else if( errorCode == TASKHANDLING_NAMECLASH_FOR_COPY ||
|
||||
errorCode == TASKHANDLING_NAMECLASH_FOR_MOVE )
|
||||
{
|
||||
NameClashException excep;
|
||||
excep.Name = getTitle(aUncPath);
|
||||
excep.Classification = InteractionClassification_ERROR;
|
||||
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
|
||||
excep.Message = "name clash during copy or move";
|
||||
NameClashException excep("name clash during copy or move",
|
||||
Reference<XInterface>(xComProc, UNO_QUERY),
|
||||
InteractionClassification_ERROR, OUString(getTitle(aUncPath)));
|
||||
|
||||
cancelCommandExecution(Any(excep), xEnv);
|
||||
}
|
||||
else if( errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_MOVE ||
|
||||
errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_COPY )
|
||||
{
|
||||
UnsupportedNameClashException excep;
|
||||
excep.NameClash = minorCode;
|
||||
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
|
||||
excep.Message = "name clash value not supported during copy or move";
|
||||
UnsupportedNameClashException excep(
|
||||
"name clash value not supported during copy or move",
|
||||
Reference<XInterface>(xComProc, UNO_QUERY), minorCode);
|
||||
|
||||
cancelCommandExecution(Any(excep), xEnv);
|
||||
}
|
||||
|
||||
@@ -55,25 +55,19 @@ XInteractionRequestImpl::XInteractionRequestImpl(
|
||||
Any aAny;
|
||||
if(nErrorCode == TASKHANDLING_FOLDER_EXISTS_MKDIR)
|
||||
{
|
||||
NameClashException excep;
|
||||
excep.Name = aClashingName;
|
||||
excep.Classification = InteractionClassification_ERROR;
|
||||
excep.Context = m_xOrigin;
|
||||
excep.Message = "folder exists and overwrite forbidden";
|
||||
NameClashException excep("folder exists and overwrite forbidden", m_xOrigin,
|
||||
InteractionClassification_ERROR, aClashingName);
|
||||
aAny <<= excep;
|
||||
}
|
||||
else if(nErrorCode == TASKHANDLING_INVALID_NAME_MKDIR)
|
||||
{
|
||||
InteractiveAugmentedIOException excep;
|
||||
excep.Code = IOErrorCode_INVALID_CHARACTER;
|
||||
PropertyValue prop;
|
||||
prop.Name = "ResourceName";
|
||||
prop.Handle = -1;
|
||||
prop.Value <<= aClashingName;
|
||||
excep.Arguments = { Any(prop) };
|
||||
excep.Classification = InteractionClassification_ERROR;
|
||||
excep.Context = m_xOrigin;
|
||||
excep.Message = "the name contained invalid characters";
|
||||
InteractiveAugmentedIOException excep("the name contained invalid characters", m_xOrigin,
|
||||
InteractionClassification_ERROR,
|
||||
IOErrorCode_INVALID_CHARACTER, { Any(prop) });
|
||||
aAny <<= excep;
|
||||
|
||||
}
|
||||
|
||||
@@ -212,9 +212,7 @@ XStream_impl::closeStream()
|
||||
osl::FileBase::RC err = m_aFile.close();
|
||||
|
||||
if( err != osl::FileBase::E_None ) {
|
||||
io::IOException ex;
|
||||
ex.Message = "could not close file";
|
||||
throw ex;
|
||||
throw io::IOException("could not close file");
|
||||
}
|
||||
|
||||
m_nIsOpen = false;
|
||||
|
||||
@@ -80,12 +80,8 @@ void cancelCommandExecution( const ucb::IOErrorCode eError,
|
||||
{
|
||||
// Fast path
|
||||
|
||||
ucb::InteractiveAugmentedIOException aRequest;
|
||||
aRequest.Message = rMessage;
|
||||
aRequest.Context = xContext;
|
||||
aRequest.Classification = task::InteractionClassification_ERROR;
|
||||
aRequest.Code = eError;
|
||||
aRequest.Arguments = rArgs;
|
||||
ucb::InteractiveAugmentedIOException aRequest(
|
||||
rMessage, xContext, task::InteractionClassification_ERROR, eError, rArgs);
|
||||
cppu::throwException( uno::Any( aRequest ) );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,12 +32,8 @@ SimpleIOErrorRequest::SimpleIOErrorRequest(
|
||||
const uno::Reference< ucb::XCommandProcessor > & xContext )
|
||||
{
|
||||
// Fill request...
|
||||
ucb::InteractiveAugmentedIOException aRequest;
|
||||
aRequest.Message = rMessage;
|
||||
aRequest.Context = xContext;
|
||||
aRequest.Classification = task::InteractionClassification_ERROR;
|
||||
aRequest.Code = eError;
|
||||
aRequest.Arguments = rArgs;
|
||||
ucb::InteractiveAugmentedIOException aRequest(
|
||||
rMessage, xContext, task::InteractionClassification_ERROR, eError, rArgs);
|
||||
|
||||
setRequest( uno::Any( aRequest ) );
|
||||
|
||||
|
||||
@@ -728,14 +728,13 @@ static bool UCBOpenContentSync(
|
||||
{
|
||||
Reference<XInteractionRetry> xRet;
|
||||
if(xInteract.is()) {
|
||||
InteractiveNetworkConnectException aExcep;
|
||||
INetURLObject aURL(
|
||||
xContId.is() ?
|
||||
xContId->getContentIdentifier() :
|
||||
OUString() );
|
||||
aExcep.Server = aURL.GetHost();
|
||||
aExcep.Classification = InteractionClassification_ERROR;
|
||||
aExcep.Message = "server not responding after five seconds";
|
||||
InteractiveNetworkConnectException aExcep(
|
||||
"server not responding after five seconds", {},
|
||||
InteractionClassification_ERROR, aURL.GetHost());
|
||||
Any request;
|
||||
request <<= aExcep;
|
||||
rtl::Reference<ucbhelper::InteractionRequest> xIR =
|
||||
|
||||
@@ -256,10 +256,8 @@ namespace DOM
|
||||
if (pDocBuilder->getErrorHandler().is()) // if custom error handler is set (using setErrorHandler ())
|
||||
{
|
||||
// Prepare SAXParseException to be passed to custom XErrorHandler::warning function
|
||||
css::xml::sax::SAXParseException saxex;
|
||||
saxex.Message = make_error_message(pctx);
|
||||
saxex.LineNumber = static_cast<sal_Int32>(pctx->lastError.line);
|
||||
saxex.ColumnNumber = static_cast<sal_Int32>(pctx->lastError.int2);
|
||||
css::xml::sax::SAXParseException saxex(make_error_message(pctx), {}, {}, {}, {},
|
||||
pctx->lastError.line, pctx->lastError.int2);
|
||||
|
||||
// Call custom warning function
|
||||
pDocBuilder->getErrorHandler()->warning(::css::uno::Any(saxex));
|
||||
@@ -288,10 +286,8 @@ namespace DOM
|
||||
if (pDocBuilder->getErrorHandler().is()) // if custom error handler is set (using setErrorHandler ())
|
||||
{
|
||||
// Prepare SAXParseException to be passed to custom XErrorHandler::error function
|
||||
css::xml::sax::SAXParseException saxex;
|
||||
saxex.Message = make_error_message(pctx);
|
||||
saxex.LineNumber = static_cast<sal_Int32>(pctx->lastError.line);
|
||||
saxex.ColumnNumber = static_cast<sal_Int32>(pctx->lastError.int2);
|
||||
css::xml::sax::SAXParseException saxex(make_error_message(pctx), {}, {}, {}, {},
|
||||
pctx->lastError.line, pctx->lastError.int2);
|
||||
|
||||
// Call custom warning function
|
||||
pDocBuilder->getErrorHandler()->error(::css::uno::Any(saxex));
|
||||
@@ -307,10 +303,8 @@ namespace DOM
|
||||
|
||||
static void throwEx(xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
css::xml::sax::SAXParseException saxex;
|
||||
saxex.Message = make_error_message(ctxt);
|
||||
saxex.LineNumber = static_cast<sal_Int32>(ctxt->lastError.line);
|
||||
saxex.ColumnNumber = static_cast<sal_Int32>(ctxt->lastError.int2);
|
||||
css::xml::sax::SAXParseException saxex(make_error_message(ctxt), {}, {}, {}, {},
|
||||
ctxt->lastError.line, ctxt->lastError.int2);
|
||||
throw saxex;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user