FileNotFoundException when generating the report based on source files

103 views
Skip to first unread message

Shehan Ranasinghe

unread,
Sep 18, 2019, 2:34:51 AM9/18/19
to JaCoCo and EclEmma Users
When I tried to generate the report with jacococli.jar with source files, this error is given to me.


here is the command I used to generate the report.

java -jar jacococli.jar report jacoco.exec --classfiles ../../Stages/sevice/target/exracted/shehan/newOne/ --html ../report/ --sourcefiles ../../Stages/sevice/

What is the problem in here? I can't find any solution.

Marc Hoffmann

unread,
Sep 18, 2019, 5:52:35 AM9/18/19
to jac...@googlegroups.com

Can you please post the full stack trace?

Without is it hard to tell which resource is missing here.

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/15e65265-306f-44bc-ade5-6e3589798755%40googlegroups.com.


Auto Generated Inline Image 1

Shehan Ranasinghe

unread,
Sep 18, 2019, 7:10:27 AM9/18/19
to JaCoCo and EclEmma Users
This is the whole error I've got


On Wednesday, September 18, 2019 at 3:22:35 PM UTC+5:30, Marc R. Hoffmann wrote:

Can you please post the full stack trace?

Without is it hard to tell which resource is missing here.


On 2019-09-18 08:34, Shehan Ranasinghe wrote:

When I tried to generate the report with jacococli.jar with source files, this error is given to me.
 
 
here is the command I used to generate the report.
 
java -jar jacococli.jar report jacoco.exec --classfiles ../../Stages/sevice/target/exracted/shehan/newOne/ --html ../report/ --sourcefiles ../../Stages/sevice/
 
What is the problem in here? I can't find any solution.


--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.

Marc Hoffmann

unread,
Sep 18, 2019, 7:45:46 AM9/18/19
to jac...@googlegroups.com

Ok, so the problem happens when the CLI tries to load referenced source file. You could verify by leaving out the parameter

  --sourcefiles ../../Stages/sevice

In this case a report should be generated without highlighted sources though.


The interesting question is, why some class files seems to have a source reference to "shehan/newOne". Normally it should look more like "a/b/c/Foo.java".

Questions about the class files in ../../Stages/sevice/target/extracted/shehan/newOne/

1) How do you create/compile these class files?

2) Can you provide a the class files for inspection (e.g. by Zip file)?

To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/d8288bcf-e31b-4260-ab1f-7a6aa33527c4%40googlegroups.com.


Auto Generated Inline Image 1

Shehan Dhaleesha

unread,
Sep 18, 2019, 8:07:03 AM9/18/19
to JaCoCo and EclEmma Users
OK, So basically this is not Java. But the compiled files are in bytecode(.class files). What I've tried is called as "Ballerina". It is also compiled into bytecode so that the JVM can run it. Why I use jacoco for Ballerina is because of Scala. I saw some blog posts that jacoco can be used to generate coverage reports in Scala also (as far as I know Scala is also running on JVM). So that is the reason to have different different paths respect to java. So yes I'll attach a compiled jar file so that you can observe it. And the best part is jacoco is generating a coverage report but not highlighting the source file. I'll attach a image of a generated coverage report. So what I want is mapping source files with the report so that I can see the coverage. If this can't be done using this jacoco version please let me know, And it would be really helpful if you can guide me a way to re-implement the jacoco so that I can achieve what I want.

Ballerina website: https://v1-0.ballerina.io/



Marc Hoffmann

unread,
Sep 20, 2019, 9:56:02 AM9/20/19
to jac...@googlegroups.com
Thanks for providing the class files. It helped me to identify an different bug in JaCoCo, thanks! ;)


Unfortunately this is not related to your problem. I was able to reproduce your issue only in a unit test and created a fix for it:


But I still want to reproduce and understand your exact issue. Can you please tell me the version of the jacococli.jar you’re using? For this please execute:

    java -jar jacococli.jar version

Thanks!

On 18. Sep 2019, at 14:07, Shehan Dhaleesha <jinuthisa...@gmail.com> wrote:

OK, So basically this is not Java. But the compiled files are in bytecode(.class files). What I've tried is called as "Ballerina". It is also compiled into bytecode so that the JVM can run it. Why I use jacoco for Ballerina is because of Scala. I saw some blog posts that jacoco can be used to generate coverage reports in Scala also (as far as I know Scala is also running on JVM). So that is the reason to have different different paths respect to java. So yes I'll attach a compiled jar file so that you can observe it. And the best part is jacoco is generating a coverage report but not highlighting the source file. I'll attach a image of a generated coverage report. So what I want is mapping source files with the report so that I can see the coverage. If this can't be done using this jacoco version please let me know, And it would be really helpful if you can guide me a way to re-implement the jacoco so that I can achieve what I want.

Ballerina website: https://v1-0.ballerina.io/


<Auto Generated Inline Image 1.png>
<Auto Generated Inline Image 2.png>

<Auto Generated Inline Image 3.png>
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/e120c4e2-9729-43e7-a87d-b40c5dd0dc93%40googlegroups.com.
<Auto Generated Inline Image 1.png><Auto Generated Inline Image 2.png><Auto Generated Inline Image 3.png>

Shehan Dhaleesha

unread,
Sep 20, 2019, 11:10:39 PM9/20/19
to JaCoCo and EclEmma Users
Oh. So this is the version I've got.


So can I still have a hope?

Marc Hoffmann

unread,
Sep 21, 2019, 4:03:33 AM9/21/19
to jac...@googlegroups.com
Sure, there is hope! We’re working on both issues we identified with your class files. Just give us some time — it’s a spare time project ;)


On 21. Sep 2019, at 05:10, Shehan Dhaleesha <jinuthisa...@gmail.com> wrote:

Oh. So this is the version I've got.

To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/44dd3287-0768-4514-87d5-2755f5eea4cb%40googlegroups.com.

Evgeny Mandrikov

unread,
Sep 21, 2019, 10:29:11 PM9/21/19
to JaCoCo and EclEmma Users
On Wednesday, September 18, 2019 at 1:45:46 PM UTC+2, Marc R. Hoffmann wrote:
The interesting question is, why some class files seems to have a source reference to "shehan/newOne". Normally it should look more like "a/b/c/Foo.java".

Files

shehan/newOne/$moduleInitFrame.class
shehan/newOne/$moduleStartFrame.class

FileNotFoundException with message "Is a directory"
because they have empty "SourceFile" attribute.

Java Virtual Machine Specification about "SourceFile" attribute ( https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.10 ) states

The string referenced by the sourcefile_index item will be interpreted as indicating the name of the source file from which this class file was compiled.

So in my opinion empty is not a valid value and you'd better report this to developers of Ballerina.


File

shehan/newOne/___init.class



On Saturday, September 21, 2019 at 5:10:39 AM UTC+2, Shehan Dhaleesha wrote:
So can I still have a hope?
 

If you exclude above files from generation of report, then even with JaCoCo version 0.8.4 you already should be able to generate report.


Master branch of JaCoCo is automatically built and snapshot is available at https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.jacoco&a=jacoco&e=zip&v=LATEST
so you can wait a bit when fixes for both will arrive into master to try them before we'll do release.

Pull requests are also built automatically, and since first issue is already fixed in master, pull request with fix for the second contains both - https://ci.appveyor.com/project/JaCoCo/jacoco/builds/27575431/artifacts

Shehan Dhaleesha

unread,
Sep 21, 2019, 11:46:57 PM9/21/19
to JaCoCo and EclEmma Users
So yes, I exclude the ___init.class file when generating the report. That is not my case. Why can't I map the source file with the generated report. It says that

Capture.PNG

When I gave the source files as a argument, Then It gives the above mentioned error. So is this mean I can't use JaCoCo in my case?

Shehan Dhaleesha

unread,
Sep 21, 2019, 11:47:44 PM9/21/19
to JaCoCo and EclEmma Users
Waiting for your reply ... :)

Evgeny Mandrikov

unread,
Sep 22, 2019, 12:03:25 AM9/22/19
to JaCoCo and EclEmma Users
File

shehan/newOne/main.class

has package name "shehan.newOne"
and "SourceFile" attribute "main.bal"
so JaCoCo looks for a source file "shehan/newOne/main.bal"
relative to a directory specified by "--sourcefiles" parameter
i.e. in case of

--sourcefiles ../../Stages/sevice

it looks for

../../Stages/service/shehan/newOne/main.bal

Shehan Dhaleesha

unread,
Sep 22, 2019, 5:14:34 AM9/22/19
to JaCoCo and EclEmma Users
So yes, I executed that path also. Then It won't do any analysis and no error. But the result is same. Any solution for this case?

Marc Hoffmann

unread,
Sep 22, 2019, 6:23:12 AM9/22/19
to JaCoCo and EclEmma Users
Hi,

we fixed both issues on master. You can download the latest build here:


Regards,
-marc

-- 
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.

she...@wso2.com

unread,
Sep 23, 2019, 12:13:20 AM9/23/19
to JaCoCo and EclEmma Users
Oh greate. now it is working, Thanks for the help ;). Love the community behind JaCoCo :D
To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.

Marc Hoffmann

unread,
Sep 23, 2019, 2:44:29 AM9/23/19
to JaCoCo and EclEmma Users
Also many thanks for re-testing!


To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/ed435f0a-b7ea-4078-ac4d-9256fe7e8dd6%40googlegroups.com.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages