File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
scanner/src/main/kotlin/storages Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ class ProvenanceBasedFileStorage(private val backend: FileStorage) : ProvenanceB
4646 override fun read (provenance : KnownProvenance , scannerMatcher : ScannerMatcher ? ): List <ScanResult > {
4747 requireEmptyVcsPath(provenance)
4848
49- val path = storagePath(provenance as RemoteProvenance )
49+ if (provenance !is RemoteProvenance ) {
50+ throw ScanStorageException (" Scan result must have a known provenance, but it is $provenance ." )
51+ }
52+
53+ val path = storagePath(provenance)
5054
5155 return runCatching {
5256 backend.read(path).use { input ->
@@ -81,7 +85,7 @@ class ProvenanceBasedFileStorage(private val backend: FileStorage) : ProvenanceB
8185
8286 requireEmptyVcsPath(provenance)
8387
84- if (provenance !is KnownProvenance ) {
88+ if (provenance !is RemoteProvenance ) {
8589 throw ScanStorageException (" Scan result must have a known provenance, but it is $provenance ." )
8690 }
8791
@@ -95,7 +99,7 @@ class ProvenanceBasedFileStorage(private val backend: FileStorage) : ProvenanceB
9599
96100 val scanResults = existingScanResults + scanResult
97101
98- val path = storagePath(provenance as RemoteProvenance )
102+ val path = storagePath(provenance)
99103 val yamlBytes = yamlMapper.writeValueAsBytes(scanResults)
100104 val input = ByteArrayInputStream (yamlBytes)
101105
You can’t perform that action at this time.
0 commit comments