Skip to content

Conversation

@Pankraz76
Copy link
Contributor

@Pankraz76 Pankraz76 commented May 10, 2025

comma after outputStream and outputStream --> output stream

#2306 (comment)

https://github.com/apache/maven/pull/2312/files#r2083278342

enabler for:

outputStream or path must be non null evolves to ->
No valid input source given.

New sentence start with upper case, we well. Especially when talking about Oxford and articles.

but we have inconsistency already.

image

@Pankraz76
Copy link
Contributor Author

[INFO] BUILD SUCCESS

@Pankraz76 Pankraz76 force-pushed the fix-write-test-fix-spelling branch from 9556942 to 7a5b1ef Compare May 10, 2025 20:33
Function<Object, String> inputLocationFormatter = request.getInputLocationFormatter();
if (writer == null && outputStream == null && path == null) {
throw new IllegalArgumentException("writer, outputStream or path must be non null");
throw new IllegalArgumentException("writer, output stream, or path must be non-null");
Copy link
Contributor Author

@Pankraz76 Pankraz76 May 10, 2025

Choose a reason for hiding this comment

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

Suggested change
throw new IllegalArgumentException("writer, output stream, or path must be non-null");
throw new IllegalArgumentException("writer, output stream, or path must be non-null.");

missing dot. (everywhere or nowhere)
image

Function<Object, String> inputLocationFormatter = request.getInputLocationFormatter();
if (writer == null && outputStream == null && path == null) {
throw new IllegalArgumentException("writer, outputStream or path must be non null");
throw new IllegalArgumentException("writer, output stream, or path must be non-null");
Copy link
Contributor

Choose a reason for hiding this comment

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

That's wrong and unrelated to this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
throw new IllegalArgumentException("writer, output stream, or path must be non-null");
throw new IllegalArgumentException("writer, output stream, or path must be non null");

you mean the hyphen - ?

Copy link
Contributor

@gnodet gnodet May 11, 2025

Choose a reason for hiding this comment

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

No, outputStream is the parameter name, it's not output stream.
If those were common nouns, they would require an article.

Copy link
Contributor Author

@Pankraz76 Pankraz76 May 11, 2025

Choose a reason for hiding this comment

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

yes true. Making it generic would take random impl. details away. What if tomorrow foo resources is new input?
This is noise feeling fluffy and takes away from whats real business case.

We need some valid input - thats all.

Suggested change
throw new IllegalArgumentException("writer, output stream, or path must be non-null");
throw new IllegalArgumentException("No valid input source given.");

Copy link
Contributor

Choose a reason for hiding this comment

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

But that's not helpful to the user. What does 'valid' means ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we could tell, as it is.

Suggested change
throw new IllegalArgumentException("writer, output stream, or path must be non-null");
throw new IllegalArgumentException("Given input source is 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.

Considering OOP leveraging domain logic its kind of clear from the context now as the code should speak for itself:

ReadRequest/WriteRequest
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should focus on communicating the actual business case rather than exposing low-level implementation details, which are likely to change.

At this stage, it’s more a matter of preference, since the code now clearly delineates each concern. Code and logging are 2 different worlds.

@Pankraz76 Pankraz76 requested review from elharo and gnodet May 11, 2025 10:47
Writer writer = request.getWriter();
Function<Object, String> inputLocationFormatter = request.getInputLocationFormatter();
if (writer == null && outputStream == null && path == null) {
throw new IllegalArgumentException("writer, outputStream or path must be non null");
Copy link
Contributor Author

@Pankraz76 Pankraz76 May 11, 2025

Choose a reason for hiding this comment

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

this might smell, as throwing IAE but having NPE.

#2277 (comment)

@Pankraz76 Pankraz76 marked this pull request as draft May 12, 2025 15:07
@Pankraz76
Copy link
Contributor Author

wip reopen

@Pankraz76
Copy link
Contributor Author

@Pankraz76
Copy link
Contributor Author

@Pankraz76 Pankraz76 closed this May 15, 2025
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.

3 participants