Skip to content

Commit 08086de

Browse files
authored
appengine-java8/mailgun: address checkstyle violation (GoogleCloudPlatform#2153)
Reorder statements to address checkstyle violation. Error from checkstyle: [ERROR] src/main/java/com/example/appengine/mailgun/MailgunServlet.java:[60] (coding) VariableDeclarationUsageDistance: Distance between variable 'webResource' declaration and its first usage is 5, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
1 parent 73b13fe commit 08086de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

appengine-java8/mailgun/src/main/java/com/example/appengine/mailgun/MailgunServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
5757
private ClientResponse sendSimpleMessage(String recipient) {
5858
Client client = Client.create();
5959
client.addFilter(new HTTPBasicAuthFilter("api", MAILGUN_API_KEY));
60-
WebResource webResource =
61-
client.resource("https://api.mailgun.net/v3/" + MAILGUN_DOMAIN_NAME + "/messages");
6260
MultivaluedMapImpl formData = new MultivaluedMapImpl();
6361
formData.add("from", "Mailgun User <mailgun@" + MAILGUN_DOMAIN_NAME + ">");
6462
formData.add("to", recipient);
6563
formData.add("subject", "Simple Mailgun Example");
6664
formData.add("text", "Plaintext content");
65+
WebResource webResource =
66+
client.resource("https://api.mailgun.net/v3/" + MAILGUN_DOMAIN_NAME + "/messages");
6767
return webResource
6868
.type(MediaType.APPLICATION_FORM_URLENCODED)
6969
.post(ClientResponse.class, formData);

0 commit comments

Comments
 (0)