Project

General

Profile

« Previous | Next » 

Revision 6944

use UTC serialization for log entries so that the timestamp, not just the date, is preserved
https://redmine.dataone.org/issues/2257

View differences:

src/edu/ucsb/nceas/metacat/EventLog.java
32 32
import java.util.List;
33 33

  
34 34
import org.apache.log4j.Logger;
35
import org.dataone.service.util.DateTimeMarshaller;
35 36

  
36 37
import edu.ucsb.nceas.metacat.database.DBConnection;
37 38
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
......
313 314
        rec.append(generateXmlElement("principal", principal));
314 315
        rec.append(generateXmlElement("docid", docid));
315 316
        rec.append(generateXmlElement("event", event));
316
        rec.append(generateXmlElement("dateLogged", dateLogged.toString()));
317
        rec.append(generateXmlElement("dateLogged", DateTimeMarshaller.serializeDateToUTC(dateLogged)));
317 318
        rec.append("</logEntry>\n");
318 319

  
319 320
        return rec.toString();
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
47 47
import org.dataone.client.D1Client;
48 48
import org.dataone.client.ObjectFormatCache;
49 49
import org.dataone.service.util.Constants;
50
import org.dataone.service.util.DateTimeMarshaller;
50 51
import org.dataone.service.exceptions.IdentifierNotUnique;
51 52
import org.dataone.service.exceptions.InsufficientResources;
52 53
import org.dataone.service.exceptions.InvalidRequest;
......
450 451

  
451 452
      le.setIdentifier(identifier);
452 453
      le.setIpAddress(ipAddress);
453
      Calendar c = Calendar.getInstance();
454
      String year = dateLogged.substring(0, 4);
455
      String month = dateLogged.substring(5, 7);
456
      String date = dateLogged.substring(8, 10);
457
      logMetacat.debug("year: " + year + " month: " + month + " day: " + date);
458
      c.set(new Integer(year).intValue(), new Integer(month).intValue(),
459
          new Integer(date).intValue());
460
      Date logDate = c.getTime();
454
      Date logDate = DateTimeMarshaller.deserializeDateToUTC(dateLogged);
461 455
      le.setDateLogged(logDate);
462 456
      NodeReference memberNode = new NodeReference();
463 457
      memberNode.setValue(ipAddress);

Also available in: Unified diff