Skip to content

#51: PrettyPrintXMLWriter fails with a java.util.NoSuchElementException (Java 1.7 only) #52

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Dec 1, 2018

Conversation

belingueres
Copy link
Contributor

Changed concatenation expression in endElement() method to avoid the Java 7 bug.
Added test to detect if the bug is present.

(Java 1.7 only)

Changed concatenation expression in endElement() method to avoid the
Java 7 bug.
Added test to detect if the bug is present.
// TODO: change the below code to a more efficient expression when the library
// be ready to target Java 8.
String element = elementStack.removeLast();
write( "</" + element + ">" );
Copy link
Member

Choose a reason for hiding this comment

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

Nice unittest! This also confirms that the following works too:

        write( "</" );
        write( elementStack.removeLast() );
        write( ">" );

I prefer this, since it removes the variable creation and assignment explicitly.

Copy link
Member

Choose a reason for hiding this comment

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

The comment is now out of sync, i.e.

removed the element into a variable first

:)

@rfscholte rfscholte merged commit 571340b into codehaus-plexus:master Dec 1, 2018
@hboutemy hboutemy added this to the 3.1.1 milestone Mar 10, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants