diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java
index 3464ed47e17..d10cf3efed5 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright 2015 Google Inc. All Rights Reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.example.appengine.appidentity;
 
 import com.google.apphosting.api.ApiProxy;
diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java
index cecebe82d6a..a7d8e8b4330 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright 2016 Google Inc. All Rights Reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.example.appengine.appidentity;
 
 import com.google.appengine.api.appidentity.AppIdentityService;
@@ -41,8 +42,8 @@ class UrlShortener {
   public String createShortUrl(String longUrl) throws Exception {
     ArrayList<String> scopes = new ArrayList<String>();
     scopes.add("https://www.googleapis.com/auth/urlshortener");
-    AppIdentityService appIdentity = AppIdentityServiceFactory.getAppIdentityService();
-    AppIdentityService.GetAccessTokenResult accessToken = appIdentity.getAccessToken(scopes);
+    final AppIdentityService appIdentity = AppIdentityServiceFactory.getAppIdentityService();
+    final AppIdentityService.GetAccessTokenResult accessToken = appIdentity.getAccessToken(scopes);
     // The token asserts the identity reported by appIdentity.getServiceAccountName()
     JSONObject request = new JSONObject();
     request.put("longUrl", longUrl);
@@ -61,8 +62,8 @@ public String createShortUrl(String longUrl) throws Exception {
     if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
       // Note: Should check the content-encoding.
       //       Any JSON parser can be used; this one is used for illustrative purposes.
-      JSONTokener response_tokens = new JSONTokener(connection.getInputStream());
-      JSONObject response = new JSONObject(response_tokens);
+      JSONTokener responseTokens = new JSONTokener(connection.getInputStream());
+      JSONObject response = new JSONObject(responseTokens);
       return (String) response.get("id");
     } else {
       try (InputStream s = connection.getErrorStream();
diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java
index 8bab40e8115..a280c5dfcc0 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright 2016 Google Inc. All Rights Reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,14 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.example.appengine.appidentity;
 
-import com.google.appengine.api.users.UserService;
-import com.google.appengine.api.users.UserServiceFactory;
+package com.example.appengine.appidentity;
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.net.URLDecoder;
 
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -36,15 +33,16 @@ public UrlShortenerServlet() {
 
   @Override
   public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
-    PrintWriter w = resp.getWriter();
-    w.println("<!DOCTYPE html>");
-    w.println("<meta charset=\"utf-8\">");
-    w.println("<title>Asserting Identity to Google APIs - App Engine App Identity Example</title>");
-    w.println("<form method=\"post\">");
-    w.println("<label for=\"longUrl\">URL:</label>");
-    w.println("<input id=\"longUrl\" name=\"longUrl\" type=\"text\">");
-    w.println("<input type=\"submit\" value=\"Shorten\">");
-    w.println("</form>");
+    PrintWriter writer = resp.getWriter();
+    writer.println("<!DOCTYPE html>");
+    writer.println("<meta charset=\"utf-8\">");
+    writer.println(
+        "<title>Asserting Identity to Google APIs - App Engine App Identity Example</title>");
+    writer.println("<form method=\"post\">");
+    writer.println("<label for=\"longUrl\">URL:</label>");
+    writer.println("<input id=\"longUrl\" name=\"longUrl\" type=\"text\">");
+    writer.println("<input type=\"submit\" value=\"Shorten\">");
+    writer.println("</form>");
   }
 
   @Override
@@ -57,19 +55,19 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
     }
 
     String shortUrl;
-    PrintWriter w = resp.getWriter();
+    PrintWriter writer = resp.getWriter();
     try {
       shortUrl = shortener.createShortUrl(longUrl);
     } catch (Exception e) {
       resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-      w.println("error shortening URL: " + longUrl);
-      e.printStackTrace(w);
+      writer.println("error shortening URL: " + longUrl);
+      e.printStackTrace(writer);
       return;
     }
 
-    w.print("long URL: ");
-    w.println(longUrl);
-    w.print("short URL: ");
-    w.println(shortUrl);
+    writer.print("long URL: ");
+    writer.println(longUrl);
+    writer.print("short URL: ");
+    writer.println(shortUrl);
   }
 }