Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E6CFB6F52 for ; Tue, 7 Jun 2011 04:47:42 +0000 (UTC) Received: (qmail 87912 invoked by uid 500); 7 Jun 2011 04:47:42 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 87895 invoked by uid 500); 7 Jun 2011 04:47:42 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 87888 invoked by uid 99); 7 Jun 2011 04:47:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2011 04:47:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2011 04:47:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2C8CA23889E0; Tue, 7 Jun 2011 04:47:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1132861 - in /db/derby/code/branches/10.8: ./ java/testing/org/apache/derbyTesting/junit/BaseTestCase.java java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Date: Tue, 07 Jun 2011 04:47:21 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110607044721.2C8CA23889E0@eris.apache.org> Author: kristwaa Date: Tue Jun 7 04:47:20 2011 New Revision: 1132861 URL: http://svn.apache.org/viewvc?rev=1132861&view=rev Log: DERBY-5262: Running JUnit tests with Java 1.4.2 fails if the package private tests are on the classpath Merged fix from trunk (r1132860). Modified: db/derby/code/branches/10.8/ (props changed) db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Propchange: db/derby/code/branches/10.8/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Jun 7 04:47:20 2011 @@ -1,2 +1,2 @@ /db/derby/code/branches/10.7:1061570,1061578,1082235 -/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101839,1102826,1103681,1103718,1125305,1126358,1127825,1127883,1129136,1129764,1129797,1130632,1130895,1131272,1132546,1132664 +/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101839,1102826,1103681,1103718,1125305,1126358,1127825,1127883,1129136,1129764,1129797,1130632,1130895,1131272,1132546,1132664,1132860 Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1132861&r1=1132860&r2=1132861&view=diff ============================================================================== --- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original) +++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Tue Jun 7 04:47:20 2011 @@ -625,6 +625,36 @@ public abstract class BaseTestCase } /** + * Returns the major version of the class specification version supported + * by the running JVM. + *
    + *
  • 48 = Java 1.4
  • + *
  • 49 = Java 1.5
  • + *
  • 50 = Java 1.6
  • + *
  • 51 = Java 1.7
  • + *
+ * + * @return Major version of class version specification, i.e. 49 for 49.0, + * or -1 if the version can't be obtained for some reason. + */ + public static int getClassVersionMajor() { + String tmp = getSystemProperty("java.class.version"); + if (tmp == null) { + println("VM doesn't have property java.class.version"); + return -1; + } + // Is String.split safe to use by now? + int dot = tmp.indexOf('.'); + int major = -1; + try { + major = Integer.parseInt(tmp.substring(0, dot)); + } catch (NumberFormatException nfe) { + // Ignore, return -1. + } + return major; + } + + /** * Check if we have old style (before Sun Java 1.7) Solaris interruptible * IO. On Sun Java 1.5 >= update 22 and Sun Java 1.6 this can be disabled * with Java option {@code -XX:-UseVMInterruptibleIO}. On Sun Java 1.7 it Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=1132861&r1=1132860&r2=1132861&view=diff ============================================================================== --- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java (original) +++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Tue Jun 7 04:47:20 2011 @@ -291,8 +291,12 @@ public final class SecurityManagerSetup classPathSet.setProperty("derbyTesting.jaxpjar", jaxp); URL testing = getURL(SecurityManagerSetup.class); - URL ppTesting = getURL("org.apache.derby.PackagePrivateTestSuite"); - + URL ppTesting = null; + // Only try to load PackagePrivateTestSuite if the running JVM is + // Java 1.5 or newer (class version 49 = Java 1.5). + if (BaseTestCase.getClassVersionMajor() >= 49) { + ppTesting = getURL("org.apache.derby.PackagePrivateTestSuite"); + } boolean isClasspath = testing.toExternalForm().endsWith("/"); if (isClasspath) { classPathSet.setProperty("derbyTesting.codeclasses",