Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix submission #233

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/info/freelibrary/iiif/webrepl/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ private String getImports() throws IOException {
* @return A list of Java imports
* @throws IOException If there is trouble reading the imports file
*/
@SuppressWarnings({ PMD.SYSTEM_PRINTLN, Sonar.SYSTEM_OUT_ERR })
private String getImports(final String aSnippet) throws IOException {
File importsFile = Path.of("/etc/jshell/imports.jsh").toFile();

Expand All @@ -338,10 +339,13 @@ private String getImports(final String aSnippet) throws IOException {
}

try (BufferedReader reader = Files.newBufferedReader(importsFile.toPath())) {
return reader.lines().filter(line -> !line.isBlank()).filter(line -> {
final String imports = reader.lines().filter(line -> !line.isBlank()).filter(line -> {
final String className = line.substring(line.lastIndexOf('.') + 1, line.length() - 1);
return aSnippet == null || aSnippet.contains(className);
}).collect(Collectors.joining(EOL)) + EOL;

System.err.println(imports);
return imports;
}
}

Expand Down
Loading