Tag: cws_src680_dba24d
User: fs      
Date: 2007-11-26 14:35:05+0000
Modified:
   dba/connectivity/source/drivers/jdbc/JConnection.cxx

Log:
 during #i81658#, upon user request: better error about inability to load 
driver class

File Changes:

Directory: /dba/connectivity/source/drivers/jdbc/
=================================================

File [changed]: JConnection.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/JConnection.cxx?r1=1.6.18.3&r2=1.6.18.4
Delta lines:  +39 -8
--------------------
--- JConnection.cxx     2007-11-21 12:40:51+0000        1.6.18.3
+++ JConnection.cxx     2007-11-26 14:35:02+0000        1.6.18.4
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: JConnection.cxx,v $
  *
- *  $Revision: 1.6.18.3 $
+ *  $Revision: 1.6.18.4 $
  *
- *  last change: $Author: oj $ $Date: 2007/11/21 12:40:51 $
+ *  last change: $Author: fs $ $Date: 2007/11/26 14:35:02 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -802,6 +802,28 @@
 
        return Any();
 }
+
+// 
-----------------------------------------------------------------------------
+namespace
+{
+    ::rtl::OUString lcl_getDriverLoadErrorMessage( const ::rtl::OUString& 
_rDriverClass, const ::rtl::OUString& _rDriverClassPath )
+    {
+        ::rtl::OUStringBuffer aMessageBuf;
+        // TODO: resource
+        aMessageBuf.appendAscii( "The driver class '" );
+        aMessageBuf.append( _rDriverClass );
+        aMessageBuf.appendAscii( "' could not be loaded" );
+        if ( _rDriverClassPath.getLength() )
+        {
+            aMessageBuf.appendAscii( " (additional driver class path: " );
+            aMessageBuf.append( _rDriverClassPath );
+            aMessageBuf.appendAscii( ")" );
+        }
+        aMessageBuf.appendAscii( "." );
+        return aMessageBuf.makeStringAndClear();
+    }
+}
+
 // 
-----------------------------------------------------------------------------
 void java_sql_Connection::loadDriverFromProperties(const ::rtl::OUString& 
_sDriverClass,const ::rtl::OUString& _sDriverClassPath)
 {
@@ -863,13 +885,22 @@
             }
         }
        }
-       catch(SQLException& e)
+       catch( const SQLException& e )
        {
-               throw SQLException(::rtl::OUString::createFromAscii("The 
specified driver could not be 
loaded!"),*this,::rtl::OUString(),1000,makeAny(e));
+               throw SQLException(
+            lcl_getDriverLoadErrorMessage( _sDriverClass, _sDriverClassPath ),
+            *this,
+            ::rtl::OUString(),
+            1000,
+            makeAny(e)
+        );
        }
-       catch(Exception&)
+       catch( Exception& )
        {
-               
::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The
 specified driver could not be loaded!")) ,*this);
+               ::dbtools::throwGenericSQLException(
+            lcl_getDriverLoadErrorMessage( _sDriverClass, _sDriverClassPath ),
+            *this
+        );
        }
 }
 // 
-----------------------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to