提交 3ac7cad3 authored 作者: Thomas Mueller's avatar Thomas Mueller

catch Exception instead of Throwable

上级 f031fa50
...@@ -55,7 +55,7 @@ public class Driver implements java.sql.Driver { ...@@ -55,7 +55,7 @@ public class Driver implements java.sql.Driver {
return null; return null;
} }
return new JdbcConnection(url, info); return new JdbcConnection(url, info);
} catch (Throwable e) { } catch (Exception e) {
throw Message.convert(e); throw Message.convert(e);
} }
} }
......
...@@ -42,13 +42,14 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -42,13 +42,14 @@ public class JdbcArray extends TraceObject implements Array {
* This method always returns an Object[]. * This method always returns an Object[].
* *
* @return the Object array * @return the Object array
* @throws SQLException
*/ */
public Object getArray() throws SQLException { public Object getArray() throws SQLException {
try { try {
debugCodeCall("getArray"); debugCodeCall("getArray");
checkClosed(); checkClosed();
return get(); return get();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -59,6 +60,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -59,6 +60,7 @@ public class JdbcArray extends TraceObject implements Array {
* *
* @param map is ignored. Only empty or null maps are supported * @param map is ignored. Only empty or null maps are supported
* @return the Object array * @return the Object array
* @throws SQLException
*/ */
public Object getArray(Map map) throws SQLException { public Object getArray(Map map) throws SQLException {
try { try {
...@@ -66,7 +68,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -66,7 +68,7 @@ public class JdbcArray extends TraceObject implements Array {
checkMap(map); checkMap(map);
checkClosed(); checkClosed();
return get(); return get();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -79,13 +81,14 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -79,13 +81,14 @@ public class JdbcArray extends TraceObject implements Array {
* @param index the start index of the subset (starting with 1) * @param index the start index of the subset (starting with 1)
* @param count the maximum number of values * @param count the maximum number of values
* @return the Object array * @return the Object array
* @throws SQLException
*/ */
public Object getArray(long index, int count) throws SQLException { public Object getArray(long index, int count) throws SQLException {
try { try {
debugCode("getArray(" + index + ", " + count + ");"); debugCode("getArray(" + index + ", " + count + ");");
checkClosed(); checkClosed();
return get(index, count); return get(index, count);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -99,6 +102,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -99,6 +102,7 @@ public class JdbcArray extends TraceObject implements Array {
* @param count the maximum number of values * @param count the maximum number of values
* @param map is ignored. Only empty or null maps are supported * @param map is ignored. Only empty or null maps are supported
* @return the Object array * @return the Object array
* @throws SQLException
*/ */
public Object getArray(long index, int count, Map map) throws SQLException { public Object getArray(long index, int count, Map map) throws SQLException {
try { try {
...@@ -106,7 +110,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -106,7 +110,7 @@ public class JdbcArray extends TraceObject implements Array {
checkClosed(); checkClosed();
checkMap(map); checkMap(map);
return get(index, count); return get(index, count);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -116,13 +120,14 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -116,13 +120,14 @@ public class JdbcArray extends TraceObject implements Array {
* arrays and therefore there is no base type. * arrays and therefore there is no base type.
* *
* @return Types.NULL * @return Types.NULL
* @throws SQLException
*/ */
public int getBaseType() throws SQLException { public int getBaseType() throws SQLException {
try { try {
debugCodeCall("getBaseType"); debugCodeCall("getBaseType");
checkClosed(); checkClosed();
return Types.NULL; return Types.NULL;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -132,13 +137,14 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -132,13 +137,14 @@ public class JdbcArray extends TraceObject implements Array {
* type arrays and therefore there is no base type. * type arrays and therefore there is no base type.
* *
* @return "NULL" * @return "NULL"
* @throws SQLException
*/ */
public String getBaseTypeName() throws SQLException { public String getBaseTypeName() throws SQLException {
try { try {
debugCodeCall("getBaseTypeName"); debugCodeCall("getBaseTypeName");
checkClosed(); checkClosed();
return "NULL"; return "NULL";
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -149,13 +155,14 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -149,13 +155,14 @@ public class JdbcArray extends TraceObject implements Array {
* (starting with 1) and the second column the value. * (starting with 1) and the second column the value.
* *
* @return the result set * @return the result set
* @throws SQLException
*/ */
public ResultSet getResultSet() throws SQLException { public ResultSet getResultSet() throws SQLException {
try { try {
debugCodeCall("getResultSet"); debugCodeCall("getResultSet");
checkClosed(); checkClosed();
return getResultSet(get(), 0); return getResultSet(get(), 0);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -166,6 +173,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -166,6 +173,7 @@ public class JdbcArray extends TraceObject implements Array {
* *
* @param map is ignored. Only empty or null maps are supported * @param map is ignored. Only empty or null maps are supported
* @return the result set * @return the result set
* @throws SQLException
*/ */
public ResultSet getResultSet(Map map) throws SQLException { public ResultSet getResultSet(Map map) throws SQLException {
try { try {
...@@ -173,7 +181,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -173,7 +181,7 @@ public class JdbcArray extends TraceObject implements Array {
checkClosed(); checkClosed();
checkMap(map); checkMap(map);
return getResultSet(get(), 0); return getResultSet(get(), 0);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -187,13 +195,14 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -187,13 +195,14 @@ public class JdbcArray extends TraceObject implements Array {
* @param index the start index of the subset (starting with 1) * @param index the start index of the subset (starting with 1)
* @param count the maximum number of values * @param count the maximum number of values
* @return the result set * @return the result set
* @throws SQLException
*/ */
public ResultSet getResultSet(long index, int count) throws SQLException { public ResultSet getResultSet(long index, int count) throws SQLException {
try { try {
debugCode("getResultSet("+index+", " + count+");"); debugCode("getResultSet("+index+", " + count+");");
checkClosed(); checkClosed();
return getResultSet(get(index, count), index); return getResultSet(get(index, count), index);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -209,6 +218,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -209,6 +218,7 @@ public class JdbcArray extends TraceObject implements Array {
* @param count the maximum number of values * @param count the maximum number of values
* @param map is ignored. Only empty or null maps are supported * @param map is ignored. Only empty or null maps are supported
* @return the result set * @return the result set
* @throws SQLException
*/ */
public ResultSet getResultSet(long index, int count, Map map) throws SQLException { public ResultSet getResultSet(long index, int count, Map map) throws SQLException {
try { try {
...@@ -216,7 +226,7 @@ public class JdbcArray extends TraceObject implements Array { ...@@ -216,7 +226,7 @@ public class JdbcArray extends TraceObject implements Array {
checkClosed(); checkClosed();
checkMap(map); checkMap(map);
return getResultSet(get(index, count), index); return getResultSet(get(index, count), index);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
package org.h2.jdbc; package org.h2.jdbc;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
...@@ -41,6 +42,7 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -41,6 +42,7 @@ public class JdbcBlob extends TraceObject implements Blob {
* Returns the length. * Returns the length.
* *
* @return the length * @return the length
* @throws SQLException
*/ */
public long length() throws SQLException { public long length() throws SQLException {
try { try {
...@@ -67,7 +69,7 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -67,7 +69,7 @@ public class JdbcBlob extends TraceObject implements Blob {
in.close(); in.close();
} }
return size; return size;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -76,6 +78,7 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -76,6 +78,7 @@ public class JdbcBlob extends TraceObject implements Blob {
* [Not supported] Truncates the object. * [Not supported] Truncates the object.
* *
* @param len the new length * @param len the new length
* @throws SQLException
*/ */
public void truncate(long len) throws SQLException { public void truncate(long len) throws SQLException {
debugCodeCall("truncate", len); debugCodeCall("truncate", len);
...@@ -88,6 +91,7 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -88,6 +91,7 @@ public class JdbcBlob extends TraceObject implements Blob {
* @param pos the index, the first byte is at position 1 * @param pos the index, the first byte is at position 1
* @param length the number of bytes * @param length the number of bytes
* @return the bytes, at most length bytes * @return the bytes, at most length bytes
* @throws SQLException
*/ */
public byte[] getBytes(long pos, int length) throws SQLException { public byte[] getBytes(long pos, int length) throws SQLException {
try { try {
...@@ -109,13 +113,18 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -109,13 +113,18 @@ public class JdbcBlob extends TraceObject implements Blob {
in.close(); in.close();
} }
return out.toByteArray(); return out.toByteArray();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
/** /**
* [Not supported] Sets some bytes of the object. * [Not supported] Sets some bytes of the object.
*
* @param pos the write position
* @param bytes the bytes to set
* @return how many bytes have been written
* @throws SQLException
*/ */
public int setBytes(long pos, byte[] bytes) throws SQLException { public int setBytes(long pos, byte[] bytes) throws SQLException {
debugCode("setBytes("+pos+", bytes);"); debugCode("setBytes("+pos+", bytes);");
...@@ -124,6 +133,13 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -124,6 +133,13 @@ public class JdbcBlob extends TraceObject implements Blob {
/** /**
* [Not supported] Sets some bytes of the object. * [Not supported] Sets some bytes of the object.
*
* @param pos the write position
* @param bytes the bytes to set
* @param offset the bytes offset
* @param len the number of bytes to write
* @return how many bytes have been written
* @throws SQLException
*/ */
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException { public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
debugCode("setBytes("+pos+", bytes, "+offset+", "+len+");"); debugCode("setBytes("+pos+", bytes, "+offset+", "+len+");");
...@@ -134,19 +150,24 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -134,19 +150,24 @@ public class JdbcBlob extends TraceObject implements Blob {
* Returns the input stream. * Returns the input stream.
* *
* @return the input stream * @return the input stream
* @throws SQLException
*/ */
public InputStream getBinaryStream() throws SQLException { public InputStream getBinaryStream() throws SQLException {
try { try {
debugCodeCall("getBinaryStream"); debugCodeCall("getBinaryStream");
checkClosed(); checkClosed();
return value.getInputStream(); return value.getInputStream();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
/** /**
* [Not supported] Returns an output stream. * [Not supported] Returns an output stream.
*
* @param pos where to start writing
* @return the output stream to write into
* @throws SQLException
*/ */
public OutputStream setBinaryStream(long pos) throws SQLException { public OutputStream setBinaryStream(long pos) throws SQLException {
debugCodeCall("setBinaryStream", pos); debugCodeCall("setBinaryStream", pos);
...@@ -159,50 +180,51 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -159,50 +180,51 @@ public class JdbcBlob extends TraceObject implements Blob {
* @param pattern the pattern to search * @param pattern the pattern to search
* @param start the index, the first byte is at position 1 * @param start the index, the first byte is at position 1
* @return the position (first byte is at position 1), or -1 for not found * @return the position (first byte is at position 1), or -1 for not found
* @throws SQLException
*/ */
public long position(byte[] pattern, long start) throws SQLException { public long position(byte[] pattern, long start) throws SQLException {
debugCode("position(pattern, "+start+");"); debugCode("position(pattern, "+start+");");
if (false) {
try {
debugCode("position(pattern, " + start + ");");
if (pattern == null) {
return -1;
}
if (pattern.length == 0) {
return 1;
}
// TODO performance: blob pattern search is slow
BufferedInputStream in = new BufferedInputStream(value.getInputStream());
IOUtils.skipFully(in, start - 1);
int pos = 0;
int patternPos = 0;
while (true) {
int x = in.read();
if (x < 0) {
break;
}
if (x == (pattern[patternPos] & 0xff)) {
if (patternPos == 0) {
in.mark(pattern.length);
}
if (patternPos == pattern.length) {
return pos - patternPos;
}
patternPos++;
} else {
if (patternPos > 0) {
in.reset();
pos -= patternPos;
}
}
pos++;
}
return -1;
} catch (Exception e) {
throw logAndConvert(e);
}
}
throw Message.getUnsupportedException(); throw Message.getUnsupportedException();
// TODO test
// try {
// debugCode("position(pattern, "+start+");");
// if(pattern == null) {
// return -1;
// }
// if(pattern.length == 0) {
// return 1;
// }
// // TODO performance: blob pattern search is slow
// BufferedInputStream in =
// new BufferedInputStream(value.getInputStream());
// IOUtils.skipFully(in, start - 1);
// int pos = 0;
// int patternPos = 0;
// while(true) {
// int x = in.read();
// if(x<0) {
// break;
// }
// if(x == (pattern[patternPos] & 0xff)) {
// if(patternPos == 0) {
// in.mark(pattern.length);
// }
// if(patternPos == pattern.length) {
// return pos - patternPos;
// }
// patternPos++;
// } else {
// if(patternPos > 0) {
// in.reset();
// pos -= patternPos;
// }
// }
// pos++;
// }
// return -1;
// } catch(Throwable e) {
// throw logAndConvert(e);
// }
} }
/** /**
...@@ -211,29 +233,31 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -211,29 +233,31 @@ public class JdbcBlob extends TraceObject implements Blob {
* @param blobPattern the pattern to search * @param blobPattern the pattern to search
* @param start the index, the first byte is at position 1 * @param start the index, the first byte is at position 1
* @return the position (first byte is at position 1), or -1 for not found * @return the position (first byte is at position 1), or -1 for not found
* @throws SQLException
*/ */
public long position(Blob blobPattern, long start) throws SQLException { public long position(Blob blobPattern, long start) throws SQLException {
debugCode("position(blobPattern, "+start+");"); debugCode("position(blobPattern, "+start+");");
if (false) {
try {
debugCode("position(blobPattern, " + start + ");");
if (blobPattern == null) {
return -1;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = blobPattern.getBinaryStream();
while (true) {
int x = in.read();
if (x < 0) {
break;
}
out.write(x);
}
return position(out.toByteArray(), start);
} catch (Exception e) {
throw logAndConvert(e);
}
}
throw Message.getUnsupportedException(); throw Message.getUnsupportedException();
// try {
// debugCode("position(blobPattern, "+start+");");
// if(blobPattern == null) {
// return -1;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// InputStream in = blobPattern.getBinaryStream();
// while(true) {
// int x = in.read();
// if(x < 0) {
// break;
// }
// out.write(x);
// }
// return position(out.toByteArray(), start);
// } catch(Throwable e) {
// throw logAndConvert(e);
// }
} }
/** /**
...@@ -246,6 +270,11 @@ public class JdbcBlob extends TraceObject implements Blob { ...@@ -246,6 +270,11 @@ public class JdbcBlob extends TraceObject implements Blob {
/** /**
* [Not supported] Returns the input stream, starting from an offset. * [Not supported] Returns the input stream, starting from an offset.
*
* @param pos where to start reading
* @param length the number of bytes that will be read
* @return the input stream to read
* @throws SQLException
*/ */
public InputStream getBinaryStream(long pos, long length) throws SQLException { public InputStream getBinaryStream(long pos, long length) throws SQLException {
debugCode("getBinaryStream("+pos+", "+length+");"); debugCode("getBinaryStream("+pos+", "+length+");");
......
...@@ -27,7 +27,6 @@ import java.sql.Timestamp; ...@@ -27,7 +27,6 @@ import java.sql.Timestamp;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map; import java.util.Map;
import org.h2.engine.SessionInterface;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.message.TraceObject; import org.h2.message.TraceObject;
...@@ -37,8 +36,9 @@ import org.h2.message.TraceObject; ...@@ -37,8 +36,9 @@ import org.h2.message.TraceObject;
*/ */
public class JdbcCallableStatement extends JdbcPreparedStatement implements CallableStatement { public class JdbcCallableStatement extends JdbcPreparedStatement implements CallableStatement {
JdbcCallableStatement(SessionInterface session, JdbcConnection conn, String sql, int resultSetType, int id) throws SQLException { JdbcCallableStatement(JdbcConnection conn, String sql, int resultSetType, int id)
super(session, conn, sql, resultSetType, id, false); throws SQLException {
super(conn, sql, resultSetType, id, false);
setTrace(session.getTrace(), TraceObject.CALLABLE_STATEMENT, id); setTrace(session.getTrace(), TraceObject.CALLABLE_STATEMENT, id);
} }
......
...@@ -76,7 +76,7 @@ public class JdbcClob extends TraceObject implements Clob ...@@ -76,7 +76,7 @@ public class JdbcClob extends TraceObject implements Clob
} finally { } finally {
in.close(); in.close();
} }
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -100,7 +100,7 @@ public class JdbcClob extends TraceObject implements Clob ...@@ -100,7 +100,7 @@ public class JdbcClob extends TraceObject implements Clob
checkClosed(); checkClosed();
String s = value.getString(); String s = value.getString();
return IOUtils.getInputStream(s); return IOUtils.getInputStream(s);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -123,7 +123,7 @@ public class JdbcClob extends TraceObject implements Clob ...@@ -123,7 +123,7 @@ public class JdbcClob extends TraceObject implements Clob
debugCodeCall("getCharacterStream"); debugCodeCall("getCharacterStream");
checkClosed(); checkClosed();
return value.getReader(); return value.getReader();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -168,7 +168,7 @@ public class JdbcClob extends TraceObject implements Clob ...@@ -168,7 +168,7 @@ public class JdbcClob extends TraceObject implements Clob
reader.close(); reader.close();
} }
return buff.toString(); return buff.toString();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
......
...@@ -159,7 +159,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -159,7 +159,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(4 + i, types[i]); prep.setString(4 + i, types[i]);
} }
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -241,7 +241,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -241,7 +241,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(3, getPattern(tableNamePattern)); prep.setString(3, getPattern(tableNamePattern));
prep.setString(4, getPattern(columnNamePattern)); prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -319,7 +319,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -319,7 +319,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -369,7 +369,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -369,7 +369,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -403,7 +403,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -403,7 +403,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
try { try {
debugCodeCall("getURL"); debugCodeCall("getURL");
return conn.getURL(); return conn.getURL();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -418,7 +418,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -418,7 +418,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
try { try {
debugCodeCall("getUserName"); debugCodeCall("getUserName");
return conn.getUser(); return conn.getUser();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -432,7 +432,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -432,7 +432,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
try { try {
debugCodeCall("isReadOnly"); debugCodeCall("isReadOnly");
return conn.isReadOnly(); return conn.isReadOnly();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -538,7 +538,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -538,7 +538,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schemaPattern)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(procedureNamePattern)); prep.setString(3, getPattern(procedureNamePattern));
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -600,7 +600,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -600,7 +600,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(3, getPattern(procedureNamePattern)); prep.setString(3, getPattern(procedureNamePattern));
prep.setString(4, getPattern(columnNamePattern)); prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -630,7 +630,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -630,7 +630,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.SCHEMATA " + "FROM INFORMATION_SCHEMA.SCHEMATA "
+ "ORDER BY SCHEMA_NAME"); + "ORDER BY SCHEMA_NAME");
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -654,7 +654,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -654,7 +654,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
"SELECT CATALOG_NAME TABLE_CAT " "SELECT CATALOG_NAME TABLE_CAT "
+ "FROM INFORMATION_SCHEMA.CATALOGS"); + "FROM INFORMATION_SCHEMA.CATALOGS");
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -680,7 +680,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -680,7 +680,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.TABLE_TYPES " + "FROM INFORMATION_SCHEMA.TABLE_TYPES "
+ "ORDER BY TABLE_TYPE"); + "ORDER BY TABLE_TYPE");
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -742,7 +742,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -742,7 +742,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(3, table); prep.setString(3, table);
prep.setString(4, getPattern(columnNamePattern)); prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -797,7 +797,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -797,7 +797,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schemaPattern)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(tableNamePattern)); prep.setString(3, getPattern(tableNamePattern));
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -862,7 +862,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -862,7 +862,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(4, getSchemaPattern(schema)); prep.setString(4, getSchemaPattern(schema));
prep.setString(5, tableName); prep.setString(5, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -909,7 +909,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -909,7 +909,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.COLUMNS " + "FROM INFORMATION_SCHEMA.COLUMNS "
+ "WHERE FALSE"); + "WHERE FALSE");
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -978,7 +978,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -978,7 +978,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -1048,7 +1048,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1048,7 +1048,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -1134,7 +1134,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1134,7 +1134,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(5, getSchemaPattern(foreignSchema)); prep.setString(5, getSchemaPattern(foreignSchema));
prep.setString(6, foreignTable); prep.setString(6, foreignTable);
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -1182,7 +1182,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1182,7 +1182,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.CATALOGS " + "FROM INFORMATION_SCHEMA.CATALOGS "
+ "WHERE FALSE"); + "WHERE FALSE");
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -1244,7 +1244,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1244,7 +1244,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "ORDER BY DATA_TYPE, POS"); + "ORDER BY DATA_TYPE, POS");
ResultSet rs = prep.executeQuery(); ResultSet rs = prep.executeQuery();
return rs; return rs;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -1356,7 +1356,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1356,7 +1356,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
rs.close(); rs.close();
prep.close(); prep.close();
return buff.toString(); return buff.toString();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -2463,7 +2463,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -2463,7 +2463,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+quote(typeNamePattern)+");"); +quote(typeNamePattern)+");");
} }
throw Message.getUnsupportedException(); throw Message.getUnsupportedException();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -2499,7 +2499,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -2499,7 +2499,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.CATALOGS " + "FROM INFORMATION_SCHEMA.CATALOGS "
+ "WHERE FALSE"); + "WHERE FALSE");
return prep.executeQuery(); return prep.executeQuery();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -2519,7 +2519,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -2519,7 +2519,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+quote(attributeNamePattern)+");"); +quote(attributeNamePattern)+");");
} }
throw Message.getUnsupportedException(); throw Message.getUnsupportedException();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
......
...@@ -49,7 +49,7 @@ implements ParameterMetaData ...@@ -49,7 +49,7 @@ implements ParameterMetaData
debugCodeCall("getParameterCount"); debugCodeCall("getParameterCount");
checkClosed(); checkClosed();
return paramCount; return paramCount;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -67,7 +67,7 @@ implements ParameterMetaData ...@@ -67,7 +67,7 @@ implements ParameterMetaData
debugCodeCall("getParameterMode", param); debugCodeCall("getParameterMode", param);
getParameter(param); getParameter(param);
return parameterModeIn; return parameterModeIn;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -89,7 +89,7 @@ implements ParameterMetaData ...@@ -89,7 +89,7 @@ implements ParameterMetaData
type = Value.STRING; type = Value.STRING;
} }
return DataType.getDataType(type).sqlType; return DataType.getDataType(type).sqlType;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -106,7 +106,7 @@ implements ParameterMetaData ...@@ -106,7 +106,7 @@ implements ParameterMetaData
debugCodeCall("getPrecision", param); debugCodeCall("getPrecision", param);
ParameterInterface p = getParameter(param); ParameterInterface p = getParameter(param);
return MathUtils.convertLongToInt(p.getPrecision()); return MathUtils.convertLongToInt(p.getPrecision());
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -123,7 +123,7 @@ implements ParameterMetaData ...@@ -123,7 +123,7 @@ implements ParameterMetaData
debugCodeCall("getScale", param); debugCodeCall("getScale", param);
ParameterInterface p = getParameter(param); ParameterInterface p = getParameter(param);
return p.getScale(); return p.getScale();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -139,7 +139,7 @@ implements ParameterMetaData ...@@ -139,7 +139,7 @@ implements ParameterMetaData
try { try {
debugCodeCall("isNullable", param); debugCodeCall("isNullable", param);
return getParameter(param).getNullable(); return getParameter(param).getNullable();
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -156,7 +156,7 @@ implements ParameterMetaData ...@@ -156,7 +156,7 @@ implements ParameterMetaData
debugCodeCall("isSigned", param); debugCodeCall("isSigned", param);
getParameter(param); getParameter(param);
return true; return true;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -177,7 +177,7 @@ implements ParameterMetaData ...@@ -177,7 +177,7 @@ implements ParameterMetaData
type = Value.STRING; type = Value.STRING;
} }
return DataType.getTypeClassName(type); return DataType.getTypeClassName(type);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -198,7 +198,7 @@ implements ParameterMetaData ...@@ -198,7 +198,7 @@ implements ParameterMetaData
type = Value.STRING; type = Value.STRING;
} }
return DataType.getDataType(type).name; return DataType.getDataType(type).name;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
......
...@@ -27,7 +27,8 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -27,7 +27,8 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
private final ResultInterface result; private final ResultInterface result;
private final int columnCount; private final int columnCount;
JdbcResultSetMetaData(JdbcResultSet rs, JdbcPreparedStatement prep, ResultInterface result, String catalog, Trace trace, int id) { JdbcResultSetMetaData(JdbcResultSet rs, JdbcPreparedStatement prep, ResultInterface result,
String catalog, Trace trace, int id) {
setTrace(trace, TraceObject.RESULT_SET_META_DATA, id); setTrace(trace, TraceObject.RESULT_SET_META_DATA, id);
this.catalog = catalog; this.catalog = catalog;
this.rs = rs; this.rs = rs;
...@@ -47,7 +48,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -47,7 +48,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnCount"); debugCodeCall("getColumnCount");
checkClosed(); checkClosed();
return columnCount; return columnCount;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -64,7 +65,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -64,7 +65,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnLabel", column); debugCodeCall("getColumnLabel", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getAlias(--column); return result.getAlias(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -81,7 +82,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -81,7 +82,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnName", column); debugCodeCall("getColumnName", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getColumnName(--column); return result.getColumnName(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -99,7 +100,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -99,7 +100,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column); checkColumnIndex(column);
int type = result.getColumnType(--column); int type = result.getColumnType(--column);
return DataType.convertTypeToSQLType(type); return DataType.convertTypeToSQLType(type);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -117,7 +118,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -117,7 +118,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column); checkColumnIndex(column);
int type = result.getColumnType(--column); int type = result.getColumnType(--column);
return DataType.getDataType(type).name; return DataType.getDataType(type).name;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -134,7 +135,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -134,7 +135,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getSchemaName", column); debugCodeCall("getSchemaName", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getSchemaName(--column); return result.getSchemaName(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -151,7 +152,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -151,7 +152,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getTableName", column); debugCodeCall("getTableName", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getTableName(--column); return result.getTableName(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -168,7 +169,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -168,7 +169,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getCatalogName", column); debugCodeCall("getCatalogName", column);
checkColumnIndex(column); checkColumnIndex(column);
return catalog; return catalog;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -186,7 +187,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -186,7 +187,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isAutoIncrement", column); debugCodeCall("isAutoIncrement", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.isAutoIncrement(--column); return result.isAutoIncrement(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -204,7 +205,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -204,7 +205,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isCaseSensitive", column); debugCodeCall("isCaseSensitive", column);
checkColumnIndex(column); checkColumnIndex(column);
return true; return true;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -222,7 +223,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -222,7 +223,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isSearchable", column); debugCodeCall("isSearchable", column);
checkColumnIndex(column); checkColumnIndex(column);
return true; return true;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -240,7 +241,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -240,7 +241,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isCurrency", column); debugCodeCall("isCurrency", column);
checkColumnIndex(column); checkColumnIndex(column);
return false; return false;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -261,7 +262,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -261,7 +262,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isNullable", column); debugCodeCall("isNullable", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getNullable(--column); return result.getNullable(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -279,7 +280,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -279,7 +280,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isSigned", column); debugCodeCall("isSigned", column);
checkColumnIndex(column); checkColumnIndex(column);
return true; return true;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -297,7 +298,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -297,7 +298,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isReadOnly", column); debugCodeCall("isReadOnly", column);
checkColumnIndex(column); checkColumnIndex(column);
return false; return false;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -315,7 +316,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -315,7 +316,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isWritable", column); debugCodeCall("isWritable", column);
checkColumnIndex(column); checkColumnIndex(column);
return true; return true;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -333,7 +334,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -333,7 +334,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isDefinitelyWritable", column); debugCodeCall("isDefinitelyWritable", column);
checkColumnIndex(column); checkColumnIndex(column);
return false; return false;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -352,7 +353,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -352,7 +353,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column); checkColumnIndex(column);
int type = result.getColumnType(--column); int type = result.getColumnType(--column);
return DataType.getTypeClassName(type); return DataType.getTypeClassName(type);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -371,7 +372,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -371,7 +372,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column); checkColumnIndex(column);
long prec = result.getColumnPrecision(--column); long prec = result.getColumnPrecision(--column);
return MathUtils.convertLongToInt(prec); return MathUtils.convertLongToInt(prec);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -389,7 +390,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -389,7 +390,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getScale", column); debugCodeCall("getScale", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getColumnScale(--column); return result.getColumnScale(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -406,7 +407,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD ...@@ -406,7 +407,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnDisplaySize", column); debugCodeCall("getColumnDisplaySize", column);
checkColumnIndex(column); checkColumnIndex(column);
return result.getDisplaySize(--column); return result.getDisplaySize(--column);
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
......
...@@ -75,7 +75,7 @@ implements Savepoint ...@@ -75,7 +75,7 @@ implements Savepoint
throw Message.getSQLException(ErrorCode.SAVEPOINT_IS_NAMED); throw Message.getSQLException(ErrorCode.SAVEPOINT_IS_NAMED);
} }
return savepointId; return savepointId;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
...@@ -92,7 +92,7 @@ implements Savepoint ...@@ -92,7 +92,7 @@ implements Savepoint
throw Message.getSQLException(ErrorCode.SAVEPOINT_IS_UNNAMED); throw Message.getSQLException(ErrorCode.SAVEPOINT_IS_UNNAMED);
} }
return name; return name;
} catch (Throwable e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
......
...@@ -26,9 +26,9 @@ import java.sql.SQLException; ...@@ -26,9 +26,9 @@ import java.sql.SQLException;
import java.util.Stack; import java.util.Stack;
import javax.sql.ConnectionEvent; import javax.sql.ConnectionEvent;
import javax.sql.DataSource;
import javax.sql.ConnectionEventListener; import javax.sql.ConnectionEventListener;
import javax.sql.ConnectionPoolDataSource; import javax.sql.ConnectionPoolDataSource;
import javax.sql.DataSource;
import javax.sql.PooledConnection; import javax.sql.PooledConnection;
/*## Java 1.6 begin ## /*## Java 1.6 begin ##
......
...@@ -59,7 +59,7 @@ implements ObjectFactory ...@@ -59,7 +59,7 @@ implements ObjectFactory
* not JdbcDataSource. * not JdbcDataSource.
*/ */
//## Java 1.4 begin ## //## Java 1.4 begin ##
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) {
if (trace.isDebugEnabled()) { if (trace.isDebugEnabled()) {
trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment); trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment);
} }
......
...@@ -19,10 +19,10 @@ import javax.sql.XAConnection; ...@@ -19,10 +19,10 @@ import javax.sql.XAConnection;
import javax.transaction.xa.XAException; 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.jdbc.JdbcConnection;
import org.h2.util.ByteUtils; import org.h2.util.ByteUtils;
import org.h2.util.JdbcConnectionListener; import org.h2.util.JdbcConnectionListener;
import org.h2.util.JdbcUtils; import org.h2.util.JdbcUtils;
import org.h2.jdbc.JdbcConnection;
//## Java 1.4 end ## //## Java 1.4 end ##
import org.h2.message.TraceObject; import org.h2.message.TraceObject;
...@@ -83,6 +83,8 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -83,6 +83,8 @@ implements XAConnection, XAResource, JdbcConnectionListener
/** /**
* Close the physical connection. * Close the physical connection.
* This method is usually called by the connection pool. * This method is usually called by the connection pool.
*
* @throws SQLException
*/ */
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void close() throws SQLException { public void close() throws SQLException {
...@@ -102,6 +104,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -102,6 +104,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* pool when there are no more connections in the pool. * pool when there are no more connections in the pool.
* *
* @return the connection * @return the connection
* @throws SQLException
*/ */
//## Java 1.4 begin ## //## Java 1.4 begin ##
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
...@@ -217,6 +220,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -217,6 +220,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* @param flag TMSTARTRSCAN, TMENDRSCAN, or TMNOFLAGS. If no other flags are set, * @param flag TMSTARTRSCAN, TMENDRSCAN, or TMNOFLAGS. If no other flags are set,
* TMNOFLAGS must be used. * TMNOFLAGS must be used.
* @return zero or more Xid objects * @return zero or more Xid objects
* @throws XAException
*/ */
//## Java 1.4 begin ## //## Java 1.4 begin ##
public Xid[] recover(int flag) throws XAException { public Xid[] recover(int flag) throws XAException {
...@@ -249,6 +253,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -249,6 +253,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* Prepare a transaction. * Prepare a transaction.
* *
* @param xid the transaction id * @param xid the transaction id
* @throws XAException
*/ */
//## Java 1.4 begin ## //## Java 1.4 begin ##
public int prepare(Xid xid) throws XAException { public int prepare(Xid xid) throws XAException {
...@@ -291,6 +296,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -291,6 +296,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* Roll back a transaction. * Roll back a transaction.
* *
* @param xid the transaction id * @param xid the transaction id
* @throws XAException
*/ */
//## Java 1.4 begin ## //## Java 1.4 begin ##
public void rollback(Xid xid) throws XAException { public void rollback(Xid xid) throws XAException {
...@@ -311,6 +317,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -311,6 +317,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* *
* @param xid the transaction id * @param xid the transaction id
* @param flags TMSUCCESS, TMFAIL, or TMSUSPEND * @param flags TMSUCCESS, TMFAIL, or TMSUSPEND
* @throws XAException
*/ */
//## 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 {
...@@ -332,6 +339,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -332,6 +339,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* *
* @param xid the transaction id * @param xid the transaction id
* @param flags TMNOFLAGS, TMJOIN, or TMRESUME * @param flags TMNOFLAGS, TMJOIN, or TMRESUME
* @throws XAException
*/ */
//## 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 {
...@@ -358,6 +366,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -358,6 +366,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* *
* @param xid the transaction id * @param xid the transaction id
* @param onePhase use a one-phase protocol if true * @param onePhase use a one-phase protocol if true
* @throws XAException
*/ */
//## 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 {
......
...@@ -44,7 +44,7 @@ implements Xid ...@@ -44,7 +44,7 @@ implements Xid
formatId = Integer.parseInt(tokenizer.nextToken()); formatId = Integer.parseInt(tokenizer.nextToken());
branchQualifier = ByteUtils.convertStringToBytes(tokenizer.nextToken()); branchQualifier = ByteUtils.convertStringToBytes(tokenizer.nextToken());
globalTransactionId = ByteUtils.convertStringToBytes(tokenizer.nextToken()); globalTransactionId = ByteUtils.convertStringToBytes(tokenizer.nextToken());
} catch (Throwable e) { } catch (Exception e) {
throw Message.getSQLException(ErrorCode.WRONG_XID_FORMAT_1, tid); throw Message.getSQLException(ErrorCode.WRONG_XID_FORMAT_1, tid);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论