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

Passing parameter value that contains a hyphen (eg. negative number) #1

Open
jmesterh opened this issue Jan 12, 2018 · 1 comment
Open

Comments

@jmesterh
Copy link

If you pass a parameter value on the command line, that is a negative number, the argument parser thinks it's an argument and it doesn't work. eg:

-pDATEINC "-10"

I made a quick fix using this patch:

--- a/source/java/org/rsna/dicomanonymizertool/DicomAnonymizerTool.java
+++ b/source/java/org/rsna/dicomanonymizertool/DicomAnonymizerTool.java
@@ -89,7 +89,7 @@ public class DicomAnonymizerTool {
                Hashtable<String,String> argsTable = new Hashtable<String,String>();
                String switchName = null;
                for (String arg : args) {
-                       if (arg.startsWith("-")) {
+                       if (arg.startsWith("-") && !arg.matches("^-[0-9]+$")) {
                                switchName = arg;
                                argsTable.put(switchName, "");
                        }

But you might want to implement something more elegant.

@johnperry
Copy link
Owner

johnperry commented Jan 13, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants