use APIs available on < 1.8 jdk

This commit is contained in:
Andy Clement
2015-05-05 22:32:58 -07:00
parent 56d0c00822
commit 8381a562da
2 changed files with 4 additions and 5 deletions

View File

@@ -82,7 +82,7 @@ public class ReloadableFileChangeListener implements FileChangeListener {
Set<JarEntry> entriesBeingWatched = watchedJarContents.get(file);
for (JarEntry entryBeingWatched : entriesBeingWatched) {
ZipEntry ze = zf.getEntry(entryBeingWatched.slashname);
long lmt = ze.getLastModifiedTime().toMillis();
long lmt = ze.getTime();//getLastModifiedTime().toMillis();
if (lmt > entryBeingWatched.lmt) {
// entry in jar has been updated
if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.INFO)) {
@@ -112,7 +112,7 @@ public class ReloadableFileChangeListener implements FileChangeListener {
ZipFile zf = new ZipFile(file);
String slashname = rtype.getSlashedName() + ".class";
ZipEntry ze = zf.getEntry(slashname);
long lmt = ze.getLastModifiedTime().toMillis();
long lmt = ze.getTime();//LastModifiedTime().toMillis();
JarEntry je = new JarEntry(rtype, slashname, lmt);
zf.close();
Set<JarEntry> jarEntries = watchedJarContents.get(file);

View File

@@ -23,7 +23,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.attribute.FileTime;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
@@ -315,10 +314,10 @@ public class ReloadingJVM {
}
// System.out.println("LMT for " + ze.getName() + " is " + new Date(ze.getLastModifiedTime().toMillis()));
if (!found) {
newZipEntry.setLastModifiedTime(ze.getLastModifiedTime());
newZipEntry.setTime(ze.getTime());//LastModifiedTime());
}
else {
newZipEntry.setLastModifiedTime(FileTime.fromMillis(newtime));
newZipEntry.setTime(newtime);//FileTime.fromMillis(newtime));
}
// System.out.println("LMT for " + ze.getName() + " is updated to "
// + new Date(newZipEntry.getLastModifiedTime().toMillis()));