mirror of
https://github.com/OpenBankProject/API-Explorer.git
synced 2026-02-06 10:47:23 +00:00
bugfix/Close streams at the function gitCommit and use lazy val instead of def
This commit is contained in:
parent
e658e848a2
commit
616d423239
@ -1908,13 +1908,18 @@ WIP to add comments on resource docs. This code copied from Sofit.
|
||||
/*
|
||||
Return the git commit. If we can't for some reason (not a git root etc) then log and return ""
|
||||
*/
|
||||
def gitCommit : String = {
|
||||
lazy val gitCommit : String = {
|
||||
val commit = try {
|
||||
val properties = new java.util.Properties()
|
||||
logger.debug("Before getResourceAsStream git.properties")
|
||||
properties.load(getClass().getClassLoader().getResourceAsStream("git.properties"))
|
||||
logger.debug("Before get Property git.commit.id")
|
||||
properties.getProperty("git.commit.id", "")
|
||||
val stream = getClass().getClassLoader().getResourceAsStream("git.properties")
|
||||
try {
|
||||
properties.load(stream)
|
||||
logger.debug("Before get Property git.commit.id")
|
||||
properties.getProperty("git.commit.id", "")
|
||||
} finally {
|
||||
stream.close()
|
||||
}
|
||||
} catch {
|
||||
case e : Throwable => {
|
||||
logger.warn("gitCommit says: Could not return git commit. Does resources/git.properties exist?")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user