You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By adding validation of input values, I want users to be aware of the following two input errors before running the conversion process.
If an empty string "" is specified in the argument, the current directory is treated as the input or output path. However, when specifying the current directory as the input value, many users specify dot(.). So specifying consecutive double quotes "" are almost always a typo. Also, as described in the Steps to reproduce, the log becomes difficult to understand. Therefore, it is better to introduce validation of empty strings.
If three or more arguments are specified incorrectly, command execution does not result in an error. Therefore, there is a risk of overwriting the original file by mistakenly specifying the argument.
For example, if the -o option is specified, the first and second arguments incorrectly specify the original conversion target, and the third argument specifies the destination file, the original conversion target will be overwritten.
This type of operation error can be prevented by adding an argument count validation process.
Steps to reproduce
# java -jar org.eclipse.transformer.cli/target/org.eclipse.transformer.cli-0.5.0-
SNAPSHOT.jar /work/transformer/test ""
Copyright (c) Contributors to the Eclipse Foundation
org.eclipse.transformer.cli.JakartaTransformerCLI Version [ 0.5.0-SNAPSHOT ]
[main] INFO Transformer - Input [ /work/transformer/test ]
[main] INFO Transformer - Output [ /home/k5user/Github/11rx4f/transformer ]
# java -jar org.eclipse.transformer.cli/target/org.eclipse.transformer.cli-0.5.0-SNAPSHOT.jar /work/transformer/test/TestServlet.java /work/transformer/test/TestServlet.java /work/transformer/test/TestServlet.java -o
Copyright (c) Contributors to the Eclipse Foundation
org.eclipse.transformer.cli.JakartaTransformerCLI Version [ 0.5.0-SNAPSHOT ]
[main] INFO Transformer - Input [ /work/transformer/test/TestServlet.java ]
[main] INFO Transformer - Output [ /work/transformer/test/TestServlet.java ]
[main] INFO Transformer - Overwrite of output is enabled
[main] INFO Transformer - Output exists and will be overwritten [ /work/transformer/test/TestServlet.java ]
Cause
There is not enough input value check for both problems.
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.
This issue has been automatically closed due to inactivity. If you can reproduce this or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.
Environment Details
Problem Description
By adding validation of input values, I want users to be aware of the following two input errors before running the conversion process.
For example, if the -o option is specified, the first and second arguments incorrectly specify the original conversion target, and the third argument specifies the destination file, the original conversion target will be overwritten.
This type of operation error can be prevented by adding an argument count validation process.
Steps to reproduce
Cause
There is not enough input value check for both problems.
Checking empty string does not exist.
https://github.com/eclipse/transformer/blob/2411075cc0413f4a3aa36a21c360d780dc55555c/org.eclipse.transformer/src/main/java/org/eclipse/transformer/Transformer.java#L946-L949
https://github.com/eclipse/transformer/blob/2411075cc0413f4a3aa36a21c360d780dc55555c/org.eclipse.transformer/src/main/java/org/eclipse/transformer/Transformer.java#L969
Checking the number of arguments does not exist.
https://github.com/eclipse/transformer/blob/2411075cc0413f4a3aa36a21c360d780dc55555c/org.eclipse.transformer.cli/src/main/java/org/eclipse/transformer/cli/TransformerCLI.java#L366-L379
The text was updated successfully, but these errors were encountered: