1818 */
1919package org .dependencytrack .tasks .repositories ;
2020
21- import java . io . IOException ;
22- import java . text . DateFormat ;
23- import java . text . SimpleDateFormat ;
24- import java . util . concurrent . TimeUnit ;
25-
21+ import alpine . common . logging . Logger ;
22+ import com . github . benmanes . caffeine . cache . Cache ;
23+ import com . github . benmanes . caffeine . cache . Caffeine ;
24+ import com . github . packageurl . PackageURL ;
25+ import jakarta . ws . rs . core . UriBuilder ;
2626import org .apache .http .HttpStatus ;
2727import org .apache .http .client .methods .CloseableHttpResponse ;
2828import org .apache .http .util .EntityUtils ;
3434import org .json .JSONArray ;
3535import org .json .JSONObject ;
3636
37- import com .github .benmanes .caffeine .cache .Cache ;
38- import com .github .benmanes .caffeine .cache .Caffeine ;
39- import com .github .packageurl .PackageURL ;
40-
41- import alpine .common .logging .Logger ;
42- import jakarta .ws .rs .core .UriBuilder ;
37+ import java .io .IOException ;
38+ import java .text .DateFormat ;
39+ import java .text .SimpleDateFormat ;
40+ import java .util .concurrent .TimeUnit ;
4341
4442/**
4543 * An IMetaAnalyzer implementation that supports Composer.
@@ -226,7 +224,7 @@ private void loadIncludedPackages(final JSONObject repoRoot, final JSONObject da
226224 }
227225
228226 final JSONObject newPackages = packages ;
229- newPackages .names ().forEach (name -> {
227+ newPackages .keySet ().forEach (name -> {
230228 String packageName = (String ) name ;
231229 JSONObject packageVersions = newPackages .getJSONObject (packageName );
232230
@@ -236,15 +234,15 @@ private void loadIncludedPackages(final JSONObject repoRoot, final JSONObject da
236234
237235 JSONObject includedPackage = repoRoot .getJSONObject ("packages" ).getJSONObject (packageName );
238236 final JSONObject finalPackageVersions = packageVersions ;
239- finalPackageVersions .names ().forEach (version -> {
237+ finalPackageVersions .keySet ().forEach (version -> {
240238 includedPackage .put ((String ) version , finalPackageVersions .getJSONObject ((String ) version ));
241239 });
242240 });
243241 }
244242
245243 if (data .has ("includes" )) {
246244 JSONObject includes = data .getJSONObject ("includes" );
247- includes .names ().forEach (name -> {
245+ includes .keySet ().forEach (name -> {
248246 String includeFilename = (String ) name ;
249247 String includeUrl = UriBuilder .fromUri (baseUrl ).path (includeFilename ).build ().toString ();
250248 try (final CloseableHttpResponse includeResponse = processHttpRequest (includeUrl )) {
@@ -345,7 +343,7 @@ private JSONObject expandPackageVersions(final JSONArray packageVersions) {
345343
346344 private JSONObject expandPackages (JSONObject packages ) {
347345 JSONObject result = new JSONObject ();
348- packages .names ().forEach (name -> {
346+ packages .keySet ().forEach (name -> {
349347 String packageName = (String ) name ;
350348 JSONArray packageVersionsMinified = packages .getJSONArray (packageName );
351349 JSONObject packageVersions = expandPackageVersions (packageVersionsMinified );
@@ -359,7 +357,7 @@ private MetaModel analyzePackageVersions(final MetaModel meta, Component compone
359357 final DateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ssXXX" );
360358
361359 LOGGER .debug ("%s: analyzing package versions in %s: " .formatted (component .getPurl (), this .repositoryId ));
362- packageVersions .names ().forEach (item -> {
360+ packageVersions .keySet ().forEach (item -> {
363361 JSONObject packageVersion = packageVersions .getJSONObject ((String ) item );
364362 // Sometimes the JSON key differs from the the version inside the JSON value. The latter is leading.
365363 String version = packageVersion .getString ("version" );
0 commit comments