Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.info
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.core.utils.inputStream
import software.aws.toolkits.jetbrains.utils.notifyStickyWithData
import java.nio.file.Paths
Expand All @@ -38,12 +39,17 @@ class ProcessNotificationsBase(
}

private fun getNotificationsFromFile(): NotificationsList? {
val path = Paths.get(PathManager.getSystemPath(), NOTIFICATIONS_PATH)
val content = path.inputStream().bufferedReader().use { it.readText() }
if (content.isEmpty()) {
try {
val path = Paths.get(PathManager.getSystemPath(), NOTIFICATIONS_PATH)
val content = path.inputStream().bufferedReader().use { it.readText() }
if (content.isEmpty()) {
return null
}
return NotificationMapperUtil.mapper.readValue(content)
} catch (e: Exception) {
LOG.warn { "Error reading notifications file: $e" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer to fix the underlying issue

return null
}
return NotificationMapperUtil.mapper.readValue(content)
}

fun retrieveStartupAndEmergencyNotifications() {
Expand Down
Loading