mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 05:32:58 +08:00
Polish "Fix thread-safety access in ProjectGenerationInvoker"
See gh-1125
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,7 +56,7 @@ public class ProjectGenerationInvoker<R extends ProjectRequest> {
|
||||
|
||||
private final ProjectRequestToDescriptionConverter<R> requestConverter;
|
||||
|
||||
private transient Map<Path, List<Path>> temporaryFiles = new ConcurrentHashMap<>();
|
||||
private final transient Map<Path, List<Path>> temporaryFiles = new ConcurrentHashMap<>();
|
||||
|
||||
public ProjectGenerationInvoker(ApplicationContext parentApplicationContext,
|
||||
ProjectRequestToDescriptionConverter<R> requestConverter) {
|
||||
@@ -144,10 +144,7 @@ public class ProjectGenerationInvoker<R extends ProjectRequest> {
|
||||
|
||||
private void addTempFile(Path group, Path file) {
|
||||
this.temporaryFiles.compute(group, (path, paths) -> {
|
||||
List<Path> newPaths = paths;
|
||||
if (newPaths == null) {
|
||||
newPaths = new ArrayList<>();
|
||||
}
|
||||
List<Path> newPaths = (paths != null) ? paths : new ArrayList<>();
|
||||
newPaths.add(file);
|
||||
return newPaths;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user