-
Bug
-
Resolution: Fixed
-
P3
-
1.0, 1.2.0, 1.4.2, 6
-
b83
-
generic, x86, sparc
-
generic, solaris_8, solaris_10, windows_2000
Name: krT82822 Date: 03/30/99
The jar tool does not preserve the creation/modification date
of any archived files on Windows 95.
Extracted files always get the date of the extraction event.
This is data loss.
Inside the jar file, (viewed with Winzip), the dates seem to be
correct.
(Review ID: 56275)
======================================================================
Suggested fix provided by https://mustang.dev.java.net/ member dmytro_sheyko:
A DESCRIPTION OF THE FIX :
Bug number : 4225317
Bug Description : jar does not preserve file modification dates during extract (win95)
Diff Baseline : Mustang b65.
Diff :
--- j2se/src/share/classes/sun/tools/jar/Main.java.prev Thu Jan 05 10:41:00 2006
+++ j2se/src/share/classes/sun/tools/jar/Main.java Thu Jan 05 10:41:09 2006
@@ -753,39 +753,43 @@
/*
* Extracts next entry from JAR file, creating directories as needed.
*/
void extractFile(ZipInputStream zis, ZipEntry e) throws IOException {
String name = e.getName();
File f = new File(e.getName().replace('/', File.separatorChar));
if (e.isDirectory()) {
if (!f.exists() && !f.mkdirs() || !f.isDirectory()) {
throw new IOException(formatMsg("error.create.dir",
f.getPath()));
}
if (vflag) {
output(formatMsg("out.create", name));
}
} else {
if (f.getParent() != null) {
File d = new File(f.getParent());
if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
throw new IOException(formatMsg(
"error.create.dir", d.getPath()));
}
}
OutputStream os = new FileOutputStream(f);
byte[] b = new byte[512];
int len;
while ((len = zis.read(b, 0, b.length)) != -1) {
os.write(b, 0, len);
}
zis.closeEntry();
os.close();
if (vflag) {
if (e.getMethod() == ZipEntry.DEFLATED) {
output(formatMsg("out.inflated", name));
} else {
output(formatMsg("out.extracted", name));
}
}
}
+ long lastModified = e.getTime();
+ if(lastModified != -1) {
+ f.setLastModified(lastModified);
+ }
}
FIX FOR BUG NUMBER:
4225317
The jar tool does not preserve the creation/modification date
of any archived files on Windows 95.
Extracted files always get the date of the extraction event.
This is data loss.
Inside the jar file, (viewed with Winzip), the dates seem to be
correct.
(Review ID: 56275)
======================================================================
Suggested fix provided by https://mustang.dev.java.net/ member dmytro_sheyko:
A DESCRIPTION OF THE FIX :
Bug number : 4225317
Bug Description : jar does not preserve file modification dates during extract (win95)
Diff Baseline : Mustang b65.
Diff :
--- j2se/src/share/classes/sun/tools/jar/Main.java.prev Thu Jan 05 10:41:00 2006
+++ j2se/src/share/classes/sun/tools/jar/Main.java Thu Jan 05 10:41:09 2006
@@ -753,39 +753,43 @@
/*
* Extracts next entry from JAR file, creating directories as needed.
*/
void extractFile(ZipInputStream zis, ZipEntry e) throws IOException {
String name = e.getName();
File f = new File(e.getName().replace('/', File.separatorChar));
if (e.isDirectory()) {
if (!f.exists() && !f.mkdirs() || !f.isDirectory()) {
throw new IOException(formatMsg("error.create.dir",
f.getPath()));
}
if (vflag) {
output(formatMsg("out.create", name));
}
} else {
if (f.getParent() != null) {
File d = new File(f.getParent());
if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
throw new IOException(formatMsg(
"error.create.dir", d.getPath()));
}
}
OutputStream os = new FileOutputStream(f);
byte[] b = new byte[512];
int len;
while ((len = zis.read(b, 0, b.length)) != -1) {
os.write(b, 0, len);
}
zis.closeEntry();
os.close();
if (vflag) {
if (e.getMethod() == ZipEntry.DEFLATED) {
output(formatMsg("out.inflated", name));
} else {
output(formatMsg("out.extracted", name));
}
}
}
+ long lastModified = e.getTime();
+ if(lastModified != -1) {
+ f.setLastModified(lastModified);
+ }
}
FIX FOR BUG NUMBER:
4225317
- duplicates
-
JDK-6310279 jar does not set the timestamps of the extracted file correctly
-
- Closed
-
-
JDK-4988654 set lastModifiedDate to date in JAR, not now()
-
- Closed
-
- relates to
-
JDK-6590289 -Dsun.tools.jar.useExtractionTime=true uses a time that is about 8 minutes early
-
- Closed
-