I run the unit tests with JDK 1.3 and get these errors:
java.lang.NoSuchMethodError
at
javax.jdo.identity.ObjectIdentityTest.testSerializedLocale(ObjectIdentityTest.java:346)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
-----------------
java.lang.NoSuchMethodError
at javax.jdo.identity.CharIdentity.toString(CharIdentity.java:97)
at
javax.jdo.identity.CharIdentityTest.testToStringConstructor(CharIdentityTest.java:63)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
---------------
java.lang.NoSuchMethodError
at javax.jdo.spi.JDOImplHelper$2.construct(JDOImplHelper.java:576)
at javax.jdo.spi.JDOImplHelper.construct(JDOImplHelper.java:630)
at javax.jdo.identity.ObjectIdentity.<init>(ObjectIdentity.java:86)
at
javax.jdo.identity.ObjectIdentityTest.testStringLocaleConstructor(ObjectIdentityTest.java:250)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Quoting Craig Russell <[EMAIL PROTECTED]>:
> Hi Erik,
>
> Can you please test the fix and update the JIRA JDO-95 issue if the
> fix is ok?
>
> Thanks,
>
> Craig
>
> Begin forwarded message:
>
> > From: [EMAIL PROTECTED]
> > Date: July 21, 2005 9:48:30 PM PDT
> > To: [email protected]
> > Subject: svn commit: r220237 - in /incubator/jdo/trunk/api20: src/
> > java/javax/jdo/spi/JDOImplHelper.java test/java/javax/jdo/identity/
> > ObjectIdentityTest.java
> > Reply-To: [email protected]
> >
> >
> > Author: clr
> > Date: Thu Jul 21 21:48:28 2005
> > New Revision: 220237
> >
> > URL: http://svn.apache.org/viewcvs?rev=220237&view=rev
> > Log:
> > JDO-95 if Currency.class is not available, don't test or create
> > helper instances for Currency
> >
> > Modified:
> > incubator/jdo/trunk/api20/src/java/javax/jdo/spi/
> > JDOImplHelper.java
> > incubator/jdo/trunk/api20/test/java/javax/jdo/identity/
> > ObjectIdentityTest.java
> >
> > Modified: incubator/jdo/trunk/api20/src/java/javax/jdo/spi/
> > JDOImplHelper.java
> > URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/
> > java/javax/jdo/spi/JDOImplHelper.java?
> > rev=220237&r1=220236&r2=220237&view=diff
> > ======================================================================
> > ========
> > --- incubator/jdo/trunk/api20/src/java/javax/jdo/spi/
> > JDOImplHelper.java (original)
> > +++ incubator/jdo/trunk/api20/src/java/javax/jdo/spi/
> > JDOImplHelper.java Thu Jul 21 21:48:28 2005
> > @@ -555,19 +555,21 @@
> > */
> > static {
> > JDOImplHelper helper = getInstance();
> > - helper.registerStringConstructor(Currency.class, new
> > StringConstructor() {
> > - public Object construct(String s) {
> > - try {
> > - return Currency.getInstance(s);
> > - } catch (IllegalArgumentException ex) {
> > - throw new javax.jdo.JDOUserException(
> > - msg.msg
> > ("EXC_CurrencyStringConstructorIllegalArgument", s), ex); //NOI18N
> > - } catch (Exception ex) {
> > - throw new JDOUserException(
> > - msg.msg
> > ("EXC_CurrencyStringConstructorException"), ex); //NOI18N
> > + if (isClassLoadable("java.util.Currency")) {
> > + helper.registerStringConstructor(Currency.class, new
> > StringConstructor() {
> > + public Object construct(String s) {
> > + try {
> > + return Currency.getInstance(s);
> > + } catch (IllegalArgumentException ex) {
> > + throw new javax.jdo.JDOUserException(
> > + msg.msg
> > ("EXC_CurrencyStringConstructorIllegalArgument", s), ex); //NOI18N
> > + } catch (Exception ex) {
> > + throw new JDOUserException(
> > + msg.msg
> > ("EXC_CurrencyStringConstructorException"), ex); //NOI18N
> > + }
> > }
> > - }
> > - });
> > + });
> > + }
> > helper.registerStringConstructor(Locale.class, new
> > StringConstructor() {
> > public Object construct(String s) {
> > try {
> > @@ -590,6 +592,18 @@
> > return result;
> > }
> > });
> > + }
> > +
> > + /**
> > + * Determine if a class is loadable in the current environment.
> > + */
> > + public static boolean isClassLoadable(String className) {
> > + try {
> > + Class.forName(className);
> > + return true;
> > + } catch (ClassNotFoundException ex) {
> > + return false;
> > + }
> > }
> >
> > /**
> >
> > Modified: incubator/jdo/trunk/api20/test/java/javax/jdo/identity/
> > ObjectIdentityTest.java
> > URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/test/
> > java/javax/jdo/identity/ObjectIdentityTest.java?
> > rev=220237&r1=220236&r2=220237&view=diff
> > ======================================================================
> > ========
> > --- incubator/jdo/trunk/api20/test/java/javax/jdo/identity/
> > ObjectIdentityTest.java (original)
> > +++ incubator/jdo/trunk/api20/test/java/javax/jdo/identity/
> > ObjectIdentityTest.java Thu Jul 21 21:48:28 2005
> > @@ -113,6 +113,7 @@
> > }
> >
> > public void testCurrencyConstructor() {
> > + if (!helper.isClassLoadable("java.util.Currency")) return;
> > ObjectIdentity c1 = new ObjectIdentity(Object.class,
> > Currency.getInstance(Locale.US));
> > ObjectIdentity c2 = new ObjectIdentity(Object.class,
> > @@ -251,11 +252,13 @@
> > }
> >
> > public void testStringCurrencyConstructor() {
> > + if (!helper.isClassLoadable("java.util.Currency")) return;
> > Object c1 = new ObjectIdentity(Object.class,
> > "java.util.Currency:USD");
> > }
> >
> > public void testBadStringCurrencyConstructor() {
> > + if (!helper.isClassLoadable("java.util.Currency")) return;
> > try {
> > ObjectIdentity c1 = new ObjectIdentity(Object.class,
> > "java.util.Currency:NowhereInTheWorld");
> > @@ -303,6 +306,7 @@
> > }
> >
> > public void testSerializedCurrency() {
> > + if (!helper.isClassLoadable("java.util.Currency")) return;
> > ObjectIdentity c1 = new ObjectIdentity(Object.class,
> > Currency.getInstance(Locale.US));
> > ObjectIdentity c2 = new ObjectIdentity(Object.class,
> > Currency.getInstance(Locale.US));
> > ObjectIdentity c3 = new ObjectIdentity(Object.class,
> > Currency.getInstance(Locale.GERMANY));
> >
> >
> >
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:[EMAIL PROTECTED]
> P.S. A good JDO? O, Gasp!
>
>