Skip to content

Commit 81a737d

Browse files
authored
CAMEL-21673 Fix missing stream closes; fix getBackOffMaxDelay usage (#1355)
* CAMEL-21673 Fix missing stream closes; fix getBackOffMaxDelay usage * Move stream.close() into finally block
1 parent 671f91e commit 81a737d

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ protected void doWriteDirectResponse(Message message, HttpServletResponse respon
167167
}
168168
} finally {
169169
IOHelper.close(new Closeable[]{is, os});
170+
stream.close();
170171
}
171172
} else {
172173
if (LOG.isDebugEnabled()) {

core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/routecontroller/SupervisingRouteControllerAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public SupervisingRouteController supervisingRouteController(SupervisingRouteCon
6161
src.setBackOffMaxAttempts(config.getBackOffMaxAttempts());
6262
}
6363
if (config.getBackOffMaxDelay() > 0) {
64-
src.setBackOffMaxDelay(config.getBackOffDelay());
64+
src.setBackOffMaxDelay(config.getBackOffMaxDelay());
6565
}
6666
if (config.getBackOffMaxElapsedTime() > 0) {
6767
src.setBackOffMaxElapsedTime(config.getBackOffMaxElapsedTime());

tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,7 @@ private void writeComponentSpringFactorySource(String packageName, String name)
19381938

19391939
FileUtils.write(target, code, StandardCharsets.UTF_8);
19401940
getLog().info("Created file: " + target);
1941+
is.close();
19411942
} catch (Exception e) {
19421943
throw new MojoFailureException("IOError with file " + target, e);
19431944
}

tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootStarterMojo.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ protected void executeAll() throws MojoExecutionException, MojoFailureException
117117

118118
private void fixAdditionalDependencies(Document pom) throws Exception {
119119
Properties properties = new Properties();
120-
properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties"));
120+
InputStream is = getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties");
121+
properties.load(is);
122+
is.close();
121123

122124
Set<String> deps = new TreeSet<>(csvToSet(properties.getProperty(getMainDepArtifactId())));
123125

@@ -233,7 +235,10 @@ private void fixExcludedDependencies(Document pom) throws Exception {
233235
// excluded dependencies
234236
Set<String> configExclusions = new HashSet<>();
235237
Properties properties = new Properties();
236-
properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties"));
238+
InputStream is = getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties");
239+
properties.load(is);
240+
is.close();
241+
237242
String artExcl = properties.getProperty("exclude_" + getMainDepArtifactId());
238243
getLog().debug("Configured exclusions: " + artExcl);
239244
if (artExcl != null && !artExcl.trim().isEmpty()) {

0 commit comments

Comments
 (0)