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

Better error messages when the user supplies a malformed .jaif file #40

Open
GoogleCodeExporter opened this issue Jul 3, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Consider the attached file test.tar, which contains a malformed Test.jaif
file.  First, compile the Test.java file:

  javac test/Test.java

Now, running insert-annotations does not indicate any problem:

% insert-annotations test.Test Test.jaif
Reading class file test.Test; writing with annotations to test.Test.class

Running insert-annotations-to-source does reveal the error, though in a
non-user-friendly way:

% insert-annotations-to-source Test.jaif test/Test.java 
Exception in thread "main" java.lang.Error: Malformed base class: LObject
    at plume.UtilMDE.fieldDescriptorToBinaryName(UtilMDE.java:606)
    at annotator.find.IsSigMethodCriterion.<init>(IsSigMethodCriterion.java:70)
    at annotator.find.InMethodCriterion.<init>(InMethodCriterion.java:19)
    at annotator.find.Criteria.inMethod(Criteria.java:297)
    at annotator.specification.IndexFileSpecification.parseMethod(IndexFileSpecification.java:446)
    at annotator.specification.IndexFileSpecification.parseClass(IndexFileSpecification.java:200)
    at annotator.specification.IndexFileSpecification.parseScene(IndexFileSpecification.java:111)
    at annotator.specification.IndexFileSpecification.parse(IndexFileSpecification.java:78)
    at annotator.Main.main(Main.java:155)

Two suggestions:

1. Make insert-annotations-to-source reveal the error in a user-friendly
way.  One way to do this would be to add a catch clause in the main method
that catches a special TerminationMessage exception that indicates user
error.  Here is an example of the approach:

https://code.google.com/p/daikon/source/browse/java/daikon/Daikon.java#459
https://code.google.com/p/daikon/source/browse/java/daikon/Daikon.java#397

Other approaches might be possible too.

2. Make insert-annotations do checking of the .jaif file (maybe in the way
insert-annotations-to-source does, or maybe in some other way) and issue
warnings, so that users are informed of their mistakes rather than being
confused by them.

Original issue reported on code.google.com by mer...@cs.washington.edu on 11 Jul 2013 at 5:33

Attachments:

@GoogleCodeExporter
Copy link
Author

Also see another example in issue #37 comment 2

Original comment by mer...@cs.washington.edu on 14 Jul 2013 at 7:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants