Skip to content

Commit

Permalink
reading antiPatternExamples.yaml as stream instead of a file. This fi…
Browse files Browse the repository at this point in the history
…xes the file not found bug happened when running the tool from a jar and using the rewrite_sql flag (#92)
  • Loading branch information
franklinWhaite authored Jul 9, 2024
1 parent 6a7633f commit a41537b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -47,9 +48,9 @@ public PromptYamlReader() throws IOException {

private void populatePromptHandler() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource(YAML_FILE_NAME).getFile());
InputStream stream = classLoader.getResourceAsStream(YAML_FILE_NAME);
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
promptDetailsList = mapper.readValue(file, PromptDetailsList.class);
promptDetailsList = mapper.readValue(stream, PromptDetailsList.class);
}

private String getExampleString(List<String> examples) {
Expand Down

0 comments on commit a41537b

Please sign in to comment.