From jose.cornado at gmail.com Tue May 3 03:41:47 2016 From: jose.cornado at gmail.com (=?UTF-8?Q?Jos=C3=A9_Cornado?=) Date: Mon, 2 May 2016 21:41:47 -0600 Subject: Help with this exception Message-ID: Hello! I am having trouble with this exception. It happens inside SocketSaver . I am using the grabber locally Error while finding jcov_network_default.properties file: java.lang.NullPointerException So before I start making stupid changes to the source or the jars (like including the properties file in the parent directory) I was wondering if there is an easier route. I could not find this props file anywhere. I launch the grabber with the command bellow. Everything else works as expected (slots are hit, etc, etc) pb.command("java", "-jar", "jcov.jar", "grabber", "-t", "template.xml", "-o", "result.xml", "-save", "receive"); Thanks a lot!!! -- Jos? Cornado -- home: http://www.efekctive.com blog: http://blogging.efekctive.com ---------------------- Everything has been said before, but since nobody listens we have to keep going back and beginning all over again. Andre Gide From alexey.fedorchenko at oracle.com Wed May 4 11:48:59 2016 From: alexey.fedorchenko at oracle.com (Alexey Fedorchenko) Date: Wed, 4 May 2016 14:48:59 +0300 Subject: Help with this exception In-Reply-To: References: Message-ID: Hello Jose, Could you specify: jcov version, jdk version and the command you are using to instrument code and run tests on the instrumented code. Thank you. --Alexey On 03.05.2016 6:41, Jos? Cornado wrote: > Hello! > > I am having trouble with this exception. It happens inside SocketSaver . I > am using the grabber locally > > Error while finding jcov_network_default.properties file: > java.lang.NullPointerException > > > So before I start making stupid changes to the source or the jars (like > including the properties file in the parent directory) I was wondering if > there is an easier route. I could not find this props file anywhere. > > I launch the grabber with the command bellow. Everything else works as > expected (slots are hit, etc, etc) > > pb.command("java", "-jar", "jcov.jar", "grabber", "-t", "template.xml", > "-o", "result.xml", "-save", "receive"); > > Thanks a lot!!! > From jose.cornado at gmail.com Wed May 4 13:22:26 2016 From: jose.cornado at gmail.com (=?UTF-8?Q?Jos=C3=A9_Cornado?=) Date: Wed, 4 May 2016 07:22:26 -0600 Subject: Help with this exception In-Reply-To: References: Message-ID: I got it to work now. It is hack but it is working. The main problem was that the results are saved using a shutdown hook. My engine serves sandboxes for each class. The hook was never called. Anyways, I just touched the default network props in the package jcov to avoid the exception, getting the defaults in place, and called save results after execution. I think I can remove jcov source and invoke save results directly in the 2.0 jar. I am using 1.8 (74_b02), jcov 2.0 jars and cloned 3.0 from repository to inspect and hack pb.command("java", "-jar", "jcov.jar", "Instr", "-t", "template.xml", "-o", instrumentedFolder, XXXXX; pb.command("java", "-jar", "jcov.jar", "grabber", "-t", "template.xml", "-o", "result.xml", "-save", "receive"); pb.command("java", "-jar", "jcov.jar", "grabbermanager", "-kill"); pb.command("java", "-jar", "jcov.jar", "repgen", "-o", "report", "result.xml"); The test execution is running in another jvm. Thanks a lot! On Wed, May 4, 2016 at 5:48 AM, Alexey Fedorchenko < alexey.fedorchenko at oracle.com> wrote: > Hello Jose, > > Could you specify: jcov version, jdk version and the command > you are using to instrument code and run tests on the instrumented code. > > Thank you. > > --Alexey > > > > On 03.05.2016 6:41, Jos? Cornado wrote: > >> Hello! >> >> I am having trouble with this exception. It happens inside SocketSaver . I >> am using the grabber locally >> >> Error while finding jcov_network_default.properties file: >> java.lang.NullPointerException >> >> >> So before I start making stupid changes to the source or the jars (like >> including the properties file in the parent directory) I was wondering if >> there is an easier route. I could not find this props file anywhere. >> >> I launch the grabber with the command bellow. Everything else works as >> expected (slots are hit, etc, etc) >> >> pb.command("java", "-jar", "jcov.jar", "grabber", "-t", "template.xml", >> "-o", "result.xml", "-save", "receive"); >> >> Thanks a lot!!! >> >> > -- Jos? Cornado -- home: http://www.efekctive.com blog: http://blogging.efekctive.com ---------------------- Everything has been said before, but since nobody listens we have to keep going back and beginning all over again. Andre Gide From jose.cornado at gmail.com Thu May 5 22:55:04 2016 From: jose.cornado at gmail.com (=?UTF-8?Q?Jos=C3=A9_Cornado?=) Date: Thu, 5 May 2016 16:55:04 -0600 Subject: How to read these stats Message-ID: Hello, again! I moved along in the work that I am doing I ran into the following: The stats show 100% coverage of blocks and 100% coverage of lines but the branch coverage is one less than I was expecting. The method in question is a switch statement with 10 case label and no default What am I missing? What should I look for in the instrumented class and templates that indicates that something is a branch? Just straight 2.0 and 1.8 74 jvm Thanks again! -- Jos? Cornado -- home: http://www.efekctive.com blog: http://blogging.efekctive.com ---------------------- Everything has been said before, but since nobody listens we have to keep going back and beginning all over again. Andre Gide From jose.cornado at gmail.com Fri May 6 03:23:14 2016 From: jose.cornado at gmail.com (=?UTF-8?Q?Jos=C3=A9_Cornado?=) Date: Thu, 5 May 2016 21:23:14 -0600 Subject: How to read the stats Message-ID: Hello, again! I moved along in the work that I am doing I ran into the following: The stats show 100% coverage of methods, blocks lines but the branch coverage is one less than 100%. The method in question is: int retR(int i){ int r = i + 2; switch(r){ case 0: r = i; break; case 1: r = i + 2; break; case 2: r = i + 3; break; case 3: r = i + 4; break; case 4: r = i + 5; break; case 5: r = i + 6; break; case 6: r = i + 7; break; case 7: r = i + 8; break; case 8: r = i + 9; break; case 9: r = i + 10; break; } return r; } What am I missing? What should I look for in the instrumented class and templates that indicates that something is a branch? How should I read this? a branch with no block or statements didn't get hit? Just straight 2.0 and 1.8 74 jvm Thanks again! -- Jos? Cornado -- home: http://www.efekctive.com blog: http://blogging.efekctive.com ---------------------- Everything has been said before, but since nobody listens we have to keep going back and beginning all over again. Andre Gide From alexey.fedorchenko at oracle.com Fri May 6 11:25:47 2016 From: alexey.fedorchenko at oracle.com (Alexey Fedorchenko) Date: Fri, 6 May 2016 14:25:47 +0300 Subject: How to read the stats In-Reply-To: References: Message-ID: Hello! I assume that you running your tests for all cases in switch without default, for an example: This example will give the results you referring to: for (int i = -2; i < 8; i++){ retR(i); } And this example will cover default branch: for (int i = -2; i < 9; i++){ retR(i); } Coloring the source code in the report is not always very user-friendly. In the result.xml this should looks similar to this: "" --Alexey On 06.05.2016 6:23, Jos? Cornado wrote: > Hello, again! > > I moved along in the work that I am doing I ran into the following: > > The stats show 100% coverage of methods, blocks lines but the branch > coverage is one less than 100%. > > The method in question is: > > int retR(int i){ > > int r = i + 2; > > switch(r){ > > case 0: > > r = i; > > break; > > case 1: > > r = i + 2; > > break; > > case 2: > > r = i + 3; > > break; > > case 3: > > r = i + 4; > > break; > > case 4: > > r = i + 5; > > break; > > case 5: > > r = i + 6; > > break; > > case 6: > > r = i + 7; > > break; > > case 7: > > r = i + 8; > > break; > > case 8: > > r = i + 9; > > break; > > case 9: > > r = i + 10; > > break; > > } > > return r; > > } > > What am I missing? What should I look for in the instrumented class and > templates that indicates that something is a branch? > > How should I read this? a branch with no block or statements didn't get hit? > > Just straight 2.0 and 1.8 74 jvm > > Thanks again! > From jose.cornado at gmail.com Fri May 6 14:28:21 2016 From: jose.cornado at gmail.com (=?UTF-8?Q?Jos=C3=A9_Cornado?=) Date: Fri, 6 May 2016 08:28:21 -0600 Subject: How to read the stats In-Reply-To: References: Message-ID: Thanks! The problem is not exercising the code in the method. The machine does it for me. I guess I should have included the actual figures: 13/13 blocks, 10/11 branches, 23/23 lines. Since we have 10 case labels I am trying to understand where the 11 comes from since everything else is hit 100% I am using SillyClass{ int retR(int i){ ..... } } does the Javac/JVM create an additional branch inside the default constructor( which I am not processing)? Do the slots have data about the element they represent? Thanks for your patience!! On Fri, May 6, 2016 at 5:25 AM, Alexey Fedorchenko < alexey.fedorchenko at oracle.com> wrote: > Hello! > > I assume that you running your tests for all cases in switch without > default, for an example: > > This example will give the results you referring to: > for (int i = -2; i < 8; i++){ > retR(i); > } > > And this example will cover default branch: > for (int i = -2; i < 9; i++){ > retR(i); > } > > Coloring the source code in the report is not always very user-friendly. > In the result.xml this should looks similar to this: > "" > > > --Alexey > > > On 06.05.2016 6:23, Jos? Cornado wrote: > >> Hello, again! >> >> I moved along in the work that I am doing I ran into the following: >> >> The stats show 100% coverage of methods, blocks lines but the branch >> coverage is one less than 100%. >> >> The method in question is: >> >> int retR(int i){ >> >> int r = i + 2; >> >> switch(r){ >> >> case 0: >> >> r = i; >> >> break; >> >> case 1: >> >> r = i + 2; >> >> break; >> >> case 2: >> >> r = i + 3; >> >> break; >> >> case 3: >> >> r = i + 4; >> >> break; >> >> case 4: >> >> r = i + 5; >> >> break; >> >> case 5: >> >> r = i + 6; >> >> break; >> >> case 6: >> >> r = i + 7; >> >> break; >> >> case 7: >> >> r = i + 8; >> >> break; >> >> case 8: >> >> r = i + 9; >> >> break; >> >> case 9: >> >> r = i + 10; >> >> break; >> >> } >> >> return r; >> >> } >> >> What am I missing? What should I look for in the instrumented class and >> templates that indicates that something is a branch? >> >> How should I read this? a branch with no block or statements didn't get >> hit? >> >> Just straight 2.0 and 1.8 74 jvm >> >> Thanks again! >> >> > -- Jos? Cornado -- home: http://www.efekctive.com blog: http://blogging.efekctive.com ---------------------- Everything has been said before, but since nobody listens we have to keep going back and beginning all over again. Andre Gide From jose.cornado at gmail.com Fri May 6 16:46:48 2016 From: jose.cornado at gmail.com (=?UTF-8?Q?Jos=C3=A9_Cornado?=) Date: Fri, 6 May 2016 10:46:48 -0600 Subject: How to read the stats In-Reply-To: References: Message-ID: Ok. I checked templates and bytecode., I need to add default label to my logic. thanks! and sorry fro the noise. On Fri, May 6, 2016 at 8:28 AM, Jos? Cornado wrote: > Thanks! > > The problem is not exercising the code in the method. The machine does it > for me. I guess I should have included the actual figures: > > 13/13 blocks, 10/11 branches, 23/23 lines. > > Since we have 10 case labels I am trying to understand where the 11 comes > from since everything else is hit 100% > > I am using > > SillyClass{ > int retR(int i){ > ..... > } > } > > does the Javac/JVM create an additional branch inside the default > constructor( which I am not processing)? > > Do the slots have data about the element they represent? > > Thanks for your patience!! > > On Fri, May 6, 2016 at 5:25 AM, Alexey Fedorchenko < > alexey.fedorchenko at oracle.com> wrote: > >> Hello! >> >> I assume that you running your tests for all cases in switch without >> default, for an example: >> >> This example will give the results you referring to: >> for (int i = -2; i < 8; i++){ >> retR(i); >> } >> >> And this example will cover default branch: >> for (int i = -2; i < 9; i++){ >> retR(i); >> } >> >> Coloring the source code in the report is not always very user-friendly. >> In the result.xml this should looks similar to this: >> "" >> >> >> --Alexey >> >> >> On 06.05.2016 6:23, Jos? Cornado wrote: >> >>> Hello, again! >>> >>> I moved along in the work that I am doing I ran into the following: >>> >>> The stats show 100% coverage of methods, blocks lines but the branch >>> coverage is one less than 100%. >>> >>> The method in question is: >>> >>> int retR(int i){ >>> >>> int r = i + 2; >>> >>> switch(r){ >>> >>> case 0: >>> >>> r = i; >>> >>> break; >>> >>> case 1: >>> >>> r = i + 2; >>> >>> break; >>> >>> case 2: >>> >>> r = i + 3; >>> >>> break; >>> >>> case 3: >>> >>> r = i + 4; >>> >>> break; >>> >>> case 4: >>> >>> r = i + 5; >>> >>> break; >>> >>> case 5: >>> >>> r = i + 6; >>> >>> break; >>> >>> case 6: >>> >>> r = i + 7; >>> >>> break; >>> >>> case 7: >>> >>> r = i + 8; >>> >>> break; >>> >>> case 8: >>> >>> r = i + 9; >>> >>> break; >>> >>> case 9: >>> >>> r = i + 10; >>> >>> break; >>> >>> } >>> >>> return r; >>> >>> } >>> >>> What am I missing? What should I look for in the instrumented class and >>> templates that indicates that something is a branch? >>> >>> How should I read this? a branch with no block or statements didn't get >>> hit? >>> >>> Just straight 2.0 and 1.8 74 jvm >>> >>> Thanks again! >>> >>> >> > > > -- > Jos? Cornado > > -- > > home: http://www.efekctive.com > blog: http://blogging.efekctive.com > ---------------------- > > Everything has been said before, but since nobody listens we have to keep > going back and beginning all over again. > > Andre Gide > -- Jos? Cornado -- home: http://www.efekctive.com blog: http://blogging.efekctive.com ---------------------- Everything has been said before, but since nobody listens we have to keep going back and beginning all over again. Andre Gide