Fix problems with config lists and default config
This commit is contained in:
parent
9a0c1033d0
commit
39caa297ac
2 changed files with 8 additions and 2 deletions
|
|
@ -73,7 +73,7 @@ object Config {
|
|||
"\n\t3. Define 'AKKA_HOME' environment variable pointing to the root of the Akka distribution." +
|
||||
"\nI have no way of finding the '" + confName + "' configuration file." +
|
||||
"\nUsing default values everywhere.")
|
||||
Configuration.fromString("<akka></akka>") // default empty config
|
||||
Configuration.fromString("akka {}") // default empty config
|
||||
}
|
||||
} catch {
|
||||
case e =>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,13 @@ class Configuration(val map: Map[String, Any]) {
|
|||
|
||||
def getString(key: String, defaultValue: String): String = getString(key).getOrElse(defaultValue)
|
||||
|
||||
def getList(key: String): Seq[String] = map(key).asInstanceOf[Seq[String]]
|
||||
def getList(key: String): Seq[String] = {
|
||||
try {
|
||||
map(key).asInstanceOf[Seq[String]]
|
||||
} catch {
|
||||
case _ => Seq.empty[String]
|
||||
}
|
||||
}
|
||||
|
||||
def getInt(key: String): Option[Int] = {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue