Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature : Allow setting custom linefeed on DefaultXmlPrettyPrinter #568
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
Feature : Allow setting custom linefeed on DefaultXmlPrettyPrinter #568
Changes from 4 commits
374e125
eb23bbd
c0b3e41
3b066cb
8595328
79564a4
f515eba
4cc4394
6974014
b75bfdd
18abcc2
c764189
af70ece
7deeb84
8360276
6187f3d
d0aaf64
29a2bbf
fc4fb17
dd198f2
b43811c
05b1f04
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just catch
Exception
, notThrowable
(ok unlike we'd get OOME or such but as a general good practice)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
late reply, but done 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected String _lineFeed = DEFAULT_LINE_FEED;
-- should not be staticThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjfanning I have a question.
Even if we make
_lineFeed
field non-static, we have static line-feeding Indenters likeLf2SpacesIndenter
. Linefeed happens insideLf2SpacesIndenter.writeIndentation()
.So Indenters can't access non-static field of outer class. 🥲
How can we solve this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thoughts, line-feed outside of Lf2SpacesIndenter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lf2SpacesIndenter could have a constructor that takes an instance of DefaultXmlPrettyPrinter in its constructor. Or we could make Lf2SpacesIndenter non-static.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to replace
\n
with system linefeed so test passes on Windows systems too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, done! 🙏🏼
And plus I checked other similar test cases' assertions and some hard coded
\n
as system linefeed.@cowtowncoder if you agree, I will make a separate PR on "replacing all hard coded
\n
to the value read fromSystem.getProperty("line.separator");
"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds good wrt hard-coded linefeeds