Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3a853065 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

Got rid to Class.NewInstance deprecated in java 9

parent 2a251262
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
* $Id$
*
* Copyright (C) Seungkeun Lee, 2006
* Copyright (C) INRIA, 2007-2009, 2013-2017
* Copyright (C) INRIA, 2007-2009, 2013-2017, 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
......@@ -23,6 +23,8 @@ package fr.inrialpes.exmo.align.service;
import java.lang.ClassNotFoundException;
import java.lang.IllegalAccessException;
import java.lang.NoSuchMethodException;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.DriverManager;
......@@ -53,13 +55,13 @@ public class DBServiceImpl implements DBService {
// "com.mysql.cj.jdbc.Driver", "jdbc:mysql"
String driverPrefix;
public DBServiceImpl( String driver, String prefix, String DBPort ) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
Class.forName(driver).newInstance();
public DBServiceImpl( String driver, String prefix, String DBPort ) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Class.forName(driver).getDeclaredConstructor().newInstance();
driverPrefix = prefix;
port = DBPort;
}
public DBServiceImpl( String driver, String prefix, String DBPort, String opt ) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
public DBServiceImpl( String driver, String prefix, String DBPort, String opt ) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
this( driver, prefix, DBPort );
options += opt;
}
......@@ -85,7 +87,7 @@ public class DBServiceImpl implements DBService {
public void connect(String IPAddress, String port, String user, String password ) throws SQLException {
connect( IPAddress, port, user, password, database );
}
}
public void connect(String IPAddress, String port, String user, String password, String database ) throws SQLException {
dbpass = password;
......@@ -95,7 +97,7 @@ public class DBServiceImpl implements DBService {
//with "dbpass" given by "connect"
public Connection reconnect() throws SQLException {
conn = DriverManager.getConnection( driverString, user, dbpass);
conn = DriverManager.getConnection( driverString, user, dbpass );
return conn;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment