summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/jdbc
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2002-08-01 05:30:16 +0000
committerOcke Janssen <oj@openoffice.org>2002-08-01 05:30:16 +0000
commit7fb4b1f8cf943348d53af27dfebb8bd3c5f74581 (patch)
treef48c5c3a0c040a339fe487f2eb11cf4aeea6639c /connectivity/source/drivers/jdbc
parent9f0aea44a8437d55d5d88cda7359fbbb5c5622a6 (diff)
#101822# check if url is the correct opn
Diffstat (limited to 'connectivity/source/drivers/jdbc')
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx
index 49b636094413..6810cbd1f750 100644
--- a/connectivity/source/drivers/jdbc/JDriver.cxx
+++ b/connectivity/source/drivers/jdbc/JDriver.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: JDriver.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: oj $ $Date: 2002-07-25 07:21:19 $
+ * last change: $Author: oj $ $Date: 2002-08-01 06:30:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,9 @@
#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_
#include "java/tools.hxx"
#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include "connectivity/dbexception.hxx"
+#endif
using namespace connectivity;
using namespace ::com::sun::star::uno;
@@ -241,7 +244,7 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin
t.pEnv->DeleteGlobalRef( object );
object = NULL;
}
- throw SQLException(::rtl::OUString::createFromAscii("The specified driver could not be loaded!"),*this,::rtl::OUString(),1000,Any());
+ ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The specified driver could not be loaded!")) ,*this);
}
jobject out(0);
@@ -314,6 +317,9 @@ sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) thro
Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url,
const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
{
+ if ( ! acceptsURL(url) )
+ ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this);
+
SDBThreadAttach t(getORB()); OSL_ENSURE(t.pEnv,"Java Enviroment gelscht worden!");
if(!object)
object = java_sql_DriverManager::getDriver(url);
@@ -322,7 +328,7 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const
{
// one of these must throw an exception
ThrowSQLException(t.pEnv,*this);
- throw SQLException(); // we need a object here
+ ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The specified driver could not be loaded!")) ,*this);
}
jobjectArray out(0);
@@ -356,7 +362,7 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const
sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) throw(RuntimeException)
{
if(!object)
- throw RuntimeException();
+ return 1;
jint out(0);
SDBThreadAttach t(getORB()); OSL_ENSURE(t.pEnv,"Java Enviroment gelscht worden!");
if( t.pEnv ){
@@ -376,7 +382,7 @@ sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) throw(RuntimeException)
sal_Int32 SAL_CALL java_sql_Driver::getMinorVersion( ) throw(RuntimeException)
{
if(!object)
- throw RuntimeException();
+ return 0;
jint out(0);
SDBThreadAttach t(getORB()); OSL_ENSURE(t.pEnv,"Java Enviroment gelscht worden!");
if( t.pEnv ){