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

Class files are closed and later used #527

Closed
ox1234 opened this issue Dec 26, 2022 · 4 comments · Fixed by #821
Closed

Class files are closed and later used #527

ox1234 opened this issue Dec 26, 2022 · 4 comments · Fixed by #821
Assignees
Labels
bug Something isn't working

Comments

@ox1234
Copy link

ox1234 commented Dec 26, 2022

image

@ox1234
Copy link
Author

ox1234 commented Dec 26, 2022

The code is like this

// construct class view and hierarchy
        System.out.println("[+] building whole class view...");
        JavaView view = project.createFullView();
        Global.setView(view);
        ViewTypeHierarchy hierarchy = new ViewTypeHierarchy(view);
        Global.setHierarchy(hierarchy);

        view.getClasses().forEach(new Consumer<JavaSootClass>() {
            @Override
            public void accept(JavaSootClass javaSootClass) {
                if(javaSootClass.getType().getFullyQualifiedName().contains("RequestMapping")){
                    return;
                }
                if(javaSootClass.getType().getFullyQualifiedName().contains("AdminPlanningController")){
                    javaSootClass.getAnnotations(Optional.of(view));
                    return;
                }
            }
        });

@ox1234
Copy link
Author

ox1234 commented Dec 26, 2022

When create full class view, it will call PathBasedAnalysisInputLocation.getClassSources(). In this method it will close zip filesystem
image
But when in getAnnotations method, it will reopen the zip filesystem and cause ClosedFileSyetem exeception.
image

@ox1234
Copy link
Author

ox1234 commented Dec 26, 2022

I build call graph and it reports the same issue.
image

@kadirayk kadirayk added the bug Something isn't working label Dec 29, 2022
@JonasKlauke JonasKlauke changed the title When i get the annotation of a class, it says filesystem is closed Class files are closed and later used May 31, 2023
@swissiety
Copy link
Collaborator

#617 could describe a solution to this problem

swissiety added a commit that referenced this issue Jan 17, 2024
… is cached and available for access and only closed afterwards; no timing based eviction;

fixes #527
fixes #617
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants