List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:December 12 2007 4:26pm
Subject:Rev 367: Added code to swap out the JDBC4 stuff if we're compiling with Java5. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 367
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Wed 2007-12-12 14:25:57 -0200
message:
  Added code to swap out the JDBC4 stuff if we're compiling with Java5.
added:
  m4/javaversion.m4              javaversion.m4-20071212134227-xa9u6jk39sapf17j-1
modified:
  Makefile.am                    makefile.am-20070228020914-u2pk759xg7thauwf-4
  acinclude.m4                   acinclude.m4-20070228020914-u2pk759xg7thauwf-8
  java/Makefile.am               makefile.am-20070415032352-9dpe6aurqcnuwcrd-1
=== added file 'm4/javaversion.m4'
--- a/m4/javaversion.m4	1970-01-01 00:00:00 +0000
+++ b/m4/javaversion.m4	2007-12-12 16:25:57 +0000
@@ -0,0 +1,56 @@
+AC_DEFUN([AC_JAVA_VERSION], [
+  AC_REQUIRE([AC_PROG_JAVAC])
+  dnl This isn't a true test - but it is good enough for what we need it for
+  dnl What we're actually testing here is if we have jdbc4 or not...
+
+  AC_CACHE_CHECK(Java version of $JAVA, ac_java_version, [
+    JAVA_TEST=Test.java
+    CLASS_TEST=Test.class
+    rm -f $JAVA_TEST $CLASS_TEST
+    cat << \EOF > $JAVA_TEST
+/*  __oline__ "configure" */
+import java.sql.RowId;
+public class Test {
+public RowId getRowId(int arg0) {
+throw new RuntimeException("");
+} }
+EOF
+  if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
+    ac_java_version=6
+  else
+    ac_java_version=5
+  fi
+  rm -f $JAVA_TEST $CLASS_TEST
+  ])
+])
+
+AC_DEFUN([SWAP_JDBC_RESULTSET],[
+  AC_REQUIRE([AC_JAVA_VERSION])
+
+  if test "x$ac_java_version" = "x5" ; then 
+
+    if test ! -f trs.java.sav ; then 
+      # Want to make sure we only do this once
+      cp java/com/mysql/cluster/ndbj/ThrowingResultSetJDBC4.java trs.java.sav
+    fi
+
+    cat << \EOF > java/com/mysql/cluster/ndbj/ThrowingResultSetJDBC4.java
+/* This is a generated file to work around jre5/jre6 issues. If this file 
+   is here, the build thinks you are using java5. If you aren't please 
+   report a bug */
+package com.mysql.cluster.ndbj;
+
+public class ThrowingResultSetJDBC4 {
+
+	public ThrowingResultSetJDBC4() {
+		super();
+	}
+
+}
+EOF
+  else 
+    if test -f trs.java.sav ; then 
+      mv trs.java.sav java/com/mysql/cluster/ndbj/ThrowingResultSetJDBC4.java
+    fi 
+  fi 
+])

=== modified file 'Makefile.am'
--- a/Makefile.am	2007-12-06 09:25:04 +0000
+++ b/Makefile.am	2007-12-12 16:25:57 +0000
@@ -29,6 +29,7 @@
 
 distclean-local:
 	rm -fr autom4te.cache
+	@if test -f trs.java.sav ; then mv trs.java.sav
java/com/mysql/cluster/ndbj/ThrowingResultSetJDBC4.java ; fi
 
 dist-hook:
 	bzr log > $(top_builddir)/ChangeLog	

=== modified file 'acinclude.m4'
--- a/acinclude.m4	2007-12-05 07:15:13 +0000
+++ b/acinclude.m4	2007-12-12 16:25:57 +0000
@@ -110,6 +110,8 @@
     AS_IF([test "x$ANT" = "x"],AC_MSG_ERROR([Couldn't find ant.]))
     AC_CHECK_JUNIT()
     AC_CHECK_JAVA_CXXFLAGS()
+    AC_JAVA_VERSION()
+    SWAP_JDBC_RESULTSET()
     
     AS_IF([test "x$JAVAC" = "xno"],[
       AS_IF([test "w$with_java" = "xyes"],[
@@ -118,6 +120,7 @@
         with_java=no
       ])
     ])
+
   ])
 ])
 

=== modified file 'java/Makefile.am'
--- a/java/Makefile.am	2007-12-12 13:10:28 +0000
+++ b/java/Makefile.am	2007-12-12 16:25:57 +0000
@@ -50,7 +50,6 @@
 	${package_builddir}/mgmj/NdbFilterList.java \
 	${package_builddir}/mgmj/NdbLogEventCategoryListener.java \
 	${package_builddir}/mgmj/NdbLogEventListener.java \
-	${package_builddir}/mgmj/NdbLogEventManager.java \
 	${package_builddir}/mgmj/NdbLogEventTypeListener.java \
 	${package_builddir}/mgmj/BackupStartOption.java \
 	${package_builddir}/mgmj/listeners/DisconnectedTypeListener.java \
@@ -343,7 +342,6 @@
       	${package_builddir}/mgmj/NdbFilterList.class \
       	${package_builddir}/mgmj/NdbLogEventCategoryListener.class \
       	${package_builddir}/mgmj/NdbLogEventListener.class \
-      	${package_builddir}/mgmj/NdbLogEventManager.class \
       	${package_builddir}/mgmj/NdbLogEventTypeListener.class  \
 	${package_builddir}/mgmj/NdbMgmException.class \
 	${package_builddir}/mgmj/events/*.class \

Thread
Rev 367: Added code to swap out the JDBC4 stuff if we're compiling with Java5. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor12 Dec