提交 bd44a909 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improve code coverage.

上级 a38c75ec
...@@ -246,7 +246,7 @@ implements XAConnection, XAResource ...@@ -246,7 +246,7 @@ implements XAConnection, XAResource
//## Java 1.4 begin ## //## Java 1.4 begin ##
public int prepare(Xid xid) throws XAException { public int prepare(Xid xid) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("prepare("+quoteXid(xid)+");"); debugCode("prepare("+JdbcXid.toString(xid)+");");
} }
checkOpen(); checkOpen();
if (!currentTransaction.equals(xid)) { if (!currentTransaction.equals(xid)) {
...@@ -274,7 +274,7 @@ implements XAConnection, XAResource ...@@ -274,7 +274,7 @@ implements XAConnection, XAResource
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void forget(Xid xid) { public void forget(Xid xid) {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("forget("+quoteXid(xid)+");"); debugCode("forget("+JdbcXid.toString(xid)+");");
} }
} }
//## Java 1.4 end ## //## Java 1.4 end ##
...@@ -288,7 +288,7 @@ implements XAConnection, XAResource ...@@ -288,7 +288,7 @@ implements XAConnection, XAResource
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void rollback(Xid xid) throws XAException { public void rollback(Xid xid) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("rollback("+quoteXid(xid)+");"); debugCode("rollback("+JdbcXid.toString(xid)+");");
} }
try { try {
physicalConn.rollback(); physicalConn.rollback();
...@@ -319,7 +319,7 @@ implements XAConnection, XAResource ...@@ -319,7 +319,7 @@ implements XAConnection, XAResource
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void end(Xid xid, int flags) throws XAException { public void end(Xid xid, int flags) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("end("+quoteXid(xid)+", "+quoteFlags(flags)+");"); debugCode("end("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");");
} }
// TODO transaction end: implement this method // TODO transaction end: implement this method
if (flags == TMSUSPEND) { if (flags == TMSUSPEND) {
...@@ -341,7 +341,7 @@ implements XAConnection, XAResource ...@@ -341,7 +341,7 @@ implements XAConnection, XAResource
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void start(Xid xid, int flags) throws XAException { public void start(Xid xid, int flags) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("start("+quoteXid(xid)+", "+quoteFlags(flags)+");"); debugCode("start("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");");
} }
if (flags == TMRESUME) { if (flags == TMRESUME) {
return; return;
...@@ -372,7 +372,7 @@ implements XAConnection, XAResource ...@@ -372,7 +372,7 @@ implements XAConnection, XAResource
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void commit(Xid xid, boolean onePhase) throws XAException { public void commit(Xid xid, boolean onePhase) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("commit("+quoteXid(xid)+", "+onePhase+");"); debugCode("commit("+JdbcXid.toString(xid)+", "+onePhase+");");
} }
Statement stat = null; Statement stat = null;
try { try {
...@@ -428,20 +428,6 @@ implements XAConnection, XAResource ...@@ -428,20 +428,6 @@ implements XAConnection, XAResource
return xa; return xa;
} }
private String quoteXid(Xid xid) {
StringBuilder buff = new StringBuilder();
buff.append("\"f:").
append(xid.getFormatId()).
append(",bq:").
append(StringUtils.convertBytesToString(xid.getBranchQualifier())).
append(",gx:").
append(StringUtils.convertBytesToString(xid.getGlobalTransactionId())).
append(",c:").
append(xid.getClass().getName()).
append("\"");
return buff.toString();
}
private String quoteFlags(int flags) { private String quoteFlags(int flags) {
StringBuilder buff = new StringBuilder(); StringBuilder buff = new StringBuilder();
if ((flags & XAResource.TMENDRSCAN) != 0) { if ((flags & XAResource.TMENDRSCAN) != 0) {
......
...@@ -88,11 +88,4 @@ implements Xid ...@@ -88,11 +88,4 @@ implements Xid
return globalTransactionId; return globalTransactionId;
} }
/**
* INTERNAL
*/
public String toString() {
return getTraceObjectName() + ": " + toString(this);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论