|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -57,8 +57,7 @@ public abstract class AbstractResource implements Resource {
@@ -57,8 +57,7 @@ public abstract class AbstractResource implements Resource {
|
|
|
|
|
catch (IOException ex) { |
|
|
|
|
// Fall back to stream existence: can we open the stream?
|
|
|
|
|
try { |
|
|
|
|
InputStream is = getInputStream(); |
|
|
|
|
is.close(); |
|
|
|
|
getInputStream().close(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
catch (Throwable isEx) { |
|
|
|
@ -146,7 +145,7 @@ public abstract class AbstractResource implements Resource {
@@ -146,7 +145,7 @@ public abstract class AbstractResource implements Resource {
|
|
|
|
|
InputStream is = getInputStream(); |
|
|
|
|
try { |
|
|
|
|
long size = 0; |
|
|
|
|
byte[] buf = new byte[255]; |
|
|
|
|
byte[] buf = new byte[256]; |
|
|
|
|
int read; |
|
|
|
|
while ((read = is.read(buf)) != -1) { |
|
|
|
|
size += read; |
|
|
|
@ -169,10 +168,11 @@ public abstract class AbstractResource implements Resource {
@@ -169,10 +168,11 @@ public abstract class AbstractResource implements Resource {
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public long lastModified() throws IOException { |
|
|
|
|
long lastModified = getFileForLastModifiedCheck().lastModified(); |
|
|
|
|
if (lastModified == 0L) { |
|
|
|
|
File fileToCheck = getFileForLastModifiedCheck(); |
|
|
|
|
long lastModified = fileToCheck.lastModified(); |
|
|
|
|
if (lastModified == 0L && !fileToCheck.exists()) { |
|
|
|
|
throw new FileNotFoundException(getDescription() + |
|
|
|
|
" cannot be resolved in the file system for resolving its last-modified timestamp"); |
|
|
|
|
" cannot be resolved in the file system for checking its last-modified timestamp"); |
|
|
|
|
} |
|
|
|
|
return lastModified; |
|
|
|
|
} |
|
|
|
|