summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-08-20 17:58:20 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-08-20 17:58:44 +0200
commit2d2337eb74161f9aab9bc3cf50fa63975d9c1731 (patch)
tree2321e843c678aa340b7eaf9860e247a6d5d20b38
parent5be1f5234b46a89a7660a9cfe3deaa00e2aa124b (diff)
Improve some debug output
Change-Id: I1008822ba8592ea43f87805bf00adbfdaf4f02fc
-rw-r--r--comphelper/source/misc/mediadescriptor.cxx38
-rw-r--r--filter/source/config/cache/typedetection.cxx14
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/source/dispatch/loaddispatcher.cxx16
-rw-r--r--framework/source/inc/loadenv/loadenvexception.hxx78
-rw-r--r--framework/source/loadenv/loadenv.cxx50
-rw-r--r--framework/source/services/autorecovery.cxx2
-rw-r--r--include/sal/log-areas.dox4
-rw-r--r--ucb/source/ucp/gvfs/gvfs_content.cxx7
9 files changed, 101 insertions, 109 deletions
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 82a1b29de8bb..8fefd7d9e25d 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -574,10 +574,22 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, sal_Bool
}
catch(const css::uno::RuntimeException&)
{ throw; }
- catch(const css::ucb::ContentCreationException&)
- { return sal_False; } // TODO error handling
- catch(const css::uno::Exception&)
- { return sal_False; } // TODO error handling
+ catch(const css::ucb::ContentCreationException& e)
+ {
+ SAL_WARN(
+ "comphelper",
+ "caught ContentCreationException \"" << e.Message
+ << "\" while opening <" << sURL << ">");
+ return sal_False; // TODO error handling
+ }
+ catch(const css::uno::Exception& e)
+ {
+ SAL_WARN(
+ "comphelper",
+ "caught Exception \"" << e.Message << "\" while opening <"
+ << sURL << ">");
+ return sal_False; // TODO error handling
+ }
// try to open the file in read/write mode
// (if its allowed to do so).
@@ -606,7 +618,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, sal_Bool
}
catch(const css::uno::RuntimeException&)
{ throw; }
- catch(const css::uno::Exception&)
+ catch(const css::uno::Exception& e)
{
// ignore exception, if reason was problem reasoned on
// open it in WRITEABLE mode! Then we try it READONLY
@@ -614,7 +626,13 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, sal_Bool
// All other errors must be handled as real error an
// break this method.
if (!pInteraction->wasWriteError() || bModeRequestedExplicitly)
+ {
+ SAL_WARN(
+ "comphelper",
+ "caught Exception \"" << e.Message
+ << "\" while opening <" << sURL << ">");
return sal_False;
+ }
xStream.clear();
xInputStream.clear();
}
@@ -667,8 +685,14 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, sal_Bool
}
catch(const css::uno::RuntimeException&)
{ throw; }
- catch(const css::uno::Exception&)
- { return sal_False; }
+ catch(const css::uno::Exception& e)
+ {
+ SAL_WARN(
+ "comphelper",
+ "caught Exception \"" << e.Message << "\" while opening <"
+ << sURL << ">");
+ return sal_False;
+ }
}
// add streams to the descriptor
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 5e3697c0474f..fd0e64c959ba 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -445,8 +445,14 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::
}
catch(const css::uno::RuntimeException&)
{ throw; }
- catch(const css::uno::Exception&)
- { sType = OUString(); }
+ catch(const css::uno::Exception& e)
+ {
+ SAL_WARN(
+ "filter.config",
+ "caught Exception \"" << e.Message
+ << "\" while querying type of <" << sURL << ">");
+ sType = OUString();
+ }
//*******************************************
// adapt media descriptor, so it contains the right values
@@ -1138,7 +1144,9 @@ void TypeDetection::impl_openStream(::comphelper::MediaDescriptor& rDescriptor)
bSuccess = rDescriptor.addInputStream();
if ( !bSuccess )
- throw css::uno::Exception(_FILTER_CONFIG_FROM_ASCII_("Could not open stream."), static_cast< css::document::XTypeDetection* >(this));
+ throw css::uno::Exception(
+ "Could not open stream for <" + sURL + ">",
+ static_cast<OWeakObject *>(this));
if ( !bRequestedReadOnly )
{
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 2f759c5b8095..b10888984c08 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -29,7 +29,6 @@ namespace framework{
//_________________________________________________________________________________________________________________
#define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" )
-#define SERVICENAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.document.TypeDetection" )
#define SERVICENAME_CFGUPDATEACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationUpdateAccess") // provides read/write access to the configuration
#define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration
#define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" )
diff --git a/framework/source/dispatch/loaddispatcher.cxx b/framework/source/dispatch/loaddispatcher.cxx
index 6c5230160d63..6eb2284a0878 100644
--- a/framework/source/dispatch/loaddispatcher.cxx
+++ b/framework/source/dispatch/loaddispatcher.cxx
@@ -122,8 +122,20 @@ css::uno::Any LoadDispatcher::impl_dispatch( const css::util::URL& rURL,
// TODO thinking about asynchronous operations and listener support
}
- catch(const LoadEnvException&)
- { xComponent.clear(); }
+ catch(const LoadEnvException& e)
+ {
+ SAL_WARN(
+ "fwk.dispatch",
+ "caught LoadEnvException " << +e.m_nID << " \"" << e.m_sMessage
+ << "\""
+ << (e.m_exOriginal.has<css::uno::Exception>()
+ ? (", " + e.m_exOriginal.getValueTypeName() + " \""
+ + e.m_exOriginal.get<css::uno::Exception>().Message
+ + "\"")
+ : OUString())
+ << " while dispatching <" << rURL.Complete << ">");
+ xComponent.clear();
+ }
if (xListener.is())
{
diff --git a/framework/source/inc/loadenv/loadenvexception.hxx b/framework/source/inc/loadenv/loadenvexception.hxx
index 868944587147..aedb6b3beae3 100644
--- a/framework/source/inc/loadenv/loadenvexception.hxx
+++ b/framework/source/inc/loadenv/loadenvexception.hxx
@@ -32,15 +32,10 @@ namespace framework{
@descr Of course outside code must wrapp it, to transport
the occurred information to its caller.
-
- @author as96863
*/
class LoadEnvException
{
-
-
public:
-
/** @short Can be used as an ID for an instance of a LoadEnvException.
@descr To prevent errors on adding/removing/changing such IDs here,
an enum field is used. Its int values are self organized ...
@@ -93,76 +88,17 @@ class LoadEnvException
ID_GENERAL_ERROR
};
- //___________________________________________
- // member
-
- public:
-
- /** @short contains a suitable message, which describes the reason for this
- exception. */
- OString m_sMessage;
-
- /** @short An ID, which make this exception unique among others. */
sal_Int32 m_nID;
-
- /** @short Contains the original exception, if any occurred. */
+ OUString m_sMessage;
css::uno::Any m_exOriginal;
- /** TODO
- Experimental use! Maybe it can be useful to know if an exception was already
- catched and handled by an interaction and might be rethrown! */
- sal_Bool m_bHandled;
-
- //___________________________________________
- // interface
-
- public:
-
- /** @short initialize a new instance with an ID.
- @descr Some other items of this exception
- (e.g. a suitable message) will be generated
- automaticly.
+ LoadEnvException(
+ sal_Int32 id, OUString const & message = OUString(),
+ css::uno::Any const & original = css::uno::Any()):
+ m_nID(id), m_sMessage(message), m_exOriginal(original)
+ {}
- @param nID
- One of the defined const IDs of this class.
- */
- LoadEnvException(sal_Int32 nID)
- {
- m_nID = nID;
- }
-
- //_______________________________________
-
- /** @short initialize a new instance with an ID
- an wrap a detected exception into this one.
- @descr Some other items of this exception
- (e.g. a suitable message) will be generated
- automaticly.
-
- @param nID
- One of the defined const IDs of this class.
-
- @param exUno
- the original catched uno exception.
- */
- LoadEnvException( sal_Int32 nID ,
- const css::uno::Any& exUno)
- {
- m_nID = nID ;
- m_exOriginal = exUno;
- }
-
- //_______________________________________
-
- /** @short destruct an instance of this exception.
- */
- ~LoadEnvException()
- {
- m_sMessage = OString();
- m_nID = 0;
- m_bHandled = false;
- m_exOriginal.clear();
- }
+ ~LoadEnvException() {}
};
} // namespace framework
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 4320edf29158..fc60f1c04a53 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -182,23 +182,23 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const
"Optional list of arguments seem to be corrupted.", xLoader, 4);
case LoadEnvException::ID_UNSUPPORTED_CONTENT:
- {
- OUStringBuffer aMsg;
- aMsg.appendAscii("Unsupported URL <").append(sURL).append('>');
-
- if (!ex.m_sMessage.isEmpty())
- {
- aMsg.appendAscii(": \"").
- append(OStringToOUString(
- ex.m_sMessage, RTL_TEXTENCODING_UTF8)).
- appendAscii("\"");
- }
-
- throw css::lang::IllegalArgumentException(aMsg.makeStringAndClear(),
+ throw css::lang::IllegalArgumentException(
+ ("Unsupported URL <" + sURL + ">" + ": \"" + ex.m_sMessage
+ + "\""),
xLoader, 1);
- }
default:
+ SAL_WARN(
+ "fwk.loadenv",
+ "caught LoadEnvException " << +ex.m_nID << " \""
+ << ex.m_sMessage << "\""
+ << (ex.m_exOriginal.has<css::uno::Exception>()
+ ? (", " + ex.m_exOriginal.getValueTypeName() + " \""
+ + (ex.m_exOriginal.get<css::uno::Exception>().
+ Message)
+ + "\"")
+ : OUString())
+ << " while loading <" << sURL << ">");
xComponent.clear();
break;
}
@@ -261,7 +261,7 @@ void LoadEnv::initializeLoading(const OUString&
{
m_eContentType = LoadEnv::classifyContent(sURL, lMediaDescriptor);
if (m_eContentType == E_UNSUPPORTED_CONTENT)
- throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT);
+ throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT, "from LoadEnv::initializeLoading");
}
// make URL part of the MediaDescriptor
@@ -369,7 +369,7 @@ void LoadEnv::startLoading()
// content can not be loaded or handled
// check "classifyContent()" failed before ...
if (m_eContentType == E_UNSUPPORTED_CONTENT)
- throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT);
+ throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT, "from LoadEnv::startLoading");
// <- SAFE
aReadLock.unlock();
@@ -640,8 +640,9 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString&
// following operations can work on an internal type name only :-(
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Reference< css::document::XTypeDetection > xDetect(
- xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_TYPEDETECTION, xContext),
- css::uno::UNO_QUERY);
+ xContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.document.TypeDetection", xContext),
+ css::uno::UNO_QUERY_THROW);
OUString sType = xDetect->queryTypeByURL(sURL);
@@ -807,13 +808,16 @@ void LoadEnv::impl_detectTypeAndFilter()
return;
}
- css::uno::Reference< css::document::XTypeDetection > xDetect( xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_TYPEDETECTION, xContext), css::uno::UNO_QUERY);
- if (xDetect.is())
- sType = xDetect->queryTypeByDescriptor(lDescriptor, sal_True); /*TODO should deep detection be able for enable/disable it from outside? */
+ css::uno::Reference< css::document::XTypeDetection > xDetect(
+ xContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.document.TypeDetection", xContext),
+ css::uno::UNO_QUERY_THROW);
+ sType = xDetect->queryTypeByDescriptor(lDescriptor, sal_True); /*TODO should deep detection be able for enable/disable it from outside? */
// no valid content -> loading not possible
if (sType.isEmpty())
- throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT);
+ throw LoadEnvException(
+ LoadEnvException::ID_UNSUPPORTED_CONTENT, "type detection failed");
// SAFE ->
WriteGuard aWriteLock(m_aLock);
@@ -1681,7 +1685,7 @@ void LoadEnv::impl_reactForLoadingState()
if (bThrow)
{
if ( aRequest.isExtractableTo( ::cppu::UnoType< css::uno::Exception >::get() ) )
- throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aRequest );
+ throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, "", aRequest );
}
// <- SAFE ----------------------------------
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index be50d2ba2421..653567dd6d94 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -1151,7 +1151,7 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume
xModuleProps->getByName(OUString(CFG_ENTRY_REALDEFAULTFILTER)) >>= rInfo.DefaultFilter;
css::uno::Reference< css::container::XNameAccess > xFilterCFG(xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_FILTERFACTORY, xContext), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::container::XNameAccess > xTypeCFG (xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_TYPEDETECTION, xContext), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::container::XNameAccess > xTypeCFG (xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", xContext), css::uno::UNO_QUERY_THROW);
::comphelper::SequenceAsHashMap lFilterProps (xFilterCFG->getByName(rInfo.DefaultFilter));
OUString sTypeRegistration = lFilterProps.getUnpackedValueOrDefault(OUString(FILTER_PROP_TYPE), OUString());
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index eea5e8830c32..1642aa34d6ec 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -152,10 +152,11 @@ certain functionality.
@section framework
@li @c fwk - framework (abbreviation)
+@li @c fwk.accelerators
@li @c fwk.desktop
@li @c fwk.dispatch
+@li @c fwk.loadenv
@li @c fwk.session
-@li @c fwk.accelerators
@li @c fwk.uielement
@section i18nlangtag
@@ -277,6 +278,7 @@ certain functionality.
@li @c ucb
@li @c ucb.ucp
@li @c ucb.ucp.gio
+@li @c ucb.ucp.gvfs
@li @c ucb.ucp.webdav
@section unotools
diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index 61443d994e05..66d3db2ffdb5 100644
--- a/ucb/source/ucp/gvfs/gvfs_content.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.cxx
@@ -1122,7 +1122,14 @@ Content::getInfo( const uno::Reference< ucb::XCommandEnvironment >& xEnv )
result = gnome_vfs_get_file_info
( aURI.getStr(), &m_info, GNOME_VFS_FILE_INFO_DEFAULT );
if (result != GNOME_VFS_OK)
+ {
+ SAL_WARN(
+ "ucb.ucp.gvfs",
+ "gnome_vfs_get_file_info for <" << aURI << "> failed with \""
+ << gnome_vfs_result_to_string(result) << "\" (" << +result
+ << ")");
gnome_vfs_file_info_clear( &m_info );
+ }
} else
result = GNOME_VFS_OK;
#if OSL_DEBUG_LEVEL > 1