Hi all,

I just checked out the java tree and encountered the following problem,
which seems fixable with a one line change (details at bottom).

Running
org.apache.tuscany.sca.databinding.extension.SimpleTypeMapperExtensionTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.094 sec
<<< FAILURE!
testMap(
org.apache.tuscany.sca.databinding.extension.SimpleTypeMapperExtensionTestCase)
Time elapsed: 0.078 sec  <<< ERROR!
java.lang.IllegalArgumentException: --02--
       at
com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseInt
(XMLGregorianCalendarImpl.java:2789)
       at
com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse
(XMLGregorianCalendarImpl.java:2711)
       at
com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl
.<init>(XMLGregorianCalendarImpl.java:433)
       at
com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar
(DatatypeFactoryImpl.java:230)
       at
org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl.toJavaObject(
SimpleTypeMapperImpl.java:330)
       at
org.apache.tuscany.sca.databinding.extension.SimpleTypeMapperExtensionTestCase.testMap
(SimpleTypeMapperExtensionTestCase.java:107)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:589)
       at junit.framework.TestCase.runTest(TestCase.java:168)
       at junit.framework.TestCase.runBare(TestCase.java:134)
       at junit.framework.TestResult$1.protect(TestResult.java:110)
       at junit.framework.TestResult.runProtected(TestResult.java:128)
       at junit.framework.TestResult.run(TestResult.java:113)
       at junit.framework.TestCase.run(TestCase.java:124)
       at junit.framework.TestSuite.runTest(TestSuite.java:232)
       at junit.framework.TestSuite.run(TestSuite.java:227)
       at org.junit.internal.runners.OldTestClassRunner.run(
OldTestClassRunner.java:35)
       at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(
JUnit4TestSet.java:62)
       at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(
AbstractDirectoryTestSuite.java:138)
       at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
AbstractDirectoryTestSuite.java:125)
       at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:589)
       at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(
SurefireBooter.java:290)
       at org.apache.maven.surefire.booter.SurefireBooter.main(
SurefireBooter.java:818)

So we have two relevant source files:
1)
modules\databinding\src\main\java\org\apache\tuscany\sca\databinding\impl\SimpleTypeMapperImpl.java
2)
modules\databinding\src\test\java\org\apache\tuscany\sca\databinding\extension\SimpleTypeMapperExtensionTestCase.java

Looking at the two relevant source files and the trace I found it was
failing when passing in a value of "--02--" to DatatypeFactory.newInstance
().newXMLGregorianCalendar.

The gMonth format is in section 3.2.14.2 of the relevant spec:
http://www.w3.org/TR/xmlschema-2/#dateTime-order, and says the format should
only be --MM.  Note that gDay is ---DD (sec. 3.2.13.1).

Looking at the TestCase I see on line 52 that the format looks wrong.
Changed it from --02-- to --02 and re-tested and got past that error.  Since
it's a one line fix I didn't attach a patch.

Reply via email to