提交 0d889897 authored 作者: Thomas Mueller's avatar Thomas Mueller

Avoid throwing runtime exceptions; trace message calls.

上级 b2e5b90f
...@@ -1609,9 +1609,26 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1609,9 +1609,26 @@ public class JdbcConnection extends TraceObject implements Connection {
@Override @Override
public void setClientInfo(String name, String value) public void setClientInfo(String name, String value)
throws SQLClientInfoException { throws SQLClientInfoException {
checkClosed(); try {
// we don't have any client properties, so just throw if (isDebugEnabled()) {
throw new SQLClientInfoException(); debugCode("setClientInfo("
+quote(name)+", "
+quote(value)+");");
}
checkClosed();
// we don't have any client properties, so just throw
throw new SQLClientInfoException();
} catch (Exception e) {
throw convertToClientInfoException(logAndConvert(e));
}
}
private static SQLClientInfoException convertToClientInfoException(SQLException x) {
if (x instanceof SQLClientInfoException) {
return (SQLClientInfoException) x;
}
return new SQLClientInfoException(
x.getMessage(), x.getSQLState(), x.getErrorCode(), null, null);
} }
/** /**
...@@ -1622,9 +1639,16 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1622,9 +1639,16 @@ public class JdbcConnection extends TraceObject implements Connection {
*/ */
@Override @Override
public void setClientInfo(Properties properties) throws SQLClientInfoException { public void setClientInfo(Properties properties) throws SQLClientInfoException {
checkClosed(); try {
// we don't have any client properties, so just throw if (isDebugEnabled()) {
throw new SQLClientInfoException(); debugCode("setClientInfo(properties);");
}
checkClosed();
// we don't have any client properties, so just throw
throw new SQLClientInfoException();
} catch (Exception e) {
throw convertToClientInfoException(logAndConvert(e));
}
} }
/** /**
...@@ -1634,10 +1658,14 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1634,10 +1658,14 @@ public class JdbcConnection extends TraceObject implements Connection {
* @return always null * @return always null
*/ */
@Override @Override
public Properties getClientInfo() throws SQLClientInfoException { public Properties getClientInfo() throws SQLException {
checkClosed(); try {
// we don't have any client properties, so return null debugCode("getClientInfo();");
return null; // we don't have any client properties, so return null
return null;
} catch (Exception e) {
throw logAndConvert(e);
}
} }
/** /**
...@@ -1649,9 +1677,14 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1649,9 +1677,14 @@ public class JdbcConnection extends TraceObject implements Connection {
*/ */
@Override @Override
public String getClientInfo(String name) throws SQLException { public String getClientInfo(String name) throws SQLException {
checkClosed(); try {
// we don't have any client properties, so just throw debugCodeCall("getClientInfo", name);
throw new SQLClientInfoException(); checkClosed();
// we don't have any client properties, so just throw
throw new SQLClientInfoException();
} catch (Exception e) {
throw logAndConvert(e);
}
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论