Skip to content

Commit adbcacb

Browse files
committed
Do not sort the result, because it's not required...
in this context. This fixes a NPE on loading the cache which contains versioned and unversioned entries of a file looking up a new version eg. 6.2.4 ::i=0\13::l=http://localhost/myapp/jnlp.extension/common.jnlp::a=1706711261663:: ::i=0\0::l=http://localhost/myapp/jnlp.extension/common.jnlp::v=6.2.3::a=1706710902351::
1 parent b8a4e55 commit adbcacb

File tree

1 file changed

+5
-5
lines changed
  • core/src/main/java/net/adoptopenjdk/icedteaweb/resources/cache

1 file changed

+5
-5
lines changed

core/src/main/java/net/adoptopenjdk/icedteaweb/resources/cache/CacheImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ Optional<CacheIndexEntry> getBestMatchingEntryInCache(final URL resourceHref, fi
238238
.findFirst();
239239
}
240240

241+
/**
242+
* Return all valid cache entries with this URL, regardless of whether they have a version or not. They are not sorted.
243+
* @param resourceHref
244+
* @return
245+
*/
241246
List<CacheIndexEntry> getAllEntriesInCache(final URL resourceHref) {
242247
final List<CacheIndexEntry> all = new ArrayList<>(cacheIndex.getSynchronized(idx -> idx.findAllEntries(resourceHref)));
243248

244-
if (all.size() > 1) {
245-
final Comparator<CacheIndexEntry> versionComparator = comparing(CacheIndexEntry::getVersion);
246-
all.sort(versionComparator);
247-
}
248-
249249
return all.stream()
250250
.filter(entry -> getInfoFile(entry).isCached())
251251
.collect(Collectors.toList());

0 commit comments

Comments
 (0)