Tag: cws_src680_odbmacros2 User: fs Date: 2008-01-23 14:21:07+0000 Modified: dba/dbaccess/source/core/dataaccess/documentcontainer.cxx
Log: loadComponentFromURL: better error message for non-existent components File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: documentcontainer.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentcontainer.cxx?r1=1.26.2.1&r2=1.26.2.2 Delta lines: +37 -31 --------------------- --- documentcontainer.cxx 2007-12-12 09:54:56+0000 1.26.2.1 +++ documentcontainer.cxx 2008-01-23 14:21:05+0000 1.26.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: documentcontainer.cxx,v $ * - * $Revision: 1.26.2.1 $ + * $Revision: 1.26.2.2 $ * - * last change: $Author: fs $ $Date: 2007/12/12 09:54:56 $ + * last change: $Author: fs $ $Date: 2008/01/23 14:21:05 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -81,6 +81,9 @@ #ifndef _COMPHELPER_MIMECONFIGHELPER_HXX_ #include <comphelper/mimeconfighelper.hxx> #endif +#ifndef INCLUDED_COMPHELPER_STRING_HXX +#include <comphelper/string.hxx> +#endif #ifndef CONNECTIVITY_SQLERROR_HXX #include <connectivity/sqlerror.hxx> #endif @@ -530,8 +533,14 @@ Any aContent; Reference< XNameContainer > xNameContainer(this); ::rtl::OUString sName; - if ( lcl_queryContent(_sURL,xNameContainer,aContent,sName) ) + if ( !lcl_queryContent(_sURL,xNameContainer,aContent,sName) ) { + ::rtl::OUString sMessage( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unable to find the document '$name$'." ) ) ); + // TODO: resource + ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", _sURL ); + throw IllegalArgumentException( sMessage, *this, 1 ); + } + Reference< XCommandProcessor > xContent(aContent,UNO_QUERY); if ( xContent.is() ) { @@ -562,9 +571,6 @@ xComp.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); } } - else - throw IllegalArgumentException(); - } catch(NoSuchElementException) { throw IllegalArgumentException(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
