Hello.

While working with the JAXP Datatypes in XercesJ 2.7.1, we found a few
bugs in both public and implementation classes from XML Commons and
Xerces projects respectively (See lists attached).  We are interested
in helping fix these bugs in both projects.

Besides, we have an internal implementation of this API that we'd like
to donate to the project (and continue to maintain it in the future)
as an additional implementation of JAXP Datatypes. We believe that
it's fairly bug free, and reasonably performant (we've done
performance testing in Intel platforms using Jrockit 1.4.2 and 1.5).

We have about 150 JUnit tests that reveal the bugs in the current
implementation, and we'd like to donate those as well.  (Our
implementation passes those tests.) Those tests can be integrated into
the current build quite easily to monitor regressions. In addition, we
have several performance tests that can be used to compare
implementations.

Our sources are now in stable state, but our internal procedures for
donation will take some time and effort.  Is this something that the
community is interested in accepting?  We'd like to be sure before we
start the internal processes.

--
Yevgeny Rouban
INTEL Middleware Product Division
9 bugs in xml-apis.jar (16 of 148 tests failed)
all bugs has been fixed

-------------------------------------------------------------------------------
6 tests: DurationTest.testGetYears
       , DurationTest.testGetSeconds
       , DurationTest.testGetMonths 
       , DurationTest.testGetMinutes
       , DurationTest.testGetHours
       , DurationTest.testGetDays
    (bug in xml-apis.jar: class javax.xml.datatype.Duration)
fail due to the bug in methods javax.xml.datatype.Duration.getXXX()
which throw NPE if the field is not defined

-------------------------------------------------------------------------------
2 tests: DatatypeFactoryTest.testNewDurationYearMonthbooleanintint002
       , DatatypeFactoryTest.testNewDurationDayTimebooleanintintintint
    (bug in xml-apis.jar: javax.xml.datatype.DatatypeFactory)
fail due to the bug in methods 
  javax.xml.datatype.DatatypeFactory.newDurationDayTime(final boolean 
isPositive, final int day, final int hour, final int minute, final int second)  
   
  javax.xml.datatype.DatatypeFactory.newDurationYearMonth(final boolean 
isPositive,     final int year, final int month)
which do not properly handle the value DatatypeConstants.FIELD_UNDEFINED
as a value for their arguments, but the spec explicitly allows such cases

-------------------------------------------------------------------------------
3 tests: XMLGregorianCalendarTest.testHashCode001
       , XMLGregorianCalendarTest.testHashCode002
       , XMLGregorianCalendarTest2.testCompare2
    (bug in xml-apis.jar: javax.xml.datatype.XMLGregorianCalendar.hashCode())
the method hashCode() do not consider 24:00:00 as the next day. For example,
dates 2000-01-01T24:00:00 and 2000-01-02T00:00:00 have different hash codes

-------------------------------------------------------------------------------
1 test: XMLGregorianCalendarTest.testHashCode003
    (bug in xml-apis.jar: javax.xml.datatype.XMLGregorianCalendar.hashCode())
the method hashCode() changes the value of the object because normalize() is 
called
inside the method

-------------------------------------------------------------------------------
1 test: DatatypeFactoryTest.testNewDurationYearMonthString002
    (bug in xml-apis.jar: 
javax.xml.datatype.DatatypeFactory.newDurationYearMonth(String 
lexicalRepresentation))
the method does not throw IllegalArgumentException for lexical representations 
additionaly 
prohibited by the API spec (i.e. there must not be fields other than year and 
month)

-------------------------------------------------------------------------------
1 test: DatatypeFactoryTest.testNewDurationDayTimeString002
    (bug in xml-apis.jar: 
javax.xml.datatype.DatatypeFactory.newDurationDayTime(String 
lexicalRepresentation))
the method does not throw IllegalArgumentException for lexical representations 
additionaly 
prohibited by the API spec (i.e. there must not be fields year and month)

-------------------------------------------------------------------------------
1 test: DatatypeFactoryTest.testNewDurationYearMonthlong
    (bug in xml-apis.jar: 
javax.xml.datatype.DatatypeFactory.newDurationYearMonth(long 
durationInMilliseconds))
the method sets all fields of the new duration but according to the API spec 
has to discard 
fields other than year and month. For example, newDurationYearMonth(0) has to 
return 
P0Y0M instead of P0Y0M0DT0H0M0.000S 

-------------------------------------------------------------------------------
1 test: DatatypeFactoryTest.testNewDurationDayTimelong
    (bug in xml-apis.jar: 
javax.xml.datatype.DatatypeFactory.newDurationDayTime(long 
durationInMilliseconds))
the method sets all fields of the new duration but according to the API spec 
has to discard 
fields year, month and milliseconds. For example, newDurationDayTime(12) has to 
return 
P0DT0H0M0S instead of P0Y0M0DT0H0M0.012S 

-------------------------------------------------------------------------------
1 test: DatatypeFactoryTest.testNewDurationYearMonthbooleanintint002
    (bug in xml-apis.jar: 
javax.xml.datatype.DatatypeFactory.newDurationYearMonth(boolean isPositive,int 
year,int month))
the method throws IllegalArgumentException if at least one of the fields (year 
or month) 
is unedfined (i.e. set to DatatypeConstants.FIELD_UNDEFINED)

16 bugs in org.apache.xerces.jaxp.datatype.* (Xerces 2.7.1)

-------------------------------------------------------------------------------
18 tests: XMLGregorianCalendarTest.testToString
       , XMLGregorianCalendarTest.testEqualsObject002
       , XMLGregorianCalendarTest.testEqualsObject001
       , XMLGregorianCalendarTest.testSetTimeintintintint003
       , XMLGregorianCalendarTest.testSetTimeintintintint002
       , XMLGregorianCalendarTest.testSetTimeintintintint001
       , XMLGregorianCalendarTest.testSetTimeintintintBigDecima003
       , XMLGregorianCalendarTest.testSetTimeintintintBigDecimal002
       , XMLGregorianCalendarTest.testSetTimeintintintBigDecimal001
       , XMLGregorianCalendarTest.testSetTimeintintint003
       , XMLGregorianCalendarTest.testSetTimeintintint002
       , XMLGregorianCalendarTest.testSetTimeintintint001
       , XMLGregorianCalendarTest.testHashCode001
       , XMLGregorianCalendarTest.testHashCode002
       , XMLGregorianCalendarTest.testHashCode003
       , XMLGregorianCalendarTest2.testIsValid
       , XMLGregorianCalendarTest2.testCompare2
       , XMLGregorianCalendarTest2.testCompare3
    (bug in Xerces: 
       org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setTime(int 
hour, int minute, int second, BigDecimal fractional)
       org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setTime(int 
hour, int minute, int second, int millisecond)
       
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.XMLGregorianCalendarImpl(String
 lexicalRepresentation))
the method throws IllegalArgumentException for the valid time value 24:00:00.

-------------------------------------------------------------------------------
2 tests: XMLGregorianCalendarTest2.testSetHour3
      , XMLGregorianCalendarTest2.testSetHour2
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setHour(int hour))
the methods does not allow 24 as a value of the hour field.
The method must allow setting 24 regardless to minutes and seconds. This setter
method must not check the whole calendar for validity.

-------------------------------------------------------------------------------
13 tests: DatatypeFactoryTest.testNewXMLGregorianCalendarGregorianCalendar
       , XMLGregorianCalendarTest.testEqualsObject001
       , XMLGregorianCalendarTest.testSetTimeintintintint001
       , XMLGregorianCalendarTest2.testXMLGregorianCalendarGregorianCalendar002
       , XMLGregorianCalendarTest2.testXMLGregorianCalendarGregorianCalendar001
       , XMLGregorianCalendarTest2.testCompare3
       , XMLGregorianCalendarTest2.testCompare2
       , XMLGregorianCalendarTest2.testSetMillisecond5
       , XMLGregorianCalendarTest2.testSetMillisecond3
       , XMLGregorianCalendarTest2.testSetMillisecond1
       , XMLGregorianCalendarTest2.testNormalize1
       , XMLGregorianCalendarTest2.testNormalize2
       , XMLGregorianCalendarTest2.testNormalize4
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setMillisecond(int 
millisecond)
                    
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.add(Duration duration))
the method uses jdk1.5 API incompatible with jdk1.4, used constructors 
java.math.BigDecimal(long) 
and java.math.BigDecimal(int), which are absent in 1.4. This bug is reproducible
with jdk1.4- on classes compiled with jdk1.5. The bug is fixed.

-------------------------------------------------------------------------------
3 tests: DatatypeFactoryTest.testNewDurationYearMonthString002
       , DatatypeFactoryTest.testNewDurationDayTimeString002
       , DurationTest2.testValueOf002
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newDurationYearMonth(String 
lexicalRepresentation)
             and in 
org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newDurationDayTime(String 
lexicalRepresentation))
the methods throw NullPointerException for the following non-null 
lexicalRepresentations:  "P1Y1Y", "PT4H4H", "PT6S4H". These are invalid,
so the methods are expected to throw IllegalArgumentException instead of NPE

-------------------------------------------------------------------------------
2 tests: DurationTest.testEqualsObject
      , DurationTest2.testCompare
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.DurationImpl.compare(Duration rhs))
the method reports equality of the following pairs of unequal durations:
("P1Y", "P365D"), ("P1M", "P28D"), ("P5M", "P150D")

-------------------------------------------------------------------------------
2 tests: DurationTest.testSubtract001
       , DurationTest2.testAdd001
    (bug in Xerces: org.apache.xerces.jaxp.datatype.DurationImpl.add(Duration 
rhs))
the method cannot borrow days from 400x years, but the duration description
in XML Schema spec implies that every subsequent 400 years has exectly 97 
leap years, i.e. 365*400 + 97 = 146097 days, thus P400Y equals to P146097D

-------------------------------------------------------------------------------
5 tests: DurationTest.testGetXMLSchemaType
      , DurationTest2.testNegate
      , DurationTest2.testNegate
      , DatatypeFactoryTest.testNewDurationYearMonthlong
      , DurationTest2.testGetSign
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.DurationImpl.DurationImpl(boolean isPositive,
       BigInteger years, BigInteger months, BigInteger days, BigInteger hours, 
BigInteger minutes, BigDecimal seconds))
the constructor does not allow all fields undefined, but the API spec 
does not prohibit such case. There only field values prohibited are negative.

-------------------------------------------------------------------------------
2 tests: DatatypeFactoryTest.testNewDurationlong 
      , DurationTest2.testGetDenormalizedValueOf001
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newDuration(long 
durationInMilliseconds))
the method does not set all the fields of the new duration but according to 
the API spec has to. For example, newDuration(1001) has to return 
P0Y0M0DT0H0M1.001S instead of PT1.001S 

-------------------------------------------------------------------------------
1 test: XMLGregorianCalendarTest2.testValueOf
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(String
 lexicalRepresentation))
the method does not throw IllegalArgumentexception for illegal lexical 
representation "00:00:00.000+001:00" (extra digit in time zone).

-------------------------------------------------------------------------------
4 tests: 
XMLGregorianCalendarTest2.testToGregorianCalendarTimeZoneLocaleXMLGregorianCalendar001
       , XMLGregorianCalendarTest2.testToGregorianCalendar002
       , DatatypeFactoryTest.testNewXMLGregorianCalendarGregorianCalendar
       , XMLGregorianCalendarTest2.testXMLGregorianCalendarGregorianCalendar002
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.toGregorianCalendar())
the method incorrectly sets years in BC era (e.g. XMLGregorianCalendar 
date "-0001-01-01" must result in GregorianCalendar date "0002-01-01 BC",
instead of "0001-01-01 BC"). For details see XML Schema 1.0 Specification 
Errata, the last section of the E2-63 Clarification.

-------------------------------------------------------------------------------
4 tests: XMLGregorianCalendarTest2.testSetFractionalSecond5
       , XMLGregorianCalendarTest2.testSetFractionalSecond3
       , XMLGregorianCalendarTest2.testSetFractionalSecond2
       , XMLGregorianCalendarTest2.testSetMillisecond5
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setFractionalSecond(BigDecimal
 fractional))
the method does not set seconds to 0 if that has been undefined,
the spec allows fractional seconds only if seconds are defined 

-------------------------------------------------------------------------------
1 test: XMLGregorianCalendarTest2.testSetFractionalSecond2
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setFractionalSecond(BigDecimal
 fractional))
the method allows setting fractionalSecond to 1.0, but the field values
must be less than 1.0 and greater or equal to 0.

-------------------------------------------------------------------------------
1 test: XMLGregorianCalendarTest2.testSetSecond4
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.setSecond(int))
when the argument is UNDEFINED, the method does not reset fractionalSecond.
The spec allows fractional seconds only if seconds are defined

-------------------------------------------------------------------------------
1 test: XMLGregorianCalendarTest2.testToXMLFormat
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.newXMLGregorianCalendar(String))
the method does not set fractionalSecond to 0 if time part is specified 
by the argument. If the time part (e.g. 12:40:00) is specified, then
it implicitly specifies zero fractionalSecond, so the method must set
fractionalSecond to zero.

-------------------------------------------------------------------------------
1 test: DurationTest2.testHashCode1
    (bug in Xerces: org.apache.xerces.jaxp.datatype.DurationImpl.hashCode())
the method returns different hash codes for equal durations "P146097D", "P400Y"
(see description of the bug in DurationImpl.add(Duration rhs))

-------------------------------------------------------------------------------
1 test: DurationTest2.testNormalizeWith
    (bug in Xerces: 
org.apache.xerces.jaxp.datatype.DurationImpl.compare(Duration rhs))
the method does not preserve the sign of the duration (eg. for the value 
"-PT23H120M" it returns "P0DT23H120M")
     
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to