Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7902823

RepGen fails with IllegalFormatArgumentIndexException if started by JDK 16 and above

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • None
    • jcov_3.0
    • tools
    • None
    • b06

    Description

      INFO : -- Reading test list
      INFO : -- Writing report to /Users/lkuskov/dev/jcov/jdk.instrument/RepGen
      INFO : -- Reading data from /Users/lkuskov/dev/jcov/jdk.instrument/report/public.xml
      INFO : -- Applying data processor class com.sun.tdk.jcov.processing.DefaultDataProcessorSPI
      INFO : -- Starting ReportGenerator com.sun.tdk.jcov.report.html.CoverageReport
      SEVERE : Illegal format argument index = 0
      Exception details: java.util.IllegalFormatArgumentIndexException: Illegal format argument index = 0
      at java.base/java.util.Formatter$FormatSpecifier.index(Formatter.java:2803)
      at java.base/java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2872)
      at java.base/java.util.Formatter.parse(Formatter.java:2729)
      at java.base/java.util.Formatter.format(Formatter.java:2671)
      at java.base/java.io.PrintStream.format(PrintStream.java:1209)
      at com.sun.tdk.jcov.report.AbstractCoverage$PercentFormatter.format(AbstractCoverage.java:202)
      at com.sun.tdk.jcov.report.CoverageData.getFormattedCoverage(CoverageData.java:138)
      at com.sun.tdk.jcov.report.AbstractCoverage.getCoverageString(AbstractCoverage.java:112)
      at com.sun.tdk.jcov.report.html.CoverageReport.getColumnData(CoverageReport.java:909)
      at com.sun.tdk.jcov.report.html.CoverageReport.printColumnCoverages(CoverageReport.java:998)
      at com.sun.tdk.jcov.report.html.CoverageReport.generateSourceFile(CoverageReport.java:1098)
      at com.sun.tdk.jcov.report.html.CoverageReport.generateSourceFiles(CoverageReport.java:1043)
      at com.sun.tdk.jcov.report.html.CoverageReport.generate(CoverageReport.java:126)
      at com.sun.tdk.jcov.report.html.CoverageReport.generateReport(CoverageReport.java:119)
      at com.sun.tdk.jcov.RepGen.generateReport(RepGen.java:331)
      at com.sun.tdk.jcov.RepGen.generateReport(RepGen.java:194)
      at com.sun.tdk.jcov.RepGen.generateReport(RepGen.java:179)
      at com.sun.tdk.jcov.RepGen.run(RepGen.java:688)
      at com.sun.tdk.jcov.tools.JCovCMDTool.run(JCovCMDTool.java:159)
      at com.sun.tdk.jcov.Helper.main(Helper.java:54)

      The problem is caused by using argument_index == 0 that is not allowed by spec https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/util/Formatter.html#dpos
      "The first argument is referenced by "1$", the second by "2$", etc. An argument may be referenced more than once."

      Attachments

        Issue Links

          Activity

            People

              lkuskov Leonid Kuskov
              lkuskov Leonid Kuskov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: