Skip to content

Commit

Permalink
chore(black-duck): Remove an unnecessary override
Browse files Browse the repository at this point in the history
While the function is a proper work-around for the issue in the
overridden function, the function is not called anymore by the Black
Duck advisor.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Jan 29, 2025
1 parent 330ce58 commit e3600d4
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.blackduck.integration.blackduck.api.core.BlackDuckPath
import com.blackduck.integration.blackduck.api.core.response.LinkMultipleResponses
import com.blackduck.integration.blackduck.api.generated.discovery.ApiDiscovery
import com.blackduck.integration.blackduck.api.generated.response.ComponentsView
import com.blackduck.integration.blackduck.api.generated.view.ComponentView
import com.blackduck.integration.blackduck.api.generated.view.OriginView
import com.blackduck.integration.blackduck.api.generated.view.VulnerabilityView
import com.blackduck.integration.blackduck.configuration.BlackDuckServerConfigBuilder
Expand All @@ -38,7 +37,6 @@ import com.blackduck.integration.log.SilentIntLogger
import com.blackduck.integration.rest.HttpUrl
import com.blackduck.integration.util.IntEnvironmentVariables

import java.util.Optional
import java.util.concurrent.Executors

// Parameter for BlackDuck services factory, see also
Expand All @@ -54,7 +52,7 @@ private val KB_COMPONENTS_SEARCH_PATH = BlackDuckPath(
)

/**
* This class adds a couple of functions which are missing in the super class and fixes an issue with an override.
* This class adds a couple of functions which are missing in the super class.
*/
internal class ExtendedComponentService(
blackDuckApiClient: BlackDuckApiClient,
Expand Down Expand Up @@ -84,17 +82,6 @@ internal class ExtendedComponentService(
override fun searchKbComponentsByExternalId(externalId: ExternalId): List<ComponentsView> =
getAllSearchResults(externalId)

override fun getComponentView(searchResult: ComponentsView): Optional<ComponentView> {
// The super function accidentally uses the URL to the version view, while it should use the URL to the
// component view. This override fixes that.
if (searchResult.component.isNotBlank()) {
val url = HttpUrl(searchResult.component)
return Optional.ofNullable(blackDuckApiClient.getResponse(url, ComponentView::class.java))
} else {
return Optional.empty()
}
}

override fun getOriginView(searchResult: ComponentsView): OriginView? {
if (searchResult.variant.isNullOrBlank()) return null

Expand Down

0 comments on commit e3600d4

Please sign in to comment.