Skip to content

Conversation

eamonnmcmanus
Copy link
Member

Otherwise we have to call String.format. This also fixes a place where
we weren't in fact calling String.format even though we were using the
%n format specifier.

Otherwise we have to call String.format. This also fixes a place where
we weren't in fact calling String.format even though we were using the
%n format specifier.
@eamonnmcmanus eamonnmcmanus requested review from ace-n and a team April 28, 2020 20:01
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 28, 2020
Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

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

LGTM - once like 39 is fixed.

for (File f : files) {
writer.write(String.format("\t%s%n", f.getName()));
writer.printf("\t%s%n", f.getName());
Copy link
Contributor

Choose a reason for hiding this comment

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

drop the %n

@ace-n
Copy link
Contributor

ace-n commented Apr 28, 2020

@eamonnmcmanus looks like this pattern is used elsewhere. Can you fix those here too (or should I + send a commit on top of this)?

$ grep write\(String **/*.java

concepts/file-system/src/main/java/functions/FileSystem.java:      writer.write(String.format("\t%s%n", f.getName()));
concepts/lazy-fields/src/main/java/functions/LazyFields.java:    writer.write(String.format("Lazy global: %s; non-lazy global: %s",
concepts/scopes/src/main/java/functions/Scopes.java:    writer.write(String.format("Instance: %s; function: %s", InstanceVar, functionVar));
helloworld/hello-http/src/main/java/functions/HelloHttp.java:    writer.write(String.format("Hello %s!", name));
http/parse-content-type/src/main/java/functions/ParseContentType.java:      writer.write(String.format("Hello %s!", name));
http/send-http-request/src/main/java/functions/SendHttpRequest.java:    writer.write(String.format("Received code '%s' from url '%s'.", getResponse.statusCode(), url));
logging/retrieve-logs/src/main/java/functions/RetrieveLogs.java:      writer.write(String.format("%s: %s%n", entry.getLogName(), entry.getTextPayload()));
spanner/src/main/java/functions/HelloSpanner.java:        writer.write(String.format("Error querying database: %s\n", e.getMessage()));
spanner/src/main/java/functions/HelloSpanner.java:      writer.write(String.format("Error setting up Spanner: %s\n", t.getMessage()));

@eamonnmcmanus
Copy link
Member Author

I'll send another PR to use PrintWriter everywhere we do anything printf-like.

@eamonnmcmanus eamonnmcmanus merged commit 20637ea into master Apr 28, 2020
@eamonnmcmanus eamonnmcmanus deleted the function-sample-filesystem branch April 28, 2020 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants