GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow nulls for write elements in MXSerializer by garydgregory · Pull Request #29 · codehaus-plexus/plexus-xml

Conversation

@garydgregory

@garydgregory garydgregory commented May 20, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/MJAVADOC-793

Allow nulls for write elements in MXSerializer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slawekjaranowski

slawekjaranowski commented May 20, 2024

Copy link
Copy Markdown
Member

@garydgregory thanks ... I afraid thet we will have a conflict with my PR #28

If you let me I first merge my PR and that you can rebase your

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@garydgregory
garydgregory force-pushed the MJAVADOC-793 branch 2 times, most recently from 8a472f5 to e03c11f Compare May 20, 2024 14:34
@garydgregory

garydgregory commented May 20, 2024

Copy link
Copy Markdown
Contributor Author

@slawekjaranowski
OK, done.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slawekjaranowski

slawekjaranowski commented May 20, 2024

Copy link
Copy Markdown
Member

@michael-o @elharo can you also look at it 😄

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented May 20, 2024

Copy link
Copy Markdown
Member

I'd like to see this rebased first...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented May 20, 2024

Copy link
Copy Markdown
Member

After the rebase is done let's try MJAVADOC again with a snapshot of Plexus XML and see what happens.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@garydgregory
garydgregory force-pushed the MJAVADOC-793 branch from e03c11f to 5a5581a Compare May 20, 2024 21:27
@garydgregory

garydgregory commented May 20, 2024

Copy link
Copy Markdown
Contributor Author

I rebased on master again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

slawekjaranowski
slawekjaranowski reviewed May 20, 2024
View reviewed changes
Comment thread src/test/java/org/codehaus/plexus/util/xml/pull/MXSerializerTest.java
Comment on lines +69 to +71
new MXSerializer().writeElementContent(null, stringWriter);
new MXSerializer().writeAttributeValue(null, stringWriter);

@slawekjaranowski slawekjaranowski May 20, 2024

Copy link
Copy Markdown
Member

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.

should support ?

new MXSerializer().writeElementContent("value", null);
new MXSerializer().writeAttributeValue("value", null);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@slawekjaranowski slawekjaranowski May 21, 2024

Copy link
Copy Markdown
Member

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.

Also add some of assertions for what content of stringWriter should be.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@garydgregory garydgregory May 21, 2024

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
slawekjaranowski
slawekjaranowski reviewed May 20, 2024
View reviewed changes
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@slawekjaranowski

slawekjaranowski commented May 20, 2024

Copy link
Copy Markdown
Member

Please also change of PR / commit message to show what really is changed, what is root cause eg

Allow nulls for write elements in MXSerializer

garydgregory reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented May 21, 2024

Copy link
Copy Markdown
Member

Test:

	 public static void main(String[] args) throws ParserConfigurationException, TransformerException {
			Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
			Element root = doc.createElement("root");
			root.setTextContent(null);
			root.setAttribute("foo", null);
			doc.appendChild(root);

			DOMSource domSource = new DOMSource(doc);
			StreamResult result = new StreamResult(System.out);
	        TransformerFactory tf = TransformerFactory.newInstance();
	        Transformer transformer = tf.newTransformer();
	        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
	        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
	        transformer.transform(domSource, result);
		}

output:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root foo=""/>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented May 21, 2024

Copy link
Copy Markdown
Member

What about the pretty printer?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

elharo
elharo approved these changes May 21, 2024
View reviewed changes

@elharo elharo left a comment

Copy link
Copy Markdown

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.

some suggestion. I don't see anything actually incorrect here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java Outdated
} else {
if (value != null) {
// .[apostrophe and <, & escaped],
final char quot = attributeUseApostrophe ? '\'' : '"';

@elharo elharo May 21, 2024

Copy link
Copy Markdown

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.

Not sure why we even make a choice here. Would be simpler to pick one and stick with it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java
out.write(quotEntity);
pos = i + 1;
} else if (ch < 32) {
// in XML 1.0 only legal character are #x9 | #xA | #xD

@elharo elharo May 21, 2024

Copy link
Copy Markdown

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.

legal C0 characters

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java Outdated
// pass through

// } else if(ch == 13) { //escape
// and they must be escaped otherwise in attribute value they are normalized to spaces

@elharo elharo May 21, 2024

Copy link
Copy Markdown

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.

escaped;

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java Outdated
pos = i + 1;
} else {
throw new IllegalStateException(
"character " + Integer.toString(ch) + " is not allowed in output" + getLocation());

@elharo elharo May 21, 2024

Copy link
Copy Markdown

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.

IllegalArgumentException

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java Outdated
} else {
throw new IllegalStateException(
"character " + Integer.toString(ch) + " is not allowed in output" + getLocation());
// in XML 1.1 legal are [#x1-#xD7FF]

@elharo elharo May 21, 2024

Copy link
Copy Markdown

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.

I'd delete all this commented code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java Outdated
if (ch == 9 || ch == 10 || ch == 13) {
// pass through

// } else if(ch == 13) { //escape

@elharo elharo May 21, 2024

Copy link
Copy Markdown

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.

delete commented code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@garydgregory
garydgregory force-pushed the MJAVADOC-793 branch from 5a5581a to b2263d5 Compare May 21, 2024 12:43
@garydgregory
garydgregory requested a review from slawekjaranowski May 21, 2024 12:44
@garydgregory

garydgregory commented May 21, 2024

Copy link
Copy Markdown
Contributor Author

@elharo Thank you for your comments. I'll let the Maven team address those since I feel they are out of scope for this PR.

slawekjaranowski reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michael-o
michael-o requested changes May 21, 2024
View reviewed changes
Comment thread src/test/java/org/codehaus/plexus/util/xml/pull/MXSerializerTest.java Outdated
* Tests MJAVADOC-793.
*/
@Test
public void testMJAVADOC793() throws IOException {

@michael-o michael-o May 21, 2024

Copy link
Copy Markdown
Member

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.

This should be renamed. This is not related to the Javadoc plugin. IT simply does not allow null values. testNullValues()?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

slawekjaranowski reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@garydgregory garydgregory May 21, 2024

Copy link
Copy Markdown
Contributor Author

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: testWriteNullValues().

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slawekjaranowski

slawekjaranowski commented May 21, 2024

Copy link
Copy Markdown
Member

@elharo Thank you for your comments. I'll let the Maven team address those since I feel they are out of scope for this PR.

you right if needed should be fixed in separate PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

slawekjaranowski
slawekjaranowski reviewed May 21, 2024
View reviewed changes

@slawekjaranowski slawekjaranowski left a comment

Copy link
Copy Markdown
Member

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.

looks OK please chenge test name and commit PR title

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

garydgregory reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@garydgregory
Allow nulls for write elements in MXSerializer
5a58475
https://issues.apache.org/jira/browse/MJAVADOC-793
@garydgregory
garydgregory force-pushed the MJAVADOC-793 branch from b2263d5 to 5a58475 Compare May 21, 2024 17:07
@garydgregory garydgregory changed the title Fix for MJAVADOC-793 Allow nulls for write elements in MXSerializer May 21, 2024
slawekjaranowski
slawekjaranowski approved these changes May 21, 2024
View reviewed changes
@garydgregory
garydgregory requested a review from michael-o May 21, 2024 20:02
@slawekjaranowski

slawekjaranowski commented May 21, 2024

Copy link
Copy Markdown
Member

@michael-o I hope your doubts was resolved, so I will merge and process forward

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slawekjaranowski slawekjaranowski added the bug Something isn't working label May 21, 2024
@slawekjaranowski
slawekjaranowski merged commit 43dbdca into codehaus-plexus:master May 21, 2024
@garydgregory
garydgregory deleted the MJAVADOC-793 branch May 21, 2024 21:49
@garydgregory

garydgregory commented May 21, 2024

Copy link
Copy Markdown
Contributor Author

TY @slawekjaranowski

slawekjaranowski reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michael-o
michael-o reviewed May 22, 2024
View reviewed changes
Comment thread src/test/java/org/codehaus/plexus/util/xml/pull/MXSerializerTest.java
}

/**
* Tests MJAVADOC-793.

@michael-o michael-o May 22, 2024

Copy link
Copy Markdown
Member

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.

Well, that comment is wrong here as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@michael-o

michael-o commented May 22, 2024

Copy link
Copy Markdown
Member

@michael-o I hope your doubts was resolved, so I will merge and process forward

Yes, but my question about the PrettyPrinter remains open.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@michael-o michael-o michael-o requested changes
@slawekjaranowski slawekjaranowski slawekjaranowski approved these changes
+1 more reviewer
@elharo elharo elharo approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@garydgregory @slawekjaranowski @michael-o @elharo
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.