Skip to content

[MNG-8729] Use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write #2312

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

Merged
merged 1 commit into from
May 14, 2025

Conversation

Pankraz76
Copy link
Contributor

@Pankraz76 Pankraz76 commented May 9, 2025

@Pankraz76 Pankraz76 marked this pull request as ready for review May 10, 2025 19:50
@Pankraz76
Copy link
Contributor Author

@Pankraz76 Pankraz76 requested a review from gnodet May 11, 2025 12:49
* @throws XmlReaderException if an error occurs during the parsing
* @see #toXmlString(Object)
*/
public static PluginDescriptor fromXml(@Nonnull String xml) throws XmlReaderException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we need this, as seems unused?

OutputStream outputStream = request.getOutputStream();
Writer writer = request.getWriter();
if (writer == null && outputStream == null && path == null) {
throw new IllegalArgumentException("writer, outputStream or path must be non null");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

how you like flow of code now? With proper dedicated software design the architecture kick in taking over story telling. Orchestrating dedicated concerns. @elharo

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

The point of this PR is to fix the call with the output stream. Please rename it accordingly.

@Pankraz76 Pankraz76 changed the title Test unused stream in DefaultPluginXmlFactory#write Fix unused variable os use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write May 12, 2025
@Pankraz76 Pankraz76 changed the title Fix unused variable os use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write Fix: Use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write May 12, 2025
@Pankraz76
Copy link
Contributor Author

The point of this PR is to fix the call with the output stream. Please rename it accordingly.

yes, updated.

@Pankraz76
Copy link
Contributor Author

rdy. lets hope windows-ci make is this time.

@gnodet gnodet changed the title Fix: Use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write [MNG-8729] Fix: Use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write May 13, 2025
@gnodet gnodet changed the title [MNG-8729] Fix: Use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write [MNG-8729] Use correct outputStream destination; request instead of path in DefaultPluginXmlFactory#write May 13, 2025
@gnodet gnodet self-assigned this May 13, 2025
@gnodet gnodet added the bug Something isn't working label May 13, 2025
@gnodet gnodet added this to the 4.0.0-rc-4 milestone May 13, 2025
@gnodet
Copy link
Contributor

gnodet commented May 13, 2025

The UTs are failing on windows

@Pankraz76
Copy link
Contributor Author

Pankraz76 commented May 13, 2025

yes thx. items:

Error: DefaultPluginXmlFactoryReadWriteTest.readFromUrlParsesPluginDescriptorCorrectly � JUnit Failed to close extension context

Error: org.apache.maven.impl.DefaultPluginXmlFactoryReadWriteTest.readFromUrlParsesPluginDescriptorCorrectly -- Time elapsed: 0.016 s <<< ERROR!
org.junit.platform.commons.JUnitException: Failed to close extension context
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.io.IOException: Failed to delete temp directory C:\Users\RUNNER~1\AppData\Local\Temp\junit-6477311588346591642. The following paths could not be deleted (see suppressed exceptions for details): , plugin.xml

@Pankraz76
Copy link
Contributor Author

yes thx. items:

Error: DefaultPluginXmlFactoryReadWriteTest.readFromUrlParsesPluginDescriptorCorrectly � JUnit Failed to close extension context

Error: org.apache.maven.impl.DefaultPluginXmlFactoryReadWriteTest.readFromUrlParsesPluginDescriptorCorrectly -- Time elapsed: 0.016 s <<< ERROR! org.junit.platform.commons.JUnitException: Failed to close extension context at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) Caused by: java.io.IOException: Failed to delete temp directory C:\Users\RUNNER~1\AppData\Local\Temp\junit-6477311588346591642. The following paths could not be deleted (see suppressed exceptions for details): , plugin.xml

@Disabled("maybe bug in Junit, as MS-DOS only https://github.com/apache/maven/pull/2312#issuecomment-2876291814")

@Pankraz76
Copy link
Contributor Author

disabled failing test. found then other disabled and removed that one. Lets see.

@michael-o
Copy link
Member

We need to fix

if (path == null && url == null && reader == null && inputStream == null) {
throw new IllegalArgumentException("path, url, reader or inputStream must be non null");
as well. It has to be an NPE.

@Pankraz76
Copy link
Contributor Author

Pankraz76 commented May 13, 2025

It has to be an NPE.

yes this next topic, as global smell not having SPOT (single point of truth).

image

Appreciate the feedback.

@Pankraz76
Copy link
Contributor Author

Pankraz76 commented May 13, 2025

We need to fix

what to be done, except of giving dedication?

@gnodet gnodet merged commit 3e9c164 into apache:master May 14, 2025
13 checks passed
@Pankraz76
Copy link
Contributor Author

merci

Pankraz76 added a commit to Pankraz76/maven that referenced this pull request May 14, 2025
…ath in DefaultPluginXmlFactory#write (apache#2312)

Co-authored-by: Vincent Potucek <vpotucek@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants