Improve ErrorCodeIOException messages

...and clean up some includes.

Change-Id: Ia5843cd38f967722d7173a6c87fba26064e3ffd6
This commit is contained in:
Stephan Bergmann
2013-10-09 19:23:35 +02:00
parent 669655d146
commit f58ee783ee
13 changed files with 94 additions and 56 deletions

View File

@@ -980,7 +980,11 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
{
sal_Int32 nError = pStream ? pStream->GetError() : ERRCODE_IO_GENERAL;
delete pStream;
throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), nError );
throw task::ErrorCodeIOException(
("utl::UcbStreamHelper::CreateStream failed for \""
+ aCodeStreamName + "\": 0x"
+ OUString::number(nError, 16)),
uno::Reference< uno::XInterface >(), nError);
}
/*sal_Bool bRet = */pMod->LoadBinaryData( *pStream );
@@ -1094,9 +1098,12 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
{
sal_Int32 nError = pStream ? pStream->GetError() : ERRCODE_IO_GENERAL;
delete pStream;
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
nError );
throw task::ErrorCodeIOException(
("utl::UcbStreamHelper::CreateStream failed"
" for code.bin: 0x"
+ OUString::number(nError, 16)),
uno::Reference< uno::XInterface >(),
nError);
}
/*sal_Bool bRet = */pMod->LoadBinaryData( *pStream );

View File

@@ -47,7 +47,6 @@
#include <com/sun/star/script/provider/theMasterScriptProviderFactory.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>

View File

@@ -28,7 +28,6 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/uno/Type.h>

View File

@@ -34,7 +34,6 @@
#if OSL_DEBUG_LEVEL > 0
#include <com/sun/star/configuration/CorruptedConfigurationException.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <cppuhelper/exc_hlp.hxx>
#include <osl/diagnose.h>
#include <osl/thread.h>

View File

@@ -71,7 +71,6 @@
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/ui/UIConfigurationManager.hpp>

View File

@@ -1382,8 +1382,10 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
if ( nError == ERRCODE_NONE ) {
nError = ERRCODE_IO_GENERAL;
}
task::ErrorCodeIOException ex( OUString(),
uno::Reference< uno::XInterface >(), nError);
task::ErrorCodeIOException ex(
("DocumentMetadataAccess::storeMetadataToMedium Commit failed: "
"0x" + OUString::number(nError, 16)),
uno::Reference< uno::XInterface >(), nError);
throw lang::WrappedTargetException(OUString(), *this,
uno::makeAny(ex));
}

View File

@@ -2118,8 +2118,10 @@ SfxDocumentMetaData::storeToMedium(const OUString & URL,
nError = ERRCODE_IO_GENERAL;
}
throw css::task::ErrorCodeIOException( OUString(),
css::uno::Reference< css::uno::XInterface >(), nError);
throw css::task::ErrorCodeIOException(
("SfxDocumentMetaData::storeToMedium <" + URL + "> Commit failed: "
"0x" + OUString::number(nError, 16)),
css::uno::Reference< css::uno::XInterface >(), nError);
}
}

View File

@@ -31,6 +31,7 @@
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -152,9 +153,10 @@ static sal_uInt8 getStoreModeFromSlotName( const OUString& aSlotName )
else if ( aSlotName == "SaveAs" )
nResult = SAVEAS_REQUESTED;
else
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_INVALIDPARAMETER );
throw task::ErrorCodeIOException(
("getStoreModeFromSlotName(\"" + aSlotName
+ "): ERRCODE_IO_INVALIDPARAMETER"),
uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER );
return nResult;
}
@@ -609,9 +611,11 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
}
else
{
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
("ModelData_Impl::ExecuteFilterDialog_Impl:"
" ERRCODE_IO_ABORT"),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_ABORT);
}
}
}
@@ -621,12 +625,13 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
}
}
}
catch( const container::NoSuchElementException& )
catch( const container::NoSuchElementException& e )
{
// the filter name is unknown
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_INVALIDPARAMETER );
throw task::ErrorCodeIOException(
("ModelData_Impl::ExecuteFilterDialog_Impl: NoSuchElementException"
" \"" + e.Message + "\": ERRCODE_IO_ABORT"),
uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER);
}
catch( const task::ErrorCodeIOException& )
{
@@ -870,9 +875,10 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
// the file name must be specified if overwrite option is set
if ( aOverwriteIter != GetMediaDescr().end() )
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_INVALIDPARAMETER );
throw task::ErrorCodeIOException(
"ModelData_Impl::OutputFileDialog: ERRCODE_IO_INVALIDPARAMETER",
uno::Reference< uno::XInterface >(),
ERRCODE_IO_INVALIDPARAMETER);
// no target file name is specified
// we need to show the file dialog
@@ -1053,7 +1059,9 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
OUString aStringTypeFN;
if ( pFileDlg->Execute( pDialogParams, aStringTypeFN ) != ERRCODE_NONE )
{
throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
"ModelData_Impl::OutputFileDialog: ERRCODE_IO_ABORT",
uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
OUString aFilterName = aStringTypeFN;
@@ -1378,7 +1386,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
// if saving is not acceptable the warning must be shown even in case of SaveAs operation
if ( ( nStoreMode & SAVEAS_REQUESTED ) && aModelData.CheckSaveAcceptable( STATUS_SAVEAS ) == STATUS_NO_ACTION )
throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
"SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
else if ( nStoreMode & SAVE_REQUESTED )
{
@@ -1386,7 +1396,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE );
if ( nStatusSave == STATUS_NO_ACTION )
throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
"SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
else if ( nStatusSave == STATUS_SAVE )
{
// check whether it is possible to use save operation
@@ -1395,7 +1407,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
if ( nStatusSave == STATUS_NO_ACTION )
{
throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
"SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
else if ( nStatusSave != STATUS_SAVE )
{
@@ -1417,9 +1431,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
if ( QueryBox( NULL, SfxResId( RID_XMLSEC_QUERY_LOSINGSIGNATURE ) ).Execute() != RET_YES )
{
// the user has decided not to store the document
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
"SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
}
}
@@ -1456,9 +1470,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
DBG_ASSERT( aFilterProps.getLength(), "No filter for storing!\n" );
if ( !aFilterProps.getLength() )
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_INVALIDPARAMETER );
throw task::ErrorCodeIOException(
"SfxStoringHelper::GUIStoreModel: ERRCODE_IO_INVALIDPARAMETER",
uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER);
::comphelper::SequenceAsHashMap aFilterPropsHM( aFilterProps );
OUString aFilterName = aFilterPropsHM.getUnpackedValueOrDefault(
@@ -1607,9 +1621,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
else
{
DBG_ASSERT( sal_False, "This code must be unreachable!\n" );
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_INVALIDPARAMETER );
throw task::ErrorCodeIOException(
"SfxStoringHelper::GUIStoreModel: ERRCODE_IO_INVALIDPARAMETER",
uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER);
}
::comphelper::SequenceAsHashMap::const_iterator aIter =

View File

@@ -30,6 +30,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/document/XCmisDocument.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
@@ -692,9 +693,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
else
{
// the user has decided not to store the document
throw task::ErrorCodeIOException( OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_ABORT );
throw task::ErrorCodeIOException(
"SfxObjectShell::ExecFile_Impl: ERRCODE_IO_ABORT",
uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
// merge aDispatchArgs to the request

View File

@@ -22,6 +22,7 @@
#include <sfx2/sfxbasemodel.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/view/XPrintJobListener.hpp>
@@ -1660,7 +1661,9 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue >
// write the contents of the logger to the file
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCFAILED), m_pData->m_pObjectShell ) );
throw task::ErrorCodeIOException( OUString(), Reference< XInterface >(), nErrCode );
throw task::ErrorCodeIOException(
"SfxBaseModel::storeSelf: 0x" + OUString::number(nErrCode, 16),
Reference< XInterface >(), nErrCode);
}
}
@@ -1807,7 +1810,9 @@ void SAL_CALL SfxBaseModel::initNew()
m_pData->m_pObjectShell->ResetError();
if ( !bRes )
throw task::ErrorCodeIOException( OUString(), Reference< XInterface >(), nErrCode );
throw task::ErrorCodeIOException(
"SfxBaseModel::initNew: 0x" + OUString::number(nErrCode, 16),
Reference< XInterface >(), nErrCode);
}
}
@@ -2733,9 +2738,10 @@ void SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium )
if ( !bWarning ) // #i30711# don't abort loading if it's only a warning
{
throw task::ErrorCodeIOException( OUString(),
Reference< XInterface >(),
nError ? nError : ERRCODE_IO_CANTREAD );
nError = nError ? nError : ERRCODE_IO_CANTREAD;
throw task::ErrorCodeIOException(
"SfxBaseModel::handleLoadError: 0x" + OUString::number(nError, 16),
Reference< XInterface >(), nError);
}
}
@@ -3158,7 +3164,10 @@ void SfxBaseModel::impl_store( const OUString& sURL
SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED),
m_pData->m_pObjectShell ) );
throw task::ErrorCodeIOException( OUString(), Reference< XInterface >(), nErrCode );
throw task::ErrorCodeIOException(
("SfxBaseModel::impl_store <" + sURL + "> failed: 0x"
+ OUString::number(nErrCode, 16)),
Reference< XInterface >(), nErrCode);
}
}
}
@@ -3781,9 +3790,10 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const Reference< embed::XStorage >&
if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
{
sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
throw task::ErrorCodeIOException( OUString(),
Reference< XInterface >(),
nError ? nError : ERRCODE_IO_CANTREAD );
nError = nError ? nError : ERRCODE_IO_CANTREAD;
throw task::ErrorCodeIOException(
"SfxBaseModel::loadFromStorage: 0x" + OUString::number(nError, 16),
Reference< XInterface >(), nError);
}
loadCmisProperties( );
}
@@ -3844,9 +3854,10 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >&
// the warnings are currently not transported
if ( !bSuccess )
{
throw task::ErrorCodeIOException( OUString(),
Reference< XInterface >(),
nError ? nError : ERRCODE_IO_GENERAL );
nError = nError ? nError : ERRCODE_IO_GENERAL;
throw task::ErrorCodeIOException(
"SfxBaseModel::storeToStorage: 0x" + OUString::number(nError, 16),
Reference< XInterface >(), nError);
}
}
@@ -3868,9 +3879,11 @@ void SAL_CALL SfxBaseModel::switchToStorage( const Reference< embed::XStorage >&
if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
{
sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
throw task::ErrorCodeIOException( OUString(),
Reference< XInterface >(),
nError ? nError : ERRCODE_IO_GENERAL );
nError = nError ? nError : ERRCODE_IO_GENERAL;
throw task::ErrorCodeIOException(
("SfxBaseModel::switchToStorage: 0x"
+ OUString::number(nError, 16)),
Reference< XInterface >(), nError);
}
else
{

View File

@@ -33,6 +33,7 @@
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/StatusIndicatorFactory.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>

View File

@@ -53,6 +53,7 @@
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdb/XColumn.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <dbmgr.hxx>
#include <swunohelper.hxx>
#include <osl/mutex.hxx>

View File

@@ -34,6 +34,7 @@
#include <windows.h>
#endif
#include "com/sun/star/task/ErrorCodeIOException.hpp"
#include <tools/debug.hxx>
#include <rtl/string.h>
#include <sal/log.hxx>