提交 17c8fe72 authored 作者: Thomas Mueller's avatar Thomas Mueller

Support for Java 1.3 and Java 1.4 has been removed.

上级 2c2262d3
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
package org.h2.fulltext; package org.h2.fulltext;
//## Java 1.4 begin ##
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
...@@ -38,7 +37,6 @@ import org.h2.util.JdbcUtils; ...@@ -38,7 +37,6 @@ import org.h2.util.JdbcUtils;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.StatementBuilder; import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
//## Java 1.4 end ##
/*## LUCENE2 begin ## /*## LUCENE2 begin ##
import org.apache.lucene.index.IndexModifier; import org.apache.lucene.index.IndexModifier;
import org.apache.lucene.search.Hits; import org.apache.lucene.search.Hits;
...@@ -64,7 +62,6 @@ public class FullTextLucene extends FullText { ...@@ -64,7 +62,6 @@ public class FullTextLucene extends FullText {
*/ */
protected static final boolean STORE_DOCUMENT_TEXT_IN_INDEX = Boolean.getBoolean("h2.storeDocumentTextInIndex"); protected static final boolean STORE_DOCUMENT_TEXT_IN_INDEX = Boolean.getBoolean("h2.storeDocumentTextInIndex");
//## Java 1.4 begin ##
private static final HashMap<String, IndexAccess> INDEX_ACCESS = New.hashMap(); private static final HashMap<String, IndexAccess> INDEX_ACCESS = New.hashMap();
private static final String TRIGGER_PREFIX = "FTL_"; private static final String TRIGGER_PREFIX = "FTL_";
private static final String SCHEMA = "FTL"; private static final String SCHEMA = "FTL";
...@@ -72,7 +69,6 @@ public class FullTextLucene extends FullText { ...@@ -72,7 +69,6 @@ public class FullTextLucene extends FullText {
private static final String LUCENE_FIELD_QUERY = "_QUERY"; private static final String LUCENE_FIELD_QUERY = "_QUERY";
private static final String LUCENE_FIELD_MODIFIED = "_modified"; private static final String LUCENE_FIELD_MODIFIED = "_modified";
private static final String LUCENE_FIELD_COLUMN_PREFIX = "_"; private static final String LUCENE_FIELD_COLUMN_PREFIX = "_";
//## Java 1.4 end ##
/** /**
* Initializes full text search functionality for this database. This adds * Initializes full text search functionality for this database. This adds
...@@ -96,7 +92,6 @@ public class FullTextLucene extends FullText { ...@@ -96,7 +92,6 @@ public class FullTextLucene extends FullText {
* *
* @param conn the connection * @param conn the connection
*/ */
//## Java 1.4 begin ##
public static void init(Connection conn) throws SQLException { public static void init(Connection conn) throws SQLException {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA); stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA);
...@@ -113,7 +108,6 @@ public class FullTextLucene extends FullText { ...@@ -113,7 +108,6 @@ public class FullTextLucene extends FullText {
throw convertException(e); throw convertException(e);
} }
} }
//## Java 1.4 end ##
/** /**
* Create a new full text index for a table and column list. Each table may * Create a new full text index for a table and column list. Each table may
...@@ -124,7 +118,6 @@ public class FullTextLucene extends FullText { ...@@ -124,7 +118,6 @@ public class FullTextLucene extends FullText {
* @param table the table name (case sensitive) * @param table the table name (case sensitive)
* @param columnList the column list (null for all columns) * @param columnList the column list (null for all columns)
*/ */
//## Java 1.4 begin ##
public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException { public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException {
init(conn); init(conn);
PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA
...@@ -136,7 +129,6 @@ public class FullTextLucene extends FullText { ...@@ -136,7 +129,6 @@ public class FullTextLucene extends FullText {
createTrigger(conn, schema, table); createTrigger(conn, schema, table);
indexExistingRows(conn, schema, table); indexExistingRows(conn, schema, table);
} }
//## Java 1.4 end ##
/** /**
* Re-creates the full text index for this database. Calling this method is * Re-creates the full text index for this database. Calling this method is
...@@ -144,7 +136,6 @@ public class FullTextLucene extends FullText { ...@@ -144,7 +136,6 @@ public class FullTextLucene extends FullText {
* *
* @param conn the connection * @param conn the connection
*/ */
//## Java 1.4 begin ##
public static void reindex(Connection conn) throws SQLException { public static void reindex(Connection conn) throws SQLException {
init(conn); init(conn);
removeAllTriggers(conn, TRIGGER_PREFIX); removeAllTriggers(conn, TRIGGER_PREFIX);
...@@ -158,21 +149,18 @@ public class FullTextLucene extends FullText { ...@@ -158,21 +149,18 @@ public class FullTextLucene extends FullText {
indexExistingRows(conn, schema, table); indexExistingRows(conn, schema, table);
} }
} }
//## Java 1.4 end ##
/** /**
* Drops all full text indexes from the database. * Drops all full text indexes from the database.
* *
* @param conn the connection * @param conn the connection
*/ */
//## Java 1.4 begin ##
public static void dropAll(Connection conn) throws SQLException { public static void dropAll(Connection conn) throws SQLException {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA); stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA);
removeAllTriggers(conn, TRIGGER_PREFIX); removeAllTriggers(conn, TRIGGER_PREFIX);
removeIndexFiles(conn); removeIndexFiles(conn);
} }
//## Java 1.4 end ##
/** /**
* Searches from the full text index for this database. * Searches from the full text index for this database.
...@@ -189,11 +177,9 @@ public class FullTextLucene extends FullText { ...@@ -189,11 +177,9 @@ public class FullTextLucene extends FullText {
* @param offset the offset or 0 for no offset * @param offset the offset or 0 for no offset
* @return the result set * @return the result set
*/ */
//## Java 1.4 begin ##
public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException { public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException {
return search(conn, text, limit, offset, false); return search(conn, text, limit, offset, false);
} }
//## Java 1.4 end ##
/** /**
* Searches from the full text index for this database. The result contains * Searches from the full text index for this database. The result contains
...@@ -215,7 +201,6 @@ public class FullTextLucene extends FullText { ...@@ -215,7 +201,6 @@ public class FullTextLucene extends FullText {
* @param offset the offset or 0 for no offset * @param offset the offset or 0 for no offset
* @return the result set * @return the result set
*/ */
//## Java 1.4 begin ##
public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException { public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException {
return search(conn, text, limit, offset, true); return search(conn, text, limit, offset, true);
} }
...@@ -470,18 +455,12 @@ public class FullTextLucene extends FullText { ...@@ -470,18 +455,12 @@ public class FullTextLucene extends FullText {
} }
return result; return result;
} }
//## Java 1.4 end ##
/** /**
* Trigger updates the index when a inserting, updating, or deleting a row. * Trigger updates the index when a inserting, updating, or deleting a row.
*/ */
public static class FullTextTrigger public static class FullTextTrigger implements Trigger {
//## Java 1.4 begin ##
implements Trigger
//## Java 1.4 end ##
{
//## Java 1.4 begin ##
protected String schema; protected String schema;
protected String table; protected String table;
protected int[] keys; protected int[] keys;
...@@ -490,12 +469,10 @@ public class FullTextLucene extends FullText { ...@@ -490,12 +469,10 @@ public class FullTextLucene extends FullText {
protected int[] columnTypes; protected int[] columnTypes;
protected String indexPath; protected String indexPath;
protected IndexAccess indexAccess; protected IndexAccess indexAccess;
//## Java 1.4 end ##
/** /**
* INTERNAL * INTERNAL
*/ */
//## Java 1.4 begin ##
public void init(Connection conn, String schemaName, String triggerName, public void init(Connection conn, String schemaName, String triggerName,
String tableName, boolean before, int type) throws SQLException { String tableName, boolean before, int type) throws SQLException {
this.schema = schemaName; this.schema = schemaName;
...@@ -556,12 +533,10 @@ public class FullTextLucene extends FullText { ...@@ -556,12 +533,10 @@ public class FullTextLucene extends FullText {
indexColumns = new int[indexList.size()]; indexColumns = new int[indexList.size()];
setColumns(indexColumns, indexList, columnList); setColumns(indexColumns, indexList, columnList);
} }
//## Java 1.4 end ##
/** /**
* INTERNAL * INTERNAL
*/ */
//## Java 1.4 begin ##
public void fire(Connection conn, Object[] oldRow, Object[] newRow) public void fire(Connection conn, Object[] oldRow, Object[] newRow)
throws SQLException { throws SQLException {
if (oldRow != null) { if (oldRow != null) {
...@@ -580,19 +555,16 @@ public class FullTextLucene extends FullText { ...@@ -580,19 +555,16 @@ public class FullTextLucene extends FullText {
insert(newRow); insert(newRow);
} }
} }
//## Java 1.4 end ##
/** /**
* INTERNAL * INTERNAL
*/ */
//## Java 1.4 begin ##
public void close() throws SQLException { public void close() throws SQLException {
if (indexAccess != null) { if (indexAccess != null) {
removeIndexAccess(indexAccess, indexPath); removeIndexAccess(indexAccess, indexPath);
indexAccess = null; indexAccess = null;
} }
} }
//## Java 1.4 end ##
/** /**
* INTERNAL * INTERNAL
......
...@@ -267,7 +267,7 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call ...@@ -267,7 +267,7 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
/** /**
* Returns the value of the specified column as a BigDecimal. * Returns the value of the specified column as a BigDecimal.
* *
* @deprecated use {@link #getBigDecimal(String)} or {@link #getBigDecimal(int)} * @deprecated use {@link #getBigDecimal(int)}
* *
* @param parameterIndex the parameter index (1, 2, ...) * @param parameterIndex the parameter index (1, 2, ...)
* @param scale is ignored * @param scale is ignored
......
...@@ -82,9 +82,7 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -82,9 +82,7 @@ public class JdbcConnection extends TraceObject implements Connection {
private CommandInterface setLockMode, getLockMode; private CommandInterface setLockMode, getLockMode;
private CommandInterface setQueryTimeout, getQueryTimeout; private CommandInterface setQueryTimeout, getQueryTimeout;
//## Java 1.4 begin ##
private int savepointId; private int savepointId;
//## Java 1.4 end ##
private Trace trace; private Trace trace;
private boolean isInternal; private boolean isInternal;
private String catalog; private String catalog;
...@@ -890,7 +888,6 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -890,7 +888,6 @@ public class JdbcConnection extends TraceObject implements Connection {
* *
* @return the new savepoint * @return the new savepoint
*/ */
//## Java 1.4 begin ##
public Savepoint setSavepoint() throws SQLException { public Savepoint setSavepoint() throws SQLException {
try { try {
int id = getNextId(TraceObject.SAVEPOINT); int id = getNextId(TraceObject.SAVEPOINT);
...@@ -907,7 +904,6 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -907,7 +904,6 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
//## Java 1.4 end ##
/** /**
* Creates a new named savepoint. * Creates a new named savepoint.
...@@ -915,7 +911,6 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -915,7 +911,6 @@ public class JdbcConnection extends TraceObject implements Connection {
* @param name the savepoint name * @param name the savepoint name
* @return the new savepoint * @return the new savepoint
*/ */
//## Java 1.4 begin ##
public Savepoint setSavepoint(String name) throws SQLException { public Savepoint setSavepoint(String name) throws SQLException {
try { try {
int id = getNextId(TraceObject.SAVEPOINT); int id = getNextId(TraceObject.SAVEPOINT);
...@@ -931,14 +926,12 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -931,14 +926,12 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
//## Java 1.4 end ##
/** /**
* Rolls back to a savepoint. * Rolls back to a savepoint.
* *
* @param savepoint the savepoint * @param savepoint the savepoint
*/ */
//## Java 1.4 begin ##
public void rollback(Savepoint savepoint) throws SQLException { public void rollback(Savepoint savepoint) throws SQLException {
try { try {
JdbcSavepoint sp = convertSavepoint(savepoint); JdbcSavepoint sp = convertSavepoint(savepoint);
...@@ -953,14 +946,12 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -953,14 +946,12 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
//## Java 1.4 end ##
/** /**
* Releases a savepoint. * Releases a savepoint.
* *
* @param savepoint the savepoint to release * @param savepoint the savepoint to release
*/ */
//## Java 1.4 begin ##
public void releaseSavepoint(Savepoint savepoint) throws SQLException { public void releaseSavepoint(Savepoint savepoint) throws SQLException {
try { try {
debugCode("releaseSavepoint(savepoint);"); debugCode("releaseSavepoint(savepoint);");
...@@ -977,7 +968,6 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -977,7 +968,6 @@ public class JdbcConnection extends TraceObject implements Connection {
} }
return (JdbcSavepoint) savepoint; return (JdbcSavepoint) savepoint;
} }
//## Java 1.4 end ##
/** /**
* Creates a prepared statement with the specified result set type, * Creates a prepared statement with the specified result set type,
...@@ -1079,11 +1069,9 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1079,11 +1069,9 @@ public class JdbcConnection extends TraceObject implements Connection {
private static void checkJavaVersion() { private static void checkJavaVersion() {
try { try {
//## Java 1.4 begin ##
// check for existence of this class (avoiding Class . forName) // check for existence of this class (avoiding Class . forName)
Class<?> clazz = java.sql.Savepoint.class; Class<?> clazz = java.sql.Savepoint.class;
clazz.getClass(); clazz.getClass();
//## Java 1.4 end ##
} catch (NoClassDefFoundError e) { } catch (NoClassDefFoundError e) {
throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION);
} }
...@@ -1333,12 +1321,10 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1333,12 +1321,10 @@ public class JdbcConnection extends TraceObject implements Connection {
private static void checkHoldability(int resultSetHoldability) { private static void checkHoldability(int resultSetHoldability) {
// TODO compatibility / correctness: DBPool uses // TODO compatibility / correctness: DBPool uses
// ResultSet.HOLD_CURSORS_OVER_COMMIT // ResultSet.HOLD_CURSORS_OVER_COMMIT
//## Java 1.4 begin ##
if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT
&& resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) { && resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
throw DbException.getInvalidValueException("resultSetHoldability", resultSetHoldability); throw DbException.getInvalidValueException("resultSetHoldability", resultSetHoldability);
} }
//## Java 1.4 end ##
} }
/** /**
......
...@@ -2644,24 +2644,20 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -2644,24 +2644,20 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* CLOSE_CURSORS_AT_COMMIT * CLOSE_CURSORS_AT_COMMIT
* @return true if the holdability is ResultSet.CLOSE_CURSORS_AT_COMMIT * @return true if the holdability is ResultSet.CLOSE_CURSORS_AT_COMMIT
*/ */
//## Java 1.4 begin ##
public boolean supportsResultSetHoldability(int holdability) { public boolean supportsResultSetHoldability(int holdability) {
debugCodeCall("supportsResultSetHoldability", holdability); debugCodeCall("supportsResultSetHoldability", holdability);
return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT; return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT;
} }
//## Java 1.4 end ##
/** /**
* Gets the result set holdability. * Gets the result set holdability.
* *
* @return ResultSet.CLOSE_CURSORS_AT_COMMIT * @return ResultSet.CLOSE_CURSORS_AT_COMMIT
*/ */
//## Java 1.4 begin ##
public int getResultSetHoldability() { public int getResultSetHoldability() {
debugCodeCall("getResultSetHoldability"); debugCodeCall("getResultSetHoldability");
return ResultSet.CLOSE_CURSORS_AT_COMMIT; return ResultSet.CLOSE_CURSORS_AT_COMMIT;
} }
//## Java 1.4 end ##
/** /**
* Gets the major version of the database. * Gets the major version of the database.
...@@ -2714,12 +2710,10 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -2714,12 +2710,10 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* *
* @return DatabaseMetaData.sqlStateSQL99 * @return DatabaseMetaData.sqlStateSQL99
*/ */
//## Java 1.4 begin ##
public int getSQLStateType() { public int getSQLStateType() {
debugCodeCall("getSQLStateType"); debugCodeCall("getSQLStateType");
return DatabaseMetaData.sqlStateSQL99; return DatabaseMetaData.sqlStateSQL99;
} }
//## Java 1.4 end ##
/** /**
* Does the database make a copy before updating. * Does the database make a copy before updating.
......
...@@ -21,11 +21,7 @@ import org.h2.value.Value; ...@@ -21,11 +21,7 @@ import org.h2.value.Value;
/** /**
* Information about the parameters of a prepared statement. * Information about the parameters of a prepared statement.
*/ */
public class JdbcParameterMetaData extends TraceObject public class JdbcParameterMetaData extends TraceObject implements ParameterMetaData {
//## Java 1.4 begin ##
implements ParameterMetaData
//## Java 1.4 end ##
{
private JdbcPreparedStatement prep; private JdbcPreparedStatement prep;
private int paramCount; private int paramCount;
...@@ -60,7 +56,6 @@ implements ParameterMetaData ...@@ -60,7 +56,6 @@ implements ParameterMetaData
* @param param the column index (1,2,...) * @param param the column index (1,2,...)
* @return parameterModeIn * @return parameterModeIn
*/ */
//## Java 1.4 begin ##
public int getParameterMode(int param) throws SQLException { public int getParameterMode(int param) throws SQLException {
try { try {
debugCodeCall("getParameterMode", param); debugCodeCall("getParameterMode", param);
...@@ -70,7 +65,6 @@ implements ParameterMetaData ...@@ -70,7 +65,6 @@ implements ParameterMetaData
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
//## Java 1.4 end ##
/** /**
* Returns the parameter type. * Returns the parameter type.
......
...@@ -669,7 +669,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat ...@@ -669,7 +669,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
/** /**
* [Not supported] This feature is deprecated and not supported. * [Not supported] This feature is deprecated and not supported.
* *
* @deprecated this feature is deprecated. * @deprecated
*/ */
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
throw unsupported("unicodeStream"); throw unsupported("unicodeStream");
...@@ -1098,9 +1098,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat ...@@ -1098,9 +1098,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
e.setNextException(next); e.setNextException(next);
next = e; next = e;
} }
//## Java 1.4 begin ##
result[i] = Statement.EXECUTE_FAILED; result[i] = Statement.EXECUTE_FAILED;
//## Java 1.4 end ##
error = true; error = true;
} }
} }
...@@ -1248,7 +1246,6 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat ...@@ -1248,7 +1246,6 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* *
* @return the meta data * @return the meta data
*/ */
//## Java 1.4 begin ##
public ParameterMetaData getParameterMetaData() throws SQLException { public ParameterMetaData getParameterMetaData() throws SQLException {
try { try {
int id = getNextId(TraceObject.PARAMETER_META_DATA); int id = getNextId(TraceObject.PARAMETER_META_DATA);
...@@ -1262,7 +1259,6 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat ...@@ -1262,7 +1259,6 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
//## Java 1.4 end ##
// ============================================================= // =============================================================
......
...@@ -696,7 +696,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet { ...@@ -696,7 +696,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/** /**
* Returns the value of the specified column as a BigDecimal. * Returns the value of the specified column as a BigDecimal.
* *
* @deprecated use {@link #getBigDecimal(String)} or {@link #getBigDecimal(int)} * @deprecated use {@link #getBigDecimal(String)}
* *
* @param columnLabel the column label * @param columnLabel the column label
* @param scale the scale of the returned value * @param scale the scale of the returned value
...@@ -722,7 +722,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet { ...@@ -722,7 +722,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/** /**
* Returns the value of the specified column as a BigDecimal. * Returns the value of the specified column as a BigDecimal.
* *
* @deprecated use {@link #getBigDecimal(String)} or {@link #getBigDecimal(int)} * @deprecated use {@link #getBigDecimal(int)}
* *
* @param columnIndex (1,2,...) * @param columnIndex (1,2,...)
* @param scale the scale of the returned value * @param scale the scale of the returned value
......
...@@ -48,9 +48,7 @@ public class JdbcSQLException extends SQLException { ...@@ -48,9 +48,7 @@ public class JdbcSQLException extends SQLException {
this.cause = cause; this.cause = cause;
this.stackTrace = stackTrace; this.stackTrace = stackTrace;
buildMessage(); buildMessage();
//## Java 1.4 begin ##
initCause(cause); initCause(cause);
//## Java 1.4 end ##
} }
/** /**
...@@ -88,11 +86,6 @@ public class JdbcSQLException extends SQLException { ...@@ -88,11 +86,6 @@ public class JdbcSQLException extends SQLException {
public void printStackTrace(PrintWriter s) { public void printStackTrace(PrintWriter s) {
if (s != null) { if (s != null) {
super.printStackTrace(s); super.printStackTrace(s);
/*## Java 1.3 only begin ##
if (cause != null) {
cause.printStackTrace(s);
}
## Java 1.3 only end ##*/
// getNextException().printStackTrace(s) would be very very slow // getNextException().printStackTrace(s) would be very very slow
// if many exceptions are joined // if many exceptions are joined
SQLException next = getNextException(); SQLException next = getNextException();
...@@ -114,11 +107,6 @@ public class JdbcSQLException extends SQLException { ...@@ -114,11 +107,6 @@ public class JdbcSQLException extends SQLException {
public void printStackTrace(PrintStream s) { public void printStackTrace(PrintStream s) {
if (s != null) { if (s != null) {
super.printStackTrace(s); super.printStackTrace(s);
/*## Java 1.3 only begin ##
if (cause != null) {
cause.printStackTrace(s);
}
## Java 1.3 only end ##*/
// getNextException().printStackTrace(s) would be very very slow // getNextException().printStackTrace(s) would be very very slow
// if many exceptions are joined // if many exceptions are joined
SQLException next = getNextException(); SQLException next = getNextException();
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
package org.h2.jdbc; package org.h2.jdbc;
import java.sql.SQLException; import java.sql.SQLException;
//## Java 1.4 begin ##
import java.sql.Savepoint; import java.sql.Savepoint;
//## Java 1.4 end ##
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.message.DbException; import org.h2.message.DbException;
...@@ -22,11 +20,7 @@ import org.h2.util.StringUtils; ...@@ -22,11 +20,7 @@ import org.h2.util.StringUtils;
* rolled back. The tasks that where done before the savepoint are not rolled * rolled back. The tasks that where done before the savepoint are not rolled
* back in this case. * back in this case.
*/ */
public class JdbcSavepoint extends TraceObject public class JdbcSavepoint extends TraceObject implements Savepoint {
//## Java 1.4 begin ##
implements Savepoint
//## Java 1.4 end ##
{
private static final String SYSTEM_SAVEPOINT_PREFIX = "SYSTEM_SAVEPOINT_"; private static final String SYSTEM_SAVEPOINT_PREFIX = "SYSTEM_SAVEPOINT_";
......
...@@ -639,9 +639,7 @@ public class JdbcStatement extends TraceObject implements Statement { ...@@ -639,9 +639,7 @@ public class JdbcStatement extends TraceObject implements Statement {
e.setNextException(next); e.setNextException(next);
next = e; next = e;
} }
//## Java 1.4 begin ##
result[i] = Statement.EXECUTE_FAILED; result[i] = Statement.EXECUTE_FAILED;
//## Java 1.4 end ##
error = true; error = true;
} }
} }
...@@ -858,7 +856,6 @@ public class JdbcStatement extends TraceObject implements Statement { ...@@ -858,7 +856,6 @@ public class JdbcStatement extends TraceObject implements Statement {
* *
* @return the holdability * @return the holdability
*/ */
//## Java 1.4 begin ##
public int getResultSetHoldability() throws SQLException { public int getResultSetHoldability() throws SQLException {
try { try {
debugCodeCall("getResultSetHoldability"); debugCodeCall("getResultSetHoldability");
...@@ -868,7 +865,6 @@ public class JdbcStatement extends TraceObject implements Statement { ...@@ -868,7 +865,6 @@ public class JdbcStatement extends TraceObject implements Statement {
throw logAndConvert(e); throw logAndConvert(e);
} }
} }
//## Java 1.4 end ##
/** /**
* [Not supported] * [Not supported]
......
...@@ -63,11 +63,7 @@ import java.util.logging.Logger; ...@@ -63,11 +63,7 @@ import java.util.logging.Logger;
* In this example the user name and password are serialized as * In this example the user name and password are serialized as
* well; this may be a security problem in some cases. * well; this may be a security problem in some cases.
*/ */
public class JdbcDataSource extends TraceObject public class JdbcDataSource extends TraceObject implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Referenceable {
//## Java 1.4 begin ##
implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Referenceable
//## Java 1.4 end ##
{
private static final long serialVersionUID = 1288136338451857771L; private static final long serialVersionUID = 1288136338451857771L;
...@@ -295,7 +291,6 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -295,7 +291,6 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* *
* @return the new reference * @return the new reference
*/ */
//## Java 1.4 begin ##
public Reference getReference() { public Reference getReference() {
debugCodeCall("getReference"); debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName(); String factoryClassName = JdbcDataSourceFactory.class.getName();
...@@ -307,20 +302,17 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -307,20 +302,17 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
ref.add(new StringRefAddr("description", description)); ref.add(new StringRefAddr("description", description));
return ref; return ref;
} }
//## Java 1.4 end ##
/** /**
* Open a new XA connection using the current URL, user name and password. * Open a new XA connection using the current URL, user name and password.
* *
* @return the connection * @return the connection
*/ */
//## Java 1.4 begin ##
public XAConnection getXAConnection() throws SQLException { public XAConnection getXAConnection() throws SQLException {
debugCodeCall("getXAConnection"); debugCodeCall("getXAConnection");
int id = getNextId(XA_DATA_SOURCE); int id = getNextId(XA_DATA_SOURCE);
return new JdbcXAConnection(factory, id, getJdbcConnection(userName, StringUtils.cloneCharArray(passwordChars))); return new JdbcXAConnection(factory, id, getJdbcConnection(userName, StringUtils.cloneCharArray(passwordChars)));
} }
//## Java 1.4 end ##
/** /**
* Open a new XA connection using the current URL and the specified user * Open a new XA connection using the current URL and the specified user
...@@ -330,7 +322,6 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -330,7 +322,6 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @param password the password * @param password the password
* @return the connection * @return the connection
*/ */
//## Java 1.4 begin ##
public XAConnection getXAConnection(String user, String password) throws SQLException { public XAConnection getXAConnection(String user, String password) throws SQLException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getXAConnection("+quote(user)+", \"\");"); debugCode("getXAConnection("+quote(user)+", \"\");");
...@@ -338,19 +329,16 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -338,19 +329,16 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
int id = getNextId(XA_DATA_SOURCE); int id = getNextId(XA_DATA_SOURCE);
return new JdbcXAConnection(factory, id, getJdbcConnection(user, convertToCharArray(password))); return new JdbcXAConnection(factory, id, getJdbcConnection(user, convertToCharArray(password)));
} }
//## Java 1.4 end ##
/** /**
* Open a new pooled connection using the current URL, user name and password. * Open a new pooled connection using the current URL, user name and password.
* *
* @return the connection * @return the connection
*/ */
//## Java 1.4 begin ##
public PooledConnection getPooledConnection() throws SQLException { public PooledConnection getPooledConnection() throws SQLException {
debugCodeCall("getPooledConnection"); debugCodeCall("getPooledConnection");
return getXAConnection(); return getXAConnection();
} }
//## Java 1.4 end ##
/** /**
* Open a new pooled connection using the current URL and the specified user * Open a new pooled connection using the current URL and the specified user
...@@ -360,14 +348,12 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -360,14 +348,12 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @param password the password * @param password the password
* @return the connection * @return the connection
*/ */
//## Java 1.4 begin ##
public PooledConnection getPooledConnection(String user, String password) throws SQLException { public PooledConnection getPooledConnection(String user, String password) throws SQLException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getPooledConnection("+quote(user)+", \"\");"); debugCode("getPooledConnection("+quote(user)+", \"\");");
} }
return getXAConnection(user, password); return getXAConnection(user, password);
} }
//## Java 1.4 end ##
/** /**
* [Not supported] Return an object of this class if possible. * [Not supported] Return an object of this class if possible.
......
...@@ -8,12 +8,10 @@ package org.h2.jdbcx; ...@@ -8,12 +8,10 @@ package org.h2.jdbcx;
import java.util.Hashtable; import java.util.Hashtable;
//## Java 1.4 begin ##
import javax.naming.Context; import javax.naming.Context;
import javax.naming.Name; import javax.naming.Name;
import javax.naming.Reference; import javax.naming.Reference;
import javax.naming.spi.ObjectFactory; import javax.naming.spi.ObjectFactory;
//## Java 1.4 end ##
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
...@@ -24,11 +22,7 @@ import org.h2.message.TraceSystem; ...@@ -24,11 +22,7 @@ import org.h2.message.TraceSystem;
* This class is used to create new DataSource objects. * This class is used to create new DataSource objects.
* An application should not use this class directly. * An application should not use this class directly.
*/ */
public class JdbcDataSourceFactory public class JdbcDataSourceFactory implements ObjectFactory {
//## Java 1.4 begin ##
implements ObjectFactory
//## Java 1.4 end ##
{
private static TraceSystem cachedTraceSystem; private static TraceSystem cachedTraceSystem;
private Trace trace; private Trace trace;
...@@ -56,7 +50,6 @@ implements ObjectFactory ...@@ -56,7 +50,6 @@ implements ObjectFactory
* @return the new JdbcDataSource, or null if the reference class name is * @return the new JdbcDataSource, or null if the reference class name is
* not JdbcDataSource. * not JdbcDataSource.
*/ */
//## Java 1.4 begin ##
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) { public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) {
if (trace.isDebugEnabled()) { if (trace.isDebugEnabled()) {
trace.debug("getObjectInstance obj={0} name={1} nameCtx={2} environment={3}", obj, name, nameCtx, environment); trace.debug("getObjectInstance obj={0} name={1} nameCtx={2} environment={3}", obj, name, nameCtx, environment);
...@@ -76,7 +69,6 @@ implements ObjectFactory ...@@ -76,7 +69,6 @@ implements ObjectFactory
} }
return null; return null;
} }
//## Java 1.4 end ##
/** /**
* INTERNAL * INTERNAL
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
package org.h2.jdbcx; package org.h2.jdbcx;
//## Java 1.4 begin ##
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
...@@ -23,7 +22,6 @@ import org.h2.constant.SysProperties; ...@@ -23,7 +22,6 @@ import org.h2.constant.SysProperties;
import org.h2.jdbc.JdbcConnection; import org.h2.jdbc.JdbcConnection;
import org.h2.util.JdbcUtils; import org.h2.util.JdbcUtils;
import org.h2.util.New; import org.h2.util.New;
//## Java 1.4 end ##
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.message.Trace; import org.h2.message.Trace;
...@@ -38,13 +36,8 @@ import javax.sql.StatementEventListener; ...@@ -38,13 +36,8 @@ import javax.sql.StatementEventListener;
* An application developer usually does not use this interface. * An application developer usually does not use this interface.
* It is used by the transaction manager internally. * It is used by the transaction manager internally.
*/ */
public class JdbcXAConnection extends TraceObject public class JdbcXAConnection extends TraceObject implements XAConnection, XAResource {
//## Java 1.4 begin ##
implements XAConnection, XAResource
//## Java 1.4 end ##
{
//## Java 1.4 begin ##
private JdbcDataSourceFactory factory; private JdbcDataSourceFactory factory;
// This connection is kept open as long as the XAConnection is alive // This connection is kept open as long as the XAConnection is alive
...@@ -64,19 +57,16 @@ implements XAConnection, XAResource ...@@ -64,19 +57,16 @@ implements XAConnection, XAResource
setTrace(factory.getTrace(), TraceObject.XA_DATA_SOURCE, id); setTrace(factory.getTrace(), TraceObject.XA_DATA_SOURCE, id);
this.physicalConn = physicalConn; this.physicalConn = physicalConn;
} }
//## Java 1.4 end ##
/** /**
* Get the XAResource object. * Get the XAResource object.
* *
* @return itself * @return itself
*/ */
//## Java 1.4 begin ##
public XAResource getXAResource() { public XAResource getXAResource() {
debugCodeCall("getXAResource"); debugCodeCall("getXAResource");
return this; return this;
} }
//## Java 1.4 end ##
/** /**
* Close the physical connection. * Close the physical connection.
...@@ -84,7 +74,6 @@ implements XAConnection, XAResource ...@@ -84,7 +74,6 @@ implements XAConnection, XAResource
* *
* @throws SQLException * @throws SQLException
*/ */
//## Java 1.4 begin ##
public void close() throws SQLException { public void close() throws SQLException {
debugCodeCall("close"); debugCodeCall("close");
PooledJdbcConnection lastHandle = handleConn; PooledJdbcConnection lastHandle = handleConn;
...@@ -100,7 +89,6 @@ implements XAConnection, XAResource ...@@ -100,7 +89,6 @@ implements XAConnection, XAResource
} }
} }
} }
//## Java 1.4 end ##
/** /**
* Get a connection that is a handle to the physical connection. This method * Get a connection that is a handle to the physical connection. This method
...@@ -109,7 +97,6 @@ implements XAConnection, XAResource ...@@ -109,7 +97,6 @@ implements XAConnection, XAResource
* *
* @return the connection * @return the connection
*/ */
//## Java 1.4 begin ##
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
debugCodeCall("getConnection"); debugCodeCall("getConnection");
PooledJdbcConnection lastHandle = handleConn; PooledJdbcConnection lastHandle = handleConn;
...@@ -119,36 +106,30 @@ implements XAConnection, XAResource ...@@ -119,36 +106,30 @@ implements XAConnection, XAResource
handleConn = new PooledJdbcConnection(physicalConn); handleConn = new PooledJdbcConnection(physicalConn);
return handleConn; return handleConn;
} }
//## Java 1.4 end ##
/** /**
* Register a new listener for the connection. * Register a new listener for the connection.
* *
* @param listener the event listener * @param listener the event listener
*/ */
//## Java 1.4 begin ##
public void addConnectionEventListener(ConnectionEventListener listener) { public void addConnectionEventListener(ConnectionEventListener listener) {
debugCode("addConnectionEventListener(listener);"); debugCode("addConnectionEventListener(listener);");
listeners.add(listener); listeners.add(listener);
} }
//## Java 1.4 end ##
/** /**
* Remove the event listener. * Remove the event listener.
* *
* @param listener the event listener * @param listener the event listener
*/ */
//## Java 1.4 begin ##
public void removeConnectionEventListener(ConnectionEventListener listener) { public void removeConnectionEventListener(ConnectionEventListener listener) {
debugCode("removeConnectionEventListener(listener);"); debugCode("removeConnectionEventListener(listener);");
listeners.remove(listener); listeners.remove(listener);
} }
//## Java 1.4 end ##
/** /**
* INTERNAL * INTERNAL
*/ */
//## Java 1.4 begin ##
void closedHandle() { void closedHandle() {
debugCode("closedHandle();"); debugCode("closedHandle();");
for (ConnectionEventListener listener : New.arrayList(listeners)) { for (ConnectionEventListener listener : New.arrayList(listeners)) {
...@@ -157,19 +138,16 @@ implements XAConnection, XAResource ...@@ -157,19 +138,16 @@ implements XAConnection, XAResource
} }
handleConn = null; handleConn = null;
} }
//## Java 1.4 end ##
/** /**
* Get the transaction timeout. * Get the transaction timeout.
* *
* @return 0 * @return 0
*/ */
//## Java 1.4 begin ##
public int getTransactionTimeout() { public int getTransactionTimeout() {
debugCodeCall("getTransactionTimeout"); debugCodeCall("getTransactionTimeout");
return 0; return 0;
} }
//## Java 1.4 end ##
/** /**
* Set the transaction timeout. * Set the transaction timeout.
...@@ -177,12 +155,10 @@ implements XAConnection, XAResource ...@@ -177,12 +155,10 @@ implements XAConnection, XAResource
* @param seconds ignored * @param seconds ignored
* @return false * @return false
*/ */
//## Java 1.4 begin ##
public boolean setTransactionTimeout(int seconds) { public boolean setTransactionTimeout(int seconds) {
debugCodeCall("setTransactionTimeout", seconds); debugCodeCall("setTransactionTimeout", seconds);
return false; return false;
} }
//## Java 1.4 end ##
/** /**
* Checks if this is the same XAResource. * Checks if this is the same XAResource.
...@@ -190,12 +166,10 @@ implements XAConnection, XAResource ...@@ -190,12 +166,10 @@ implements XAConnection, XAResource
* @param xares the other object * @param xares the other object
* @return true if this is the same object * @return true if this is the same object
*/ */
//## Java 1.4 begin ##
public boolean isSameRM(XAResource xares) { public boolean isSameRM(XAResource xares) {
debugCode("isSameRM(xares);"); debugCode("isSameRM(xares);");
return xares == this; return xares == this;
} }
//## Java 1.4 end ##
/** /**
* Get the list of prepared transaction branches. * Get the list of prepared transaction branches.
...@@ -206,7 +180,6 @@ implements XAConnection, XAResource ...@@ -206,7 +180,6 @@ implements XAConnection, XAResource
* @return zero or more Xid objects * @return zero or more Xid objects
* @throws XAException * @throws XAException
*/ */
//## Java 1.4 begin ##
public Xid[] recover(int flag) throws XAException { public Xid[] recover(int flag) throws XAException {
debugCodeCall("recover", quoteFlags(flag)); debugCodeCall("recover", quoteFlags(flag));
checkOpen(); checkOpen();
...@@ -233,7 +206,6 @@ implements XAConnection, XAResource ...@@ -233,7 +206,6 @@ implements XAConnection, XAResource
JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(stat);
} }
} }
//## Java 1.4 end ##
/** /**
* Prepare a transaction. * Prepare a transaction.
...@@ -242,7 +214,6 @@ implements XAConnection, XAResource ...@@ -242,7 +214,6 @@ implements XAConnection, XAResource
* @return XA_OK * @return XA_OK
* @throws XAException * @throws XAException
*/ */
//## Java 1.4 begin ##
public int prepare(Xid xid) throws XAException { public int prepare(Xid xid) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("prepare("+JdbcXid.toString(xid)+");"); debugCode("prepare("+JdbcXid.toString(xid)+");");
...@@ -262,7 +233,6 @@ implements XAConnection, XAResource ...@@ -262,7 +233,6 @@ implements XAConnection, XAResource
} }
return XA_OK; return XA_OK;
} }
//## Java 1.4 end ##
/** /**
* Forget a transaction. * Forget a transaction.
...@@ -270,13 +240,11 @@ implements XAConnection, XAResource ...@@ -270,13 +240,11 @@ implements XAConnection, XAResource
* *
* @param xid the transaction id * @param xid the transaction id
*/ */
//## Java 1.4 begin ##
public void forget(Xid xid) { public void forget(Xid xid) {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("forget("+JdbcXid.toString(xid)+");"); debugCode("forget("+JdbcXid.toString(xid)+");");
} }
} }
//## Java 1.4 end ##
/** /**
* Roll back a transaction. * Roll back a transaction.
...@@ -284,7 +252,6 @@ implements XAConnection, XAResource ...@@ -284,7 +252,6 @@ implements XAConnection, XAResource
* @param xid the transaction id * @param xid the transaction id
* @throws XAException * @throws XAException
*/ */
//## Java 1.4 begin ##
public void rollback(Xid xid) throws XAException { public void rollback(Xid xid) throws XAException {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("rollback("+JdbcXid.toString(xid)+");"); debugCode("rollback("+JdbcXid.toString(xid)+");");
...@@ -306,7 +273,6 @@ implements XAConnection, XAResource ...@@ -306,7 +273,6 @@ implements XAConnection, XAResource
} }
currentTransaction = null; currentTransaction = null;
} }
//## Java 1.4 end ##
/** /**
* End a transaction. * End a transaction.
...@@ -315,7 +281,6 @@ implements XAConnection, XAResource ...@@ -315,7 +281,6 @@ implements XAConnection, XAResource
* @param flags TMSUCCESS, TMFAIL, or TMSUSPEND * @param flags TMSUCCESS, TMFAIL, or TMSUSPEND
* @throws XAException * @throws XAException
*/ */
//## 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("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); debugCode("end("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");");
...@@ -328,7 +293,6 @@ implements XAConnection, XAResource ...@@ -328,7 +293,6 @@ implements XAConnection, XAResource
throw new XAException(XAException.XAER_OUTSIDE); throw new XAException(XAException.XAER_OUTSIDE);
} }
} }
//## Java 1.4 end ##
/** /**
* Start or continue to work on a transaction. * Start or continue to work on a transaction.
...@@ -337,7 +301,6 @@ implements XAConnection, XAResource ...@@ -337,7 +301,6 @@ implements XAConnection, XAResource
* @param flags TMNOFLAGS, TMJOIN, or TMRESUME * @param flags TMNOFLAGS, TMJOIN, or TMRESUME
* @throws XAException * @throws XAException
*/ */
//## 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("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); debugCode("start("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");");
...@@ -359,7 +322,6 @@ implements XAConnection, XAResource ...@@ -359,7 +322,6 @@ implements XAConnection, XAResource
} }
currentTransaction = xid; currentTransaction = xid;
} }
//## Java 1.4 end ##
/** /**
* Commit a transaction. * Commit a transaction.
...@@ -368,7 +330,6 @@ implements XAConnection, XAResource ...@@ -368,7 +330,6 @@ implements XAConnection, XAResource
* @param onePhase use a one-phase protocol if true * @param onePhase use a one-phase protocol if true
* @throws XAException * @throws XAException
*/ */
//## 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("+JdbcXid.toString(xid)+", "+onePhase+");"); debugCode("commit("+JdbcXid.toString(xid)+", "+onePhase+");");
...@@ -389,7 +350,6 @@ implements XAConnection, XAResource ...@@ -389,7 +350,6 @@ implements XAConnection, XAResource
} }
currentTransaction = null; currentTransaction = null;
} }
//## Java 1.4 end ##
/** /**
* [Not supported] Add a statement event listener. * [Not supported] Add a statement event listener.
...@@ -416,7 +376,6 @@ implements XAConnection, XAResource ...@@ -416,7 +376,6 @@ implements XAConnection, XAResource
/** /**
* INTERNAL * INTERNAL
*/ */
//## Java 1.4 begin ##
public String toString() { public String toString() {
return getTraceObjectName() + ": " + physicalConn; return getTraceObjectName() + ": " + physicalConn;
} }
...@@ -467,7 +426,6 @@ implements XAConnection, XAResource ...@@ -467,7 +426,6 @@ implements XAConnection, XAResource
throw new XAException(XAException.XAER_RMERR); throw new XAException(XAException.XAER_RMERR);
} }
} }
//## Java 1.4 end ##
/** /**
* A pooled connection. * A pooled connection.
......
...@@ -16,11 +16,7 @@ import org.h2.util.StringUtils; ...@@ -16,11 +16,7 @@ import org.h2.util.StringUtils;
/** /**
* An object of this class represents a transaction id. * An object of this class represents a transaction id.
*/ */
public class JdbcXid extends TraceObject public class JdbcXid extends TraceObject implements Xid {
//## Java 1.4 begin ##
implements Xid
//## Java 1.4 end ##
{
private static final String PREFIX = "XID"; private static final String PREFIX = "XID";
......
...@@ -344,9 +344,7 @@ public class DbException extends RuntimeException { ...@@ -344,9 +344,7 @@ public class DbException extends RuntimeException {
} }
} }
IOException io = new IOException(e.toString()); IOException io = new IOException(e.toString());
//## Java 1.4 begin ##
io.initCause(e); io.initCause(e);
//## Java 1.4 end ##
return io; return io;
} }
......
...@@ -79,7 +79,6 @@ public class CipherFactory { ...@@ -79,7 +79,6 @@ public class CipherFactory {
*/ */
public static Socket createSocket(InetAddress address, int port) throws IOException { public static Socket createSocket(InetAddress address, int port) throws IOException {
Socket socket = null; Socket socket = null;
//## Java 1.4 begin ##
setKeystore(); setKeystore();
SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket secureSocket = (SSLSocket) f.createSocket(); SSLSocket secureSocket = (SSLSocket) f.createSocket();
...@@ -91,7 +90,6 @@ public class CipherFactory { ...@@ -91,7 +90,6 @@ public class CipherFactory {
secureSocket.setEnabledCipherSuites(list); secureSocket.setEnabledCipherSuites(list);
} }
socket = secureSocket; socket = secureSocket;
//## Java 1.4 end ##
return socket; return socket;
} }
...@@ -106,7 +104,6 @@ public class CipherFactory { ...@@ -106,7 +104,6 @@ public class CipherFactory {
*/ */
public static ServerSocket createServerSocket(int port, InetAddress bindAddress) throws IOException { public static ServerSocket createServerSocket(int port, InetAddress bindAddress) throws IOException {
ServerSocket socket = null; ServerSocket socket = null;
//## Java 1.4 begin ##
setKeystore(); setKeystore();
ServerSocketFactory f = SSLServerSocketFactory.getDefault(); ServerSocketFactory f = SSLServerSocketFactory.getDefault();
SSLServerSocket secureSocket; SSLServerSocket secureSocket;
...@@ -121,11 +118,9 @@ public class CipherFactory { ...@@ -121,11 +118,9 @@ public class CipherFactory {
secureSocket.setEnabledCipherSuites(list); secureSocket.setEnabledCipherSuites(list);
} }
socket = secureSocket; socket = secureSocket;
//## Java 1.4 end ##
return socket; return socket;
} }
//## Java 1.4 begin ##
private static byte[] getKeyStoreBytes(KeyStore store, String password) throws IOException { private static byte[] getKeyStoreBytes(KeyStore store, String password) throws IOException {
ByteArrayOutputStream bout = new ByteArrayOutputStream(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
try { try {
...@@ -135,15 +130,13 @@ public class CipherFactory { ...@@ -135,15 +130,13 @@ public class CipherFactory {
} }
return bout.toByteArray(); return bout.toByteArray();
} }
//## Java 1.4 end ##
/** /**
* Get the keystore object using the given password. * Get the keystore object using the given password.
* *
* @param password the keystore password * @param password the keystore password
* @return the keystore * @return the keystore
*/ */
//## Java 1.4 begin ##
public static KeyStore getKeyStore(String password) throws IOException { public static KeyStore getKeyStore(String password) throws IOException {
try { try {
// The following source code can be re-generated // The following source code can be re-generated
......
...@@ -1123,12 +1123,9 @@ public class WebApp { ...@@ -1123,12 +1123,9 @@ public class WebApp {
} }
rs.addRow("conn.getTypeMap", "" + map); rs.addRow("conn.getTypeMap", "" + map);
rs.addRow("conn.isReadOnly", "" + conn.isReadOnly()); rs.addRow("conn.isReadOnly", "" + conn.isReadOnly());
//## Java 1.4 begin ##
rs.addRow("conn.getHoldability", "" + conn.getHoldability()); rs.addRow("conn.getHoldability", "" + conn.getHoldability());
//## Java 1.4 end ##
addDatabaseMetaData(rs, meta); addDatabaseMetaData(rs, meta);
return rs; return rs;
//## Java 1.4 begin ##
} else if (isBuiltIn(sql, "@attributes")) { } else if (isBuiltIn(sql, "@attributes")) {
String[] p = split(sql); String[] p = split(sql);
return meta.getAttributes(p[1], p[2], p[3], p[4]); return meta.getAttributes(p[1], p[2], p[3], p[4]);
...@@ -1138,7 +1135,6 @@ public class WebApp { ...@@ -1138,7 +1135,6 @@ public class WebApp {
} else if (isBuiltIn(sql, "@super_types")) { } else if (isBuiltIn(sql, "@super_types")) {
String[] p = split(sql); String[] p = split(sql);
return meta.getSuperTypes(p[1], p[2], p[3]); return meta.getSuperTypes(p[1], p[2], p[3]);
//## Java 1.4 end ##
} else if (isBuiltIn(sql, "@prof_stop")) { } else if (isBuiltIn(sql, "@prof_stop")) {
if (profiler != null) { if (profiler != null) {
profiler.stopCollecting(); profiler.stopCollecting();
...@@ -1309,9 +1305,7 @@ public class WebApp { ...@@ -1309,9 +1305,7 @@ public class WebApp {
session.addCommand(sql); session.addCommand(sql);
if (generatedKeys) { if (generatedKeys) {
rs = null; rs = null;
//## Java 1.4 begin ##
rs = stat.getGeneratedKeys(); rs = stat.getGeneratedKeys();
//## Java 1.4 end ##
} else { } else {
if (!isResultSet) { if (!isResultSet) {
buff.append("${text.result.updateCount}: " + stat.getUpdateCount()); buff.append("${text.result.updateCount}: " + stat.getUpdateCount());
......
...@@ -27,9 +27,7 @@ class FileObjectMemoryData { ...@@ -27,9 +27,7 @@ class FileObjectMemoryData {
private static final byte[] BUFFER = new byte[BLOCK_SIZE * 2]; private static final byte[] BUFFER = new byte[BLOCK_SIZE * 2];
private static final byte[] COMPRESSED_EMPTY_BLOCK; private static final byte[] COMPRESSED_EMPTY_BLOCK;
//## Java 1.4 begin ##
private static final Cache<CompressItem, CompressItem> COMPRESS_LATER = new Cache<CompressItem, CompressItem>(CACHE_SIZE); private static final Cache<CompressItem, CompressItem> COMPRESS_LATER = new Cache<CompressItem, CompressItem>(CACHE_SIZE);
//## Java 1.4 end ##
private String name; private String name;
private final boolean compress; private final boolean compress;
...@@ -49,7 +47,6 @@ class FileObjectMemoryData { ...@@ -49,7 +47,6 @@ class FileObjectMemoryData {
/** /**
* This small cache compresses the data if an element leaves the cache. * This small cache compresses the data if an element leaves the cache.
*/ */
//## Java 1.4 begin ##
static class Cache<K, V> extends LinkedHashMap<K, V> { static class Cache<K, V> extends LinkedHashMap<K, V> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -97,7 +94,6 @@ class FileObjectMemoryData { ...@@ -97,7 +94,6 @@ class FileObjectMemoryData {
return false; return false;
} }
} }
//## Java 1.4 end ##
FileObjectMemoryData(String name, boolean compress) { FileObjectMemoryData(String name, boolean compress) {
this.name = name; this.name = name;
...@@ -107,14 +103,12 @@ class FileObjectMemoryData { ...@@ -107,14 +103,12 @@ class FileObjectMemoryData {
} }
private static void compressLater(byte[][] data, int page) { private static void compressLater(byte[][] data, int page) {
//## Java 1.4 begin ##
CompressItem c = new CompressItem(); CompressItem c = new CompressItem();
c.data = data; c.data = data;
c.page = page; c.page = page;
synchronized (LZF) { synchronized (LZF) {
COMPRESS_LATER.put(c, c); COMPRESS_LATER.put(c, c);
} }
//## Java 1.4 end ##
} }
private static void expand(byte[][] data, int page) { private static void expand(byte[][] data, int page) {
......
...@@ -1683,11 +1683,9 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData { ...@@ -1683,11 +1683,9 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
* *
* @return the holdability * @return the holdability
*/ */
//## Java 1.4 begin ##
public int getHoldability() { public int getHoldability() {
return ResultSet.HOLD_CURSORS_OVER_COMMIT; return ResultSet.HOLD_CURSORS_OVER_COMMIT;
} }
//## Java 1.4 end ##
/** /**
* Returns whether this result set has been closed. * Returns whether this result set has been closed.
......
...@@ -555,12 +555,7 @@ public class DateTimeUtils { ...@@ -555,12 +555,7 @@ public class DateTimeUtils {
if (locale == null) { if (locale == null) {
df = new SimpleDateFormat(format); df = new SimpleDateFormat(format);
} else { } else {
//## Java 1.4 begin ##
Locale l = new Locale(locale); Locale l = new Locale(locale);
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
Locale l = new Locale(locale, "");
## Java 1.3 only end ##*/
df = new SimpleDateFormat(format, l); df = new SimpleDateFormat(format, l);
} }
if (timeZone != null) { if (timeZone != null) {
......
...@@ -146,7 +146,6 @@ public class JdbcUtils { ...@@ -146,7 +146,6 @@ public class JdbcUtils {
Class<?> d = Utils.loadUserClass(driver); Class<?> d = Utils.loadUserClass(driver);
if (java.sql.Driver.class.isAssignableFrom(d)) { if (java.sql.Driver.class.isAssignableFrom(d)) {
return DriverManager.getConnection(url, prop); return DriverManager.getConnection(url, prop);
//## Java 1.4 begin ##
} else if (javax.naming.Context.class.isAssignableFrom(d)) { } else if (javax.naming.Context.class.isAssignableFrom(d)) {
// JNDI context // JNDI context
try { try {
...@@ -161,9 +160,8 @@ public class JdbcUtils { ...@@ -161,9 +160,8 @@ public class JdbcUtils {
} catch (Exception e) { } catch (Exception e) {
throw DbException.toSQLException(e); throw DbException.toSQLException(e);
} }
//## Java 1.4 end ##
} else { } else {
// Don't know, but maybe it loaded a JDBC Driver // don't know, but maybe it loaded a JDBC Driver
return DriverManager.getConnection(url, prop); return DriverManager.getConnection(url, prop);
} }
} }
......
...@@ -30,8 +30,6 @@ public class MathUtils { ...@@ -30,8 +30,6 @@ public class MathUtils {
*/ */
static volatile boolean seeded; static volatile boolean seeded;
private static boolean usePrecisionWorkaround;
private static final Random RANDOM = new Random(); private static final Random RANDOM = new Random();
/** /**
...@@ -305,24 +303,6 @@ public class MathUtils { ...@@ -305,24 +303,6 @@ public class MathUtils {
return (reverseInt((int) (x >>> 32L)) & 0xffffffffL) ^ (((long) reverseInt((int) x)) << 32L); return (reverseInt((int) (x >>> 32L)) & 0xffffffffL) ^ (((long) reverseInt((int) x)) << 32L);
} }
/**
* Compatibility for BigDecimal.precision() which is not available in Java 1.4.
*
* @param x the value
* @return the precision
*/
public static int precision(BigDecimal x) {
if (!usePrecisionWorkaround) {
try {
return x.precision();
} catch (Throwable e) {
// NoSuchMethodError
usePrecisionWorkaround = true;
}
}
return x.unscaledValue().abs().toString().length();
}
/** /**
* Compare two values. Returns -1 if the first value is smaller, 1 if bigger, * Compare two values. Returns -1 if the first value is smaller, 1 if bigger,
* and 0 if equal. * and 0 if equal.
......
...@@ -187,11 +187,9 @@ public class NetUtils { ...@@ -187,11 +187,9 @@ public class NetUtils {
*/ */
public static boolean isLocalAddress(Socket socket) throws UnknownHostException { public static boolean isLocalAddress(Socket socket) throws UnknownHostException {
InetAddress test = socket.getInetAddress(); InetAddress test = socket.getInetAddress();
//## Java 1.4 begin ##
if (test.isLoopbackAddress()) { if (test.isLoopbackAddress()) {
return true; return true;
} }
//## Java 1.4 end ##
InetAddress localhost = InetAddress.getLocalHost(); InetAddress localhost = InetAddress.getLocalHost();
// localhost.getCanonicalHostName() is very very slow // localhost.getCanonicalHostName() is very very slow
String host = localhost.getHostAddress(); String host = localhost.getHostAddress();
......
...@@ -6,12 +6,7 @@ ...@@ -6,12 +6,7 @@
*/ */
package org.h2.util; package org.h2.util;
//## Java 1.4 begin ##
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
import java.util.HashMap;
## Java 1.3 only end ##*/
import java.util.Map; import java.util.Map;
/** /**
...@@ -20,14 +15,7 @@ import java.util.Map; ...@@ -20,14 +15,7 @@ import java.util.Map;
* @param <K> the key * @param <K> the key
* @param <V> the value * @param <V> the value
*/ */
public class SmallLRUCache<K, V> public class SmallLRUCache<K, V> extends LinkedHashMap<K, V> {
//## Java 1.4 begin ##
extends LinkedHashMap<K, V>
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
extends HashMap
## Java 1.3 only end ##*/
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int size; private int size;
...@@ -53,9 +41,8 @@ extends HashMap ...@@ -53,9 +41,8 @@ extends HashMap
this.size = size; this.size = size;
} }
//## Java 1.4 begin ##
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
return size() > size; return size() > size;
} }
//## Java 1.4 end ##
} }
...@@ -432,25 +432,12 @@ public class StringUtils { ...@@ -432,25 +432,12 @@ public class StringUtils {
* @return the encoded string * @return the encoded string
*/ */
public static String urlEncode(String s) { public static String urlEncode(String s) {
//## Java 1.4 begin ##
try { try {
return URLEncoder.encode(s, "UTF-8"); return URLEncoder.encode(s, "UTF-8");
} catch (Exception e) { } catch (Exception e) {
// UnsupportedEncodingException // UnsupportedEncodingException
throw DbException.convert(e); throw DbException.convert(e);
} }
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
/*
return URLEncoder.encode(s);
*/
//## Java 1.4 end ##
// byte[] utf = utf8Encode(s);
// StringBuilder buff = new StringBuilder(utf.length);
// for(int i=0; i<utf.length; i++) {
//
// buff.append()
// }
} }
/** /**
......
...@@ -143,7 +143,7 @@ public class ValueDecimal extends Value { ...@@ -143,7 +143,7 @@ public class ValueDecimal extends Value {
public long getPrecision() { public long getPrecision() {
if (precision == 0) { if (precision == 0) {
precision = MathUtils.precision(value); precision = value.precision();
} }
return precision; return precision;
} }
...@@ -223,7 +223,7 @@ public class ValueDecimal extends Value { ...@@ -223,7 +223,7 @@ public class ValueDecimal extends Value {
} }
public int getMemory() { public int getMemory() {
return MathUtils.precision(value) + 120; return value.precision() + 120;
} }
} }
...@@ -58,33 +58,15 @@ public class SwitchSource { ...@@ -58,33 +58,15 @@ public class SwitchSource {
} }
if (version == null) { if (version == null) {
// ok // ok
} else if ("1.3".equals(version)) {
enable.add("Java 1.3 only");
disable.add("Java 1.4");
disable.add("Java 1.5");
disable.add("Java 1.6");
disable.add("Java 1.7");
} else if ("1.4".equals(version)) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
disable.add("Java 1.5");
disable.add("Java 1.6");
disable.add("Java 1.7");
} else if ("1.5".equals(version)) { } else if ("1.5".equals(version)) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
enable.add("Java 1.5"); enable.add("Java 1.5");
disable.add("Java 1.6"); disable.add("Java 1.6");
disable.add("Java 1.7"); disable.add("Java 1.7");
} else if ("1.6".equals(version)) { } else if ("1.6".equals(version)) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
enable.add("Java 1.5"); enable.add("Java 1.5");
enable.add("Java 1.6"); enable.add("Java 1.6");
disable.add("Java 1.7"); disable.add("Java 1.7");
} else if (version.compareTo("1.7") >= 0) { } else if (version.compareTo("1.7") >= 0) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
enable.add("Java 1.5"); enable.add("Java 1.5");
enable.add("Java 1.6"); enable.add("Java 1.6");
enable.add("Java 1.7"); enable.add("Java 1.7");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论