8000 Fix Name constructor failing with max length relative name and root origin by MMauro94 · Pull Request #289 · dnsjava/dnsjava · GitHub
[go: up one dir, main page]

Skip to content

Fix Name constructor failing with max length relative name and root origin #289

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

Closed
wants to merge 1 commit into from

Conversation

MMauro94
Copy link

The Name constructor failed when passing a max-length (253 chars) relative name and Name.root as origin, while this name is technically allowed.

The failure was caused by the Name constructor having the local "absolute" variable wrongly set to false in this case. This change fixes this by updating this flag when the origin is present.

Previous to this fix the workaround was to pass a null origin and manually append the final dot (root) to the string: in this case the constructor would work (as demonstrated by the "ctor_max_length_abs" test.

With this change I've also added a few tests for these edge-cases.

…rigin

The Name constructor failed when passing a max-length (253 chars) relative name and Name.root as origin, while this name is technically allowed.

The failure was caused by the Name constructor having the local "absolute" variable wrongly set to false in this case. This change fixes this by updating this flag when the origin is present.

Previous to this fix the workaround was to pass a null origin and manually append the final dot (root) to the string: in this case the constructor would work (as demonstrated by the "ctor_max_length_abs" test.

With this change I've also added a few tests for these edge-cases.
@codecov
Copy link
codecov bot commented Jul 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.07% ⚠️

Comparison is base (473a153) 64.25% compared to head (84e0e23) 64.18%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #289      +/-   ##
============================================
- Coverage     64.25%   64.18%   -0.07%     
+ Complexity     2771     2767       -4     
============================================
  Files           178      178              
  Lines         12539    12540       +1     
  Branches       1912     1912              
============================================
- Hits           8057     8049       -8     
- Misses         3994     3998       +4     
- Partials        488      493       +5     
Files Changed Coverage Δ
src/main/java/org/xbill/DNS/Name.java 98.45% <100.00%> (+0.51%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MMauro94
Copy link
Author

There are two failing jobs:

  1. For Java 17/x64/windows-latest: I don't see how my small change could cause that failure only on that particular combination. Could you please retry the job, as maybe it was a transient issue?
  2. For the code coverage: again, I don't see how my change could have impacted the code coverage of those other classes - do you have any hint on that?

@ibauersachs
Copy link
Member

Thanks!

The failed test is a bit brittle, I need to rework that. And the code coverage is probably lower because of the other failed test.

I'll have a deeper look at the changes, there was already an edge case about this somewhere.

@ibauersachs
Copy link
Member

Thanks again. Sorry for showing this as closed, I've cherry-picked the commit into the release/3.5.x branch.

@ibauersachs ibauersachs self-assigned this Aug 1, 2023
@ibauersachs ibauersachs added the bug label Aug 1, 2023
@ibauersachs ibauersachs added this to the v3.5.3 milestone Aug 1, 2023
@MMauro94
Copy link
Author
MMauro94 commented Aug 1, 2023

No worries, thank you :)

@ratherlargerobot
Copy link

Thank you for adding this fix, it is very helpful. Looking forward to seeing it in the next release!

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

Successfully merging this pull request may close these issues.

3 participants
0