Skip to content

Commit

Permalink
fix(spring-boot-starter): avoid logging Resource objects
Browse files Browse the repository at this point in the history
related to CAM-13833, closes camunda#1636

Co-authored-by: Tobias Metzke-Bernstein <tobias.metzke@camunda.com>
  • Loading branch information
tasso94 and tmetzke authored Oct 22, 2021
1 parent a9275a0 commit 16ef69d
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import org.springframework.core.io.Resource;

import java.net.URL;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

public class SpringBootProcessEngineLogger extends BaseLogger {
public static final String PROJECT_CODE = "STARTER";
Expand Down Expand Up @@ -54,7 +56,16 @@ public void skipAutoDeployment() {
}

public void autoDeployResources(Set<Resource> resources) {
logInfo("021", "Auto-Deploying resources: {}", resources);
// Only log the description of `Resource` objects since log libraries that serialize them and
// therefore consume the input stream make the deployment fail since the input stream has
// already been consumed.
Set<String> resourceDescriptions = resources.stream()
.filter(Objects::nonNull)
.map(Resource::getDescription)
.filter(Objects::nonNull)
.collect(Collectors.toSet());

logInfo("021", "Auto-Deploying resources: {}", resourceDescriptions);
}

public void enterLicenseKey(String licenseKeySource) {
Expand All @@ -74,4 +85,4 @@ public SpringBootStarterException exceptionDuringBinding(String message) {
"050", message));
}

}
}

0 comments on commit 16ef69d

Please sign in to comment.