Skip to content

Conversation

@nresare
Copy link
Member

@nresare nresare commented Jun 16, 2022

Instantiating an empty TXT record using Record.fromString() would
previously render as a TXT without the empty string.

Closes #254

return sb.toString();
String s = sb.toString();
// always return at least an empty quoted String
return "".equals(s) ? "\"\"" : s;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather do an if (strings.isEmpty()){ return "\"\""; } at the beginning to avoid unnecessary objects (iterator, string builder, string).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that looks better. Updating.

Copy link
Member

@ibauersachs ibauersachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and please target this to the release/3.5.x branch.

Instantiating an empty TXT record using Record.fromString() would
previously render as a TXT without the empty string.

Closes dnsjava#254
@nresare nresare changed the base branch from master to release/3.5.x July 24, 2022 20:06
@nresare nresare force-pushed the empty_txt_record_toString branch from 6ed0fcf to 43ad780 Compare July 24, 2022 20:06
@nresare
Copy link
Member Author

nresare commented Jul 24, 2022

Updated according to feedback and re-targeted onto release/3.5.x

@nresare nresare requested a review from ibauersachs July 24, 2022 20:09
@nresare nresare merged commit 5c86922 into dnsjava:release/3.5.x Jul 24, 2022
@nresare nresare deleted the empty_txt_record_toString branch July 24, 2022 20:11
@ibauersachs ibauersachs mentioned this pull request Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quoting of empty TXT records

2 participants