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
46
46
override fun read (provenance : KnownProvenance , scannerMatcher : ScannerMatcher ? ): List <ScanResult > {
47
47
requireEmptyVcsPath(provenance)
48
48
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)
50
54
51
55
return runCatching {
52
56
backend.read(path).use { input ->
@@ -81,7 +85,7 @@ class ProvenanceBasedFileStorage(private val backend: FileStorage) : ProvenanceB
81
85
82
86
requireEmptyVcsPath(provenance)
83
87
84
- if (provenance !is KnownProvenance ) {
88
+ if (provenance !is RemoteProvenance ) {
85
89
throw ScanStorageException (" Scan result must have a known provenance, but it is $provenance ." )
86
90
}
87
91
@@ -95,7 +99,7 @@ class ProvenanceBasedFileStorage(private val backend: FileStorage) : ProvenanceB
95
99
96
100
val scanResults = existingScanResults + scanResult
97
101
98
- val path = storagePath(provenance as RemoteProvenance )
102
+ val path = storagePath(provenance)
99
103
val yamlBytes = yamlMapper.writeValueAsBytes(scanResults)
100
104
val input = ByteArrayInputStream (yamlBytes)
101
105
You can’t perform that action at this time.
0 commit comments