Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Main parameter doesn't support Converter

See original GitHub issue

The converter isn’t called and I get an Exception: Exception in thread “main” com.beust.jcommander.ParameterException: Could not invoke null Reason: Can not set java.nio.file.Path field mypackage.MyCommand.file to java.lang.String

@Parameter(description = "File", converter = PathConverter.class) private Path file;

(The PathConverter is from JCommander)

If I add a name to the Parameter (like -f) then the converter works like a charm.

Whole class: MyCommand.txt

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

cbeustcommented, May 20, 2018

1.74 was released about a month ago:

antonio-rodrigescommented, Jul 19, 2022

Thanks for adding converter capability to parse the main param:

However, the code does not work if we provide IStringConverterFactory. A workaround is to specify a dummy converter class for the main parameter that cannot be instantiated.

I noticed the solution above Added a check in testing if Converter is specified and is not a NoConverter.

But the condition

prevents using the IStringConverterFactory. It would be good to call convertValue anyway. All in all, if there is no appropriate converter, it would just return the same string

However, to avoid breaking tests without the condition, should the if clause be extended to account for IStringConverterFactory?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HDMI to VGA converter. Input not supported - Super User
If you are using a HDMI to VGA adapter and it is showing "Input not supported" then: First go to your second monitor...
Read more >
Xbox to VGA monitor problems - Microsoft Community
I have a HDMI extension cable to a HDMI to VGA converter to my monitor that i use for the 360 all the...
Read more >
Solved: P2419HC, VGA to HDMI not working - Dell Community
Solved: I have a pretty basic Lenovo desktop. ... I got a VGA to HDMI cord but the monitor just says "No HDMI...
Read more >
jpa inbound-channel-adapter doesn't support parameter source
I am trying to use the parameter-source to provide a parameter to my query in the inbound-channel-adapter but it doesn't seem to work....
Read more >
[FEATURE] Support for custom parameter type with ... - GitHub
ParamType, for defining custom parameter types, but it doesn't work ... pragma no cover RuntimeError: Type not yet supported: <__main__.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found