From d316fb9de99e9e0e65f6d1ea37ec5fd5979653f8 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Thu, 4 Sep 2008 06:07:03 +0000 Subject: INTEGRATION: CWS mav38_DEV300 (1.36.24); FILE MERGED 2008/09/01 10:28:38 mav 1.36.24.1: #i93288# let database application open the stream itself for now --- dbaccess/source/filter/xml/dbloader2.cxx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index e55b785764eb..81288ea39160 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbloader2.cxx,v $ - * $Revision: 1.37 $ + * $Revision: 1.38 $ * * This file is part of OpenOffice.org. * @@ -143,16 +143,19 @@ DBTypeDetection::DBTypeDetection(const Reference< XMultiServiceFactory >& _rxFac try { ::comphelper::NamedValueCollection aMedia( Descriptor ); + sal_Bool bStreamFromDescr = sal_False; + ::rtl::OUString sURL = aMedia.getOrDefault( "URL", ::rtl::OUString() ); + Reference< XInputStream > xInStream( aMedia.getOrDefault( "InputStream", Reference< XInputStream >() ) ); Reference< XPropertySet > xStorageProperties; if ( xInStream.is() ) { + bStreamFromDescr = sal_True; xStorageProperties.set( ::comphelper::OStorageHelper::GetStorageFromInputStream( xInStream, m_aContext.getLegacyServiceFactory() ), UNO_QUERY ); } else { - ::rtl::OUString sURL = aMedia.getOrDefault( "URL", ::rtl::OUString() ); ::rtl::OUString sSalvagedURL( aMedia.getOrDefault( "SalvagedFile", ::rtl::OUString() ) ); ::rtl::OUString sFileLocation( sSalvagedURL.getLength() ? sSalvagedURL : sURL ); @@ -168,7 +171,21 @@ DBTypeDetection::DBTypeDetection(const Reference< XMultiServiceFactory >& _rxFac ::rtl::OUString sMediaType; xStorageProperties->getPropertyValue( INFO_MEDIATYPE ) >>= sMediaType; if ( sMediaType.equalsAscii(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) || sMediaType.equalsAscii(MIMETYPE_VND_SUN_XML_BASE_ASCII) ) + { + if ( bStreamFromDescr && sURL.compareTo( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) ), 14 ) != COMPARE_EQUAL ); + { + // After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further + // for now the file should be reopened to have read/write access + aMedia.remove( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) ) ); + aMedia >>= Descriptor; + try { + if ( xInStream.is() ) + xInStream->closeInput(); + } catch( Exception& ) {} + } + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StarBase")); + } ::comphelper::disposeComponent(xStorageProperties); } } catch(Exception&){} -- cgit