Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
36ed8325
提交
36ed8325
authored
7月 06, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
If a pooled connection was not closed but garbage collected, a NullPointerException could occur.
上级
b6d235be
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
39 行增加
和
4 行删除
+39
-4
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+8
-2
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+19
-0
TraceObject.java
h2/src/main/org/h2/message/TraceObject.java
+10
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
36ed8325
...
@@ -18,7 +18,8 @@ Change Log
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Fulltext search: a NullPointerException was thrown when updating a value that
<ul><li>
If a pooled connection was not closed but garbage collected, a NullPointerException could occur.
</li><li>
Fulltext search: a NullPointerException was thrown when updating a value that
was NULL previously.
was NULL previously.
</li><li>
The Recover tool did not work with .data.db files of the wrong size.
</li><li>
The Recover tool did not work with .data.db files of the wrong size.
</li><li>
Triggers: if there was an exception when initializing a trigger, this exception could be hidden,
</li><li>
Triggers: if there was an exception when initializing a trigger, this exception could be hidden,
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
36ed8325
...
@@ -59,6 +59,12 @@ import java.sql.SQLClientInfoException;
...
@@ -59,6 +59,12 @@ import java.sql.SQLClientInfoException;
* </p>
* </p>
*/
*/
public
class
JdbcConnection
extends
TraceObject
implements
Connection
{
public
class
JdbcConnection
extends
TraceObject
implements
Connection
{
/**
* The stack trace of when the connection was created.
*/
protected
Exception
openStackTrace
;
private
String
url
;
private
String
url
;
private
String
user
;
private
String
user
;
...
@@ -71,7 +77,6 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -71,7 +77,6 @@ public class JdbcConnection extends TraceObject implements Connection {
private
CommandInterface
getReadOnly
,
getGeneratedKeys
;
private
CommandInterface
getReadOnly
,
getGeneratedKeys
;
private
CommandInterface
setLockMode
,
getLockMode
;
private
CommandInterface
setLockMode
,
getLockMode
;
private
CommandInterface
setQueryTimeout
,
getQueryTimeout
;
private
CommandInterface
setQueryTimeout
,
getQueryTimeout
;
private
Exception
openStackTrace
;
//## Java 1.4 begin ##
//## Java 1.4 begin ##
private
int
savepointId
;
private
int
savepointId
;
...
@@ -285,6 +290,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -285,6 +290,7 @@ public class JdbcConnection extends TraceObject implements Connection {
public
synchronized
void
close
()
throws
SQLException
{
public
synchronized
void
close
()
throws
SQLException
{
try
{
try
{
debugCodeCall
(
"close"
);
debugCodeCall
(
"close"
);
openStackTrace
=
null
;
if
(
executingStatement
!=
null
)
{
if
(
executingStatement
!=
null
)
{
executingStatement
.
cancel
();
executingStatement
.
cancel
();
}
}
...
@@ -1320,7 +1326,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -1320,7 +1326,7 @@ public class JdbcConnection extends TraceObject implements Connection {
if
(
isInternal
)
{
if
(
isInternal
)
{
return
;
return
;
}
}
if
(
session
!=
null
)
{
if
(
session
!=
null
&&
openStackTrace
!=
null
)
{
trace
.
error
(
"Connection not closed"
,
openStackTrace
);
trace
.
error
(
"Connection not closed"
,
openStackTrace
);
try
{
try
{
close
();
close
();
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
36ed8325
...
@@ -20,6 +20,7 @@ import javax.transaction.xa.XAException;
...
@@ -20,6 +20,7 @@ import javax.transaction.xa.XAException;
import
javax.transaction.xa.XAResource
;
import
javax.transaction.xa.XAResource
;
import
javax.transaction.xa.Xid
;
import
javax.transaction.xa.Xid
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
...
@@ -28,6 +29,7 @@ import org.h2.util.StringUtils;
...
@@ -28,6 +29,7 @@ import org.h2.util.StringUtils;
//## Java 1.4 end ##
//## Java 1.4 end ##
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.message.Trace
;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
/*## Java 1.6 begin ##
/*## Java 1.6 begin ##
...
@@ -94,6 +96,7 @@ implements XAConnection, XAResource
...
@@ -94,6 +96,7 @@ implements XAConnection, XAResource
public
void
close
()
throws
SQLException
{
public
void
close
()
throws
SQLException
{
debugCodeCall
(
"close"
);
debugCodeCall
(
"close"
);
if
(
handleConn
!=
null
)
{
if
(
handleConn
!=
null
)
{
listeners
.
clear
();
handleConn
.
close
();
handleConn
.
close
();
}
}
if
(
physicalConn
!=
null
)
{
if
(
physicalConn
!=
null
)
{
...
@@ -479,6 +482,7 @@ implements XAConnection, XAResource
...
@@ -479,6 +482,7 @@ implements XAConnection, XAResource
public
PooledJdbcConnection
(
JdbcConnection
conn
)
{
public
PooledJdbcConnection
(
JdbcConnection
conn
)
{
super
(
conn
);
super
(
conn
);
openStackTrace
=
new
Exception
(
"Stack Trace"
);
}
}
public
synchronized
void
close
()
throws
SQLException
{
public
synchronized
void
close
()
throws
SQLException
{
...
@@ -501,6 +505,21 @@ implements XAConnection, XAResource
...
@@ -501,6 +505,21 @@ implements XAConnection, XAResource
super
.
checkClosed
(
write
);
super
.
checkClosed
(
write
);
}
}
protected
void
finalize
()
{
if
(!
SysProperties
.
runFinalize
)
{
return
;
}
Trace
trace
=
getTrace
();
try
{
if
(!
isClosed
())
{
trace
.
error
(
"Pooled connection not closed"
,
openStackTrace
);
JdbcXAConnection
.
this
.
close
();
}
}
catch
(
SQLException
e
)
{
trace
.
debug
(
"finalize"
,
e
);
}
}
}
}
}
}
h2/src/main/org/h2/message/TraceObject.java
浏览文件 @
36ed8325
...
@@ -131,7 +131,7 @@ public class TraceObject {
...
@@ -131,7 +131,7 @@ public class TraceObject {
}
}
/**
/**
* Update the trace.
* Update the trace
object
.
*
*
* @param trace the trace object
* @param trace the trace object
*/
*/
...
@@ -139,6 +139,15 @@ public class TraceObject {
...
@@ -139,6 +139,15 @@ public class TraceObject {
this
.
trace
=
trace
;
this
.
trace
=
trace
;
}
}
/**
* Get the trace object.
*
* @return the trace object
*/
protected
Trace
getTrace
()
{
return
trace
;
}
/**
/**
* INTERNAL
* INTERNAL
*/
*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论