Permalink
Browse files

getTimestamp() now returns null instead of creation time

  • Loading branch information...
mordechaim committed Dec 21, 2018
1 parent b6606b0 commit 8724d3779aa94ce47526ead9bc9f6be0e14c4044
Showing with 10 additions and 7 deletions.
  1. +1 −0 CHANGELOG.md
  2. +9 −7 src/main/java/org/update4j/Configuration.java
@@ -10,6 +10,7 @@
* Bug fix when local config file was missing in `DefaultBootstrap::launchFirst`.
* Changed how `--delegate` argument in `Bootstrap` works.
* Fixed bug in `deleteOldFiles()` where it would try to compare files even if it belongs to different OS.
* `Configuration.getTimestamp()` now returns `null` if not present in the XML instead of time of object creation.
* **1.3.3**
* Properly escape special chars in output XML. Allow control chars in properties.
* Renamed `UpdateHandler::connect` to `UpdateHandler::openDownloadStream`
@@ -472,9 +472,8 @@ private Configuration() {
/**
* Returns the timestamp this configuration was last updated using the
* {@link Configuration.Builder} API or {@code sync()}. This is read from the
* {@code timestamp} attribute in the root element. If the attribute is missing
* it will return the time this instance was created.
*
* {@code timestamp} attribute in the <em>root</em> element. If the attribute is
* missing this will return {@code null}.
* <p>
* It does not have any effect on the behavior of anything else; it is rather
* just for reference purposes (i.e. "Last Updated: 2 Weeks Ago"), or for
@@ -1668,8 +1667,6 @@ private static Configuration parseNoCopy(ConfigMapper configMapper, PropertyMana

if (configMapper.timestamp != null)
config.timestamp = Instant.parse(configMapper.timestamp);
else
config.timestamp = Instant.now();

config.signature = configMapper.signature;

@@ -1987,8 +1984,13 @@ public boolean equals(Object other) {
}

Configuration otherConfig = (Configuration) other;
if (!this.getTimestamp().equals(otherConfig.getTimestamp())) {
return false;
if (getTimestamp() == null) {
if (otherConfig.getTimestamp() != null)
return false;
} else {
if (!getTimestamp().equals(otherConfig.getTimestamp())) {
return false;
}
}

return toString().equals(other.toString());

0 comments on commit 8724d37

Please sign in to comment.