[h2] Added patch for JDBC 4.1/Java 7 support (based on upstream patch)

Deepak Bhole dbhole at fedoraproject.org
Tue Jan 24 19:20:01 UTC 2012


commit 4cbc0246b6c61cae39474ef730a1183f119993dd
Author: Deepak Bhole <dbhole at redhat.com>
Date:   Tue Jan 24 14:19:50 2012 -0500

    Added patch for JDBC 4.1/Java 7 support (based on upstream patch)

 h2-jdbc-4.1-support.patch |  391 +++++++++++++++++++++++++++++++++++++++++++++
 h2.spec                   |    7 +-
 2 files changed, 397 insertions(+), 1 deletions(-)
---
diff --git a/h2-jdbc-4.1-support.patch b/h2-jdbc-4.1-support.patch
new file mode 100644
index 0000000..ba10560
--- /dev/null
+++ b/h2-jdbc-4.1-support.patch
@@ -0,0 +1,391 @@
+diff -ur h2.orig/src/main/org/h2/Driver.java h2/src/main/org/h2/Driver.java
+--- h2.orig/src/main/org/h2/Driver.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/Driver.java	2012-01-24 14:16:53.000000000 -0500
+@@ -19,6 +19,10 @@
+ import org.h2.upgrade.DbUpgrade;
+ import org.h2.util.StringUtils;
+ 
++/*## Java 1.7 begin ##
++import java.util.logging.Logger;
++## Java 1.7 end ##*/
++
+ /**
+  * The database driver. An application should not use this class directly. The
+  * only thing the application needs to do is load the driver. This can be done
+@@ -129,6 +133,15 @@
+     }
+ 
+     /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public Logger getParentLogger() {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
+      * INTERNAL
+      */
+     public static synchronized Driver load() {
+diff -ur h2.orig/src/main/org/h2/jdbc/JdbcCallableStatement.java h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
+--- h2.orig/src/main/org/h2/jdbc/JdbcCallableStatement.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbc/JdbcCallableStatement.java	2012-01-24 14:11:40.000000000 -0500
+@@ -1497,6 +1497,30 @@
+     }
+ ## Java 1.6 end ##*/
+ 
++    /**
++     * [Not supported]
++     *
++     * @param parameterIndex the parameter index (1, 2, ...)
++     * @param type the class of the returned value
++     */
++/*## Java 1.7 begin ##
++    public <T> T getObject(int parameterIndex, Class<T> type) {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     *
++     * @param parameterName the parameter name
++     * @param type the class of the returned value
++     */
++/*## Java 1.7 begin ##
++    public <T> T getObject(String parameterName, Class<T> type) {
++        return null;
++    }
++## Java 1.7 end ##*/
++
+     private ResultSetMetaData getCheckedMetaData() throws SQLException {
+         ResultSetMetaData meta = getMetaData();
+         if (meta == null) {
+diff -ur h2.orig/src/main/org/h2/jdbc/JdbcConnection.java h2/src/main/org/h2/jdbc/JdbcConnection.java
+--- h2.orig/src/main/org/h2/jdbc/JdbcConnection.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbc/JdbcConnection.java	2012-01-24 13:56:15.000000000 -0500
+@@ -49,6 +49,10 @@
+ import java.sql.SQLClientInfoException;
+ ## Java 1.6 end ##*/
+ 
++/*## Java 1.7 begin ##
++import java.util.concurrent.Executor;
++## Java 1.7 end ##*/
++
+ /**
+  * <p>
+  * Represents a connection (session) to a database.
+@@ -1633,6 +1637,58 @@
+         return v;
+     }
+ 
++    /**
++     * [Not supported]
++     *
++     * @param schema the schema
++     */
++/*## Java 1.7 begin ##
++    public void setSchema(String schema) {
++        // not supported
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public String getSchema() {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     *
++     * @param executor the executor used by this method
++     */
++/*## Java 1.7 begin ##
++    public void abort(Executor executor) {
++        // not supported
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     *
++     * @param executor the executor used by this method
++     * @param milliseconds the TCP connection timeout
++     */
++/*## Java 1.7 begin ##
++    public void setNetworkTimeout(Executor executor, int milliseconds) {
++        // not supported
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public int getNetworkTimeout() {
++        return 0;
++    }
++## Java 1.7 end ##*/
++
+     private void checkMap(Map<String, Class<?>> map) {
+         if (map != null && map.size() > 0) {
+             throw DbException.getUnsupportedException("map.size > 0");
+diff -ur h2.orig/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+--- h2.orig/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java	2012-01-24 14:11:01.000000000 -0500
+@@ -2844,6 +2844,33 @@
+     ## Java 1.6 end ##*/
+ 
+     /**
++     * [Not supported]
++     */
++    /*## Java 1.7 begin ##
++    public boolean generatedKeyAlwaysReturned() {
++        return true;
++    }
++    ## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     *
++     * @param catalog null (to get all objects) or the catalog name
++     * @param schemaPattern null (to get all objects) or a schema name
++     *            (uppercase for unquoted names)
++     * @param tableNamePattern null (to get all objects) or a table name
++     *            (uppercase for unquoted names)
++     * @param columnNamePattern null (to get all objects) or a column name
++     *            (uppercase for unquoted names)
++     */
++    /*## Java 1.7 begin ##
++    public ResultSet getPseudoColumns(String catalog, String schemaPattern,
++            String tableNamePattern, String columnNamePattern) {
++        return null;
++    }
++    ## Java 1.7 end ##*/
++
++    /**
+      * INTERNAL
+      */
+     public String toString() {
+diff -ur h2.orig/src/main/org/h2/jdbc/JdbcPreparedStatement.java h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
+--- h2.orig/src/main/org/h2/jdbc/JdbcPreparedStatement.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java	2012-01-24 14:05:55.000000000 -0500
+@@ -1512,4 +1512,23 @@
+         return false;
+     }
+ 
++    /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public void closeOnCompletion() {
++        // not supported
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public boolean isCloseOnCompletion() {
++        return true;
++    }
++## Java 1.7 end ##*/
++
++
+ }
+diff -ur h2.orig/src/main/org/h2/jdbc/JdbcResultSet.java h2/src/main/org/h2/jdbc/JdbcResultSet.java
+--- h2.orig/src/main/org/h2/jdbc/JdbcResultSet.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbc/JdbcResultSet.java	2012-01-24 14:01:24.000000000 -0500
+@@ -3420,6 +3420,30 @@
+ ## Java 1.6 end ##*/
+ 
+     /**
++     * [Not supported]
++     *
++     * @param columnIndex the column index (1, 2, ...)
++     * @param type the class of the returned value
++     */
++/*## Java 1.7 begin ##
++    public <T> T getObject(int columnIndex, Class<T> type) {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     *
++     * @param columnName the column name
++     * @param type the class of the returned value
++     */
++/*## Java 1.7 begin ##
++    public <T> T getObject(String columnName, Class<T> type) {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
+      * INTERNAL
+      */
+     public String toString() {
+diff -ur h2.orig/src/main/org/h2/jdbc/JdbcStatement.java h2/src/main/org/h2/jdbc/JdbcStatement.java
+--- h2.orig/src/main/org/h2/jdbc/JdbcStatement.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbc/JdbcStatement.java	2012-01-24 14:00:33.000000000 -0500
+@@ -852,6 +852,24 @@
+     }
+ //## Java 1.4 end ##
+ 
++    /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public void closeOnCompletion() {
++        // not supported
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public boolean isCloseOnCompletion() {
++        return true;
++    }
++## Java 1.7 end ##*/
++
+     // =============================================================
+ 
+     /**
+diff -ur h2.orig/src/main/org/h2/jdbcx/JdbcConnectionPool.java h2/src/main/org/h2/jdbcx/JdbcConnectionPool.java
+--- h2.orig/src/main/org/h2/jdbcx/JdbcConnectionPool.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbcx/JdbcConnectionPool.java	2012-01-24 14:08:41.000000000 -0500
+@@ -35,6 +35,10 @@
+ import org.h2.message.DbException;
+ ## Java 1.6 end ##*/
+ 
++/*## Java 1.7 begin ##
++import java.util.logging.Logger;
++## Java 1.7 end ##*/
++
+ /**
+  * A simple standalone JDBC connection pool.
+  * It is based on the
+@@ -349,6 +353,15 @@
+ ## Java 1.6 end ##*/
+ 
+     /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public Logger getParentLogger() {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
+      * [Not supported] Checks if unwrap can return an object of this class.
+      *
+      * @param iface the class
+diff -ur h2.orig/src/main/org/h2/jdbcx/JdbcDataSource.java h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+--- h2.orig/src/main/org/h2/jdbcx/JdbcDataSource.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/jdbcx/JdbcDataSource.java	2012-01-24 14:09:27.000000000 -0500
+@@ -26,6 +26,10 @@
+ import org.h2.message.TraceObject;
+ import org.h2.util.StringUtils;
+ 
++/*## Java 1.7 begin ##
++import java.util.logging.Logger;
++## Java 1.7 end ##*/
++
+ /**
+  * A data source for H2 database connections. It is a factory for XAConnection
+  * and Connection objects. This class is usually registered in a JNDI naming
+@@ -382,6 +386,15 @@
+ ## Java 1.6 end ##*/
+ 
+     /**
++     * [Not supported]
++     */
++/*## Java 1.7 begin ##
++    public Logger getParentLogger() {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
+      * INTERNAL
+      */
+     public String toString() {
+diff -ur h2.orig/src/main/org/h2/tools/SimpleResultSet.java h2/src/main/org/h2/tools/SimpleResultSet.java
+--- h2.orig/src/main/org/h2/tools/SimpleResultSet.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/main/org/h2/tools/SimpleResultSet.java	2012-01-24 14:17:06.000000000 -0500
+@@ -2120,4 +2120,28 @@
+     }
+ ## Java 1.6 end ##*/
+ 
++    /**
++     * INTERNAL
++     *
++     * @param columnIndex the column index (1, 2, ...)
++     * @param type the class of the returned value
++     */
++/*## Java 1.7 begin ##
++    public <T> T getObject(int columnIndex, Class<T> type) {
++        return null;
++    }
++## Java 1.7 end ##*/
++
++    /**
++     * INTERNAL
++     *
++     * @param columnName the column name
++     * @param type the class of the returned value
++     */
++/*## Java 1.7 begin ##
++    public <T> T getObject(String columnName, Class<T> type) {
++        return null;
++    }
++## Java 1.7 end ##*/
++
+ }
+diff -ur h2.orig/src/tools/org/h2/build/code/SwitchSource.java h2/src/tools/org/h2/build/code/SwitchSource.java
+--- h2.orig/src/tools/org/h2/build/code/SwitchSource.java	2010-11-21 18:28:08.000000000 -0500
++++ h2/src/tools/org/h2/build/code/SwitchSource.java	2012-01-24 14:18:27.000000000 -0500
+@@ -63,21 +63,31 @@
+             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)) {
+             disable.add("Java 1.3 only");
+             enable.add("Java 1.4");
+             enable.add("Java 1.5");
+             disable.add("Java 1.6");
+-        } else if (version.compareTo("1.6") >= 0) {
++			disable.add("Java 1.7");
++        } 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.6");
++			disable.add("Java 1.7");
++        } 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.6");
++            enable.add("Java 1.7");
+         } else {
+             throw new IllegalArgumentException("version: " + version);
+         }
diff --git a/h2.spec b/h2.spec
index f6eac0e..e80e30b 100644
--- a/h2.spec
+++ b/h2.spec
@@ -1,6 +1,6 @@
 Name:           h2
 Version:        1.2.147
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Java SQL database
 
 Group:          Development/Libraries
@@ -9,6 +9,7 @@ URL:            http://www.h2database.com
 Source0:        http://www.h2database.com/h2-2010-11-21.zip
 Patch0:         fix-for-servlet25.patch
 Patch1:         fix-build.patch
+Patch2:         %{name}-jdbc-4.1-support.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
 BuildRequires: java-devel >= 1:1.5.0
@@ -42,6 +43,7 @@ popd
 pushd src/tools/org/h2/build
 %patch1
 popd
+%patch2 -p1
 find -name '*.class' -exec rm -f '{}' \;
 find -name '*.jar' -exec rm -f '{}' \;
 
@@ -75,6 +77,9 @@ rm -rf $RPM_BUILD_ROOT
 %doc src/docsrc/html/license.html
 
 %changelog
+* Tue Jan 24 2012 Deepak Bhole <dbhole at redhat.com> - 1.2.147-5
+- Added patch for JDBC 4.1/Java 7 support (based on upstream patch)
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.147-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list