remove unneeded dependency, use try catch when writing files
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8d9fcd3d7c
commit
fe72c02562
|
@ -14,7 +14,6 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-reflect'
|
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
|
|
|
@ -190,12 +190,16 @@ class CacheController {
|
||||||
* @param timetable a timetable of the type [TimetableCourseWeek]
|
* @param timetable a timetable of the type [TimetableCourseWeek]
|
||||||
*/
|
*/
|
||||||
private fun saveTimetableToCache(timetable: TimetableCourseWeek) {
|
private fun saveTimetableToCache(timetable: TimetableCourseWeek) {
|
||||||
println(timetable.timetable.toString())
|
|
||||||
|
|
||||||
val file = File(StartupController.dirTcorCache, "timetable-${timetable.meta.courseName}-${timetable.meta.weekIndex}.json")
|
val file = File(StartupController.dirTcorCache, "timetable-${timetable.meta.courseName}-${timetable.meta.weekIndex}.json")
|
||||||
val writer = BufferedWriter(FileWriter(file))
|
val writer = BufferedWriter(FileWriter(file))
|
||||||
writer.write(Gson().toJson(timetable))
|
|
||||||
writer.close()
|
try {
|
||||||
|
writer.write(Gson().toJson(timetable))
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.error("something went wrong while trying to write a cache file", e)
|
||||||
|
} finally {
|
||||||
|
writer.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue