Added better error handling for spring environment issues

This commit is contained in:
neviyn 2019-03-04 11:45:40 +00:00
parent b72060cd2a
commit 707b8a1b26
2 changed files with 15 additions and 10 deletions

View File

@ -176,8 +176,15 @@ class GroupSessionController {
retryCount++
Thread.sleep(1_000) // Sleep for 1 second
}
if (ipv4 != null)
if (ipv4 != null && this::environment.isInitialized)
return mapOf("ip" to ipv4, "port" to environment["local.server.port"])
else if(ipv4 == null) {
logger.error("IP Address could not be determined")
return mapOf("error" to "Could not determine IP Address")
}
else {
logger.error("Port could not be determined, environment not initialised")
return mapOf("error" to "Could not determine port")
}
}
}

View File

@ -30,12 +30,10 @@ class GroupSessionControllerTest{
lateinit var siteRepository: SiteRepository
@Mock
lateinit var tutorRepository: TutorRepository
/**
@Mock
lateinit var observationRepository: ObservationRepository
@Mock
lateinit var personRepository: PersonRepository
**/
@After
fun tearDown() {