Skip to content

Commit

Permalink
Test failures on Mac OS
Browse files Browse the repository at this point in the history
Fixes #574

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Oct 16, 2019
1 parent f8a2c15 commit 99baf46
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.eclipse.lsp4xml.extensions.contentmodel.model;

import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
Expand All @@ -18,6 +19,7 @@
import java.nio.file.attribute.FileTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -54,11 +56,15 @@ public boolean isDirty() {
return true;
}
FileTime currentLastMofied = Files.getLastModifiedTime(file);
Field f = FileTime.class.getDeclaredField("value");
f.setAccessible(true);
TimeUnit tu = (TimeUnit) f.get(currentLastMofied);
LOGGER.log(Level.INFO, "isDirty=", tu);
if (!currentLastMofied.equals(lastModified)) {
lastModified = currentLastMofied;
return true;
}
} catch (IOException e) {
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Get last modified time failed", e);
return true;
}
Expand Down

0 comments on commit 99baf46

Please sign in to comment.