GregorianCalendar not equal when read from space

Jean Cote <[email protected]> Thu, 3 May 2007 12:05:49 -0700
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
Hi,

Here is my problem. I write to the space a
GregorianCalendar and when I read it back, it is not
equal to the initial entry.
If I write a GregorianCalendar without the
SimpleTimeZone, it is equal. If I write only a
SimpleTimeZone it is also equal.
It seems to me like it is a bug in Java itself but
just want to see if anyone have seen this before. I
use the latest version of Java (1.6.0.01) and Jini2.1
plain.

Here is the code:
=================
  JavaSpace space = SpaceAccessor.getSpace();
  TestEntry testEntry = new TestEntry();
  Calendar now = new GregorianCalendar( new
SimpleTimeZone( 0, "GMT" ) );
  testEntry._test = now;
  try {
     space.write(testEntry, null, Long.MAX_VALUE);
     TestEntry result = (TestEntry)space.read(new
TestEntry(), null, Long.MAX_VALUE);
     Calendar cal = (Calendar)result._test;
//If this is enabled, it is equal...
//   cal.setTimeZone(new SimpleTimeZone( 0, "GMT" ) );
     logger.debug("FROM SPACE:"+cal);
     logger.debug("ORIGINAL:"+now);
     logger.debug("EQUALS?:"+cal.equals(now));

Here is the output:
===================
2007-04-19 17:16:01,521 51 anager2.WorkerMaster
(DEBUG) - FROM
SPACE:java.util.GregorianCalendar[time=1177024561219,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2007,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=19,DAY_OF_YEAR=109,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=11,HOUR_OF_DAY=23,MINUTE=16,SECOND=1,MILLISECOND=219,ZONE_OFFSET=0,DST_OFFSET=0]
2007-04-19 17:16:01,567 52 anager2.WorkerMaster
(DEBUG) -
ORIGINAL:java.util.GregorianCalendar[time=1177024561219,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=java.util.SimpleTimeZone[id=GMT,offset=0,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0,endTimeMode=0],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2007,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=19,DAY_OF_YEAR=109,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=11,HOUR_OF_DAY=23,MINUTE=16,SECOND=1,MILLISECOND=219,ZONE_OFFSET=0,DST_OFFSET=0]
2007-04-19 17:16:01,569 53 anager2.WorkerMaster
(DEBUG) - EQUALS?:false


I appreciate any pointer anyone can give me.
Thanks

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html