mirror of https://github.com/sbt/sbt.git
Hash calculation may throw exception w/ getModifiedTime(); fix
In Eval there is a calculation of hashes by scanning the elements of classpath, and getting the last modification time of each directory. When lastModified() was in use, non-existent elements would return 0L, but getModifiedTime() will throw an exception instead (like getLastModifiedTime(), incidentally). So, we catch the FileNotFoundException and return 0L now as well.
This commit is contained in:
parent
2129f8ceb5
commit
295bcff851
|
|
@ -487,8 +487,12 @@ private[sbt] object Eval {
|
|||
if (fs eq null) filesModifiedBytes(Array[File]()) else seqBytes(fs)(fileModifiedBytes)
|
||||
def fileModifiedBytes(f: File): Array[Byte] =
|
||||
(if (f.isDirectory) filesModifiedBytes(f listFiles classDirFilter)
|
||||
else bytes(getModifiedTime(f))) ++
|
||||
bytes(f.getAbsolutePath)
|
||||
else
|
||||
bytes(try {
|
||||
getModifiedTime(f)
|
||||
} catch {
|
||||
case _: java.io.FileNotFoundException => 0L
|
||||
})) ++ bytes(f.getAbsolutePath)
|
||||
def fileExistsBytes(f: File): Array[Byte] =
|
||||
bytes(f.exists) ++
|
||||
bytes(f.getAbsolutePath)
|
||||
|
|
|
|||
Loading…
Reference in New Issue