Commit 7ccf5ce0 authored by Sander Bollen's avatar Sander Bollen
Browse files

Merge branch 'feature-gitlab_issues' into 'develop'

Split methods

Split methods that are used in GitlabIssueToJira in sasc-utils

See merge request !461
parents 57b31904 cf5e59e4
......@@ -117,11 +117,21 @@ object ConfigUtils extends Logging {
def fileToJson(configFile: File): Json = {
logger.debug("Jsonfile: " + configFile)
val jsonText = scala.io.Source.fromFile(configFile).mkString
try { textToJson(jsonText) }
catch {
case e: IllegalStateException =>
throw new IllegalStateException("The config JSON file is either not properly formatted or not a JSON file, file: " + configFile, e)
}
}
/** Make json aboject from a file */
def textToJson(jsonText: String): Json = {
logger.debug("jsonText: " + jsonText)
val json = Parse.parseOption(jsonText)
logger.debug(json)
json getOrElse {
throw new IllegalStateException("The config JSON file is either not properly formatted or not a JSON file, file: " + configFile)
throw new IllegalStateException("The config JSON file is either not properly formatted or not a JSON file, file: " + jsonText)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment