Skip to content

Commit

Permalink
SLI-777 Fix SSF-317
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-urruty-sonarsource committed Sep 28, 2022
1 parent 68b844b commit d0d767e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ import org.sonarlint.intellij.core.SecurityHotspotMatcher
import org.sonarlint.intellij.editor.EditorDecorator
import org.sonarlint.intellij.issue.Location
import org.sonarlint.intellij.telemetry.SonarLintTelemetry
import org.sonarlint.intellij.util.GlobalLogOutput
import org.sonarsource.sonarlint.core.commons.log.ClientLogOutput
import org.sonarsource.sonarlint.core.serverapi.hotspot.GetSecurityHotspotRequestParams
import org.sonarsource.sonarlint.core.serverapi.hotspot.ServerHotspot
import java.net.URL

const val NOTIFICATION_TITLE = "Error opening security hotspot"

Expand All @@ -50,6 +53,12 @@ open class SecurityHotspotShowRequestHandler(
) {

open fun open(projectKey: String, hotspotKey: String, serverUrl: String) {
try {
URL(serverUrl)
} catch (e: Exception) {
GlobalLogOutput.get().log("Invalid open hotspot request received, ignoring it", ClientLogOutput.Level.INFO)
return
}
telemetry.showHotspotRequestReceived()
doOpen(projectKey, hotspotKey, serverUrl)
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/sonarlint/intellij/ui/ModalPresenter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
package org.sonarlint.intellij.ui

import com.intellij.openapi.ui.Messages
import org.apache.commons.lang.StringEscapeUtils

open class ModalPresenter {

open fun showConfirmModal(title: String, message: String, confirmText: String): Boolean {
return Messages.showYesNoDialog(null, message, title, confirmText, "Cancel", Messages.getWarningIcon()) == Messages.OK
return Messages.showYesNoDialog(null, StringEscapeUtils.escapeHtml(message), title, confirmText, "Cancel", Messages.getWarningIcon()) == Messages.OK
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import org.sonarsource.sonarlint.core.serverapi.hotspot.ServerHotspot
import java.util.Optional

const val FILE_PATH = "com/sonarsource/sample/MyFile.java"
const val CONNECTED_URL = "serverUrl"
const val CONNECTED_URL = "http://server.url"
const val PROJECT_KEY = "projectKey"
const val HOTSPOT_KEY = "hotspotKey"

Expand Down

0 comments on commit d0d767e

Please sign in to comment.