Skip to content

Commit dd52b91

Browse files
committed
code cleanup
1 parent cb69084 commit dd52b91

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

core/src/main/java/net/adoptopenjdk/icedteaweb/resources/ResourceTracker.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ private void waitForCompletion(Resource... resources) {
384384
final int threadCount = Math.min(configuredThreadCount, resources.length);
385385
final ExecutorService downloadExecutor = Executors.newFixedThreadPool(threadCount, new DaemonThreadFactory());
386386
try {
387-
final List<Future<Resource>> futures = Arrays.asList(resources).stream()
387+
final List<Future<Resource>> futures = Arrays.stream(resources)
388388
.map(r -> triggerDownloadFor(r, downloadExecutor))
389389
.collect(Collectors.toList());
390390

@@ -397,9 +397,10 @@ private void waitForCompletion(Resource... resources) {
397397
LOG.debug("Download done. Shutting down executor");
398398
downloadExecutor.shutdownNow();
399399
}
400-
401-
if (resources.length == 1 && resources[0].isSet(Status.ERROR))
400+
401+
if (resources.length == 1 && resources[0].isSet(Status.ERROR)) {
402402
throw new RuntimeException("Error while downloading initial resource " + resources[0]);
403+
}
403404
}
404405

405406
private Future<Resource> triggerDownloadFor(Resource resource, final Executor downloadExecutor) {

core/src/main/java/net/sourceforge/jnlp/cache/CacheUtil.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -234,27 +234,29 @@ public static String hex(String origName, String candidate) throws NoSuchAlgorit
234234
* @param title name of the download
235235
*/
236236
public static void waitForResources(final JNLPClassLoader jnlpClassLoader, final ResourceTracker tracker, final URL[] resources, final String title) {
237-
// download first initial jar : so in case of client certificate, only 1 https client handshake is done
237+
// download first initial jar : so in case of client certificate, only 1 https client handshake is done
238238
boolean downloadInitialJarFirst = resources.length > 1 && resources[0].getProtocol().equals("https");
239239
try {
240240
final DownloadIndicator indicator = Optional.ofNullable(JNLPRuntime.getDefaultDownloadIndicator())
241-
.orElseGet(() -> new DummyDownloadIndicator());
241+
.orElseGet(DummyDownloadIndicator::new);
242242
final DownloadServiceListener listener = getDownloadServiceListener(jnlpClassLoader, title, resources, indicator);
243243
try {
244244
for (URL url : resources) {
245245
tracker.addDownloadListener(url, resources, listener);
246246
}
247-
if (downloadInitialJarFirst)
247+
if (downloadInitialJarFirst) {
248248
tracker.waitForResources(resources[0]);
249+
}
249250
// download all remaining ones
250251
tracker.waitForResources(resources);
251252
} finally {
252253
indicator.disposeListener(listener);
253254
}
254255
} catch (Exception ex) {
255256
LOG.error("Downloading of resources ended with error", ex);
256-
if (downloadInitialJarFirst)
257-
throw new RuntimeException(ex);
257+
if (downloadInitialJarFirst) {
258+
throw new RuntimeException(ex);
259+
}
258260
}
259261
}
260262

0 commit comments

Comments
 (0)