Kaydet (Commit) 47160402 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Better error reporting

Change-Id: I48bd329e1a29ce9cbf9840bf5e3cb48a92cb8073
üst 32e2cfda
...@@ -108,8 +108,11 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA ...@@ -108,8 +108,11 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA
{ {
if( !( aArguments[1] >>= nStorageMode ) ) if( !( aArguments[1] >>= nStorageMode ) )
{ {
OSL_FAIL( "Wrong second argument!\n" ); throw lang::IllegalArgumentException(
throw uno::Exception(); // TODO: Illegal argument ("second argument to css.embed.FileSystemStorageFactory."
"createInstanceWithArguments must be a"
" css.embed.ElementModes"),
static_cast< OWeakObject * >(this), -1);
} }
// it's allways possible to read written storage in this implementation // it's allways possible to read written storage in this implementation
nStorageMode |= embed::ElementModes::READ; nStorageMode |= embed::ElementModes::READ;
...@@ -118,18 +121,13 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA ...@@ -118,18 +121,13 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA
// retrieve storage source URL // retrieve storage source URL
::rtl::OUString aURL; ::rtl::OUString aURL;
if ( aArguments[0] >>= aURL ) if ( !( aArguments[0] >>= aURL ) || aURL.isEmpty() )
{ {
if ( aURL.isEmpty() ) throw lang::IllegalArgumentException(
{ ("first argument to"
OSL_FAIL( "Empty URL is provided!\n" ); " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
throw uno::Exception(); // TODO: illegal argument " must be a (non-empty) URL"),
} static_cast< OWeakObject * >(this), -1);
}
else
{
OSL_FAIL( "Wrong first argument!\n" );
throw uno::Exception(); // TODO: Illegal argument
} }
// allow to use other ucp's // allow to use other ucp's
...@@ -138,14 +136,21 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA ...@@ -138,14 +136,21 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA
|| aURL.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip")) || aURL.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip"))
|| ::utl::UCBContentHelper::IsDocument( aURL ) ) || ::utl::UCBContentHelper::IsDocument( aURL ) )
{ {
OSL_FAIL( "File system storages can be based only on file URLs!\n" ); // ??? throw lang::IllegalArgumentException(
throw uno::Exception(); // TODO: illegal argument ("URL \"" + aURL + "\" passed as first argument to"
" css.embed.FileSystemStorageFactory.createInstanceWithArguments"
" must be a file URL denoting a directory"),
static_cast< OWeakObject * >(this), -1);
} }
if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & embed::ElementModes::NOCREATE ) ) if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & embed::ElementModes::NOCREATE ) )
FSStorage::MakeFolderNoUI( aURL ); FSStorage::MakeFolderNoUI( aURL );
else if ( !::utl::UCBContentHelper::IsFolder( aURL ) ) else if ( !::utl::UCBContentHelper::IsFolder( aURL ) )
throw io::IOException(); // there is no such folder throw io::IOException(
("URL \"" + aURL + "\" passed to"
" css.embed.FileSystemStorageFactory.createInstanceWithArguments"
" does not denote an existing directory"),
static_cast< OWeakObject * >(this));
::ucbhelper::Content aResultContent( ::ucbhelper::Content aResultContent(
aURL, uno::Reference< ucb::XCommandEnvironment >(), aURL, uno::Reference< ucb::XCommandEnvironment >(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment