Found the problem... The Calendar object returned over binding.ws, GregorianCalendar object, has a gregorianCutover field set to -9223372036854775808 (== Long.MIN_VALUE). Whereas the one returned by Calendar.getInstance() has the field set to GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER = -12219292800000L. Here is what javadoc for GregorianCalendar.setGregorianChange() says: "To obtain a pure Julian calendar, set the change date to Date(Long.MAX_VALUE). To obtain a pure Gregorian calendar,set the change date to Date(Long.MIN_VALUE)."
++Vamsi On Tue, Jun 3, 2008 at 3:37 PM, Vamsavardhana Reddy <[EMAIL PROTECTED]> wrote: > While writing databinding tests for java.util.Calendar type, I have hit a > strange problem with comparing Calendar objects. The problem occurs only > when using binding.ws to invoke the service method. Even in the > problematic case, expected.toString() and actual.toString() are equal but > expected.equals(actual) returns false!! Here is an excerpt from the > FailureTrace: > > > expected:<java.util.GregorianCalendar[time=1212745401890,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+05:30",offset=19800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2008,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=1,DAY_OF_MONTH=6,DAY_OF_YEAR=158,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=13,SECOND=21,MILLISECOND=890,ZONE_OFFSET=19800000,DST_OFFSET=0]> > but > was:<java.util.GregorianCalendar[time=1212745401890,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+05:30",offset=19800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2008,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=1,DAY_OF_MONTH=6,DAY_OF_YEAR=158,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=13,SECOND=21,MILLISECOND=890,ZONE_OFFSET=19800000,DST_OFFSET=0]> > > Any ideas what could be wrong? > > ++Vamsi > >