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

Four properties do not report correct violation locations #225

Open
emopers opened this issue Mar 17, 2016 · 0 comments
Open

Four properties do not report correct violation locations #225

emopers opened this issue Mar 17, 2016 · 0 comments

Comments

@emopers
Copy link

emopers commented Mar 17, 2016

For the following 4 properties: File_DeleteTempFile, ObjectInput_Close, StringBuffer_SingleThreadUsage, ObjectOutput_Close, violation locations would be shown as "Unknown." instead of the FQN of the Java file with line number.
Though we understand due to the formation of such properties it is hard to point out the exact place where the violation happens immediately, but at least it would be good if it could capture the location of TempFile creation or ObjectOutput opening and report it later. For example, we conceive is there any way to improve File_DeleteTempFile like:

File_DeleteTempFile(File f) {
         Location l;
         event create after returning(File f) :
                 call(File+ File.createTempFile(..)) { l = MOPLogging.getLocation(); }
         ...
         @violation {
                 MOPLogging.out.println(Level.CRITICAL, __DEFAULT_MESSAGE);
                 MOPLogging.out.println(Level.CRITICAL, "A temporary file created at " + l + " has not been deleted.");
         }
}

Is this feasible in JavaMOP? Thanks!

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

1 participant