Skip to content

DO NOT MERGE Gemini "fix" for MCHANGES-467#118

Closed
elharo wants to merge 1 commit intomasterfrom
MCHANGES-467
Closed

DO NOT MERGE Gemini "fix" for MCHANGES-467#118
elharo wants to merge 1 commit intomasterfrom
MCHANGES-467

Conversation

@elharo
Copy link
Copy Markdown
Contributor

@elharo elharo commented Mar 1, 2025

Curious to see if Gemini code assist can help with a real prioblem in Maven. tldr, no, no it can't.

It could not write a unit test to expose the bug, and the code it produced to fix the bug not only didn't fix the bug; it didn't even compile.

Copy link
Copy Markdown
Contributor Author

@elharo elharo left a comment

Choose a reason for hiding this comment

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

There are no unit tests (although I prompted for one).

*
* @since 1.3
*/
private static class WriterOutputStream extends OutputStream {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This class is insane. Who would create something this broken?

}

@Override
public void write(final int b) throws IOException {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This all depends on the platform dependent default encoding.


@Override
public void write(final byte[] b) throws IOException {
writer.write(new String(b));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

only works in ASCII and 8859-1

}

@Override
public void write(final byte[] b, final int off, final int len) throws IOException {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

avoid single letter and abbreviated variable names

try {
new SyndFeedOutput().output(feed, writer);
} catch (FeedException ex) {
} catch (FeedException ex) { //NOPMD
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

delete comment

feed.setFeedType(feedType);
feed.setTitle(title);
feed.setAuthor(author);
feed.setPublishedDate(new Date());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

never sets encoding, which is the point of the bug

exportInternal(releases, outputStream);
}

private void exportInternal(final List<Release> releases, final OutputStream outputStream) throws IOException {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This implementation probably shouldn't be shared.

feed.setEntries(getEntries(releases));

try {
new SyndFeedOutput().output(feed, writer);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

writer variable does not exist. This does not compile.

@elharo elharo changed the title DO NOT MERGE Gemini "fix for MCHANGES-467 DO NOT MERGE Gemini "fix" for MCHANGES-467 Mar 1, 2025
@elharo elharo closed this Mar 6, 2025
@elharo elharo deleted the MCHANGES-467 branch March 6, 2025 12:38
@jira-importer
Copy link
Copy Markdown

Resolve #390

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 this pull request may close these issues.

2 participants