package org.schemaspy.cli;

import com.beust.jcommander.IDefaultProvider;
import org.springframework.util.FileCopyUtils;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.Objects;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Implementation of {@link IDefaultProvider} that provides values reading from a {@link Properties} file.
 *
 * TODO
 * JCommander already provides a com.beust.jcommander.defaultprovider.PropertyFileDefaultProvider.
 * But it always reports "cannot find file on classpath" although it exists. Maybe open an issue at the JCommander project?
 */
public class PropertyFileDefaultProvider implements IDefaultProvider {

    private static final Logger LOGGER = Logger.getLogger(PropertyFileDefaultProvider.class.getName());

    private final Properties properties;

    public PropertyFileDefaultProvider(String propertiesFilename) {
        Objects.requireNonNull(propertiesFilename);
        properties = loadProperties(propertiesFilename);
    }

    private static Properties loadProperties(String path) {
        try {
            FileInputStream inputStream = new FileInputStream(path);
            Properties properties = new Properties();
            String contents = FileCopyUtils.copyToString(new InputStreamReader(inputStream, "UTF-8"));
            // Replace backslashes with double backslashes to escape windows path separator.
            // Example input: schemaspy.o=C:\tools\schemaspy\output
            properties.load(new StringReader(contents.replace("\\", "\\\\")));
            return properties;
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "File not found: " + path, e);
            throw new IllegalArgumentException("Could not find or load properties file: " + path, e);
        }
    }

    @Override
    public String getDefaultValueFor(String optionName) {
        return properties.getProperty(optionName);
    }
}

@@ -134,114 +134,9 @@
 .io.
-FileInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.io.StringReader
+*
 ;%0Aim
@@ -1082,52 +1082,47 @@
 try 
-%7B%0A            FileInputStream inputStream = 
+(Reader reader = new InputStreamReader(
 new 
@@ -1142,17 +1142,28 @@
 am(path)
-;
+, %22UTF-8%22))%7B
 %0A       
@@ -1270,51 +1270,14 @@
 ing(
-new InputStreamReader(inputStream, %22UTF-8%22)
+reader
 );%0A 

Fix one more try-with-resources issue