Skip to content

For format version mismatches, report version number in a human friendly way#330

Closed
somechris wants to merge 1 commit intojacoco:masterfrom
somechris:format_version
Closed

For format version mismatches, report version number in a human friendly way#330
somechris wants to merge 1 commit intojacoco:masterfrom
somechris:format_version

Conversation

@somechris
Copy link

Version numbers have been reported as hex string, but without any hex
string marker. So effectively when seeing a mismatch reported around
version '1006', it came down to version '0x1006', which is version
4102 in decimal. Those high format version numbers and mismatch in hex
vs. decimal was confusing.
Hence, we now get rid of the byte-marker 0x1000, and report the format
version as plain decimal.
Thereby, nice low format versions get reported. And the confusion
between (markerless) hex and decimal is gone.

What is 0x1007 format version on-disk, is now reported as version 7.
What is 0x1006 format version on-disk, is now reported as version 6.

@Godin
Copy link
Member

Godin commented Jun 27, 2015

IMO this relates to #319

@Godin
Copy link
Member

Godin commented Jun 27, 2015

@somechris I didn't get why "6" or "7" is more user-friendly and less misleading than any other numbers like "1006" and "1007"? In both cases remediation action is unknown, when user receives such internal version format number, which is IMO root of the problem.

The error message

  Incompatible version 1007

was confusing, as it:
* Showed a hex string without a hex string marker,
* Showed an alienatingly high number, as it still contained the padding,
* Did not gave hints about what actually failed, why it failed, and
  how to get around it.

We now report incompatible versions like

  Failed to read version 6 data (This JaCoCo build can only read/write
  version 7 data). To read the version 6 data, use the same JaCoCo
  version that got used for writing it.

Also, we give JaCoCo users a chance to reliably identify version-
mismatch exceptions by providing a separate exception class for them.

Issue #319
@somechris
Copy link
Author

Thanks for the pointer. You're right, they are definitely related.
I'll respond on #319 to your questions, so all the discussion is in one place.

@marchof
Copy link
Member

marchof commented Oct 2, 2015

@somechris In a separate PR #219 I fixed the error message and created a specialized IOException. Though the decission that we write version numbers as hex strings and started with version 0x1001 I decided not to hide this fact in the error message. But version numbers are now properly written as hex literals (0x1007).

Thankf for your support!

@marchof marchof closed this Oct 2, 2015
@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants