Skip to content

Commit

Permalink
GH-102: Update vulnerable jcommander dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dweiss committed Jan 2, 2020
1 parent 44a69b8 commit 50b37cf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Bug Fixes
* PR #103: fix distance value in the result of `Speller.findReplacementCandidates`
(Daniel Naber).

* GH-102: upgrade jcommander to newest version. (Dawid Weiss)

Other Changes

* PR #103: introduce `Speller.replaceRunOnWordCandidates()` which returns
Expand Down
2 changes: 1 addition & 1 deletion morfologik-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
<version>1.78</version>
</dependency>
</dependencies>

Expand Down
4 changes: 2 additions & 2 deletions morfologik-tools/src/main/java/morfologik/tools/CliTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ protected static <T> T checkNotNull(T arg) {
private static void helpDisplayCommandOptions(PrintStream pw, String command, JCommander jc) {
StringBuilder sb = new StringBuilder();
jc = jc.getCommands().get(command);
jc.usage(sb, "");
jc.getUsageFormatter().usage(sb, "");
pw.print(sb);
}

private static void helpDisplayCommandOptions(PrintStream pw, JCommander jc) {
StringBuilder sb = new StringBuilder();
jc.usage(sb, "");
jc.getUsageFormatter().usage(sb, "");
pw.print(sb);
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
package morfologik.tools;

import java.nio.file.Path;
import java.nio.file.Paths;

import com.beust.jcommander.IStringConverter;
import com.beust.jcommander.IStringConverterFactory;

import java.nio.file.Path;
import java.nio.file.Paths;

class CustomParameterConverters implements IStringConverterFactory {
public static class PathConverter implements IStringConverter<Path> {
@Override
public Path convert(String value) {
return Paths.get(value);
}
}

@SuppressWarnings({ "unchecked", "rawtypes" })

@Override
public <T> Class<? extends IStringConverter<T>> getConverter(Class<T> forType) {
public Class<? extends IStringConverter<?>> getConverter(Class<?> forType) {
if (forType.equals(Path.class)) {
return (Class) PathConverter.class;
return PathConverter.class;
}
return null;
}
Expand Down

0 comments on commit 50b37cf

Please sign in to comment.