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

Summaries are not generated due to FileNotFoundException #1227

Closed
amandelpie opened this issue Oct 25, 2022 · 4 comments · Fixed by #1303
Closed

Summaries are not generated due to FileNotFoundException #1227

amandelpie opened this issue Oct 25, 2022 · 4 comments · Fixed by #1303
Assignees
Labels
comp-summaries Something related to the method names, code comments and display names generation ctg-bug Issue is a bug

Comments

@amandelpie
Copy link
Collaborator

Description

Summaries are not generated due to FileNotFoundException thrown in the SourceCodeParser.kt:45

The error message is the following: "C:\Users<username>.jdks\corretto-11.0.16.1\lib\src.zip!\java.base\java\lang\Math.java (??????? ?? ??????? ????? ????????? ????)"

Need to say that the Math.java file is exist as a Zip entry in the archive with sources mentioned above

To Reproduce

  1. Run runIde Gradle task
  2. Copy to the open project the mentioned below snippet of code
  3. Use plugin to generate tests for DoubleFunctions::hypo method
public class DoubleFunctions {
    public double hypo(double a, double b) {
        return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
    }

    @SuppressWarnings("ManualMinMaxCalculation")
    public double max(double a, double b) {
        return a > b ? a : b;
    }

    public double circleSquare(double r) {
        if (r < 0 || Double.isNaN(r) || r > 10000) {
            throw new IllegalArgumentException();
        }
        double square = Math.PI * r * r;
        if (square > 777.85) {
            return square;
        } else {
            return 0;
        }
    }

    public int numberOfRootsInSquareFunction(double a, double b, double c) {

        double result = b * b - 4 * a * c;
        if (result > 0) {
            return 2;
        } else if (result == 0) {
            return 1;
        }
        return 0;
    }
}

Expected behavior

Tests with summaries should be generated.

Actual behavior

Tests are generated without summaries.

Visual proofs (screenshots, logs, images)

image

Environment

The Coretto jdk 11.0.16.1 is installed and used in both, initial and debug IDEs

@amandelpie amandelpie added the ctg-bug Issue is a bug label Oct 25, 2022
@korifey korifey moved this to Todo in UTBot Java Oct 25, 2022
@amandelpie amandelpie added the comp-summaries Something related to the method names, code comments and display names generation label Oct 25, 2022
@amandelpie
Copy link
Collaborator Author

Is not reproduced on other machines by other community members

@alisevych
Copy link
Member

@amandelpie Same for me - not reproducing.
Probably the exact JDK files have been corrupted somehow.

@alisevych alisevych removed their assignment Oct 27, 2022
@amandelpie
Copy link
Collaborator Author

Looks like the problem was related to the wrong JAVA_HOME and PATH environment variables.
I installed alternative JDK, set up env vars correctly and it's not reproduced.

Repository owner moved this from Todo to Done in UTBot Java Oct 28, 2022
@amandelpie
Copy link
Collaborator Author

amandelpie commented Nov 3, 2022

It's reproduced on two different machines with Windows 10 / IDEA 2022.1.2 and 2022.2.2 with installed JAVA_HOME env variables and with two different JDK 11

The main problem, that src.zip/blabla is not a file, it's a Zip entry and Java File API could not recognized it as a File.

@amandelpie amandelpie reopened this Nov 3, 2022
Repository owner moved this from Done to In Progress in UTBot Java Nov 3, 2022
Repository owner moved this from In Progress to Done in UTBot Java Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-summaries Something related to the method names, code comments and display names generation ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants