Skip to content
Merged
Changes from all commits
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 @@ -16,6 +16,7 @@
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.info
import software.aws.toolkits.core.utils.inputStream
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.jetbrains.utils.notifyStickyWithData
import java.nio.file.Paths
import java.util.concurrent.atomic.AtomicBoolean
Expand All @@ -38,12 +39,17 @@
}

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)

Check warning on line 43 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/ProcessNotificationsBase.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/ProcessNotificationsBase.kt#L42-L43

Added lines #L42 - L43 were not covered by tests
val content = path.inputStream().bufferedReader().use { it.readText() }
if (content.isEmpty()) {
return null

Check warning on line 46 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/ProcessNotificationsBase.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/ProcessNotificationsBase.kt#L46

Added line #L46 was not covered by tests
}
return NotificationMapperUtil.mapper.readValue(content)
} catch (e: Exception) {
LOG.warn { "Error reading notifications file: $e" }

Check warning on line 50 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/ProcessNotificationsBase.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/ProcessNotificationsBase.kt#L48-L50

Added lines #L48 - L50 were not covered by tests
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