Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
db69a996
Unverified
提交
db69a996
authored
6月 24, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
6月 24, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1235 from katzyn/newInstance
Do not use deprecated Class.newInstance()
上级
e26ab316
2b95bb8b
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
31 行增加
和
34 行删除
+31
-34
Set.java
h2/src/main/org/h2/command/dml/Set.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+3
-3
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+2
-2
UserAggregate.java
h2/src/main/org/h2/engine/UserAggregate.java
+1
-1
TraceSystem.java
h2/src/main/org/h2/message/TraceSystem.java
+1
-1
TriggerObject.java
h2/src/main/org/h2/schema/TriggerObject.java
+1
-1
DefaultAuthenticator.java
h2/src/main/org/h2/security/auth/DefaultAuthenticator.java
+2
-2
FilePath.java
h2/src/main/org/h2/store/fs/FilePath.java
+1
-1
FilePathWrapper.java
h2/src/main/org/h2/store/fs/FilePathWrapper.java
+1
-1
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+4
-4
SourceCompiler.java
h2/src/main/org/h2/util/SourceCompiler.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-5
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
Database.java
h2/src/test/org/h2/test/bench/Database.java
+1
-1
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+1
-1
TaskDef.java
h2/src/test/org/h2/test/db/TaskDef.java
+1
-1
TestRecover.java
h2/src/test/org/h2/test/poweroff/TestRecover.java
+1
-1
TestClassLoaderLeak.java
h2/src/test/org/h2/test/unit/TestClassLoaderLeak.java
+2
-2
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+1
-1
Db.java
h2/src/tools/org/h2/jaqu/Db.java
+1
-1
ClassUtils.java
h2/src/tools/org/h2/jaqu/util/ClassUtils.java
+2
-2
没有找到文件。
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
db69a996
...
@@ -489,7 +489,7 @@ public class Set extends Prepared {
...
@@ -489,7 +489,7 @@ public class Set extends Prepared {
Class
<
RowFactory
>
rowFactoryClass
=
JdbcUtils
.
loadUserClass
(
rowFactoryName
);
Class
<
RowFactory
>
rowFactoryClass
=
JdbcUtils
.
loadUserClass
(
rowFactoryName
);
RowFactory
rowFactory
;
RowFactory
rowFactory
;
try
{
try
{
rowFactory
=
rowFactoryClass
.
newInstance
();
rowFactory
=
rowFactoryClass
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
db69a996
...
@@ -2179,7 +2179,7 @@ public class Database implements DataHandler {
...
@@ -2179,7 +2179,7 @@ public class Database implements DataHandler {
}
else
{
}
else
{
try
{
try
{
eventListener
=
(
DatabaseEventListener
)
eventListener
=
(
DatabaseEventListener
)
JdbcUtils
.
loadUserClass
(
className
).
newInstance
();
JdbcUtils
.
loadUserClass
(
className
).
getDeclaredConstructor
().
newInstance
();
String
url
=
databaseURL
;
String
url
=
databaseURL
;
if
(
cipher
!=
null
)
{
if
(
cipher
!=
null
)
{
url
+=
";CIPHER="
+
cipher
;
url
+=
";CIPHER="
+
cipher
;
...
@@ -2939,7 +2939,7 @@ public class Database implements DataHandler {
...
@@ -2939,7 +2939,7 @@ public class Database implements DataHandler {
!
serializerName
.
equals
(
"null"
))
{
!
serializerName
.
equals
(
"null"
))
{
try
{
try
{
javaObjectSerializer
=
(
JavaObjectSerializer
)
javaObjectSerializer
=
(
JavaObjectSerializer
)
JdbcUtils
.
loadUserClass
(
serializerName
).
newInstance
();
JdbcUtils
.
loadUserClass
(
serializerName
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
@@ -2968,7 +2968,7 @@ public class Database implements DataHandler {
...
@@ -2968,7 +2968,7 @@ public class Database implements DataHandler {
TableEngine
engine
=
tableEngines
.
get
(
tableEngine
);
TableEngine
engine
=
tableEngines
.
get
(
tableEngine
);
if
(
engine
==
null
)
{
if
(
engine
==
null
)
{
try
{
try
{
engine
=
(
TableEngine
)
JdbcUtils
.
loadUserClass
(
tableEngine
).
newInstance
();
engine
=
(
TableEngine
)
JdbcUtils
.
loadUserClass
(
tableEngine
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
...
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
db69a996
...
@@ -409,7 +409,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
...
@@ -409,7 +409,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
className
=
StringUtils
.
trim
(
className
,
true
,
true
,
"'"
);
className
=
StringUtils
.
trim
(
className
,
true
,
true
,
"'"
);
try
{
try
{
eventListener
=
(
DatabaseEventListener
)
JdbcUtils
eventListener
=
(
DatabaseEventListener
)
JdbcUtils
.
loadUserClass
(
className
).
newInstance
();
.
loadUserClass
(
className
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
@@ -794,7 +794,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
...
@@ -794,7 +794,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
if
(!
serializerFQN
.
isEmpty
()
&&
!
serializerFQN
.
equals
(
"null"
))
{
if
(!
serializerFQN
.
isEmpty
()
&&
!
serializerFQN
.
equals
(
"null"
))
{
try
{
try
{
javaObjectSerializer
=
(
JavaObjectSerializer
)
JdbcUtils
javaObjectSerializer
=
(
JavaObjectSerializer
)
JdbcUtils
.
loadUserClass
(
serializerFQN
).
newInstance
();
.
loadUserClass
(
serializerFQN
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
...
h2/src/main/org/h2/engine/UserAggregate.java
浏览文件 @
db69a996
...
@@ -39,7 +39,7 @@ public class UserAggregate extends DbObjectBase {
...
@@ -39,7 +39,7 @@ public class UserAggregate extends DbObjectBase {
}
}
Object
obj
;
Object
obj
;
try
{
try
{
obj
=
javaClass
.
newInstance
();
obj
=
javaClass
.
getDeclaredConstructor
().
newInstance
();
Aggregate
agg
;
Aggregate
agg
;
if
(
obj
instanceof
Aggregate
)
{
if
(
obj
instanceof
Aggregate
)
{
agg
=
(
Aggregate
)
obj
;
agg
=
(
Aggregate
)
obj
;
...
...
h2/src/main/org/h2/message/TraceSystem.java
浏览文件 @
db69a996
...
@@ -189,7 +189,7 @@ public class TraceSystem implements TraceWriter {
...
@@ -189,7 +189,7 @@ public class TraceSystem implements TraceWriter {
if
(
level
==
ADAPTER
)
{
if
(
level
==
ADAPTER
)
{
String
adapterClass
=
"org.h2.message.TraceWriterAdapter"
;
String
adapterClass
=
"org.h2.message.TraceWriterAdapter"
;
try
{
try
{
writer
=
(
TraceWriter
)
Class
.
forName
(
adapterClass
).
newInstance
();
writer
=
(
TraceWriter
)
Class
.
forName
(
adapterClass
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
e
=
DbException
.
get
(
ErrorCode
.
CLASS_NOT_FOUND_1
,
e
,
adapterClass
);
e
=
DbException
.
get
(
ErrorCode
.
CLASS_NOT_FOUND_1
,
e
,
adapterClass
);
write
(
ERROR
,
Trace
.
DATABASE
,
adapterClass
,
e
);
write
(
ERROR
,
Trace
.
DATABASE
,
adapterClass
,
e
);
...
...
h2/src/main/org/h2/schema/TriggerObject.java
浏览文件 @
db69a996
...
@@ -74,7 +74,7 @@ public class TriggerObject extends SchemaObjectBase {
...
@@ -74,7 +74,7 @@ public class TriggerObject extends SchemaObjectBase {
Connection
c2
=
sysSession
.
createConnection
(
false
);
Connection
c2
=
sysSession
.
createConnection
(
false
);
Object
obj
;
Object
obj
;
if
(
triggerClassName
!=
null
)
{
if
(
triggerClassName
!=
null
)
{
obj
=
JdbcUtils
.
loadUserClass
(
triggerClassName
).
newInstance
();
obj
=
JdbcUtils
.
loadUserClass
(
triggerClassName
).
getDeclaredConstructor
().
newInstance
();
}
else
{
}
else
{
obj
=
loadFromSource
();
obj
=
loadFromSource
();
}
}
...
...
h2/src/main/org/h2/security/auth/DefaultAuthenticator.java
浏览文件 @
db69a996
...
@@ -245,7 +245,7 @@ public class DefaultAuthenticator implements Authenticator {
...
@@ -245,7 +245,7 @@ public class DefaultAuthenticator implements Authenticator {
CredentialsValidator
currentValidator
=
null
;
CredentialsValidator
currentValidator
=
null
;
try
{
try
{
currentValidator
=
(
CredentialsValidator
)
Class
.
forName
(
currentRealmConfig
.
getValidatorClass
())
currentValidator
=
(
CredentialsValidator
)
Class
.
forName
(
currentRealmConfig
.
getValidatorClass
())
.
newInstance
();
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
AuthenticationException
(
"invalid validator class fo realm "
+
currentRealmName
,
e
);
throw
new
AuthenticationException
(
"invalid validator class fo realm "
+
currentRealmName
,
e
);
}
}
...
@@ -260,7 +260,7 @@ public class DefaultAuthenticator implements Authenticator {
...
@@ -260,7 +260,7 @@ public class DefaultAuthenticator implements Authenticator {
UserToRolesMapper
currentUserToRolesMapper
=
null
;
UserToRolesMapper
currentUserToRolesMapper
=
null
;
try
{
try
{
currentUserToRolesMapper
=
(
UserToRolesMapper
)
Class
currentUserToRolesMapper
=
(
UserToRolesMapper
)
Class
.
forName
(
currentUserToRolesMapperConfig
.
getClassName
()).
newInstance
();
.
forName
(
currentUserToRolesMapperConfig
.
getClassName
()).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
AuthenticationException
(
"Invalid class in UserToRolesMapperConfig"
,
e
);
throw
new
AuthenticationException
(
"Invalid class in UserToRolesMapperConfig"
,
e
);
}
}
...
...
h2/src/main/org/h2/store/fs/FilePath.java
浏览文件 @
db69a996
...
@@ -78,7 +78,7 @@ public abstract class FilePath {
...
@@ -78,7 +78,7 @@ public abstract class FilePath {
"org.h2.store.fs.FilePathRetryOnInterrupt"
"org.h2.store.fs.FilePathRetryOnInterrupt"
})
{
})
{
try
{
try
{
FilePath
p
=
(
FilePath
)
Class
.
forName
(
c
).
newInstance
();
FilePath
p
=
(
FilePath
)
Class
.
forName
(
c
).
getDeclaredConstructor
().
newInstance
();
map
.
put
(
p
.
getScheme
(),
p
);
map
.
put
(
p
.
getScheme
(),
p
);
if
(
defaultProvider
==
null
)
{
if
(
defaultProvider
==
null
)
{
defaultProvider
=
p
;
defaultProvider
=
p
;
...
...
h2/src/main/org/h2/store/fs/FilePathWrapper.java
浏览文件 @
db69a996
...
@@ -41,7 +41,7 @@ public abstract class FilePathWrapper extends FilePath {
...
@@ -41,7 +41,7 @@ public abstract class FilePathWrapper extends FilePath {
private
FilePathWrapper
create
(
String
path
,
FilePath
base
)
{
private
FilePathWrapper
create
(
String
path
,
FilePath
base
)
{
try
{
try
{
FilePathWrapper
p
=
getClass
().
newInstance
();
FilePathWrapper
p
=
getClass
().
getDeclaredConstructor
().
newInstance
();
p
.
name
=
path
;
p
.
name
=
path
;
p
.
base
=
base
;
p
.
base
=
base
;
return
p
;
return
p
;
...
...
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
db69a996
...
@@ -114,7 +114,7 @@ public class JdbcUtils {
...
@@ -114,7 +114,7 @@ public class JdbcUtils {
String
clazz
=
SysProperties
.
JAVA_OBJECT_SERIALIZER
;
String
clazz
=
SysProperties
.
JAVA_OBJECT_SERIALIZER
;
if
(
clazz
!=
null
)
{
if
(
clazz
!=
null
)
{
try
{
try
{
serializer
=
(
JavaObjectSerializer
)
loadUserClass
(
clazz
).
newInstance
();
serializer
=
(
JavaObjectSerializer
)
loadUserClass
(
clazz
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
@@ -124,7 +124,7 @@ public class JdbcUtils {
...
@@ -124,7 +124,7 @@ public class JdbcUtils {
if
(
customTypeHandlerClass
!=
null
)
{
if
(
customTypeHandlerClass
!=
null
)
{
try
{
try
{
customDataTypesHandler
=
(
CustomDataTypesHandler
)
customDataTypesHandler
=
(
CustomDataTypesHandler
)
loadUserClass
(
customTypeHandlerClass
).
newInstance
();
loadUserClass
(
customTypeHandlerClass
).
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
@@ -290,7 +290,7 @@ public class JdbcUtils {
...
@@ -290,7 +290,7 @@ public class JdbcUtils {
Class
<?>
d
=
loadUserClass
(
driver
);
Class
<?>
d
=
loadUserClass
(
driver
);
if
(
java
.
sql
.
Driver
.
class
.
isAssignableFrom
(
d
))
{
if
(
java
.
sql
.
Driver
.
class
.
isAssignableFrom
(
d
))
{
try
{
try
{
Driver
driverInstance
=
(
Driver
)
d
.
newInstance
();
Driver
driverInstance
=
(
Driver
)
d
.
getDeclaredConstructor
().
newInstance
();
return
driverInstance
.
connect
(
url
,
prop
);
/*fix issue #695 with drivers with the same
return
driverInstance
.
connect
(
url
,
prop
);
/*fix issue #695 with drivers with the same
jdbc subprotocol in classpath of jdbc drivers (as example redshift and postgresql drivers)*/
jdbc subprotocol in classpath of jdbc drivers (as example redshift and postgresql drivers)*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -299,7 +299,7 @@ public class JdbcUtils {
...
@@ -299,7 +299,7 @@ public class JdbcUtils {
}
else
if
(
javax
.
naming
.
Context
.
class
.
isAssignableFrom
(
d
))
{
}
else
if
(
javax
.
naming
.
Context
.
class
.
isAssignableFrom
(
d
))
{
// JNDI context
// JNDI context
try
{
try
{
Context
context
=
(
Context
)
d
.
newInstance
();
Context
context
=
(
Context
)
d
.
getDeclaredConstructor
().
newInstance
();
DataSource
ds
=
(
DataSource
)
context
.
lookup
(
url
);
DataSource
ds
=
(
DataSource
)
context
.
lookup
(
url
);
String
user
=
prop
.
getProperty
(
"user"
);
String
user
=
prop
.
getProperty
(
"user"
);
String
password
=
prop
.
getProperty
(
"password"
);
String
password
=
prop
.
getProperty
(
"password"
);
...
...
h2/src/main/org/h2/util/SourceCompiler.java
浏览文件 @
db69a996
...
@@ -399,7 +399,7 @@ public class SourceCompiler {
...
@@ -399,7 +399,7 @@ public class SourceCompiler {
System
.
setErr
(
temp
);
System
.
setErr
(
temp
);
Method
compile
;
Method
compile
;
compile
=
JAVAC_SUN
.
getMethod
(
"compile"
,
String
[].
class
);
compile
=
JAVAC_SUN
.
getMethod
(
"compile"
,
String
[].
class
);
Object
javac
=
JAVAC_SUN
.
newInstance
();
Object
javac
=
JAVAC_SUN
.
getDeclaredConstructor
().
newInstance
();
compile
.
invoke
(
javac
,
(
Object
)
new
String
[]
{
compile
.
invoke
(
javac
,
(
Object
)
new
String
[]
{
"-sourcepath"
,
COMPILE_DIR
,
"-sourcepath"
,
COMPILE_DIR
,
// "-Xlint:unchecked",
// "-Xlint:unchecked",
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
db69a996
...
@@ -1054,11 +1054,8 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -1054,11 +1054,8 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
private
static
TestBase
createTest
(
String
className
)
{
private
static
TestBase
createTest
(
String
className
)
{
try
{
try
{
Class
<?>
clazz
=
Class
.
forName
(
className
);
Class
<?>
clazz
=
Class
.
forName
(
className
);
return
(
TestBase
)
clazz
.
newInstance
();
return
(
TestBase
)
clazz
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
|
NoClassDefFoundError
e
)
{
// ignore
TestBase
.
printlnWithTime
(
0
,
className
+
" class not found"
);
}
catch
(
NoClassDefFoundError
e
)
{
// ignore
// ignore
TestBase
.
printlnWithTime
(
0
,
className
+
" class not found"
);
TestBase
.
printlnWithTime
(
0
,
className
+
" class not found"
);
}
}
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
db69a996
...
@@ -1303,7 +1303,7 @@ public abstract class TestBase {
...
@@ -1303,7 +1303,7 @@ public abstract class TestBase {
try
{
try
{
return
(
TestBase
)
new
SecurityManager
()
{
return
(
TestBase
)
new
SecurityManager
()
{
Class
<?>
clazz
=
getClassContext
()[
2
];
Class
<?>
clazz
=
getClassContext
()[
2
];
}.
clazz
.
newInstance
();
}.
clazz
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
h2/src/test/org/h2/test/bench/Database.java
浏览文件 @
db69a996
...
@@ -107,7 +107,7 @@ class Database {
...
@@ -107,7 +107,7 @@ class Database {
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
}
else
if
(
url
.
startsWith
(
"jdbc:derby://"
))
{
}
else
if
(
url
.
startsWith
(
"jdbc:derby://"
))
{
serverDerby
=
Class
.
forName
(
serverDerby
=
Class
.
forName
(
"org.apache.derby.drda.NetworkServerControl"
).
newInstance
();
"org.apache.derby.drda.NetworkServerControl"
).
getDeclaredConstructor
().
newInstance
();
Method
m
=
serverDerby
.
getClass
().
getMethod
(
"start"
,
PrintWriter
.
class
);
Method
m
=
serverDerby
.
getClass
().
getMethod
(
"start"
,
PrintWriter
.
class
);
m
.
invoke
(
serverDerby
,
new
Object
[]
{
null
});
m
.
invoke
(
serverDerby
,
new
Object
[]
{
null
});
// serverDerby = new NetworkServerControl();
// serverDerby = new NetworkServerControl();
...
...
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
db69a996
...
@@ -111,7 +111,7 @@ public class TestPerformance implements Database.DatabaseTest {
...
@@ -111,7 +111,7 @@ public class TestPerformance implements Database.DatabaseTest {
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
String
testString
=
prop
.
getProperty
(
"test"
+
i
);
String
testString
=
prop
.
getProperty
(
"test"
+
i
);
if
(
testString
!=
null
)
{
if
(
testString
!=
null
)
{
Bench
bench
=
(
Bench
)
Class
.
forName
(
testString
).
newInstance
();
Bench
bench
=
(
Bench
)
Class
.
forName
(
testString
).
getDeclaredConstructor
().
newInstance
();
tests
.
add
(
bench
);
tests
.
add
(
bench
);
}
}
}
}
...
...
h2/src/test/org/h2/test/db/TaskDef.java
浏览文件 @
db69a996
...
@@ -28,7 +28,7 @@ public abstract class TaskDef {
...
@@ -28,7 +28,7 @@ public abstract class TaskDef {
TaskDef
task
;
TaskDef
task
;
try
{
try
{
String
className
=
args
[
0
];
String
className
=
args
[
0
];
task
=
(
TaskDef
)
Class
.
forName
(
className
).
newInstance
();
task
=
(
TaskDef
)
Class
.
forName
(
className
).
getDeclaredConstructor
().
newInstance
();
System
.
out
.
println
(
"running"
);
System
.
out
.
println
(
"running"
);
}
catch
(
Throwable
t
)
{
}
catch
(
Throwable
t
)
{
System
.
out
.
println
(
"init error: "
+
t
);
System
.
out
.
println
(
"init error: "
+
t
);
...
...
h2/src/test/org/h2/test/poweroff/TestRecover.java
浏览文件 @
db69a996
...
@@ -205,7 +205,7 @@ public class TestRecover {
...
@@ -205,7 +205,7 @@ public class TestRecover {
// ignore
// ignore
}
}
try
{
try
{
Driver
driver
=
(
Driver
)
Class
.
forName
(
DRIVER
).
newInstance
();
Driver
driver
=
(
Driver
)
Class
.
forName
(
DRIVER
).
getDeclaredConstructor
().
newInstance
();
DriverManager
.
registerDriver
(
driver
);
DriverManager
.
registerDriver
(
driver
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
h2/src/test/org/h2/test/unit/TestClassLoaderLeak.java
浏览文件 @
db69a996
...
@@ -63,9 +63,9 @@ public class TestClassLoaderLeak extends TestBase {
...
@@ -63,9 +63,9 @@ public class TestClassLoaderLeak extends TestBase {
}
}
}
}
DriverManager
.
registerDriver
((
Driver
)
DriverManager
.
registerDriver
((
Driver
)
Class
.
forName
(
"org.h2.Driver"
).
newInstance
());
Class
.
forName
(
"org.h2.Driver"
).
getDeclaredConstructor
().
newInstance
());
DriverManager
.
registerDriver
((
Driver
)
DriverManager
.
registerDriver
((
Driver
)
Class
.
forName
(
"org.h2.upgrade.v1_1.Driver"
).
newInstance
());
Class
.
forName
(
"org.h2.upgrade.v1_1.Driver"
).
getDeclaredConstructor
().
newInstance
());
}
}
private
static
WeakReference
<
ClassLoader
>
createClassLoader
()
throws
Exception
{
private
static
WeakReference
<
ClassLoader
>
createClassLoader
()
throws
Exception
{
...
...
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
db69a996
...
@@ -974,7 +974,7 @@ public class BuildBase {
...
@@ -974,7 +974,7 @@ public class BuildBase {
}));
}));
}
}
Method
compile
=
clazz
.
getMethod
(
"compile"
,
new
Class
<?>[]
{
String
[].
class
});
Method
compile
=
clazz
.
getMethod
(
"compile"
,
new
Class
<?>[]
{
String
[].
class
});
Object
instance
=
clazz
.
newInstance
();
Object
instance
=
clazz
.
getDeclaredConstructor
().
newInstance
();
result
=
(
Integer
)
invoke
(
compile
,
instance
,
new
Object
[]
{
array
});
result
=
(
Integer
)
invoke
(
compile
,
instance
,
new
Object
[]
{
array
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
h2/src/tools/org/h2/jaqu/Db.java
浏览文件 @
db69a996
...
@@ -66,7 +66,7 @@ public class Db {
...
@@ -66,7 +66,7 @@ public class Db {
private
static
<
T
>
T
instance
(
Class
<
T
>
clazz
)
{
private
static
<
T
>
T
instance
(
Class
<
T
>
clazz
)
{
try
{
try
{
return
clazz
.
newInstance
();
return
clazz
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
h2/src/tools/org/h2/jaqu/util/ClassUtils.java
浏览文件 @
db69a996
...
@@ -65,7 +65,7 @@ public class ClassUtils {
...
@@ -65,7 +65,7 @@ public class ClassUtils {
return
(
T
)
new
ArrayList
<>();
return
(
T
)
new
ArrayList
<>();
}
}
try
{
try
{
return
clazz
.
newInstance
();
return
clazz
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
MAKE_ACCESSIBLE
)
{
if
(
MAKE_ACCESSIBLE
)
{
Constructor
<?>[]
constructors
=
clazz
.
getDeclaredConstructors
();
Constructor
<?>[]
constructors
=
clazz
.
getDeclaredConstructors
();
...
@@ -74,7 +74,7 @@ public class ClassUtils {
...
@@ -74,7 +74,7 @@ public class ClassUtils {
if
(
c
.
getParameterTypes
().
length
==
0
)
{
if
(
c
.
getParameterTypes
().
length
==
0
)
{
c
.
setAccessible
(
true
);
c
.
setAccessible
(
true
);
try
{
try
{
return
clazz
.
newInstance
();
return
clazz
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e2
)
{
}
catch
(
Exception
e2
)
{
// ignore
// ignore
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论