Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for file existing when detect file's last modified time #65

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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