Buggy code:
public class DurationDV extends AbstractDateTimeDV { public static final int DURATION_TYPE = 0 ; public static final int YEARMONTHDURATION_TYPE = 1 ; public static final int DAYTIMEDURATION_TYPE = 2 ; private static final DateTimeData [ ] DATETIMES = new DateTimeData [ ] { new DateTimeData ( 1696 , 9 , 1 , 0 , 0 , 0 , 'Z' , null , true , null ) , new DateTimeData ( 1697 , 2 , 1 , 0 , 0 , 0 , 'Z' , null , true , null ) , new DateTimeData ( 1903 , 3 , 1 , 0 , 0 , 0 , 'Z' , null , true , null ) , new DateTimeData ( 1903 , 7 , 1 , 0 , 0 , 0 , 'Z' , null , true , null ) } ; public Object getActualValue ( String content , ValidationContext context ) throws InvalidDatatypeValueException { } protected DateTimeData parse ( String str , int durationType ) throws SchemaDateTimeException { } protected short compareDates ( DateTimeData date1 , DateTimeData date2 , boolean strict ) { } private short compareResults ( short resultA , short resultB , boolean strict ) { } private DateTimeData addDuration ( DateTimeData date , DateTimeData addto , DateTimeData duration ) { } protected double parseSecond ( String buffer , int start , int end ) throws NumberFormatException { } protected String dateToString ( DateTimeData date ) { } protected Duration getDuration ( DateTimeData date ) { int sign = 1 ; if ( ( ( ( ( ( ( date . year ) < 0 ) || ( ( date . month ) < 0 ) ) || ( ( date . day ) < 0 ) ) || ( ( date . hour ) < 0 ) ) || ( ( date . minute ) < 0 ) ) || ( ( date . second ) < 0 ) ) { sign = - 1 ; } <START_BUG> return factory . newDuration ( ( sign == 1 ) , ( ( date . year ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . year ) ) ) : null ) , ( ( date . month ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . month ) ) ) : null ) , ( ( date . day ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . day ) ) ) : null ) , ( ( date . hour ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . hour ) ) ) : null ) , ( ( date . minute ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . minute ) ) ) : null ) , ( ( date . second ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? new BigDecimal ( String . valueOf ( ( sign * ( date . second ) ) ) ) : null ) ) ; <END_BUG> } }

Fix:
return datatypeFactory . newDuration ( ( sign == 1 ) , ( ( date . year ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . year ) ) ) : null ) , ( ( date . month ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . month ) ) ) : null ) , ( ( date . day ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . day ) ) ) : null ) , ( ( date . hour ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . hour ) ) ) : null ) , ( ( date . minute ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? BigInteger . valueOf ( ( sign * ( date . minute ) ) ) : null ) , ( ( date . second ) != ( DatatypeConstants . FIELD_UNDEFINED ) ? new BigDecimal ( String . valueOf ( ( sign * ( date . second ) ) ) ) : null ) ) ;