Skip to content

Commit

Permalink
CAMEL-21673 Fix missing stream closes; fix getBackOffMaxDelay usage (#…
Browse files Browse the repository at this point in the history
…1355)

* CAMEL-21673 Fix missing stream closes; fix getBackOffMaxDelay usage

* Move stream.close() into finally block
  • Loading branch information
cunningt authored Jan 30, 2025
1 parent 671f91e commit 81a737d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ protected void doWriteDirectResponse(Message message, HttpServletResponse respon
}
} finally {
IOHelper.close(new Closeable[]{is, os});
stream.close();
}
} else {
if (LOG.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public SupervisingRouteController supervisingRouteController(SupervisingRouteCon
src.setBackOffMaxAttempts(config.getBackOffMaxAttempts());
}
if (config.getBackOffMaxDelay() > 0) {
src.setBackOffMaxDelay(config.getBackOffDelay());
src.setBackOffMaxDelay(config.getBackOffMaxDelay());
}
if (config.getBackOffMaxElapsedTime() > 0) {
src.setBackOffMaxElapsedTime(config.getBackOffMaxElapsedTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,7 @@ private void writeComponentSpringFactorySource(String packageName, String name)

FileUtils.write(target, code, StandardCharsets.UTF_8);
getLog().info("Created file: " + target);
is.close();
} catch (Exception e) {
throw new MojoFailureException("IOError with file " + target, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ protected void executeAll() throws MojoExecutionException, MojoFailureException

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

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

Expand Down Expand Up @@ -233,7 +235,10 @@ private void fixExcludedDependencies(Document pom) throws Exception {
// excluded dependencies
Set<String> configExclusions = new HashSet<>();
Properties properties = new Properties();
properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties"));
InputStream is = getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties");
properties.load(is);
is.close();

String artExcl = properties.getProperty("exclude_" + getMainDepArtifactId());
getLog().debug("Configured exclusions: " + artExcl);
if (artExcl != null && !artExcl.trim().isEmpty()) {
Expand Down

0 comments on commit 81a737d

Please sign in to comment.