380034 last modified times taken from JarEntry for JarFile resources
This commit is contained in:
parent
d436400db1
commit
ca2a040a39
|
@ -228,7 +228,11 @@ class JarFileResource extends JarResource
|
|||
public long lastModified()
|
||||
{
|
||||
if (checkConnection() && _file!=null)
|
||||
{
|
||||
if (exists() && _entry!=null)
|
||||
return _entry.getTime();
|
||||
return _file.lastModified();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
|||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -310,6 +311,16 @@ public class ResourceTest
|
|||
assertFalse(jarFileResource.isContainedIn(container));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Test
|
||||
public void testJarFileLastModified ()
|
||||
throws Exception
|
||||
{
|
||||
String s = "jar:"+__userURL+"TestData/test.zip!/subdir/numbers";
|
||||
Resource r = Resource.newResource(s);
|
||||
assertEquals(971425252000L,r.lastModified()); // Known date value inside zip
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Test
|
||||
public void testJarFileCopyToDirectoryTraversal () throws Exception
|
||||
|
|
Loading…
Reference in New Issue