@@ -136,13 +136,13 @@ public void runGrype(String repoDir, CodeRepo codeRepo, CodeRepoBranch codeRepoB
136136 createFindingService .saveFindings (findings , codeRepoBranch , codeRepo , Finding .Source .SCA , null );
137137
138138 log .info ("[GrypeService] Scan results processed successfully - [{} / {}]" , codeRepo .getRepourl (), codeRepoBranch .getName ());
139- } catch (JsonParseException | MalformedPackageURLException e ) {
140- log .warn ("[GrypeService] Error with running scan for repository - [{} / {}]" , codeRepo .getRepourl (), codeRepoBranch .getName ());
139+ } catch (JsonParseException e ) {
140+ log .warn ("[GrypeService] Error with running scan for repository - [{} / {}]" , codeRepo .getRepourl (), codeRepoBranch .getName (), e );
141141 }
142142 }
143143
144144 @ Transactional
145- public void processSBOMComponents (File sbomFile , CodeRepo codeRepo ) throws IOException , MalformedPackageURLException {
145+ public void processSBOMComponents (File sbomFile , CodeRepo codeRepo ) throws IOException {
146146
147147 log .info ("[GrypeService] Started processing SBOM components." );
148148
@@ -158,7 +158,13 @@ public void processSBOMComponents(File sbomFile, CodeRepo codeRepo) throws IOExc
158158 continue ;
159159 }
160160
161- PackageURL pkg = new PackageURL (purl );
161+ PackageURL pkg ;
162+ try {
163+ pkg = new PackageURL (purl );
164+ } catch (MalformedPackageURLException e ) {
165+ log .warn ("[GrypeService] Skipping invalid component purl: {}" , purl , e );
166+ continue ;
167+ }
162168
163169 String type = pkg .getType ();
164170 String version = pkg .getVersion ();
0 commit comments