sourceStream.close();
}
}
}
private static void writeNiFiPropertiesFile(ByteArrayOutputStream nifiPropertiesOutputStream, String destPath) throws IOException {
<BUG>try {</BUG>
final Path nifiPropertiesPath = Paths.get(destPath, "nifi.properties");
<BUG>FileOutputStream nifiProperties = new FileOutputStream(new File(nifiPropertiesPath.toString()));

nifiProperties.write(nifiPropertiesOutputStream.getUnderlyingBuffer());
} finally {
if (nifiPropertiesOutputStream != null){
</BUG>
nifiPropertiesOutputStream.flush();

sourceStream.close();
}
}
}
private static void writeNiFiPropertiesFile(ByteArrayOutputStream nifiPropertiesOutputStream, String destPath) throws IOException {
final Path nifiPropertiesPath = Paths.get(destPath, "nifi.properties");
try (FileOutputStream nifiProperties = new FileOutputStream(nifiPropertiesPath.toString())) {
nifiPropertiesOutputStream.writeTo(nifiProperties);
} finally {
if (nifiPropertiesOutputStream != null) {
nifiPropertiesOutputStream.flush();
