Handle cases where ExtensionDescription is called on nonexisting path

...which happens when installing non-bundle extensions (like a plain .xcu
file), where the path computed for the description.xml contains the path to
the non-bundle extension file itself as a prefix, so access results in
E_NOTDIR.

Change-Id: Ic0f4a34b46d99d1817ceea599bb8b53dbd65bc49
This commit is contained in:
Stephan Bergmann
2012-05-02 18:25:28 +02:00
parent cbc99cf1de
commit bd5da80bef
2 changed files with 9 additions and 4 deletions

View File

@@ -49,7 +49,7 @@
#include "com/sun/star/xml/dom/XNodeList.hpp" #include "com/sun/star/xml/dom/XNodeList.hpp"
#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" #include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
#include "com/sun/star/xml/xpath/XXPathAPI.hpp" #include "com/sun/star/xml/xpath/XXPathAPI.hpp"
#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" #include "com/sun/star/ucb/InteractiveIOException.hpp"
#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase2.hxx" #include "cppuhelper/implbase2.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
@@ -206,7 +206,7 @@ ExtensionDescription::ExtensionDescription(
//throws an com::sun::star::uno::Exception if the file is not available //throws an com::sun::star::uno::Exception if the file is not available
Reference<css::io::XInputStream> xIn; Reference<css::io::XInputStream> xIn;
try try
{ //throws com.sun.star.ucb.InteractiveAugmentedIOException { //throws com.sun.star.ucb.InteractiveIOException
xIn = descContent.openStream(); xIn = descContent.openStream();
} }
catch ( const css::uno::Exception& ) catch ( const css::uno::Exception& )
@@ -318,8 +318,10 @@ void FileDoesNotExistFilter::handle(
{ {
css::uno::Any request( xRequest->getRequest() ); css::uno::Any request( xRequest->getRequest() );
css::ucb::InteractiveAugmentedIOException ioexc; css::ucb::InteractiveIOException ioexc;
if ((request>>= ioexc) && ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING ) if ((request>>= ioexc)
&& (ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING
|| ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING_PATH))
{ {
m_bExist = false; m_bExist = false;
return; return;

View File

@@ -323,6 +323,9 @@ namespace fileaccess {
// No such device // No such device
ioErrorCode = IOErrorCode_INVALID_DEVICE; ioErrorCode = IOErrorCode_INVALID_DEVICE;
break; break;
case FileBase::E_NOTDIR:
ioErrorCode = IOErrorCode_NOT_EXISTING_PATH;
break;
case FileBase::E_NOENT: case FileBase::E_NOENT:
// No such file or directory // No such file or directory
ioErrorCode = IOErrorCode_NOT_EXISTING; ioErrorCode = IOErrorCode_NOT_EXISTING;