Skip to content
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

Formatting differs in section with no blank lines whether or not keepBlankLines is used #36

Closed
thekalla opened this issue Mar 1, 2023 · 1 comment · Fixed by #57
Closed
Assignees

Comments

@thekalla
Copy link

thekalla commented Mar 1, 2023

The formatting output differs whether keepBlankLines and thus the BlankLinesWriter is used or not

Original unformatted xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <test>${project.build.directory}/reports/json/
    </test>
</project>

Format with keepBlankLines=false

Output:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <test>${project.build.directory}/reports/json/</test>
</project>

Format with keepBlankLines=true

Actual:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <test></test>
</project>

Expected:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <test>${project.build.directory}/reports/json/</test>
</project>
@hazendaz
Copy link
Collaborator

What is going on here is that its taking the line ${project.build.directory}/reports/json/\n to process, since that contains the check for \n, it is considered to be skipped and it continues to next token which there will not be one. Thus it skips printing that entirely as indicated. What it should be doing is checking that it even has more tokens to process. If it does not, it needs to continue on as it normally does so it does not skip writing data.

I'm working on a fix now including adding this example as a test case now.

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 a pull request may close this issue.

2 participants