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

FileNotFound excepton when running compiled code from the target on tests #8

Open
akuleshov7 opened this issue Jul 17, 2021 · 6 comments
Assignees

Comments

@akuleshov7
Copy link

Executing the following command:
$ akuleshov7@DESKTOP-2BQ3IF3:/mnt/d/polystat$ java -jar target/polystat-1.0-SNAPSHOT-jar-with-dependencies.jar src test

Getting exception:

Exception in thread "main" java.io.UncheckedIOException: java.io.FileNotFoundException: src/foo.eo (No such file or directory)
        at org.cactoos.scalar.Unchecked.value(Unchecked.java:58)
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:57)
        at org.polystat.far.Reverses.errors(Reverses.java:87)
        at org.polystat.Polystat.exec(Polystat.java:82)
        at org.polystat.Polystat.main(Polystat.java:63)
Caused by: java.io.FileNotFoundException: src/foo.eo (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at org.cactoos.io.InputOf.lambda$new$2(InputOf.java:76)
        at org.cactoos.io.InputOf.stream(InputOf.java:310)
        at org.cactoos.io.TeeInput.stream(TeeInput.java:867)
        at org.cactoos.io.InputAsBytes.asBytes(InputAsBytes.java:77)
        at org.cactoos.io.BytesOf.asBytes(BytesOf.java:341)
        at org.cactoos.text.TextOf.lambda$new$0(TextOf.java:297)
        at org.cactoos.scalar.Checked.value(Checked.java:76)
        at org.cactoos.scalar.IoChecked.value(IoChecked.java:63)
        at org.cactoos.text.TextEnvelope.asString(TextEnvelope.java:65)
        at org.eolang.parser.Syntax.parse(Syntax.java:87)
        at org.polystat.XMIR.apply(XMIR.java:81)
        at org.polystat.XMIR.apply(XMIR.java:49)
        at org.cactoos.func.UncheckedFunc.lambda$apply$0(UncheckedFunc.java:56)
        at org.cactoos.scalar.Checked.value(Checked.java:76)
        at org.cactoos.scalar.IoChecked.value(IoChecked.java:63)
        at org.cactoos.scalar.Unchecked.value(Unchecked.java:56)
        ... 4 more

It looks like file discovery works incorrectly and is getting the path from the root where thecoomand was executed

@yegor256
Copy link
Member

yegor256 commented Sep 20, 2021

@akuleshov7 are you sure you have the src/foo.eo file available? I just did what you are doing and it seems to work for me:

$ mkdir src
$ cat > src/foo.eo
[x] > foo
  div. > @
    42
    x
$ java -jar /code/polystat/polystat/target/polystat-1.0-SNAPSHOT-jar-with-dependencies.jar src temp
Error: \perp at {x=0, κ-4-3=\any}

This is where the location of the .eo file is being resolved: https://github.com/polystat/polystat/blob/master/src/main/java/org/polystat/Program.java#L80 Should work on both Unix and Windows.

@mximp
Copy link
Contributor

mximp commented Nov 28, 2022

@pollyvolk please check this out.

@pollyvolk
Copy link
Contributor

@mximp Could you, please, describe current requirements for the option --files?

According to the option description in Polystat.java, the value of this option specifies a directory with EO files. However, as mentioned in README, the program processes a single file called test.eo ignoring other .eo files.
If a user specifies, e.g., --files sources, but the folder sources doesn't contain test.eo, Polystat will throw an error.

Other case: a user runs Polystat with --files sources --tmp result, and there is a file sources/test.eo. The result of the analysis will be saved to result/test.xml. If the user renames or deletes the file sources/test.eo and runs the same command again, Polystat will print the previous correct result, taking it from result/test.xml, not throwing an exception.

Is it the functionality you expect to have?

@mximp
Copy link
Contributor

mximp commented Dec 1, 2022

@pollyvolk The second case is incorrect behaviour: if source is deleted the temp file should be deleted as well.

Regarding test files: current implementation supports only single object within sources named test.
This needs to be enhanced (we even have several requests for this feature) so that all .eo files are processed.

@pollyvolk
Copy link
Contributor

@mximp Do you want me to fix the second case, as it is a wrong behaviour?

@mximp
Copy link
Contributor

mximp commented Dec 1, 2022

@pollyvolk yes please.

For the sources we already have issues: #58, #18, #17

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

4 participants