JarEntryTime.java revision 3261
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4225317 6969651
* @summary Check extracted files have date as per those in the .jar file
*/
public class JarEntryTime {
boolean rc = true;
if (x != null) {
for (int i = 0; i < x.length; i++) {
}
}
}
}
if (useExtractionTime) {
"-J-Dsun.tools.jar.useExtractionTime=true",
"xf",
} else {
"xf",
}
}
// Remove any leftovers from prior run
/* Create a directory structure
* outer/
* inner/
* foo.txt
* Set the lastModified dates so that outer is created now, inner
* yesterday, and foo.txt created "earlier".
*/
// Get the "now" from the "last-modified-time" of the last file we
// just created, instead of the "System.currentTimeMillis()", to
// workaround the possible "time difference" due to nfs.
// ZipEntry's mod date has 2 seconds precision: give extra time to
// allow for e.g. rounding/truncation and networked/samba drives.
final long PRECISION = 10000L;
// Make a jar file from that directory structure
"cf",
// Extract and check that the last modified values are those specified
// in the archive
extractJar(jarFile, false);
// Extract and check the last modified values are the current times.
// See sun.tools.jar.Main
extractJar(jarFile, true);
}
//--------------------- Infrastructure ---------------------------
else fail(x + " not equal to " + y);}
}