rpms/openoffice.org/FC-6 workspace.hsql1808.patch, NONE, 1.1 openoffice.org.spec, 1.949, 1.950

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Dec 3 14:53:58 UTC 2007


Author: caolanm

Update of /cvs/dist/rpms/openoffice.org/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv31491

Modified Files:
	openoffice.org.spec 
Added Files:
	workspace.hsql1808.patch 
Log Message:
Resolves: rhbz#303611 workspace.hsql1808.patch

workspace.hsql1808.patch:
 OOD680_m5/comphelper/source/misc/namedvaluecollection.cxx                         |   55 ++++
 OOD680_m5/connectivity/source/drivers/hsqldb/HDriver.cxx                          |   96 +++++--
 OOD680_m5/connectivity/source/drivers/hsqldb/makefile.mk                          |    3 
 OOD680_m5/connectivity/source/drivers/jdbc/Connection.cxx                         |  137 +++++++---
 OOD680_m5/connectivity/source/drivers/jdbc/JDriver.cxx                            |   21 +
 OOD680_m5/connectivity/source/drivers/jdbc/SQLException.cxx                       |    4 
 OOD680_m5/connectivity/source/drivers/jdbc/tools.cxx                              |    1 
 OOD680_m5/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs          |   24 +
 comphelper/inc/comphelper/namedvaluecollection.hxx                                |   42 +++
 dba/connectivity/source/inc/java/LocalRef.hxx                                     |  114 ++++++++
 openoffice.org/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java |   26 +
 11 files changed, 453 insertions(+), 70 deletions(-)

--- NEW FILE workspace.hsql1808.patch ---
--- OOD680_m5.orig/comphelper/inc/comphelper/namedvaluecollection.hxx	2007-10-25 12:17:58.000000000 -0400
+++ OOD680_m5/comphelper/inc/comphelper/namedvaluecollection.hxx	2007-10-26 03:30:17.000000000 -0400
@@ -50,6 +50,9 @@
 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
 #include <com/sun/star/beans/PropertyValue.hpp>
 #endif
+#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
+#include <com/sun/star/beans/NamedValue.hpp>
+#endif
 /** === end UNO includes === **/
 
 #include <memory>
@@ -158,6 +161,42 @@
             return impl_get( _rValueName );
         }
 
+        /** puts a value into the collection
+
+            @return <TRUE/> if and only if a value was already present previously, in
+                which case it has been overwritten.
+        */
+        template < typename VALUE_TYPE >
+        inline bool put( const sal_Char* _pAsciiValueName, const VALUE_TYPE& _rValue )
+        {
+            return impl_put( ::rtl::OUString::createFromAscii( _pAsciiValueName ), ::com::sun::star::uno::makeAny( _rValue ) );
+        }
+
+        /** puts a value into the collection
+
+            @return <TRUE/> if and only if a value was already present previously, in
+                which case it has been overwritten.
+        */
+        template < typename VALUE_TYPE >
+        inline bool put( const ::rtl::OUString& _rValueName, const VALUE_TYPE& _rValue )
+        {
+            return impl_put( _rValueName, ::com::sun::star::uno::makeAny( _rValue ) );
+        }
+
+        /** transforms the collection to a sequence of PropertyValues
+
+            @return
+                the  number of elements in the sequence
+        */
+        sal_Int32 operator >>= ( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rValues );
+
+        /** transforms the collection to a sequence of NamedValues
+
+            @return
+                the  number of elements in the sequence
+        */
+        sal_Int32 operator >>= ( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rValues );
+
     private:
         void    impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments );
         void    impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments );
@@ -170,6 +209,9 @@
 
         const ::com::sun::star::uno::Any&
                 impl_get( const ::rtl::OUString& _rValueName ) const;
+
+        bool    impl_has( const ::rtl::OUString& _rValueName ) const;
+        bool    impl_put( const ::rtl::OUString& _rValueName, const ::com::sun::star::uno::Any& _rValue );
     };
 
 //........................................................................
diff -ru OOD680_m5.orig/comphelper/source/misc/namedvaluecollection.cxx OOD680_m5/comphelper/source/misc/namedvaluecollection.cxx
--- OOD680_m5.orig/comphelper/source/misc/namedvaluecollection.cxx	2007-10-25 12:17:59.000000000 -0400
+++ OOD680_m5/comphelper/source/misc/namedvaluecollection.cxx	2007-10-25 12:30:53.000000000 -0400
@@ -41,6 +41,7 @@
 #ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
 #include <com/sun/star/beans/NamedValue.hpp>
 #endif
+#include <com/sun/star/beans/PropertyState.hpp>
 /** === end UNO includes === **/
 
 #ifndef _OSL_DIAGNOSE_H_
@@ -48,6 +49,8 @@
 #endif
 
 #include <hash_map>
+#include <functional>
+#include <algorithm>
 
 //........................................................................
 namespace comphelper
@@ -63,6 +66,7 @@
     using ::com::sun::star::uno::cpp_acquire;
     using ::com::sun::star::uno::cpp_release;
     using ::com::sun::star::uno::cpp_queryInterface;
+    using ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
     /** === end UNO using === **/
 
     //====================================================================
@@ -159,6 +163,20 @@
     }
 
     //--------------------------------------------------------------------
+    bool NamedValueCollection::impl_has( const ::rtl::OUString& _rValueName ) const
+    {
+        NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
+        return ( pos != m_pImpl->aValues.end() );
+    }
+
+    bool NamedValueCollection::impl_put( const ::rtl::OUString& _rValueName, const Any& _rValue )
+    {
+        bool bHas = impl_has( _rValueName );
+        m_pImpl->aValues[ _rValueName ] = _rValue;
+        return bHas;
+    }
+ 
+    //--------------------------------------------------------------------
     const Any& NamedValueCollection::impl_get( const ::rtl::OUString& _rValueName ) const
     {
         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
@@ -169,6 +187,43 @@
         return aEmptyDefault;
     }
 
+    //--------------------------------------------------------------------
+    namespace
+    {
+        struct Value2PropertyValue : public ::std::unary_function< NamedValueRepository::value_type, PropertyValue >
+        {
+            PropertyValue operator()( const NamedValueRepository::value_type& _rValue )
+            {
+                return PropertyValue(
+                    _rValue.first, 0, _rValue.second, PropertyState_DIRECT_VALUE );
+            }
+        };
+
+        struct Value2NamedValue : public ::std::unary_function< NamedValueRepository::value_type, NamedValue >
+        {
+            NamedValue operator()( const NamedValueRepository::value_type& _rValue )
+            {
+                return NamedValue( _rValue.first, _rValue.second );
+            }                                     
+        };
+    }
+
+    //--------------------------------------------------------------------
+    sal_Int32 NamedValueCollection::operator >>= ( Sequence< PropertyValue >& _out_rValues )
+    {
+        _out_rValues.realloc( m_pImpl->aValues.size() );
+        ::std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2PropertyValue() );
+        return _out_rValues.getLength();
+    }
+
+    //--------------------------------------------------------------------
+    sal_Int32 NamedValueCollection::operator >>= ( Sequence< NamedValue >& _out_rValues )
+    {
+        _out_rValues.realloc( m_pImpl->aValues.size() );
+        ::std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2NamedValue() );
+        return _out_rValues.getLength();
+    }
+
 //........................................................................
 } // namespace comphelper
 //........................................................................
diff -ru OOD680_m5.orig/connectivity/source/drivers/hsqldb/HDriver.cxx OOD680_m5/connectivity/source/drivers/hsqldb/HDriver.cxx
--- OOD680_m5.orig/connectivity/source/drivers/hsqldb/HDriver.cxx	2007-10-25 12:18:05.000000000 -0400
+++ OOD680_m5/connectivity/source/drivers/hsqldb/HDriver.cxx	2007-10-25 14:10:42.000000000 -0400
@@ -98,6 +98,13 @@
 #ifndef _DBHELPER_DBEXCEPTION_HXX_
 #include <connectivity/dbexception.hxx>
 #endif
+#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX
+#include <comphelper/namedvaluecollection.hxx>
+#endif
+#ifndef _UNOTOOLS_CONFIGNODE_HXX_
+#include <unotools/confignode.hxx>
+#endif
+
 //........................................................................
 namespace connectivity
 {
@@ -183,6 +190,37 @@
 	}
 
 	//--------------------------------------------------------------------
+    namespace
+    {
+        ::rtl::OUString lcl_getPermittedJavaMethods_nothrow( const Reference< XMultiServiceFactory >& _rxORB )
+        {
+            ::rtl::OUStringBuffer aConfigPath;
+            aConfigPath.appendAscii( "/org.openoffice.Office.DataAccess/DriverSettings/" );
+            aConfigPath.append     ( ODriverDelegator::getImplementationName_Static() );
+            aConfigPath.appendAscii( "/PermittedJavaMethods" );
+            ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+                _rxORB, aConfigPath.makeStringAndClear() ) );
+
+            ::rtl::OUStringBuffer aPermittedMethods;
+            Sequence< ::rtl::OUString > aNodeNames( aConfig.getNodeNames() );
+            for (   const ::rtl::OUString* pNodeNames = aNodeNames.getConstArray();
+                    pNodeNames != aNodeNames.getConstArray() + aNodeNames.getLength();
+                    ++pNodeNames
+                )
+            {
+                ::rtl::OUString sPermittedMethod;
+                OSL_VERIFY( aConfig.getNodeValue( *pNodeNames ) >>= sPermittedMethod );
+
+                if ( aPermittedMethods.getLength() )
+                    aPermittedMethods.append( (sal_Unicode)';' );
+                aPermittedMethods.append( sPermittedMethod );
+            }
+
+            return aPermittedMethods.makeStringAndClear();;
+        }
+    }
+
+	//--------------------------------------------------------------------
 	Reference< XConnection > SAL_CALL ODriverDelegator::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException)
 	{
 		Reference< XConnection > xConnection;
@@ -225,28 +263,37 @@
 
                 bool bIsNewDatabase = !xStorage->hasElements();
 
-				Sequence< PropertyValue > aConvertedProperties(8);
-				sal_Int32 nPos = 0;
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("storage_key"));
-                ::rtl::OUString sConnPartURL = sSystemPath.copy(0,nIndex);
-				::rtl::OUString sKey = StorageContainer::registerStorage(xStorage,sConnPartURL);
-				aConvertedProperties[nPos++].Value <<= sKey;
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("storage_class_name"));
-				aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.comp.hsqldb.StorageAccess"));
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fileaccess_class_name"));
-				aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess"));
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"));
-				aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.hsqldb.jdbcDriver"));
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled"));
-				aConvertedProperties[nPos++].Value <<= sal_True;
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"));
-				aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CALL IDENTITY()"));
-				aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges"));
-				aConvertedProperties[nPos++].Value <<= sal_True;
+                ::comphelper::NamedValueCollection aProperties;
+
+                // properties for accessing the embedded storage
+                               ::rtl::OUString sConnPartURL = sSystemPath.copy( 0, ::std::max< sal_Int32 >( nIndex, sSystemPath.getLength() ) );
+                               ::rtl::OUString sKey = StorageContainer::registerStorage( xStorage, sConnPartURL );
+                aProperties.put( "storage_key", sKey );
+                aProperties.put( "storage_class_name",
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbcx.comp.hsqldb.StorageAccess" ) ) );
+                aProperties.put( "fileaccess_class_name",
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess" ) ) );
+
+                // JDBC driver and driver's classpath
+                aProperties.put( "JavaDriverClass",
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.hsqldb.jdbcDriver" ) ) );
+
+                // auto increment handling
+                aProperties.put( "IsAutoRetrievingEnabled", true );
+                aProperties.put( "AutoRetrievingStatement",
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CALL IDENTITY()" ) ) );
+                aProperties.put( "IgnoreDriverPrivileges", true );
 
                 // don't want to expose HSQLDB's schema capabilities which exist since 1.8.0RC10
-				aConvertedProperties[nPos].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "default_schema" ) );
-                aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"));
+                aProperties.put( "default_schema",
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
+
+                // security: permitted Java classes
+                NamedValue aPermittedClasses(
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hsqldb.method_class_names" ) ),
+                    makeAny( lcl_getPermittedJavaMethods_nothrow( m_xFactory ) )
+                );
+                aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) );
 
 				Reference<XPropertySet> xProp(xStorage,UNO_QUERY);
 				if ( xProp.is() )
@@ -255,19 +302,20 @@
 					xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nMode;
 					if ( (nMode & ElementModes::WRITE) != ElementModes::WRITE )
 					{
-						aConvertedProperties.realloc(nPos+1);
-						aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("readonly"));
-						aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"));
+                        aProperties.put( "readonly", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
 					}
 				}
 
+                Sequence< PropertyValue > aConnectionArgs;
+                aProperties >>= aConnectionArgs;
+
 				::rtl::OUString sConnectURL(RTL_CONSTASCII_USTRINGPARAM("jdbc:hsqldb:"));
 
 				sConnectURL += sConnPartURL;
                 Reference<XConnection> xOrig;
                 try
                 {
-                    xOrig = xDriver->connect( sConnectURL, aConvertedProperties );
+                    xOrig = xDriver->connect( sConnectURL, aConnectionArgs );
                 }
                 catch(SQLException e)
                 {
diff -ru OOD680_m5.orig/connectivity/source/drivers/hsqldb/makefile.mk OOD680_m5/connectivity/source/drivers/hsqldb/makefile.mk
--- OOD680_m5.orig/connectivity/source/drivers/hsqldb/makefile.mk	2007-10-25 12:18:05.000000000 -0400
+++ OOD680_m5/connectivity/source/drivers/hsqldb/makefile.mk	2007-10-25 12:24:36.000000000 -0400
@@ -91,7 +91,8 @@
 	$(JVMACCESSLIB)				\
 	$(DBTOOLSLIB)				\
 	$(JVMFWKLIB)				\
-	$(COMPHELPERLIB)
+	$(COMPHELPERLIB)            \
+	$(UNOTOOLSLIB)
 
 
 SHL1DEPN=
diff -ru OOD680_m5.orig/connectivity/source/drivers/jdbc/Connection.cxx OOD680_m5/connectivity/source/drivers/jdbc/Connection.cxx
--- OOD680_m5.orig/connectivity/source/drivers/jdbc/Connection.cxx	2007-10-25 12:18:05.000000000 -0400
+++ OOD680_m5/connectivity/source/drivers/jdbc/Connection.cxx	2007-10-25 14:03:56.000000000 -0400
@@ -60,6 +60,12 @@
 #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
 #include <com/sun/star/lang/DisposedException.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
+#include <com/sun/star/beans/NamedValue.hpp>
+#endif
 #ifndef _CONNECTIVITY_SQLPARSE_HXX
 #include "connectivity/sqlparse.hxx"
 #endif
@@ -67,9 +73,11 @@
 #include "connectivity/dbexception.hxx"
 #endif
 #include "java/util/Property.hxx"
+#include "java/LocalRef.hxx"
 #include <memory>
 
 using namespace connectivity;
+using namespace connectivity::jdbc;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 //	using namespace ::com::sun::star::sdbcx;
@@ -670,13 +678,66 @@
 	if( out )
 	{
 		java_sql_SQLWarning_BASE		warn_base(t.pEnv, out);
-		return makeAny(
-            static_cast< starsdbc::SQLException >(
-                java_sql_SQLWarning(warn_base,*this)));
+        SQLException aAsException( static_cast< starsdbc::SQLException >( java_sql_SQLWarning( warn_base, *this ) ) );
+
+        // translate to warning
+        SQLWarning aWarning;
+        aWarning.Context = aAsException.Context;
+        aWarning.Message = aAsException.Message;
+        aWarning.SQLState = aAsException.SQLState;
+        aWarning.ErrorCode = aAsException.ErrorCode;
+        aWarning.NextException = aAsException.NextException;
+        
+               return makeAny( aWarning );
 	}
 
 	return Any();
 }
+
+namespace
+{
+    bool lcl_setSystemProperties_nothrow( JNIEnv& _rEnv, const Sequence< NamedValue >& _rSystemProperties )
+    {
+        if ( _rSystemProperties.getLength() == 0 )
+            // nothing to do
+            return true;
+
+        LocalRef< jclass > systemClass( _rEnv );
+        jmethodID nSetPropertyMethodID = 0;
+        // retrieve the java.lang.System class
+        systemClass.set( _rEnv.FindClass( "java/lang/System" ) );
+        if ( systemClass.is() )
+        {
+            nSetPropertyMethodID = _rEnv.GetStaticMethodID(
+                systemClass.get(), "setProperty", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" );
+        }
+
+        if ( nSetPropertyMethodID == 0 )
+            return false;
+
+        for (   const NamedValue* pSystemProp = _rSystemProperties.getConstArray();
+                pSystemProp != _rSystemProperties.getConstArray() + _rSystemProperties.getLength();
+                ++pSystemProp
+            )
+        {
+            ::rtl::OUString sValue;
+            OSL_VERIFY( pSystemProp->Value >>= sValue );
+
+            LocalRef< jstring > jName( _rEnv, convertwchar_tToJavaString( &_rEnv, pSystemProp->Name ) );
+            LocalRef< jstring > jValue( _rEnv, convertwchar_tToJavaString( &_rEnv, sValue ) );
+
+            _rEnv.CallStaticObjectMethod( systemClass.get(), nSetPropertyMethodID, jName.get(), jValue.get() );
+            LocalRef< jthrowable > throwable( _rEnv, _rEnv.ExceptionOccurred() );
+            if ( throwable.is() )
+                return false;
+        }
+
+        return true;
+    }
+}
+
+// -----------------------------------------------------------------------------
+
 // -----------------------------------------------------------------------------
 void java_sql_Connection::loadDriverFromProperties(const Sequence< PropertyValue >& info,
 												   ::rtl::OUString& _rsGeneratedValueStatement,
@@ -688,40 +749,15 @@
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
 	try
 	{
+		Sequence< NamedValue > aSystemProperties;
 		const PropertyValue* pBegin	= info.getConstArray();
 		const PropertyValue* pEnd	= pBegin + info.getLength();
+      const PropertyValue* pJavaDriverClass = 0;
 		for(;pBegin != pEnd;++pBegin)
 		{
-			if ( !object && !pBegin->Name.compareToAscii("JavaDriverClass") )
+			if ( !pBegin->Name.compareToAscii("JavaDriverClass") )
 			{
-				// here I try to find the class for jdbc driver
-				java_sql_SQLException_BASE::getMyClass();
-				java_lang_Throwable::getMyClass();
-
-				::rtl::OUString aStr;
-				pBegin->Value >>= aStr;
-				OSL_ASSERT( aStr.getLength());
-				if ( aStr.getLength() )
-				{
-					// the driver manager holds the class of the driver for later use
-					// if forName didn't find the class it will throw an exception
-					::std::auto_ptr< java_lang_Class > pDrvClass = ::std::auto_ptr< java_lang_Class >(java_lang_Class::forName(aStr));
-					if ( pDrvClass.get() )
-					{
-						m_pDriverobject = pDrvClass->newInstanceObject();
-						if( t.pEnv && m_pDriverobject )
-							m_pDriverobject = t.pEnv->NewGlobalRef( m_pDriverobject );
-						if( t.pEnv )
-						{
-							jclass tempClass = t.pEnv->GetObjectClass(m_pDriverobject);
-							if ( m_pDriverobject )
-							{
-								m_Driver_theClass = (jclass)t.pEnv->NewGlobalRef( tempClass );
-								t.pEnv->DeleteLocalRef( tempClass );
-							}
-						}
-					}
-				}
+                pJavaDriverClass = pBegin;
 			}
 			else if(!pBegin->Name.compareToAscii("IsAutoRetrievingEnabled"))
 			{
@@ -739,6 +775,43 @@
 			{
 				pBegin->Value >>= _bIgnoreDriverPrivileges;
 			}
+			else if(!pBegin->Name.compareToAscii("SystemProperties"))
+			{
+				OSL_VERIFY( pBegin->Value >>= aSystemProperties );
+			}
+		}
+		if ( !object && pJavaDriverClass != 0 )
+		{
+         if ( !lcl_setSystemProperties_nothrow( *t.pEnv, aSystemProperties ) )
+             throw SQLException(::rtl::OUString::createFromAscii("The specified driver could not be loaded!"),*this,::rtl::OUString(),1000,Any());
+			// here I try to find the class for jdbc driver
+			java_sql_SQLException_BASE::getMyClass();
+			java_lang_Throwable::getMyClass();
+
+			::rtl::OUString aStr;
+			pJavaDriverClass->Value >>= aStr;
+			OSL_ASSERT( aStr.getLength());
+			if ( aStr.getLength() )
+			{
+				// the driver manager holds the class of the driver for later use
+				// if forName didn't find the class it will throw an exception
+				::std::auto_ptr< java_lang_Class > pDrvClass = ::std::auto_ptr< java_lang_Class >(java_lang_Class::forName(aStr));
+				if ( pDrvClass.get() )
+				{
+					m_pDriverobject = pDrvClass->newInstanceObject();
+					if( t.pEnv && m_pDriverobject )
+						m_pDriverobject = t.pEnv->NewGlobalRef( m_pDriverobject );
+					if( t.pEnv )
+					{
+						jclass tempClass = t.pEnv->GetObjectClass(m_pDriverobject);
+						if ( m_pDriverobject )
+						{
+							m_Driver_theClass = (jclass)t.pEnv->NewGlobalRef( tempClass );
+							t.pEnv->DeleteLocalRef( tempClass );
+						}
+					}
+				}
+			}
 		}
 	}
 	catch(SQLException& e)
diff -ru OOD680_m5.orig/connectivity/source/drivers/jdbc/JDriver.cxx OOD680_m5/connectivity/source/drivers/jdbc/JDriver.cxx
--- OOD680_m5.orig/connectivity/source/drivers/jdbc/JDriver.cxx	2007-10-25 12:18:05.000000000 -0400
+++ OOD680_m5/connectivity/source/drivers/jdbc/JDriver.cxx	2007-10-25 13:47:16.000000000 -0400
@@ -163,9 +163,26 @@
 				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))
 				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The JDBC driver class name."))
 				,sal_True
-				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.mysql.jdbc.Driver"))
+				,::rtl::OUString()
+				,Sequence< ::rtl::OUString >())
+				);
+
+		aDriverInfo.push_back(DriverPropertyInfo(
+				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClassPath"))
+				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The class path where to look for the JDBC driver."))
+				,sal_True
+				,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) )
+				,Sequence< ::rtl::OUString >())
+				);
+
+		aDriverInfo.push_back(DriverPropertyInfo(
+				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemProperties"))
+				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Additional properties to set at java.lang.System before loading the driver."))
+				,sal_True
+				,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) )
 				,Sequence< ::rtl::OUString >())
 				);
+
 		aDriverInfo.push_back(DriverPropertyInfo(
 				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParameterNameSubstitution"))
 				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Change named parameters with '?'."))
@@ -173,6 +190,7 @@
 				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
 				,aBoolean)
 				);
+
 		aDriverInfo.push_back(DriverPropertyInfo(
 				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges"))
 				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the privileges from the database driver."))
@@ -187,6 +205,7 @@
 				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
 				,aBoolean)
 				);
+
 		aDriverInfo.push_back(DriverPropertyInfo(
 				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"))
 				,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Auto-increment statement."))
diff -ru OOD680_m5.orig/connectivity/source/drivers/jdbc/SQLException.cxx OOD680_m5/connectivity/source/drivers/jdbc/SQLException.cxx
--- OOD680_m5.orig/connectivity/source/drivers/jdbc/SQLException.cxx	2007-10-25 12:18:05.000000000 -0400
+++ OOD680_m5/connectivity/source/drivers/jdbc/SQLException.cxx	2007-10-25 12:24:42.000000000 -0400
@@ -104,12 +104,12 @@
 	if( t.pEnv ){
 
 		// temporaere Variable initialisieren
-		static const char * cSignature = "()Ljava/sql/Exception;";
+		static const char * cSignature = "()Ljava/sql/SQLException;";
 		static const char * cMethodName = "getNextException";
 		// Java-Call absetzen
 		static jmethodID mID = NULL;
 		if ( !mID  )
-			mID  = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );
+			mID  = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
 		if( mID ){
 			out = t.pEnv->CallObjectMethod( object, mID);
 			ThrowSQLException(t.pEnv,0);
diff -ru OOD680_m5.orig/connectivity/source/drivers/jdbc/tools.cxx OOD680_m5/connectivity/source/drivers/jdbc/tools.cxx
--- OOD680_m5.orig/connectivity/source/drivers/jdbc/tools.cxx	2007-10-25 12:18:05.000000000 -0400
+++ OOD680_m5/connectivity/source/drivers/jdbc/tools.cxx	2007-10-25 12:38:43.000000000 -0400
@@ -160,6 +160,7 @@
 	{
 		// this is a special property to find the jdbc driver
 		if( pBegin->Name.compareToAscii("JavaDriverClass") &&
+			pBegin->Name.compareToAscii("SystemProperties") &&
 			pBegin->Name.compareToAscii("CharSet") &&
 			pBegin->Name.compareToAscii("AppendTableAlias") &&
 			pBegin->Name.compareToAscii("ParameterNameSubstitution") &&
diff -ru OOD680_m5.orig/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs OOD680_m5/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
--- OOD680_m5.orig/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs	2007-10-25 12:21:06.000000000 -0400
+++ OOD680_m5/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs	2007-10-25 12:24:47.000000000 -0400
@@ -252,6 +252,7 @@
 				<desc>Contains a list of descriptions for user defined drivers.</desc>
 			</info>
 		</set>
+
 		<group oor:name="AddressBook">
 			<info>
 				<desc>Specifies the data source that can be used as an AddressBook.</desc>
@@ -287,6 +288,7 @@
 				</info>
 			</set>
 		</group>
+
 		<group oor:name="Bibliography">
 			<info>
 				<author>OS</author>
@@ -339,10 +341,12 @@
 				</info>
 			</set>
 		</group>
+
 		<group oor:name="DriverSettings">
 			<info>
 				<desc>Specifies the driver settings that are used.</desc>
 			</info>
+
 			<group oor:name="com.sun.star.comp.sdbc.MozabDriver">
 				<info>
 					<desc>Specifies the driver settings for the mozilla database driver.</desc>
@@ -562,6 +566,7 @@
 					</prop>
 				</group>
 			</group>
+
 			<group oor:name="com.sun.star.comp.sdbc.evoab.OEvoabDriver">
 				<info>
 					<desc>Specifies the driver settings for the evolution database driver.</desc>
@@ -749,6 +754,7 @@
 					</prop>
 				</group>
 			</group>
+
             <group oor:name="com.sun.star.comp.sdbc.kab.Driver">
                 <info>
                     <desc>Specifies the driver settings for the mozilla database driver.</desc>
@@ -762,7 +768,25 @@
                     <value>false</value>
                 </prop>
             </group>
+
+            <group oor:name="com.sun.star.sdbcx.comp.hsqldb.Driver">
+                <info>
+                    <desc>Specifies settings for the driver accessing HSQL databases embedded into OpenOffice.org
+                          database documents (.odb)</desc>
+                </info>
+                <group oor:name="PermittedJavaMethods" oor:extensible="true">
+                    <info>
+                        <desc>HSQLDB features calling Java code directly from SQL statements. For security
+                              reasons, this is restricted to classes from the org.hsqldb.Library package,
+                              the java.lang.math package, plus any methods specified in this configuraton
+                              setting. If a method specification ends with .*, then all methods
+                              from the respectiv package are permitted.</desc>
+                    </info>
+                </group>
+            </group>
+
         </group>
+
 		<group oor:name="FormSearchOptions">
 			<info>
 				<desc>Specifies the options for searching in forms.</desc>
Index: com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java
===================================================================
RCS file: /cvs/dba/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- openoffice.org/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java	8 Sep 2005 04:55:55 -0000	1.7
+++ openoffice.org/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java	12 Dec 2006 15:50:19 -0000	1.8
@@ -80,16 +82,22 @@
         return new NativeOutputStreamHelper(key,streamName);
     }
 
-    public void removeElement(java.lang.String filename) throws java.util.NoSuchElementException, java.io.IOException {
-        if ( isStreamElement(key,filename) )
-            removeElement(key,filename);
-    }
-
-    public void renameElement(java.lang.String oldName, java.lang.String newName) throws java.util.NoSuchElementException, java.io.IOException {
-        if ( isStreamElement(key,oldName) ){
-            removeElement(key,newName);
-            renameElement(key,oldName, newName);
-        }
+    public void removeElement(java.lang.String filename) throws java.util.NoSuchElementException {
+        try {
+            if ( isStreamElement(key,filename) )
+                removeElement(key,filename);
+	    } catch (java.io.IOException e) {
+       }
+    }
+
+    public void renameElement(java.lang.String oldName, java.lang.String newName) throws java.util.NoSuchElementException {
+        try {
+            if ( isStreamElement(key,oldName) ){
+                removeElement(key,newName);
+                renameElement(key,oldName, newName);
+            }
+       } catch (java.io.IOException e) {
+       }
     }
 
     public class FileSync implements FileAccess.FileSync
Index: dba/connectivity/source/inc/java/LocalRef.hxx
diff -u /dev/null dba/connectivity/source/inc/java/LocalRef.hxx:1.1.4.2
--- /dev/null	Thu Oct 25 08:23:50 2007
+++ dba/connectivity/source/inc/java/LocalRef.hxx	Tue Oct 16 05:59:02 2007
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_LOCALREF_HXX
+#define CONNECTIVITY_LOCALREF_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <jvmaccess/virtualmachine.hxx>
+
+//........................................................................
+namespace connectivity { namespace jdbc
+{
+//........................................................................
+
+	//====================================================================
+	//= LocalRef
+	//====================================================================
+    /** helper class to hold a local ref to a JNI object
+
+        Note that this class never actually calls NewLocalRef. It is assumed that all objects
+        passed are already acquired with a local ref (as it usually is the case if you obtain
+        the object from an JNI method).
+    */
+    template< typename T >
+    class LocalRef
+    {
+    public:
+        explicit LocalRef( JNIEnv& environment )
+            :m_environment( environment )
+            ,m_object( NULL )
+        {
+        }
+
+        LocalRef( JNIEnv& environment, T object )
+            :m_environment( environment )
+            ,m_object( object )
+        {
+        }
+
+        ~LocalRef()
+        {
+            reset();
+        }
+
+        T release()
+        {
+            T t = m_object;
+            m_object = NULL;
+            return t;
+        }
+
+        void set( T object ) { reset(); m_object = object; }
+
+        void reset()
+        {
+            if ( m_object != NULL )
+            {
+                m_environment.DeleteLocalRef( m_object );
+                m_object = NULL;
+            }
+        }
+
+        JNIEnv& env() const { return m_environment; }
+        T       get() const { return m_object; }
+        bool    is()  const { return m_object != NULL; }
+
+    private:
+        LocalRef(LocalRef &); // not defined
+        void operator =(LocalRef &); // not defined
+
+    protected:
+        JNIEnv& m_environment;
+        T       m_object;
+    };
+
+//........................................................................
+} } // namespace connectivity::jdbc
+//........................................................................
+
+#endif // CONNECTIVITY_LOCALREF_HXX


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/dist/rpms/openoffice.org/FC-6/openoffice.org.spec,v
retrieving revision 1.949
retrieving revision 1.950
diff -u -r1.949 -r1.950
--- openoffice.org.spec	17 Sep 2007 07:47:09 -0000	1.949
+++ openoffice.org.spec	3 Dec 2007 14:53:55 -0000	1.950
@@ -1,6 +1,6 @@
 %define oootag OOD680
 %define ooomilestone 5
-%define rh_rpm_release 5.24
+%define rh_rpm_release 5.25
 
 # gcc#19664#
 %define stlvisibilityfcked 1
@@ -156,7 +156,7 @@
 Patch88: openoffice.org-2.0.4.ooo71039.svx.purevirtual.patch
 Patch89: openoffice.org-2.2.0.ooo73974.bridges.doublereturn.patch
 Patch90: openoffice.org-2.2.0.rh226966.scoverflow.sc.patch
-Patch91: openoffice.org-2.2.0.oooXXXXX.connectivity.newhsqldb.patch
+Patch91: workspace.hsql1808.patch
 Patch92: workspace.fwk55.patch
 Patch93: openoffice.org-2.2.0.rh228002.escape.shell.patch
 Patch94: openoffice.org-2.2.0.ooo74451.sw.typemismatch.patch
@@ -1058,7 +1058,7 @@
 %patch88 -p1 -b .ooo71039.svx.purevirtual.patch
 %patch89 -p1 -b .ooo73974.bridges.doublereturn.patch
 %patch90 -p1 -b .rh226966.scoverflow.sc.patch
-%patch91 -p1 -b .oooXXXXX.connectivity.newhsqldb.patch
+%patch91 -p1 -b .workspace.hsql1808.patch
 %patch92 -p1 -b .workspace.fwk55.patch
 %patch93 -p1 -b .rh228002.escape.shell.patch
 %patch94 -p1 -b .ooo74451.sw.typemismatch.patch
@@ -2599,6 +2599,9 @@
 %{instdir}/share/registry/modules/org/openoffice/Office/Scripting/Scripting-python.xcu
 
 %changelog
+* Mon Dec 03 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.0.4-5.5.25
+- Resolves: rhbz#303611 CVE-2007-4575 workspace.hsql1808.patch
+
 * Mon Sep 17 2007 Jan Navratil <jnavrati at redhat.com> - 1:2.0.4-5.5.24
 - Resolves: rhbz#251975 CVE-2007-2834 workspace.tipatch8.patch
 




More information about the fedora-cvs-commits mailing list