Skip to content

Commit

Permalink
Merge pull request #65 from avpinchuk/check-file-exists
Browse files Browse the repository at this point in the history
Check for file existing when detect file's last modified time
  • Loading branch information
arjantijms authored Nov 4, 2023
2 parents 1f9bff7 + a4ff41d commit 74a96ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/glassfish/wasp/compiler/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ public boolean isOutDated(boolean checkClass) {
*
* <p>The {@code 0L} time stamp may be returned when:
* <ul>
* <li>File does not exists.</li>
* <li>Basic attribute view is not available for {@code file}.</li>
* <li>Creation time stamp and last modified time stamp not implemented for {@code file}.</li>
* <li>An I/O error occurred.</li>
Expand All @@ -599,6 +600,10 @@ public boolean isOutDated(boolean checkClass) {
* @return a time stamp representing the time the file was last modified
*/
private long getLastModifiedTime(File file) {
if (!file.exists()) {
return 0L;
}

BasicFileAttributeView attributeView = Files.getFileAttributeView(file.toPath(), BasicFileAttributeView.class);
if (attributeView == null) {
log.log(SEVERE, "Basic attribute view is not available for " + file.getAbsolutePath());
Expand Down

0 comments on commit 74a96ac

Please sign in to comment.