From 01fb3649a81e190c972f255dd378816e6de40283 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 30 Jul 2013 14:36:07 +0200 Subject: [PATCH] Resolves: rhbz#989246 Honor user's JavaDriverClass override in mysql driver --- ...r-user-s-JavaDriverClass-override-in.patch | 103 ++++++++++++++++++ libreoffice.spec | 7 +- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 0001-rhbz-989246-Honor-user-s-JavaDriverClass-override-in.patch diff --git a/0001-rhbz-989246-Honor-user-s-JavaDriverClass-override-in.patch b/0001-rhbz-989246-Honor-user-s-JavaDriverClass-override-in.patch new file mode 100644 index 0000000..d680879 --- /dev/null +++ b/0001-rhbz-989246-Honor-user-s-JavaDriverClass-override-in.patch @@ -0,0 +1,103 @@ +From 0c1d2fcdcfbfe83317e8660dd6165f3b438e80ad Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 30 Jul 2013 09:01:01 +0200 +Subject: [PATCH] rhbz#989246: Honor user's JavaDriverClass override in mysql + driver + +Change-Id: Ic7dbddb5b17af0bd23864fd19ab2bd815969d008 +(cherry picked from commit 63897351fc4fd31305bef43b649be74e2b6006c4) +Reviewed-on: https://gerrit.libreoffice.org/5193 +Reviewed-by: Fridrich Strba +Tested-by: Fridrich Strba +--- + connectivity/source/drivers/mysql/YDriver.cxx | 36 +++++++++++++++++++-------- + 1 file changed, 25 insertions(+), 11 deletions(-) + +diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx +index bd826e0..b55f464 100644 +--- a/connectivity/source/drivers/mysql/YDriver.cxx ++++ b/connectivity/source/drivers/mysql/YDriver.cxx +@@ -49,6 +49,15 @@ namespace connectivity + } + } + ++ namespace ++ { ++ OUString getJavaDriverClass( ++ css::uno::Sequence const & info) ++ { ++ return comphelper::NamedValueCollection(info).getOrDefault( ++ "JavaDriverClass", OUString("com.mysql.jdbc.Driver")); ++ } ++ } + + //==================================================================== + //= ODriverDelegator +@@ -156,9 +165,14 @@ namespace connectivity + const PropertyValue* pEnd = pSupported + info.getLength(); + + aProps.reserve(info.getLength() + 5); ++ bool jdc = false; + for (;pSupported != pEnd; ++pSupported) + { + aProps.push_back( *pSupported ); ++ if (pSupported->Name == "JavaDriverClass") ++ { ++ jdc = true; ++ } + } + + if ( _eType == D_ODBC ) +@@ -176,11 +190,14 @@ namespace connectivity + } + else if ( _eType == D_JDBC ) + { +- aProps.push_back( PropertyValue( +- OUString("JavaDriverClass") +- ,0 +- ,makeAny(OUString("com.mysql.jdbc.Driver")) +- ,PropertyState_DIRECT_VALUE) ); ++ if (!jdc) ++ { ++ aProps.push_back( PropertyValue( ++ OUString("JavaDriverClass") ++ ,0 ++ ,makeAny(OUString("com.mysql.jdbc.Driver")) ++ ,PropertyState_DIRECT_VALUE) ); ++ } + } + else + { +@@ -229,10 +246,7 @@ namespace connectivity + } + else + { +- ::comphelper::NamedValueCollection aSettings( info ); +- OUString sDriverClass("com.mysql.jdbc.Driver"); +- sDriverClass = aSettings.getOrDefault( "JavaDriverClass", sDriverClass ); +- ++ OUString sDriverClass(getJavaDriverClass(info)); + TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass); + if ( aFind == m_aJdbcDrivers.end() ) + aFind = m_aJdbcDrivers.insert(TJDBCDrivers::value_type(sDriverClass,lcl_loadDriver(m_xContext,sCuttedUrl))).first; +@@ -318,7 +332,7 @@ namespace connectivity + } + + //-------------------------------------------------------------------- +- Sequence< DriverPropertyInfo > SAL_CALL ODriverDelegator::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw (SQLException, RuntimeException) ++ Sequence< DriverPropertyInfo > SAL_CALL ODriverDelegator::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException) + { + ::std::vector< DriverPropertyInfo > aDriverInfo; + if ( !acceptsURL(url) ) +@@ -350,7 +364,7 @@ namespace connectivity + OUString("JavaDriverClass") + ,OUString("The JDBC driver class name.") + ,sal_True +- ,OUString("com.mysql.jdbc.Driver") ++ ,getJavaDriverClass(info) + ,Sequence< OUString >()) + ); + } +-- +1.8.1.4 + diff --git a/libreoffice.spec b/libreoffice.spec index 1568d56..e9180ee 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.4 -Release: 4%{?libo_prerelease}%{?dist} +Release: 5%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 Group: Applications/Productivity URL: http://www.libreoffice.org/default/ @@ -260,6 +260,7 @@ Patch22: 0001-resolved-fdo-67094-handle-text-s-in-text-p-and-text-.patch Patch23: 0001-Use-inconditionally-the-libwpd-0.9.5-path.patch Patch24: 0001-sanitize-system-clucene-includes.patch Patch25: 0001-Resolves-rhbz-989686-Fix-crash-with-ooo120774-1.doc.patch +Patch26: 0001-rhbz-989246-Honor-user-s-JavaDriverClass-override-in.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -1017,6 +1018,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch23 -p1 -b .Use-inconditionally-the-libwpd-0.9.5-path.patch %patch24 -p1 -b .sanitize-system-clucene-includes.patch %patch25 -p1 -b .rhbz-989686-Fix-crash-with-ooo120774-1.doc.patch +%patch26 -p1 -b .rhbz-989246-Honor-user-s-JavaDriverClass-override-in.patch # TODO: check this # these are horribly incomplete--empty translations and copied english @@ -2103,6 +2105,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Tue Jul 30 2013 Stephan Bergmann - 1:4.1.0.4-5-UNBUILT +- Resolves: rhbz#989246 Honor user's JavaDriverClass override in mysql driver + * Tue Jul 30 2013 Caolán McNamara - 1:4.1.0.4-4 - Resolves: rhbz#989686 Fix crash with stripping whitespace from toc entries