Skip to content

Improve input checking for command line execution #295

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

Open
11rx4f opened this issue May 19, 2022 · 2 comments · May be fixed by #754
Open

Improve input checking for command line execution #295

11rx4f opened this issue May 19, 2022 · 2 comments · May be fixed by #754

Comments

@11rx4f
Copy link
Contributor

11rx4f commented May 19, 2022

Environment Details

  • Transformer Version: 0.5.0
  • JDK version: openjdk 11.0.12
  • OS: Red Hat Enterprise Linux 7.4

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.

  • 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.

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label May 19, 2023
@github-actions
Copy link

github-actions bot commented Jun 9, 2023

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2023
@11rx4f 11rx4f reopened this Apr 21, 2025
@11rx4f 11rx4f removed the stale label Apr 21, 2025
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

Successfully merging a pull request may close this issue.

1 participant