Format Java files with google-java-format

Change-Id: I90421ebf660a8fdbfa68cd0f5c3673498312ea64
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/ConfigSection.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/ConfigSection.java
index b61dae8..df41a36 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/ConfigSection.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/ConfigSection.java
@@ -15,10 +15,8 @@
 package com.googlesource.gerrit.plugins.xdocs;
 
 import com.google.common.base.MoreObjects;
-
-import org.eclipse.jgit.lib.Config;
-
 import java.util.Set;
+import org.eclipse.jgit.lib.Config;
 
 public class ConfigSection {
   private final Config cfg;
@@ -47,8 +45,7 @@
     if (defaultValue == null) {
       return cfg.getString(section, subsection, name);
     } else {
-      return MoreObjects.firstNonNull(cfg.getString(section, subsection, name),
-          defaultValue);
+      return MoreObjects.firstNonNull(cfg.getString(section, subsection, name), defaultValue);
     }
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/DiffMode.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/DiffMode.java
index 5f37e5e..979337f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/DiffMode.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/DiffMode.java
@@ -15,5 +15,8 @@
 package com.googlesource.gerrit.plugins.xdocs;
 
 public enum DiffMode {
-  NO_DIFF, UNIFIED, SIDEBYSIDE_A, SIDEBYSIDE_B;
+  NO_DIFF,
+  UNIFIED,
+  SIDEBYSIDE_A,
+  SIDEBYSIDE_B;
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/HttpModule.java
index dae128e..06ef00f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/HttpModule.java
@@ -22,10 +22,8 @@
 class HttpModule extends ServletModule {
   @Override
   protected void configureServlets() {
-    serveRegex("^" + XDocServlet.PATH_PREFIX + "(.+)?$")
-        .with(XDocServlet.class);
+    serveRegex("^" + XDocServlet.PATH_PREFIX + "(.+)?$").with(XDocServlet.class);
 
-    DynamicSet.bind(binder(), WebUiPlugin.class)
-        .toInstance(new GwtPlugin("xdocs"));
+    DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new GwtPlugin("xdocs"));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/Module.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/Module.java
index ee029e3..8e6b440 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/Module.java
@@ -28,7 +28,6 @@
 import com.google.gerrit.extensions.webui.ProjectWebLink;
 import com.google.gerrit.extensions.webui.TopMenu;
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.AsciidoctorFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.DocxFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatter;
@@ -36,7 +35,6 @@
 import com.googlesource.gerrit.plugins.xdocs.formatter.MarkdownFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.PlainTextFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.ZipFormatter;
-
 import java.util.List;
 
 public class Module extends FactoryModule {
@@ -56,9 +54,7 @@
     bind(Formatter.class)
         .annotatedWith(Exports.named(AsciidoctorFormatter.NAME))
         .to(AsciidoctorFormatter.class);
-    bind(Formatter.class)
-        .annotatedWith(Exports.named(DocxFormatter.NAME))
-        .to(DocxFormatter.class);
+    bind(Formatter.class).annotatedWith(Exports.named(DocxFormatter.NAME)).to(DocxFormatter.class);
     bind(Formatter.class)
         .annotatedWith(Exports.named(MarkdownFormatter.NAME))
         .to(MarkdownFormatter.class);
@@ -68,32 +64,29 @@
     bind(Formatter.class)
         .annotatedWith(Exports.named(PlainTextFormatter.NAME))
         .to(PlainTextFormatter.class);
-    bind(Formatter.class)
-        .annotatedWith(Exports.named(ZipFormatter.NAME))
-        .to(ZipFormatter.class);
+    bind(Formatter.class).annotatedWith(Exports.named(ZipFormatter.NAME)).to(ZipFormatter.class);
 
-    DynamicSet.bind(binder(), ProjectWebLink.class)
-        .to(XDocWebLink.class);
-    DynamicSet.bind(binder(), BranchWebLink.class)
-        .to(XDocWebLink.class);
-    DynamicSet.bind(binder(), FileWebLink.class)
-        .to(XDocWebLink.class);
-    DynamicSet.bind(binder(), DiffWebLink.class)
-        .to(SideBySideDiffPreviewWebLink.class);
-    DynamicSet.bind(binder(), DiffWebLink.class)
-        .to(UnifiedDiffPreviewWebLink.class);
+    DynamicSet.bind(binder(), ProjectWebLink.class).to(XDocWebLink.class);
+    DynamicSet.bind(binder(), BranchWebLink.class).to(XDocWebLink.class);
+    DynamicSet.bind(binder(), FileWebLink.class).to(XDocWebLink.class);
+    DynamicSet.bind(binder(), DiffWebLink.class).to(SideBySideDiffPreviewWebLink.class);
+    DynamicSet.bind(binder(), DiffWebLink.class).to(UnifiedDiffPreviewWebLink.class);
 
-    DynamicSet.bind(binder(), TopMenu.class).toInstance(new TopMenu() {
-      @Override
-      public List<MenuEntry> getEntries() {
-        StringBuilder url = new StringBuilder();
-        url.append("/plugins/");
-        url.append(pluginName);
-        url.append(XDocServlet.PATH_PREFIX);
-        url.append("${projectName}");
-        return Lists.newArrayList(new MenuEntry(GerritTopMenu.PROJECTS,
-            Lists.newArrayList(new MenuItem("Readme", url.toString()))));
-      }
-    });
+    DynamicSet.bind(binder(), TopMenu.class)
+        .toInstance(
+            new TopMenu() {
+              @Override
+              public List<MenuEntry> getEntries() {
+                StringBuilder url = new StringBuilder();
+                url.append("/plugins/");
+                url.append(pluginName);
+                url.append(XDocServlet.PATH_PREFIX);
+                url.append("${projectName}");
+                return Lists.newArrayList(
+                    new MenuEntry(
+                        GerritTopMenu.PROJECTS,
+                        Lists.newArrayList(new MenuItem("Readme", url.toString()))));
+              }
+            });
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/PreviewDiffUrl.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/PreviewDiffUrl.java
index 366ad4a..dc85ed3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/PreviewDiffUrl.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/PreviewDiffUrl.java
@@ -25,8 +25,7 @@
     this.pluginName = pluginName;
   }
 
-  public String getSideBySideUrl(int changeId, Integer patchSetIdA,
-      int patchSetIdB, String path) {
+  public String getSideBySideUrl(int changeId, Integer patchSetIdA, int patchSetIdB, String path) {
     return getUrl(changeId, patchSetIdA, patchSetIdB, path, false);
   }
 
@@ -34,8 +33,7 @@
     return "plugins/" + pluginName + "/static/sideBySideDiffPreview.png";
   }
 
-  public String getUnifiedUrl(int changeId, Integer patchSetIdA,
-      int patchSetIdB, String path) {
+  public String getUnifiedUrl(int changeId, Integer patchSetIdA, int patchSetIdB, String path) {
     return getUrl(changeId, patchSetIdA, patchSetIdB, path, true);
   }
 
@@ -43,8 +41,8 @@
     return "plugins/" + pluginName + "/static/unifiedDiffPreview.png";
   }
 
-  private String getUrl(int changeId, Integer patchSetIdA, int patchSetIdB,
-      String path, boolean unified) {
+  private String getUrl(
+      int changeId, Integer patchSetIdA, int patchSetIdB, String path, boolean unified) {
     StringBuilder url = new StringBuilder();
     url.append("#/x/");
     url.append(pluginName);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/Resources.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/Resources.java
index 02e547b..378627d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/Resources.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/Resources.java
@@ -16,35 +16,33 @@
 
 import com.google.gerrit.httpd.resources.Resource;
 import com.google.gwtexpui.server.CacheHeaders;
-
 import java.io.IOException;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 public class Resources {
-  public static final Resource METHOD_NOT_ALLOWED = new Resource() {
-    private static final long serialVersionUID = 1L;
+  public static final Resource METHOD_NOT_ALLOWED =
+      new Resource() {
+        private static final long serialVersionUID = 1L;
 
-    @Override
-    public int weigh() {
-      return 0;
-    }
+        @Override
+        public int weigh() {
+          return 0;
+        }
 
-    @Override
-    public void send(HttpServletRequest req, HttpServletResponse res)
-        throws IOException {
-      CacheHeaders.setNotCacheable(res);
-      res.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
-    }
+        @Override
+        public void send(HttpServletRequest req, HttpServletResponse res) throws IOException {
+          CacheHeaders.setNotCacheable(res);
+          res.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+        }
 
-    @Override
-    public boolean isUnchanged(long latestModifiedDate) {
-      return false;
-    }
+        @Override
+        public boolean isUnchanged(long latestModifiedDate) {
+          return false;
+        }
 
-    protected Object readResolve() {
-      return METHOD_NOT_ALLOWED;
-    }
-  };
+        protected Object readResolve() {
+          return METHOD_NOT_ALLOWED;
+        }
+      };
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/SideBySideDiffPreviewWebLink.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/SideBySideDiffPreviewWebLink.java
index 0205047..439a797 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/SideBySideDiffPreviewWebLink.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/SideBySideDiffPreviewWebLink.java
@@ -17,7 +17,6 @@
 import com.google.gerrit.extensions.common.DiffWebLinkInfo;
 import com.google.gerrit.extensions.webui.DiffWebLink;
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters.FormatterProvider;
 
@@ -28,23 +27,28 @@
   private final Formatters formatters;
 
   @Inject
-  SideBySideDiffPreviewWebLink(
-      PreviewDiffUrl previewDiffUrl,
-      Formatters formatters) {
+  SideBySideDiffPreviewWebLink(PreviewDiffUrl previewDiffUrl, Formatters formatters) {
     this.previewDiffUrl = previewDiffUrl;
     this.formatters = formatters;
   }
 
   @Override
-  public DiffWebLinkInfo getDiffLink(String projectName, int changeId,
-      Integer patchSetIdA, String revisionA, String pathA, int patchSetIdB,
-      String revisionB, String pathB) {
+  public DiffWebLinkInfo getDiffLink(
+      String projectName,
+      int changeId,
+      Integer patchSetIdA,
+      String revisionA,
+      String pathA,
+      int patchSetIdB,
+      String revisionB,
+      String pathB) {
     FormatterProvider formatter = formatters.get(projectName, pathB);
     if (formatter == null) {
       return null;
     }
 
-    return DiffWebLinkInfo.forSideBySideDiffView(SIDE_BY_SIDE_PREVIEW_DIFF,
+    return DiffWebLinkInfo.forSideBySideDiffView(
+        SIDE_BY_SIDE_PREVIEW_DIFF,
         previewDiffUrl.getSideBySideIconUrl(),
         previewDiffUrl.getSideBySideUrl(changeId, patchSetIdA, patchSetIdB, pathB),
         Target.SELF);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/UnifiedDiffPreviewWebLink.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/UnifiedDiffPreviewWebLink.java
index a3cdb6e..0005f53 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/UnifiedDiffPreviewWebLink.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/UnifiedDiffPreviewWebLink.java
@@ -17,7 +17,6 @@
 import com.google.gerrit.extensions.common.DiffWebLinkInfo;
 import com.google.gerrit.extensions.webui.DiffWebLink;
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters.FormatterProvider;
 
@@ -28,23 +27,28 @@
   private final Formatters formatters;
 
   @Inject
-  UnifiedDiffPreviewWebLink(
-      PreviewDiffUrl previewDiffUrl,
-      Formatters formatters) {
+  UnifiedDiffPreviewWebLink(PreviewDiffUrl previewDiffUrl, Formatters formatters) {
     this.previewDiffUrl = previewDiffUrl;
     this.formatters = formatters;
   }
 
   @Override
-  public DiffWebLinkInfo getDiffLink(String projectName, int changeId,
-      Integer patchSetIdA, String revisionA, String pathA, int patchSetIdB,
-      String revisionB, String pathB) {
+  public DiffWebLinkInfo getDiffLink(
+      String projectName,
+      int changeId,
+      Integer patchSetIdA,
+      String revisionA,
+      String pathA,
+      int patchSetIdB,
+      String revisionB,
+      String pathB) {
     FormatterProvider formatter = formatters.get(projectName, pathB);
     if (formatter == null) {
       return null;
     }
 
-    return DiffWebLinkInfo.forUnifiedDiffView(UNIFIED_PREVIEW_DIFF,
+    return DiffWebLinkInfo.forUnifiedDiffView(
+        UNIFIED_PREVIEW_DIFF,
         previewDiffUrl.getUnifiedIconUrl(),
         previewDiffUrl.getUnifiedUrl(changeId, patchSetIdA, patchSetIdB, pathB),
         Target.SELF);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocCache.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocCache.java
index 91917c4..c25d8d0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocCache.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocCache.java
@@ -24,9 +24,7 @@
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import com.google.inject.name.Named;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters.FormatterProvider;
-
 import org.eclipse.jgit.lib.ObjectId;
 
 @Singleton
@@ -42,16 +40,29 @@
     this.projectCache = projectCache;
   }
 
-  public Resource get(FormatterProvider formatter, Project.NameKey project,
-      String file, ObjectId revId, ObjectId revIdB, DiffMode diffMode) {
+  public Resource get(
+      FormatterProvider formatter,
+      Project.NameKey project,
+      String file,
+      ObjectId revId,
+      ObjectId revIdB,
+      DiffMode diffMode) {
     ProjectState p = projectCache.get(project);
     ObjectId metaConfigRevId =
         p != null && p.getConfig().getRevision() != null
             ? p.getConfig().getRevision()
             : ObjectId.zeroId();
-    return cache.getUnchecked((new XDocResourceKey(formatter.getName(),
-        project, file, revId, metaConfigRevId, getParentsHash(project),
-        revIdB, diffMode)).asString());
+    return cache.getUnchecked(
+        (new XDocResourceKey(
+                formatter.getName(),
+                project,
+                file,
+                revId,
+                metaConfigRevId,
+                getParentsHash(project),
+                revIdB,
+                diffMode))
+            .asString());
   }
 
   private String getParentsHash(Project.NameKey project) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocGlobalConfig.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocGlobalConfig.java
index 28bfd2c..db9a339 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocGlobalConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocGlobalConfig.java
@@ -20,10 +20,8 @@
 import com.googlesource.gerrit.plugins.xdocs.formatter.MarkdownFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.PlainTextFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.ZipFormatter;
-
-import org.eclipse.jgit.lib.Config;
-
 import java.util.Arrays;
+import org.eclipse.jgit.lib.Config;
 
 public class XDocGlobalConfig {
   public static final String SECTION_FORMATTER = "formatter";
@@ -50,15 +48,11 @@
 
   static void initialize(Config cfg) {
     cfg.setString(SECTION_FORMATTER, AsciidoctorFormatter.NAME, KEY_EXT, "adoc");
-    cfg.setStringList(SECTION_FORMATTER, DocxFormatter.NAME, KEY_EXT,
-        Arrays.asList("docx"));
-    cfg.setString(SECTION_FORMATTER, ImageFormatter.NAME, KEY_MIME_TYPE,
-        "image/*");
-    cfg.setString(SECTION_FORMATTER, MarkdownFormatter.NAME, KEY_MIME_TYPE,
-        "text/x-markdown");
-    cfg.setString(SECTION_FORMATTER, PlainTextFormatter.NAME, KEY_MIME_TYPE,
-        "text/plain");
-    cfg.setStringList(SECTION_FORMATTER, ZipFormatter.NAME, KEY_EXT,
-        Arrays.asList("jar", "war", "zip"));
+    cfg.setStringList(SECTION_FORMATTER, DocxFormatter.NAME, KEY_EXT, Arrays.asList("docx"));
+    cfg.setString(SECTION_FORMATTER, ImageFormatter.NAME, KEY_MIME_TYPE, "image/*");
+    cfg.setString(SECTION_FORMATTER, MarkdownFormatter.NAME, KEY_MIME_TYPE, "text/x-markdown");
+    cfg.setString(SECTION_FORMATTER, PlainTextFormatter.NAME, KEY_MIME_TYPE, "text/plain");
+    cfg.setStringList(
+        SECTION_FORMATTER, ZipFormatter.NAME, KEY_EXT, Arrays.asList("jar", "war", "zip"));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocInit.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocInit.java
index d916d1d..026d4f1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocInit.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocInit.java
@@ -22,12 +22,10 @@
 import com.google.gerrit.server.config.SitePaths;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-
+import java.io.File;
 import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.util.FS;
 
-import java.io.File;
-
 @Singleton
 public class XDocInit implements InitStep {
   private final String pluginName;
@@ -35,8 +33,7 @@
   private final ConsoleUI ui;
 
   @Inject
-  XDocInit(@PluginName String pluginName, SitePaths sitePaths,
-      ConsoleUI ui) {
+  XDocInit(@PluginName String pluginName, SitePaths sitePaths, ConsoleUI ui) {
     this.pluginName = pluginName;
     this.sitePaths = sitePaths;
     this.ui = ui;
@@ -44,8 +41,7 @@
 
   @Override
   public void run() throws Exception {
-    File pluginConfig = new File(
-        sitePaths.etc_dir.toFile(), pluginName + ".config");
+    File pluginConfig = new File(sitePaths.etc_dir.toFile(), pluginName + ".config");
     if (!pluginConfig.exists()) {
       ui.message("\n");
       ui.header("%s plugin", pluginName);
@@ -54,22 +50,23 @@
       XDocGlobalConfig.initialize(cfg);
       cfg.save();
 
-      ui.message("Initialized %s plugin: %s", pluginName,
-          pluginConfig.getAbsolutePath());
+      ui.message("Initialized %s plugin: %s", pluginName, pluginConfig.getAbsolutePath());
     }
 
-    extract(new File(sitePaths.static_dir.toFile(),
-        "xdocs/css/unified.css").toPath(),
-        XDocInit.class, "diff/unified.css");
-    extract(new File(sitePaths.static_dir.toFile(),
-        "xdocs/css/sidebyside-a.css").toPath(),
-        XDocInit.class, "diff/sidebyside-a.css");
-    extract(new File(sitePaths.static_dir.toFile(),
-        "xdocs/css/sidebyside-b.css").toPath(),
-        XDocInit.class, "diff/sidebyside-b.css");
+    extract(
+        new File(sitePaths.static_dir.toFile(), "xdocs/css/unified.css").toPath(),
+        XDocInit.class,
+        "diff/unified.css");
+    extract(
+        new File(sitePaths.static_dir.toFile(), "xdocs/css/sidebyside-a.css").toPath(),
+        XDocInit.class,
+        "diff/sidebyside-a.css");
+    extract(
+        new File(sitePaths.static_dir.toFile(), "xdocs/css/sidebyside-b.css").toPath(),
+        XDocInit.class,
+        "diff/sidebyside-b.css");
   }
 
   @Override
-  public void postRun() throws Exception {
-  }
+  public void postRun() throws Exception {}
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocLoader.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocLoader.java
index c2fab74..d98c037 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocLoader.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocLoader.java
@@ -34,13 +34,24 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters.FormatterProvider;
 import com.googlesource.gerrit.plugins.xdocs.formatter.StreamFormatter;
 import com.googlesource.gerrit.plugins.xdocs.formatter.StringFormatter;
-
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.diff.RawText;
@@ -66,21 +77,6 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-
 @Singleton
 public class XDocLoader extends CacheLoader<String, Resource> {
   private static final Logger log = LoggerFactory.getLogger(XDocLoader.class);
@@ -94,7 +90,8 @@
   private final Formatters formatters;
 
   @Inject
-  XDocLoader(GitRepositoryManager repoManager,
+  XDocLoader(
+      GitRepositoryManager repoManager,
       @CanonicalWebUrl Provider<String> webUrl,
       @PluginName String pluginName,
       PluginConfigFactory cfgFactory,
@@ -118,8 +115,7 @@
         }
 
         if (key.getDiffMode() != DiffMode.NO_DIFF) {
-          String htmlB =
-              loadHtml(formatter, repo, rw, key, checkRevId(key.getRevIdB()));
+          String htmlB = loadHtml(formatter, repo, rw, key, checkRevId(key.getRevIdB()));
           if (html == null && htmlB == null) {
             throw new ResourceNotFoundException();
           }
@@ -130,8 +126,8 @@
           }
         }
 
-        RevCommit commit = rw.parseCommit(
-            MoreObjects.firstNonNull(key.getRevIdB(), key.getRevId()));
+        RevCommit commit =
+            rw.parseCommit(MoreObjects.firstNonNull(key.getRevIdB(), key.getRevId()));
         return getAsHtmlResource(html, commit.getCommitTime());
       }
     } catch (ResourceNotFoundException e) {
@@ -141,8 +137,7 @@
     }
   }
 
-  private FormatterProvider getFormatter(String formatterName)
-      throws ResourceNotFoundException {
+  private FormatterProvider getFormatter(String formatterName) throws ResourceNotFoundException {
     FormatterProvider formatter = formatters.getByName(formatterName);
     if (formatter == null) {
       throw new ResourceNotFoundException();
@@ -150,17 +145,16 @@
     return formatter;
   }
 
-  private static ObjectId checkRevId(ObjectId revId)
-      throws ResourceNotFoundException {
+  private static ObjectId checkRevId(ObjectId revId) throws ResourceNotFoundException {
     if (revId == null) {
       throw new ResourceNotFoundException();
     }
     return revId;
   }
 
-  private String loadHtml(FormatterProvider formatter, Repository repo,
-      RevWalk rw, XDocResourceKey key, ObjectId revId) throws IOException,
-      ResourceNotFoundException, MethodNotAllowedException, GitAPIException {
+  private String loadHtml(
+      FormatterProvider formatter, Repository repo, RevWalk rw, XDocResourceKey key, ObjectId revId)
+      throws IOException, ResourceNotFoundException, MethodNotAllowedException, GitAPIException {
     RevCommit commit = rw.parseCommit(revId);
     RevTree tree = commit.getTree();
     try (TreeWalk tw = new TreeWalk(repo)) {
@@ -172,32 +166,38 @@
       }
       ObjectId objectId = tw.getObjectId(0);
       ObjectLoader loader = repo.open(objectId);
-      return getHtml(formatter, repo, loader, key.getProject(),
-          key.getResource(), revId);
+      return getHtml(formatter, repo, loader, key.getProject(), key.getResource(), revId);
     }
   }
 
-  private String getHtml(FormatterProvider formatter, Repository repo,
-      ObjectLoader loader, Project.NameKey project, String path, ObjectId revId)
-      throws MethodNotAllowedException, IOException, GitAPIException,
-      ResourceNotFoundException {
+  private String getHtml(
+      FormatterProvider formatter,
+      Repository repo,
+      ObjectLoader loader,
+      Project.NameKey project,
+      String path,
+      ObjectId revId)
+      throws MethodNotAllowedException, IOException, GitAPIException, ResourceNotFoundException {
     Formatter f = formatter.get();
     if (f instanceof StringFormatter) {
-      return getHtml(formatter.getName(), (StringFormatter) f, repo, loader,
-          project, path, revId);
+      return getHtml(formatter.getName(), (StringFormatter) f, repo, loader, project, path, revId);
     } else if (f instanceof StreamFormatter) {
-      return getHtml(formatter.getName(), (StreamFormatter) f, repo, loader,
-          project, path, revId);
+      return getHtml(formatter.getName(), (StreamFormatter) f, repo, loader, project, path, revId);
     } else {
       log.error(String.format("Unsupported formatter: %s", formatter.getName()));
       throw new ResourceNotFoundException();
     }
   }
 
-  private String getHtml(String formatterName, StringFormatter f,
-      Repository repo, ObjectLoader loader, Project.NameKey project,
-      String path, ObjectId revId) throws MethodNotAllowedException,
-      IOException, GitAPIException {
+  private String getHtml(
+      String formatterName,
+      StringFormatter f,
+      Repository repo,
+      ObjectLoader loader,
+      Project.NameKey project,
+      String path,
+      ObjectId revId)
+      throws MethodNotAllowedException, IOException, GitAPIException {
     byte[] bytes = loader.getBytes(Integer.MAX_VALUE);
     boolean isBinary = RawText.isBinary(bytes);
     if (formatterName.equals(Formatters.RAW_FORMATTER) && isBinary) {
@@ -208,26 +208,36 @@
     if (!isBinary) {
       raw = replaceMacros(repo, project, revId, abbrRevId, raw);
     }
-    return f.format(project.get(), path, revId.getName(), abbrRevId,
-        getFormatterConfig(formatterName), raw);
+    return f.format(
+        project.get(), path, revId.getName(), abbrRevId, getFormatterConfig(formatterName), raw);
   }
 
-  private String getHtml(String formatterName, StreamFormatter f,
-      Repository repo, ObjectLoader loader, Project.NameKey project,
-      String path, ObjectId revId) throws IOException {
+  private String getHtml(
+      String formatterName,
+      StreamFormatter f,
+      Repository repo,
+      ObjectLoader loader,
+      Project.NameKey project,
+      String path,
+      ObjectId revId)
+      throws IOException {
     try (InputStream raw = loader.openStream()) {
-      return f.format(project.get(), path, revId.getName(),
-          getAbbrRevId(repo, revId), getFormatterConfig(formatterName), raw);
+      return f.format(
+          project.get(),
+          path,
+          revId.getName(),
+          getAbbrRevId(repo, revId),
+          getFormatterConfig(formatterName),
+          raw);
     }
   }
 
   private String diffHtml(String htmlA, String htmlB, DiffMode diffMode)
       throws IOException, TransformerConfigurationException, SAXException,
-      ResourceNotFoundException {
+          ResourceNotFoundException {
     ByteArrayOutputStream htmlDiff = new ByteArrayOutputStream();
 
-    SAXTransformerFactory tf =
-        (SAXTransformerFactory) TransformerFactory.newInstance();
+    SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
     TransformerHandler result = tf.newTransformerHandler();
     result.setResult(new StreamResult(htmlDiff));
 
@@ -249,10 +259,8 @@
 
     ContentHandler postProcess = new XslFilter().xsl(result, htmlHeader);
     postProcess.startDocument();
-    postProcess.startElement("", "diffreport", "diffreport",
-            new AttributesImpl());
-    postProcess.startElement("", "diff", "diff",
-            new AttributesImpl());
+    postProcess.startElement("", "diffreport", "diffreport", new AttributesImpl());
+    postProcess.startElement("", "diff", "diff", new AttributesImpl());
 
     HtmlSaxDiffOutput output = new HtmlSaxDiffOutput(postProcess, "diff");
     HTMLDiffer differ = new HTMLDiffer(output);
@@ -267,50 +275,46 @@
 
   /**
    * The daisydiff formatting may make inlined styles unparsable. Fix it:
+   *
    * <ul>
-   *   <li>Remove span element to highlight addition/deletion inside style elements.</li>
-   *   <li>Replace '&gt;' with '>'.</li>
+   *   <li>Remove span element to highlight addition/deletion inside style elements.
+   *   <li>Replace '&gt;' with '>'.
    * </ul>
    */
   private String fixStyles(String html) {
     Matcher m =
         Pattern.compile("(<style[a-zA-Z -=/\"]+>\n)<[a-zA-Z -=\"]+>(.*)</[a-z]+>(\n</style>)")
-               .matcher(html);
+            .matcher(html);
     StringBuffer sb = new StringBuffer();
     while (m.find()) {
-      m.appendReplacement(sb, m.group(1) + m.group(2).replaceAll("&gt;", ">")
-          + m.group(3));
+      m.appendReplacement(sb, m.group(1) + m.group(2).replaceAll("&gt;", ">") + m.group(3));
     }
     m.appendTail(sb);
     return sb.toString();
   }
 
-  private TextNodeComparator getComparator(String html) throws IOException,
-      SAXException {
+  private TextNodeComparator getComparator(String html) throws IOException, SAXException {
     InputSource source =
-        new InputSource(new ByteArrayInputStream(
-            Strings.nullToEmpty(html).getBytes(UTF_8)));
+        new InputSource(new ByteArrayInputStream(Strings.nullToEmpty(html).getBytes(UTF_8)));
     DomTreeBuilder handler = new DomTreeBuilder();
     new HtmlCleaner().cleanAndParse(source, handler);
     return new TextNodeComparator(handler, Locale.US);
   }
 
   private ConfigSection getFormatterConfig(String formatterName) {
-    XDocGlobalConfig cfg =
-        new XDocGlobalConfig(cfgFactory.getGlobalPluginConfig(pluginName));
+    XDocGlobalConfig cfg = new XDocGlobalConfig(cfgFactory.getGlobalPluginConfig(pluginName));
     return cfg.getFormatterConfig(formatterName);
   }
 
-  private static String getAbbrRevId(Repository repo, ObjectId revId)
-      throws IOException {
+  private static String getAbbrRevId(Repository repo, ObjectId revId) throws IOException {
     try (ObjectReader reader = repo.newObjectReader()) {
       return reader.abbreviate(revId).name();
     }
   }
 
-  private String replaceMacros(Repository repo, Project.NameKey project,
-      ObjectId revId, String abbrRevId, String raw) throws GitAPIException,
-      IOException {
+  private String replaceMacros(
+      Repository repo, Project.NameKey project, ObjectId revId, String abbrRevId, String raw)
+      throws GitAPIException, IOException {
     Map<String, String> macros = Maps.newHashMap();
 
     String url = webUrl.get();
@@ -323,8 +327,9 @@
     macros.put("PROJECT_URL", url + "#/admin/projects/" + project.get());
     macros.put("REVISION", abbrRevId);
     try (Git git = new Git(repo)) {
-      macros.put("GIT_DESCRIPTION", MoreObjects.firstNonNull(
-          git.describe().setTarget(revId).call(), abbrRevId));
+      macros.put(
+          "GIT_DESCRIPTION",
+          MoreObjects.firstNonNull(git.describe().setTarget(revId).call(), abbrRevId));
     }
 
     Matcher m = Pattern.compile("(\\\\)?@([A-Z_]+)@").matcher(raw);
@@ -354,20 +359,20 @@
 
     @Override
     protected void configure() {
-      install(new CacheModule() {
-        @Override
-        protected void configure() {
-          persist(X_DOC_RESOURCES, String.class, Resource.class)
-            .maximumWeight(2 << 20)
-            .weigher(XDocResourceWeigher.class)
-            .loader(XDocLoader.class);
-        }
-      });
+      install(
+          new CacheModule() {
+            @Override
+            protected void configure() {
+              persist(X_DOC_RESOURCES, String.class, Resource.class)
+                  .maximumWeight(2 << 20)
+                  .weigher(XDocResourceWeigher.class)
+                  .loader(XDocLoader.class);
+            }
+          });
     }
   }
 
-  private static class XDocResourceWeigher implements
-      Weigher<String, Resource> {
+  private static class XDocResourceWeigher implements Weigher<String, Resource> {
     @Override
     public int weigh(String key, Resource value) {
       return key.length() * 2 + value.weigh();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocProjectConfig.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocProjectConfig.java
index eb45cd7..e0746be 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocProjectConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocProjectConfig.java
@@ -20,7 +20,6 @@
 import com.google.gerrit.server.project.ProjectState;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
-
 import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.lib.Constants;
 
@@ -37,20 +36,20 @@
   private final Config cfg;
 
   @Inject
-  XDocProjectConfig(@PluginName String pluginName, PluginConfigFactory cfgFactory,
+  XDocProjectConfig(
+      @PluginName String pluginName,
+      PluginConfigFactory cfgFactory,
       @Assisted ProjectState project) {
     this.cfg = cfgFactory.getProjectPluginConfigWithInheritance(project, pluginName);
   }
 
   String getIndexRef() {
     return MoreObjects.firstNonNull(
-        cfg.getString(SECTION_WEB, null, KEY_INDEX_REF),
-        Constants.HEAD);
+        cfg.getString(SECTION_WEB, null, KEY_INDEX_REF), Constants.HEAD);
   }
 
   String getIndexFile() {
     return MoreObjects.firstNonNull(
-        cfg.getString(SECTION_WEB, null, KEY_INDEX_FILE),
-        DEFAULT_INDEX_FILE);
+        cfg.getString(SECTION_WEB, null, KEY_INDEX_FILE), DEFAULT_INDEX_FILE);
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocResourceKey.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocResourceKey.java
index 3bb94c7..df607dd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocResourceKey.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocResourceKey.java
@@ -17,10 +17,8 @@
 import com.google.common.base.Strings;
 import com.google.gerrit.extensions.restapi.IdString;
 import com.google.gerrit.reviewdb.client.Project;
-
-import org.eclipse.jgit.lib.ObjectId;
-
 import java.util.Objects;
+import org.eclipse.jgit.lib.ObjectId;
 
 public class XDocResourceKey {
   private final String formatter;
@@ -32,9 +30,15 @@
   private final ObjectId revIdB;
   private final DiffMode diffMode;
 
-  XDocResourceKey(String formatter, Project.NameKey project, String r,
-      ObjectId revId, ObjectId metaConfigRevId, String parentsHash,
-      ObjectId revIdB, DiffMode diffMode) {
+  XDocResourceKey(
+      String formatter,
+      Project.NameKey project,
+      String r,
+      ObjectId revId,
+      ObjectId metaConfigRevId,
+      String parentsHash,
+      ObjectId revIdB,
+      DiffMode diffMode) {
     this.formatter = formatter;
     this.project = project;
     this.resource = r;
@@ -71,8 +75,8 @@
 
   @Override
   public int hashCode() {
-    return Objects.hash(formatter, project, resource, revId, metaConfigRevId,
-        parentsHash, revIdB, diffMode);
+    return Objects.hash(
+        formatter, project, resource, revId, metaConfigRevId, parentsHash, revIdB, diffMode);
   }
 
   @Override
@@ -145,9 +149,15 @@
     if (s.length > 7) {
       diffMode = s[7];
     }
-    return new XDocResourceKey(formatter, new Project.NameKey(project), file,
-        toObjectId(revision), toObjectId(metaConfigRevision), parentsHash,
-        toObjectId(revisionB), DiffMode.valueOf(diffMode));
+    return new XDocResourceKey(
+        formatter,
+        new Project.NameKey(project),
+        file,
+        toObjectId(revision),
+        toObjectId(metaConfigRevision),
+        parentsHash,
+        toObjectId(revisionB),
+        DiffMode.valueOf(diffMode));
   }
 
   private static ObjectId toObjectId(String id) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocServlet.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocServlet.java
index 6312c38..89327fa 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocServlet.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocServlet.java
@@ -33,9 +33,9 @@
 import com.google.gerrit.httpd.resources.SmallResource;
 import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.reviewdb.server.ReviewDb;
-import com.google.gerrit.server.mime.FileTypeRegistry;
 import com.google.gerrit.server.change.FileContentUtil;
 import com.google.gerrit.server.git.GitRepositoryManager;
+import com.google.gerrit.server.mime.FileTypeRegistry;
 import com.google.gerrit.server.permissions.PermissionBackend;
 import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.google.gerrit.server.permissions.RefPermission;
@@ -50,12 +50,14 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters.FormatterProvider;
-
 import eu.medsea.mimeutil.MimeType;
-
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import org.eclipse.jgit.errors.RepositoryNotFoundException;
 import org.eclipse.jgit.errors.RevisionSyntaxException;
 import org.eclipse.jgit.lib.Constants;
@@ -68,18 +70,11 @@
 import org.eclipse.jgit.treewalk.TreeWalk;
 import org.eclipse.jgit.treewalk.filter.PathFilter;
 
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 @Singleton
 public class XDocServlet extends HttpServlet {
   private static final long serialVersionUID = 1L;
 
-  public  static final String PATH_PREFIX = "/project/";
+  public static final String PATH_PREFIX = "/project/";
 
   private final String pluginName;
   private final Provider<ReviewDb> db;
@@ -123,8 +118,7 @@
   }
 
   @Override
-  public void service(HttpServletRequest req, HttpServletResponse res)
-      throws IOException {
+  public void service(HttpServletRequest req, HttpServletResponse res) throws IOException {
     try {
       validateRequestMethod(req);
 
@@ -137,23 +131,27 @@
         return;
       }
 
-      MimeType mimeType = fileTypeRegistry.getMimeType(key.file, (byte[])null);
-      mimeType = new MimeType(FileContentUtil.resolveContentType(
-          state, key.file, FileMode.FILE, mimeType.toString()));
+      MimeType mimeType = fileTypeRegistry.getMimeType(key.file, (byte[]) null);
+      mimeType =
+          new MimeType(
+              FileContentUtil.resolveContentType(
+                  state, key.file, FileMode.FILE, mimeType.toString()));
       FormatterProvider formatter = getFormatter(req, key, mimeType);
       validateDiffMode(key);
 
       ProjectControl projectControl = projectControlFactory.controlFor(key.project);
-      String rev = getRevision(
-          key.diffMode == DiffMode.NO_DIFF
-              ? MoreObjects.firstNonNull(key.revision, cfg.getIndexRef())
-              : key.revision,
-          projectControl);
+      String rev =
+          getRevision(
+              key.diffMode == DiffMode.NO_DIFF
+                  ? MoreObjects.firstNonNull(key.revision, cfg.getIndexRef())
+                  : key.revision,
+              projectControl);
       String revB = getRevision(key.revisionB, projectControl);
 
       try (Repository repo = repoManager.openRepository(key.project)) {
         ObjectId revId =
-            resolveRevision(repo,
+            resolveRevision(
+                repo,
                 key.diffMode == DiffMode.NO_DIFF
                     ? MoreObjects.firstNonNull(rev, Constants.HEAD)
                     : rev);
@@ -173,8 +171,7 @@
 
         Resource rsc;
         if (formatter != null) {
-          rsc = docCache.get(formatter, key.project, key.file, revId,
-              revIdB, key.diffMode);
+          rsc = docCache.get(formatter, key.project, key.file, revId, revIdB, key.diffMode);
         } else if (isImage(mimeType)) {
           rsc = getImageResource(repo, key.diffMode, revId, revIdB, key.file);
         } else {
@@ -182,8 +179,8 @@
         }
 
         if (rsc != Resource.NOT_FOUND) {
-          res.setHeader(HttpHeaders.ETAG,
-              computeETag(key.project, revId, key.file, revIdB, key.diffMode));
+          res.setHeader(
+              HttpHeaders.ETAG, computeETag(key.project, revId, key.file, revIdB, key.diffMode));
         }
         if (key.diffMode == DiffMode.NO_DIFF && rev == null) {
           // file was loaded from HEAD, since HEAD is modifiable the document
@@ -195,8 +192,11 @@
         rsc.send(req, res);
         return;
       }
-    } catch (RepositoryNotFoundException | NoSuchProjectException
-        | ResourceNotFoundException | AuthException | RevisionSyntaxException e) {
+    } catch (RepositoryNotFoundException
+        | NoSuchProjectException
+        | ResourceNotFoundException
+        | AuthException
+        | RevisionSyntaxException e) {
       Resource.NOT_FOUND.send(req, res);
     } catch (MethodNotAllowedException e) {
       CacheHeaders.setNotCacheable(res);
@@ -215,11 +215,10 @@
     return path;
   }
 
-  private Resource getImageResource(Repository repo, DiffMode diffMode,
-      ObjectId revId, ObjectId revIdB, String file) {
-    ObjectId id = diffMode == DiffMode.NO_DIFF || diffMode == DiffMode.SIDEBYSIDE_A
-        ? revId
-        : revIdB;
+  private Resource getImageResource(
+      Repository repo, DiffMode diffMode, ObjectId revId, ObjectId revIdB, String file) {
+    ObjectId id =
+        diffMode == DiffMode.NO_DIFF || diffMode == DiffMode.SIDEBYSIDE_A ? revId : revIdB;
     try (RevWalk rw = new RevWalk(repo)) {
       RevCommit commit = rw.parseCommit(id);
       RevTree tree = commit.getTree();
@@ -255,15 +254,13 @@
     }
   }
 
-  private static void validateDiffMode(ResourceKey key)
-      throws ResourceNotFoundException {
+  private static void validateDiffMode(ResourceKey key) throws ResourceNotFoundException {
     if (key.diffMode != DiffMode.NO_DIFF && (key.revisionB == null)) {
       throw new ResourceNotFoundException();
     }
   }
 
-  private ProjectState getProject(ResourceKey key)
-      throws ResourceNotFoundException {
+  private ProjectState getProject(ResourceKey key) throws ResourceNotFoundException {
     ProjectState state = projectCache.get(key.project);
     if (state == null) {
       throw new ResourceNotFoundException();
@@ -271,8 +268,8 @@
     return state;
   }
 
-  private FormatterProvider getFormatter(HttpServletRequest req,
-      ResourceKey key, MimeType mimeType) throws ResourceNotFoundException {
+  private FormatterProvider getFormatter(HttpServletRequest req, ResourceKey key, MimeType mimeType)
+      throws ResourceNotFoundException {
     FormatterProvider formatter;
     if (req.getParameter("raw") != null) {
       formatter = formatters.getRawFormatter();
@@ -303,9 +300,8 @@
     return "image".equals(mimeType.getMediaType());
   }
 
-  private String getRevision(String revision,
-      ProjectControl projectControl) throws ResourceNotFoundException,
-      AuthException, IOException, PermissionBackendException {
+  private String getRevision(String revision, ProjectControl projectControl)
+      throws ResourceNotFoundException, AuthException, IOException, PermissionBackendException {
     if (revision == null) {
       return null;
     }
@@ -348,8 +344,7 @@
     return revId;
   }
 
-  private void validateCanReadCommit(Repository repo,
-      ProjectControl projectControl, ObjectId revId)
+  private void validateCanReadCommit(Repository repo, ProjectControl projectControl, ObjectId revId)
       throws ResourceNotFoundException, IOException {
     try (RevWalk rw = new RevWalk(repo)) {
       RevCommit commit = rw.parseCommit(revId);
@@ -360,18 +355,17 @@
     }
   }
 
-  private static boolean isResourceNotModified(HttpServletRequest req,
-      ResourceKey key, ObjectId revId, ObjectId revIdB) {
+  private static boolean isResourceNotModified(
+      HttpServletRequest req, ResourceKey key, ObjectId revId, ObjectId revIdB) {
     String receivedETag = req.getHeader(HttpHeaders.IF_NONE_MATCH);
     if (receivedETag != null) {
-      return receivedETag.equals(computeETag(key.project, revId, key.file,
-          revIdB, key.diffMode));
+      return receivedETag.equals(computeETag(key.project, revId, key.file, revIdB, key.diffMode));
     }
     return false;
   }
 
-  private static String computeETag(Project.NameKey project, ObjectId revId,
-      String file, ObjectId revIdB, DiffMode diffMode) {
+  private static String computeETag(
+      Project.NameKey project, ObjectId revId, String file, ObjectId revIdB, DiffMode diffMode) {
     Hasher hasher = Hashing.md5().newHasher();
     hasher.putUnencodedChars(project.get());
     if (revId != null) {
@@ -379,17 +373,16 @@
     }
     hasher.putUnencodedChars(file);
     if (diffMode != DiffMode.NO_DIFF) {
-      hasher.putUnencodedChars(revIdB.getName()).putUnencodedChars(
-          diffMode.name());
+      hasher.putUnencodedChars(revIdB.getName()).putUnencodedChars(diffMode.name());
     }
     return hasher.hash().toString();
   }
 
-  private String getRedirectUrl(HttpServletRequest req, ResourceKey key,
-      XDocProjectConfig cfg) {
+  private String getRedirectUrl(HttpServletRequest req, ResourceKey key, XDocProjectConfig cfg) {
     StringBuilder redirectUrl = new StringBuilder();
-    redirectUrl.append(req.getRequestURL().substring(0,
-        req.getRequestURL().length() - req.getRequestURI().length()));
+    redirectUrl.append(
+        req.getRequestURL()
+            .substring(0, req.getRequestURL().length() - req.getRequestURI().length()));
     redirectUrl.append(req.getContextPath());
     redirectUrl.append(PATH_PREFIX);
     redirectUrl.append(IdString.fromDecoded(key.project.get()).encoded());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocWebLink.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocWebLink.java
index 5ec6172..832d8ac 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocWebLink.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/XDocWebLink.java
@@ -27,22 +27,18 @@
 import com.google.gerrit.server.project.ProjectState;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters;
 import com.googlesource.gerrit.plugins.xdocs.formatter.Formatters.FormatterProvider;
-
+import java.io.IOException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.Repository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-
 @Singleton
 public class XDocWebLink implements ProjectWebLink, BranchWebLink, FileWebLink {
-  private static final Logger log = LoggerFactory
-      .getLogger(XDocWebLink.class);
+  private static final Logger log = LoggerFactory.getLogger(XDocWebLink.class);
 
   private static final String README = "readme";
   private static final String PREVIEW = "preview";
@@ -73,26 +69,19 @@
   @Override
   public WebLinkInfo getBranchWebLink(String projectName, String branchName) {
     String url = getBranchUrl(projectName, branchName);
-    return url == null
-        ? null
-        : new WebLinkInfo(README, getImageUrl(), url, Target.SELF);
+    return url == null ? null : new WebLinkInfo(README, getImageUrl(), url, Target.SELF);
   }
 
   @Override
   public WebLinkInfo getProjectWeblink(String projectName) {
     String url = getBranchUrl(projectName, Constants.HEAD);
-    return url == null
-        ? null
-        : new WebLinkInfo(README, getImageUrl(), url, Target.SELF);
+    return url == null ? null : new WebLinkInfo(README, getImageUrl(), url, Target.SELF);
   }
 
   @Override
-  public WebLinkInfo getFileWebLink(String projectName, String revision,
-      String fileName) {
+  public WebLinkInfo getFileWebLink(String projectName, String revision, String fileName) {
     String url = getFileUrl(projectName, revision, fileName, false);
-    return url == null
-        ? null
-        : new WebLinkInfo(PREVIEW, getImageUrl(), url, Target.BLANK);
+    return url == null ? null : new WebLinkInfo(PREVIEW, getImageUrl(), url, Target.BLANK);
   }
 
   private String getBranchUrl(String projectName, String branchName) {
@@ -101,12 +90,10 @@
       // project not found -> no link
       return null;
     }
-    return getFileUrl(projectName, branchName,
-        cfgFactory.create(state).getIndexFile(), true);
+    return getFileUrl(projectName, branchName, cfgFactory.create(state).getIndexFile(), true);
   }
 
-  public String getFileUrl(String projectName, String revision,
-      String fileName, boolean framed) {
+  public String getFileUrl(String projectName, String revision, String fileName, boolean framed) {
     FormatterProvider formatter = formatters.get(projectName, fileName);
     if (formatter == null) {
       return null;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeApi.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeApi.java
index 0a3b3e1..6ab6fca 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeApi.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeApi.java
@@ -17,16 +17,13 @@
 import com.google.gerrit.extensions.client.ListChangesOption;
 import com.google.gerrit.plugin.client.rpc.RestApi;
 import com.google.gwt.user.client.rpc.AsyncCallback;
-
 import com.googlesource.gerrit.plugins.xdocs.client.ChangeInfo.EditInfo;
-
 import java.util.EnumSet;
 
 public class ChangeApi {
   public static void getChangeInfo(String id, AsyncCallback<ChangeInfo> callback) {
     RestApi call = ChangeApi.detail(id);
-    addOptions(call, EnumSet.of(
-      ListChangesOption.ALL_REVISIONS));
+    addOptions(call, EnumSet.of(ListChangesOption.ALL_REVISIONS));
     call.get(callback);
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeInfo.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeInfo.java
index 48a4156..9c382a5 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ChangeInfo.java
@@ -19,19 +19,26 @@
 import com.google.gerrit.extensions.client.ChangeStatus;
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.JsArray;
-
 import java.util.Collections;
 import java.util.Comparator;
 
 public class ChangeInfo extends JavaScriptObject {
   public final native String project() /*-{ return this.project; }-*/;
+
   public final native NativeMap<RevisionInfo> revisions() /*-{ return this.revisions; }-*/;
+
   public final native RevisionInfo revision(String n) /*-{ return this.revisions[n]; }-*/;
+
   public final native int _number() /*-{ return this._number; }-*/;
+
   private final native String statusRaw() /*-{ return this.status; }-*/;
+
   public final native String current_revision() /*-{ return this.current_revision; }-*/;
+
   public final native void set_edit(EditInfo edit) /*-{ this.edit = edit; }-*/;
+
   public final native EditInfo edit() /*-{ return this.edit; }-*/;
+
   public final native boolean has_edit() /*-{ return this.hasOwnProperty('edit') }-*/;
 
   public final ChangeStatus getStatus() {
@@ -47,8 +54,7 @@
     }
   }
 
-  protected ChangeInfo() {
-  }
+  protected ChangeInfo() {}
 
   public static class RevisionInfo extends JavaScriptObject {
     public static RevisionInfo fromEdit(EditInfo edit) {
@@ -65,10 +71,15 @@
     }-*/;
 
     public final native int _number() /*-{ return this._number; }-*/;
+
     public final native String name() /*-{ return this.name; }-*/;
+
     public final native String ref() /*-{ return this.ref; }-*/;
+
     public final native boolean is_edit() /*-{ return this._number == 0; }-*/;
+
     public final native CommitInfo commit() /*-{ return this.commit; }-*/;
+
     public final native String edit_base() /*-{ return this.edit_base; }-*/;
 
     public static int findEditParent(JsArray<RevisionInfo> list) {
@@ -93,26 +104,26 @@
 
     public static void sortRevisionInfoByNumber(JsArray<RevisionInfo> list) {
       final int editParent = findEditParent(list);
-      Collections.sort(Natives.asList(list), new Comparator<RevisionInfo>() {
-        @Override
-        public int compare(RevisionInfo a, RevisionInfo b) {
-          return num(a) - num(b);
-        }
+      Collections.sort(
+          Natives.asList(list),
+          new Comparator<RevisionInfo>() {
+            @Override
+            public int compare(RevisionInfo a, RevisionInfo b) {
+              return num(a) - num(b);
+            }
 
-        private int num(RevisionInfo r) {
-          return !r.is_edit() ? 2 * (r._number() - 1) + 1 : 2 * editParent;
-        }
-      });
+            private int num(RevisionInfo r) {
+              return !r.is_edit() ? 2 * (r._number() - 1) + 1 : 2 * editParent;
+            }
+          });
     }
 
-    protected RevisionInfo () {
-    }
+    protected RevisionInfo() {}
   }
 
   public static class EditInfo extends JavaScriptObject {
     public final native String name() /*-{ return this.name; }-*/;
 
-    protected EditInfo() {
-    }
+    protected EditInfo() {}
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/CommitInfo.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/CommitInfo.java
index 00b2641..de05dc0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/CommitInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/CommitInfo.java
@@ -20,8 +20,8 @@
 public class CommitInfo extends JavaScriptObject {
 
   public final native String commit() /*-{ return this.commit; }-*/;
+
   public final native JsArray<CommitInfo> parents() /*-{ return this.parents; }-*/;
 
-  protected CommitInfo() {
-  }
+  protected CommitInfo() {}
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/DiffApi.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/DiffApi.java
index 7bd9b7f..b21d77e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/DiffApi.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/DiffApi.java
@@ -20,7 +20,10 @@
 
 public class DiffApi {
 
-  public static void list(String changeId, int patchSetId, Integer basePatchSetId,
+  public static void list(
+      String changeId,
+      int patchSetId,
+      Integer basePatchSetId,
       AsyncCallback<NativeMap<FileInfo>> cb) {
     RestApi api = ChangeApi.revision(changeId, patchSetId).view("files");
     if (basePatchSetId != null) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/FileInfo.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/FileInfo.java
index 88941a4..ec7bfc3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/FileInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/FileInfo.java
@@ -17,37 +17,37 @@
 import com.google.gerrit.client.rpc.Natives;
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.JsArray;
-
 import java.util.Collections;
 import java.util.Comparator;
 
 public class FileInfo extends JavaScriptObject {
   public static final String COMMIT_MSG = "/COMMIT_MSG";
+
   public final native String path() /*-{ return this.path; }-*/;
+
   public final native boolean binary() /*-{ return this.binary || false; }-*/;
 
   public static void sortFileInfoByPath(JsArray<FileInfo> list) {
-    Collections.sort(Natives.asList(list), new Comparator<FileInfo>() {
-      @Override
-      public int compare(FileInfo a, FileInfo b) {
-        if (COMMIT_MSG.equals(a.path())) {
-          return -1;
-        } else if (COMMIT_MSG.equals(b.path())) {
-          return 1;
-        }
-        return a.path().compareTo(b.path());
-      }
-    });
+    Collections.sort(
+        Natives.asList(list),
+        new Comparator<FileInfo>() {
+          @Override
+          public int compare(FileInfo a, FileInfo b) {
+            if (COMMIT_MSG.equals(a.path())) {
+              return -1;
+            } else if (COMMIT_MSG.equals(b.path())) {
+              return 1;
+            }
+            return a.path().compareTo(b.path());
+          }
+        });
   }
 
   public static String getFileName(String path) {
-    String fileName = COMMIT_MSG.equals(path)
-        ? "Commit Message"
-        : path;
+    String fileName = COMMIT_MSG.equals(path) ? "Commit Message" : path;
     int s = fileName.lastIndexOf('/');
     return s >= 0 ? fileName.substring(s + 1) : fileName;
   }
 
-  protected FileInfo() {
-  }
+  protected FileInfo() {}
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/PatchSetSelectBox.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/PatchSetSelectBox.java
index a25620d..26964ef 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/PatchSetSelectBox.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/PatchSetSelectBox.java
@@ -23,13 +23,13 @@
 import com.google.gwt.user.client.ui.ImageResourceRenderer;
 import com.google.gwt.user.client.ui.InlineHyperlink;
 import com.google.gwt.user.client.ui.Label;
-
 import com.googlesource.gerrit.plugins.xdocs.client.ChangeInfo.RevisionInfo;
 
 public class PatchSetSelectBox extends FlowPanel {
 
   public enum DisplaySide {
-    A, B
+    A,
+    B
   }
 
   public static enum DiffView {
@@ -44,8 +44,13 @@
   private final int patchSet;
   private final String path;
 
-  public PatchSetSelectBox(DiffView diffView, DisplaySide side,
-      ChangeInfo change, Integer basePatchSet, int patchSet, String path) {
+  public PatchSetSelectBox(
+      DiffView diffView,
+      DisplaySide side,
+      ChangeInfo change,
+      Integer basePatchSet,
+      int patchSet,
+      String path) {
     this.diffView = diffView;
     this.side = side;
     this.change = change;
@@ -108,8 +113,8 @@
   }
 
   private InlineHyperlink createBaseLink() {
-    InlineHyperlink link = new InlineHyperlink("Base",
-        getUrl(change._number(), null, patchSet, path, diffView));
+    InlineHyperlink link =
+        new InlineHyperlink("Base", getUrl(change._number(), null, patchSet, path, diffView));
     if (isBaseSelected()) {
       link.setStyleName("xdocs-patch-set-select-box-selected");
     }
@@ -126,8 +131,9 @@
     String label = r.is_edit() ? "edit" : Integer.toString(r._number());
     Integer patchSetIdA = sideA() ? Integer.valueOf(r._number()) : basePatchSet;
     int patchSetIdB = sideA() ? patchSet : r._number();
-    InlineHyperlink link = new InlineHyperlink(label,
-        getUrl(change._number(), patchSetIdA, patchSetIdB, path, diffView));
+    InlineHyperlink link =
+        new InlineHyperlink(
+            label, getUrl(change._number(), patchSetIdA, patchSetIdB, path, diffView));
     if (isSelected(r._number())) {
       link.setStyleName("xdocs-patch-set-select-box-selected");
     }
@@ -137,12 +143,14 @@
   private Anchor createDownloadLink() {
     String base = GWT.getHostPageBaseURL() + "cat/";
     String sideUrl = isBaseSelected() ? "1" : "0";
-    int ps = isBaseSelected()
-        ? change.revision(change.current_revision())._number()
-        : getSelectedPatchSet();
-    Anchor anchor = new Anchor(
-        new ImageResourceRenderer().render(XDocsPlugin.RESOURCES.downloadIcon()),
-        base + URL.encode(change._number() + "," + ps + "," + path) + "^" + sideUrl);
+    int ps =
+        isBaseSelected()
+            ? change.revision(change.current_revision())._number()
+            : getSelectedPatchSet();
+    Anchor anchor =
+        new Anchor(
+            new ImageResourceRenderer().render(XDocsPlugin.RESOURCES.downloadIcon()),
+            base + URL.encode(change._number() + "," + ps + "," + path) + "^" + sideUrl);
     anchor.setTitle("Download");
     return anchor;
   }
@@ -160,9 +168,10 @@
   }
 
   private Anchor createEditIcon() {
-    Anchor anchor = new Anchor(
-        new ImageResourceRenderer().render(XDocsPlugin.RESOURCES.edit()),
-        "#" + getEditUrl(change._number(), patchSet, path));
+    Anchor anchor =
+        new Anchor(
+            new ImageResourceRenderer().render(XDocsPlugin.RESOURCES.edit()),
+            "#" + getEditUrl(change._number(), patchSet, path));
     anchor.setTitle("Edit");
     return anchor;
   }
@@ -176,12 +185,11 @@
   }
 
   private boolean isSelected(int ps) {
-    return getSelectedPatchSet() != null
-        && getSelectedPatchSet().intValue() == ps;
+    return getSelectedPatchSet() != null && getSelectedPatchSet().intValue() == ps;
   }
 
-  private static String getUrl(int changeId, Integer patchSetIdA,
-      int patchSetIdB, String path, DiffView diffView) {
+  private static String getUrl(
+      int changeId, Integer patchSetIdA, int patchSetIdB, String path, DiffView diffView) {
     StringBuilder url = new StringBuilder();
     url.append("/x/");
     url.append(Plugin.get().getName());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ProjectApi.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ProjectApi.java
index 85060ad..8776712 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ProjectApi.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/ProjectApi.java
@@ -18,8 +18,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public class ProjectApi {
-  public static void getCommitInfo(String project, String ref,
-      AsyncCallback<CommitInfo> callback) {
+  public static void getCommitInfo(String project, String ref, AsyncCallback<CommitInfo> callback) {
     project(project).view("commits").id(ref).get(callback);
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/VoidResult.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/VoidResult.java
index d381cd6..a01bf58 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/VoidResult.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/VoidResult.java
@@ -17,8 +17,7 @@
 import com.google.gwt.core.client.JavaScriptObject;
 
 public final class VoidResult extends JavaScriptObject {
-  protected VoidResult() {
-  }
+  protected VoidResult() {}
 
   public static VoidResult create() {
     return createObject().cast();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocApi.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocApi.java
index 65d39fe..b1f8f23 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocApi.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocApi.java
@@ -24,8 +24,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public class XDocApi {
-  public static String getUrl(String projectName, String revision,
-      String path) {
+  public static String getUrl(String projectName, String revision, String path) {
     StringBuilder url = new StringBuilder();
     url.append("plugins/");
     url.append(Plugin.get().getName());
@@ -41,27 +40,27 @@
     return url.toString();
   }
 
-  public static void checkHtml(String url,
-      final AsyncCallback<VoidResult> callback) {
+  public static void checkHtml(String url, final AsyncCallback<VoidResult> callback) {
     RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
     try {
-      builder.sendRequest(null, new RequestCallback() {
-        @Override
-        public void onResponseReceived(Request request, Response response) {
-          int status = response.getStatusCode();
-          if (200 <= status && status < 300) {
-            callback.onSuccess(VoidResult.create());
-          } else {
-            callback.onFailure(new RequestException(status + " "
-                + response.getStatusText()));
-          }
-        }
+      builder.sendRequest(
+          null,
+          new RequestCallback() {
+            @Override
+            public void onResponseReceived(Request request, Response response) {
+              int status = response.getStatusCode();
+              if (200 <= status && status < 300) {
+                callback.onSuccess(VoidResult.create());
+              } else {
+                callback.onFailure(new RequestException(status + " " + response.getStatusText()));
+              }
+            }
 
-        @Override
-        public void onError(Request request, Throwable caught) {
-          callback.onFailure(caught);
-        }
-      });
+            @Override
+            public void onError(Request request, Throwable caught) {
+              callback.onFailure(caught);
+            }
+          });
     } catch (RequestException e) {
       callback.onFailure(e);
     }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocDiffScreen.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocDiffScreen.java
index b3d4690..02b1632 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocDiffScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocDiffScreen.java
@@ -30,10 +30,8 @@
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
 import com.googlesource.gerrit.plugins.xdocs.client.ChangeInfo.EditInfo;
 import com.googlesource.gerrit.plugins.xdocs.client.ChangeInfo.RevisionInfo;
-
 import java.util.List;
 
 public abstract class XDocDiffScreen extends VerticalPanel {
@@ -52,70 +50,79 @@
     this.changeId = changeId;
     this.path = path;
 
-    ChangeApi.getChangeInfo(changeId, new AsyncCallback<ChangeInfo>() {
+    ChangeApi.getChangeInfo(
+        changeId,
+        new AsyncCallback<ChangeInfo>() {
 
-      @Override
-      public void onSuccess(final ChangeInfo change) {
-        change.revisions().copyKeysIntoChildren("name");
-        if (Plugin.get().isSignedIn()) {
-          ChangeApi.edit(change._number(), new AsyncCallback<EditInfo>() {
-            @Override
-            public void onSuccess(EditInfo edit) {
-              if (edit != null) {
-                change.set_edit(edit);
-                change.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
-              }
+          @Override
+          public void onSuccess(final ChangeInfo change) {
+            change.revisions().copyKeysIntoChildren("name");
+            if (Plugin.get().isSignedIn()) {
+              ChangeApi.edit(
+                  change._number(),
+                  new AsyncCallback<EditInfo>() {
+                    @Override
+                    public void onSuccess(EditInfo edit) {
+                      if (edit != null) {
+                        change.set_edit(edit);
+                        change.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
+                      }
+                      initRevisionsAndShow(change);
+                    }
+
+                    @Override
+                    public void onFailure(Throwable caught) {
+                      // never invoked
+                    }
+                  });
+            } else {
               initRevisionsAndShow(change);
             }
+          }
 
-            @Override
-            public void onFailure(Throwable caught) {
-              // never invoked
-            }
-          });
-        } else {
-          initRevisionsAndShow(change);
-        }
-      }
-
-      private void initRevisionsAndShow(final ChangeInfo change) {
-        parseRevisions(change, patchSet);
-        if (revisionA == null) {
-          ProjectApi.getCommitInfo(change.project(), change.current_revision(),
-              new AsyncCallback<CommitInfo>() {
-                @Override
-                public void onSuccess(CommitInfo commit) {
-                  if (commit.parents() != null) {
-                    List<CommitInfo> parents = Natives.asList(commit.parents());
-                    if (!parents.isEmpty()) {
-                      revisionA = parents.get(0).commit();
+          private void initRevisionsAndShow(final ChangeInfo change) {
+            parseRevisions(change, patchSet);
+            if (revisionA == null) {
+              ProjectApi.getCommitInfo(
+                  change.project(),
+                  change.current_revision(),
+                  new AsyncCallback<CommitInfo>() {
+                    @Override
+                    public void onSuccess(CommitInfo commit) {
+                      if (commit.parents() != null) {
+                        List<CommitInfo> parents = Natives.asList(commit.parents());
+                        if (!parents.isEmpty()) {
+                          revisionA = parents.get(0).commit();
+                        }
+                      }
+                      show(change);
                     }
-                  }
-                  show(change);
-                }
 
-                @Override
-                public void onFailure(Throwable caught) {
-                  // never invoked
-                }
-              });
-        } else {
-          show(change);
-        }
-      }
+                    @Override
+                    public void onFailure(Throwable caught) {
+                      // never invoked
+                    }
+                  });
+            } else {
+              show(change);
+            }
+          }
 
-      private void show(ChangeInfo change) {
-        addHeader(change);
-        init();
-        display(change);
-      }
+          private void show(ChangeInfo change) {
+            addHeader(change);
+            init();
+            display(change);
+          }
 
-      @Override
-      public void onFailure(Throwable caught) {
-        showError("Unable to load change " + XDocDiffScreen.this.changeId
-            + ": " + caught.getMessage());
-      }
-    });
+          @Override
+          public void onFailure(Throwable caught) {
+            showError(
+                "Unable to load change "
+                    + XDocDiffScreen.this.changeId
+                    + ": "
+                    + caught.getMessage());
+          }
+        });
   }
 
   protected abstract void display(ChangeInfo change);
@@ -184,8 +191,7 @@
     add(p);
   }
 
-  protected void init() {
-  }
+  protected void init() {}
 
   private Widget getPathHeader(ChangeInfo change) {
     HorizontalPanel p = new HorizontalPanel();
@@ -209,71 +215,71 @@
   }
 
   private void addNavigationButtons(final ChangeInfo change) {
-    DiffApi.list(changeId, patchSet, base,
+    DiffApi.list(
+        changeId,
+        patchSet,
+        base,
         new AsyncCallback<NativeMap<FileInfo>>() {
-      @Override
-      public void onSuccess(NativeMap<FileInfo> result) {
-        JsArray<FileInfo> files = result.values();
-        FileInfo.sortFileInfoByPath(files);
-        int index = 0;
-        for (int i = 0; i < files.length(); i++) {
-          if (path.equals(files.get(i).path())) {
-            index = i;
-            break;
+          @Override
+          public void onSuccess(NativeMap<FileInfo> result) {
+            JsArray<FileInfo> files = result.values();
+            FileInfo.sortFileInfoByPath(files);
+            int index = 0;
+            for (int i = 0; i < files.length(); i++) {
+              if (path.equals(files.get(i).path())) {
+                index = i;
+                break;
+              }
+            }
+
+            FileInfo prevInfo = index == 0 ? null : files.get(index - 1);
+            if (prevInfo != null) {
+              iconPanel.add(
+                  createNavLink(XDocsPlugin.RESOURCES.goPrev(), change, patchSet, base, prevInfo));
+            }
+
+            iconPanel.add(
+                createIcon(XDocsPlugin.RESOURCES.goUp(), "Up to change", toChange(change)));
+
+            FileInfo nextInfo = index == files.length() - 1 ? null : files.get(index + 1);
+            if (nextInfo != null) {
+              iconPanel.add(
+                  createNavLink(XDocsPlugin.RESOURCES.goNext(), change, patchSet, base, nextInfo));
+            }
           }
-        }
 
-        FileInfo prevInfo = index == 0 ? null : files.get(index - 1);
-        if (prevInfo != null) {
-          iconPanel.add(createNavLink(XDocsPlugin.RESOURCES.goPrev(),
-              change, patchSet, base, prevInfo));
-        }
-
-        iconPanel.add(createIcon(XDocsPlugin.RESOURCES.goUp(),
-            "Up to change", toChange(change)));
-
-        FileInfo nextInfo = index == files.length() - 1
-            ? null
-            : files.get(index + 1);
-        if (nextInfo != null) {
-          iconPanel.add(createNavLink(XDocsPlugin.RESOURCES.goNext(),
-              change, patchSet, base, nextInfo));
-        }
-      }
-
-      @Override
-      public void onFailure(Throwable caught) {
-        showError("Unable to load files of change " + changeId + ": "
-            + caught.getMessage());
-      }
-    });
+          @Override
+          public void onFailure(Throwable caught) {
+            showError("Unable to load files of change " + changeId + ": " + caught.getMessage());
+          }
+        });
   }
 
-  private InlineHyperlink createNavLink(ImageResource res,
-      final ChangeInfo change, final int patchSet, final Integer base,
+  private InlineHyperlink createNavLink(
+      ImageResource res,
+      final ChangeInfo change,
+      final int patchSet,
+      final Integer base,
       final FileInfo file) {
-    final InlineHyperlink link = createIcon(
-        res, FileInfo.getFileName(file.path()),
-        toFile(change, patchSet, base, file));
-    XDocApi.checkHtml(XDocApi.getUrl(change.project(),
-        getRevision(change, patchSet), file.path()),
+    final InlineHyperlink link =
+        createIcon(res, FileInfo.getFileName(file.path()), toFile(change, patchSet, base, file));
+    XDocApi.checkHtml(
+        XDocApi.getUrl(change.project(), getRevision(change, patchSet), file.path()),
         new AsyncCallback<VoidResult>() {
-      @Override
-      public void onSuccess(VoidResult result) {
-        link.setTargetHistoryToken(
-            toPreview(change, patchSet, base, file));
-      }
+          @Override
+          public void onSuccess(VoidResult result) {
+            link.setTargetHistoryToken(toPreview(change, patchSet, base, file));
+          }
 
-      @Override
-      public void onFailure(Throwable caught) {
-      }
-    });
+          @Override
+          public void onFailure(Throwable caught) {}
+        });
     return link;
   }
 
   protected static InlineHyperlink createIcon(ImageResource res, String tooltip, String target) {
-    InlineHyperlink l = new InlineHyperlink(
-        AbstractImagePrototype.create(res).getHTML(), true, target);
+    InlineHyperlink l =
+        new InlineHyperlink(AbstractImagePrototype.create(res).getHTML(), true, target);
     if (tooltip != null) {
       l.setTitle(tooltip);
     }
@@ -284,21 +290,18 @@
     additionalIconPanel.add(icon);
   }
 
-  private String toPreview(ChangeInfo change, int patchSet,
-      Integer base, FileInfo file) {
+  private String toPreview(ChangeInfo change, int patchSet, Integer base, FileInfo file) {
     String panel = getPanel();
-    return "/x/" + Plugin.get().getName()
+    return "/x/"
+        + Plugin.get().getName()
         + toPatchSet(change, patchSet, base)
         + file.path()
         + (panel != null ? "," + panel : "");
   }
 
-  private String toFile(ChangeInfo change, int patchSet, Integer base,
-      FileInfo file) {
+  private String toFile(ChangeInfo change, int patchSet, Integer base, FileInfo file) {
     String panel = file.binary() ? "unified" : getPanel();
-    return toPatchSet(change, patchSet, base)
-        + file.path()
-        + (panel != null ? "," + panel : "");
+    return toPatchSet(change, patchSet, base) + file.path() + (panel != null ? "," + panel : "");
   }
 
   protected String getPanel() {
@@ -306,8 +309,7 @@
   }
 
   private static String toPatchSet(ChangeInfo change, int patchSet, Integer base) {
-    return toChange(change)
-        + (base != null ? patchSet + ".." + base : patchSet) + "/";
+    return toChange(change) + (base != null ? patchSet + ".." + base : patchSet) + "/";
   }
 
   private static String toChange(ChangeInfo change) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocScreen.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocScreen.java
index 5d7dd4a..42301c1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocScreen.java
@@ -58,21 +58,23 @@
     add(p);
 
     final String url = XDocApi.getUrl(projectName, revision, path);
-    XDocApi.checkHtml(url, new AsyncCallback<VoidResult>() {
-      @Override
-      public void onSuccess(VoidResult result) {
-        String frameId = "xdoc_iframe";
-        Frame frame = new Frame(url);
-        frame.getElement().setId(frameId);
-        resize(frame, frameId);
-        add(frame);
-      }
+    XDocApi.checkHtml(
+        url,
+        new AsyncCallback<VoidResult>() {
+          @Override
+          public void onSuccess(VoidResult result) {
+            String frameId = "xdoc_iframe";
+            Frame frame = new Frame(url);
+            frame.getElement().setId(frameId);
+            resize(frame, frameId);
+            add(frame);
+          }
 
-      @Override
-      public void onFailure(Throwable caught) {
-        showError(caught.getMessage());
-      }
-    });
+          @Override
+          public void onFailure(Throwable caught) {
+            showError(caught.getMessage());
+          }
+        });
   }
 
   private void showError(String message) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocSideBySideDiffScreen.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocSideBySideDiffScreen.java
index f3a17dc..fd5eaf0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocSideBySideDiffScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocSideBySideDiffScreen.java
@@ -18,7 +18,6 @@
 import com.google.gwt.http.client.URL;
 import com.google.gwt.user.client.ui.FlexTable;
 import com.google.gwt.user.client.ui.Frame;
-
 import com.googlesource.gerrit.plugins.xdocs.client.PatchSetSelectBox.DiffView;
 import com.googlesource.gerrit.plugins.xdocs.client.PatchSetSelectBox.DisplaySide;
 
@@ -41,25 +40,29 @@
   @Override
   protected void display(ChangeInfo change) {
     String frameIdA = "xdoc_sidebyside_diff_a_iframe";
-    Frame frameA = getRevisionA() != null
-        ? new Frame(XDocApi.getUrl(change.project(), getRevisionSideA(), getPath()))
-        : new Frame();
+    Frame frameA =
+        getRevisionA() != null
+            ? new Frame(XDocApi.getUrl(change.project(), getRevisionSideA(), getPath()))
+            : new Frame();
     frameA.getElement().setId(frameIdA);
     XDocScreen.resize(frameA, frameIdA);
 
     String frameIdB = "xdoc_sidebyside_diff_b_iframe";
-    Frame frameB =
-        new Frame(XDocApi.getUrl(change.project(), getRevisionSideB(), getPath()));
+    Frame frameB = new Frame(XDocApi.getUrl(change.project(), getRevisionSideB(), getPath()));
     frameB.getElement().setId(frameIdB);
     XDocScreen.resize(frameB, frameIdB);
 
     FlexTable t = new FlexTable();
     t.setStyleName("xdocs-diff-table");
     int row = addRow(t);
-    t.setWidget(row, 0, new PatchSetSelectBox(
-        DiffView.SIDE_BY_SIDE, DisplaySide.A, change, base, patchSet, path));
-    t.setWidget(row, 1, new PatchSetSelectBox(
-        DiffView.SIDE_BY_SIDE,  DisplaySide.B, change, base, patchSet, path));
+    t.setWidget(
+        row,
+        0,
+        new PatchSetSelectBox(DiffView.SIDE_BY_SIDE, DisplaySide.A, change, base, patchSet, path));
+    t.setWidget(
+        row,
+        1,
+        new PatchSetSelectBox(DiffView.SIDE_BY_SIDE, DisplaySide.B, change, base, patchSet, path));
     row = addRow(t);
     t.setWidget(row, 0, frameA);
     t.setWidget(row, 1, frameB);
@@ -76,13 +79,15 @@
 
   @Override
   protected void init() {
-    addIcon(createIcon(
-        XDocsPlugin.RESOURCES.sideBySideDiff(),
-        "side-by-side text diff",
-        XDocsPlugin.getSideBySideDiffUrl(changeId, base, patchSet, path)));
-    addIcon(createIcon(
-        XDocsPlugin.RESOURCES.unifiedDiffPreview(),
-        "unified preview diff",
-        XDocsPlugin.getUnifiedPreviewDiffUrl(changeId, base, patchSet, path)));
+    addIcon(
+        createIcon(
+            XDocsPlugin.RESOURCES.sideBySideDiff(),
+            "side-by-side text diff",
+            XDocsPlugin.getSideBySideDiffUrl(changeId, base, patchSet, path)));
+    addIcon(
+        createIcon(
+            XDocsPlugin.RESOURCES.unifiedDiffPreview(),
+            "unified preview diff",
+            XDocsPlugin.getUnifiedPreviewDiffUrl(changeId, base, patchSet, path)));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocUnifiedDiffScreen.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocUnifiedDiffScreen.java
index 043ec9f..a4f2b70 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocUnifiedDiffScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocUnifiedDiffScreen.java
@@ -18,7 +18,6 @@
 import com.google.gwt.http.client.URL;
 import com.google.gwt.user.client.ui.FlexTable;
 import com.google.gwt.user.client.ui.Frame;
-
 import com.googlesource.gerrit.plugins.xdocs.client.PatchSetSelectBox.DiffView;
 import com.googlesource.gerrit.plugins.xdocs.client.PatchSetSelectBox.DisplaySide;
 
@@ -41,18 +40,21 @@
   @Override
   protected void display(ChangeInfo change) {
     String frameId = "xdoc_unified_diff_iframe";
-    Frame frame =
-        new Frame(XDocApi.getUrl(change.project(), getRevision(), getPath()));
+    Frame frame = new Frame(XDocApi.getUrl(change.project(), getRevision(), getPath()));
     frame.getElement().setId(frameId);
     XDocScreen.resize(frame, frameId);
 
     FlexTable t = new FlexTable();
     t.setStyleName("xdocs-diff-table");
     t.addStyleName("xdocs-unified-diff-table");
-    t.setWidget(addRow(t), 0, new PatchSetSelectBox(
-        DiffView.UNIFIED_DIFF, DisplaySide.A, change, base, patchSet, path));
-    t.setWidget(addRow(t), 0, new PatchSetSelectBox(
-        DiffView.UNIFIED_DIFF, DisplaySide.B, change, base, patchSet, path));
+    t.setWidget(
+        addRow(t),
+        0,
+        new PatchSetSelectBox(DiffView.UNIFIED_DIFF, DisplaySide.A, change, base, patchSet, path));
+    t.setWidget(
+        addRow(t),
+        0,
+        new PatchSetSelectBox(DiffView.UNIFIED_DIFF, DisplaySide.B, change, base, patchSet, path));
     t.setWidget(addRow(t), 0, frame);
     add(t);
   }
@@ -68,13 +70,15 @@
 
   @Override
   protected void init() {
-    addIcon(createIcon(
-        XDocsPlugin.RESOURCES.unifiedDiff(),
-        "unified text diff",
-        XDocsPlugin.getUnifiedDiffUrl(changeId, base, patchSet, path)));
-    addIcon(createIcon(
-        XDocsPlugin.RESOURCES.sideBySideDiffPreview(),
-        "side-by-side preview diff",
-        XDocsPlugin.getSideBySidePreviewDiffUrl(changeId, base, patchSet, path)));
+    addIcon(
+        createIcon(
+            XDocsPlugin.RESOURCES.unifiedDiff(),
+            "unified text diff",
+            XDocsPlugin.getUnifiedDiffUrl(changeId, base, patchSet, path)));
+    addIcon(
+        createIcon(
+            XDocsPlugin.RESOURCES.sideBySideDiffPreview(),
+            "side-by-side preview diff",
+            XDocsPlugin.getSideBySidePreviewDiffUrl(changeId, base, patchSet, path)));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocsPlugin.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocsPlugin.java
index 4d09480..4af8396 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocsPlugin.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/client/XDocsPlugin.java
@@ -24,18 +24,18 @@
 
   @Override
   public void onPluginLoad() {
-    Plugin.get().screenRegex("project/([^/]*)/rev/([^/]*)/(.*)",
-        new XDocScreen.Factory());
-    Plugin.get().screenRegex("project/([^/]*)/(.*)",
-        new XDocScreen.HeadFactory());
-    Plugin.get().screenRegex("c/([^/]*)/([0-9]+(\\.{2}[0-9]+)?)/(.*),unified",
-        new XDocUnifiedDiffScreen.Factory());
-    Plugin.get().screenRegex("c/([^/]*)/([0-9]+(\\.{2}[0-9]+)?)/(.*)",
-        new XDocSideBySideDiffScreen.Factory());
+    Plugin.get().screenRegex("project/([^/]*)/rev/([^/]*)/(.*)", new XDocScreen.Factory());
+    Plugin.get().screenRegex("project/([^/]*)/(.*)", new XDocScreen.HeadFactory());
+    Plugin.get()
+        .screenRegex(
+            "c/([^/]*)/([0-9]+(\\.{2}[0-9]+)?)/(.*),unified", new XDocUnifiedDiffScreen.Factory());
+    Plugin.get()
+        .screenRegex(
+            "c/([^/]*)/([0-9]+(\\.{2}[0-9]+)?)/(.*)", new XDocSideBySideDiffScreen.Factory());
   }
 
-  public static String getSideBySideDiffUrl(String changeId,
-      Integer patchSetIdA, int patchSetIdB, String fileName) {
+  public static String getSideBySideDiffUrl(
+      String changeId, Integer patchSetIdA, int patchSetIdB, String fileName) {
     StringBuilder url = new StringBuilder();
     url.append("/c/");
     url.append(changeId);
@@ -50,14 +50,13 @@
     return url.toString();
   }
 
-  public static String getUnifiedDiffUrl(String changeId, Integer patchSetIdA,
-      int patchSetIdB, String fileName) {
-    return getSideBySideDiffUrl(changeId, patchSetIdA, patchSetIdB, fileName)
-        + ",unified";
+  public static String getUnifiedDiffUrl(
+      String changeId, Integer patchSetIdA, int patchSetIdB, String fileName) {
+    return getSideBySideDiffUrl(changeId, patchSetIdA, patchSetIdB, fileName) + ",unified";
   }
 
-  public static String getSideBySidePreviewDiffUrl(String changeId,
-      Integer patchSetIdA, int patchSetIdB, String fileName) {
+  public static String getSideBySidePreviewDiffUrl(
+      String changeId, Integer patchSetIdA, int patchSetIdB, String fileName) {
     StringBuilder url = new StringBuilder();
     url.append("/x/");
     url.append(Plugin.get().getPluginName());
@@ -65,9 +64,8 @@
     return url.toString();
   }
 
-  public static String getUnifiedPreviewDiffUrl(String changeId,
-      Integer patchSetIdA, int patchSetIdB, String fileName) {
-    return getSideBySidePreviewDiffUrl(changeId, patchSetIdA, patchSetIdB,
-        fileName) + ",unified";
+  public static String getUnifiedPreviewDiffUrl(
+      String changeId, Integer patchSetIdA, int patchSetIdB, String fileName) {
+    return getSideBySidePreviewDiffUrl(changeId, patchSetIdA, patchSetIdB, fileName) + ",unified";
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatter.java
index 2da5f69..a233fe6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatter.java
@@ -19,19 +19,16 @@
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
-import org.asciidoctor.Asciidoctor;
-import org.asciidoctor.AttributesBuilder;
-import org.asciidoctor.OptionsBuilder;
-import org.asciidoctor.SafeMode;
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
 import java.util.Properties;
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.AttributesBuilder;
+import org.asciidoctor.OptionsBuilder;
+import org.asciidoctor.SafeMode;
 
 @Singleton
 public class AsciidoctorFormatter implements StringFormatter {
@@ -46,25 +43,30 @@
   private final Formatters formatters;
 
   @Inject
-  public AsciidoctorFormatter(
-      FormatterUtil formatterUtil,
-      Formatters formatters) throws IOException {
+  public AsciidoctorFormatter(FormatterUtil formatterUtil, Formatters formatters)
+      throws IOException {
     this.attributes = readAttributes();
     this.util = formatterUtil;
     this.formatters = formatters;
   }
 
   @Override
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection globalCfg, String raw) throws IOException {
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection globalCfg,
+      String raw)
+      throws IOException {
     if (!globalCfg.getBoolean(KEY_ALLOW_HTML, false)) {
       raw = suppressHtml(raw);
     }
 
-    ConfigSection projectCfg =
-        formatters.getFormatterConfig(NAME, projectName);
-    String html = Asciidoctor.Factory.create(AsciidoctorFormatter.class.getClassLoader())
-        .convert(raw, createOptions(projectCfg, abbrRev));
+    ConfigSection projectCfg = formatters.getFormatterConfig(NAME, projectName);
+    String html =
+        Asciidoctor.Factory.create(AsciidoctorFormatter.class.getClassLoader())
+            .convert(raw, createOptions(projectCfg, abbrRev));
     return util.applyCss(html, NAME, projectName);
   }
 
@@ -97,9 +99,10 @@
   }
 
   private AttributesBuilder getAttributes(ConfigSection cfg, String revision) {
-    AttributesBuilder ab = AttributesBuilder.attributes()
-        .tableOfContents(cfg.getBoolean(KEY_INCLUDE_TOC, true))
-        .sourceHighlighter("prettify");
+    AttributesBuilder ab =
+        AttributesBuilder.attributes()
+            .tableOfContents(cfg.getBoolean(KEY_INCLUDE_TOC, true))
+            .sourceHighlighter("prettify");
     for (String name : attributes.stringPropertyNames()) {
       ab.attribute(name, attributes.getProperty(name));
     }
@@ -110,8 +113,8 @@
 
   private static Properties readAttributes() throws IOException {
     Properties attributes = new Properties();
-    try (InputStream in = AsciidoctorFormatter.class
-        .getResourceAsStream("asciidoctor.properties")) {
+    try (InputStream in =
+        AsciidoctorFormatter.class.getResourceAsStream("asciidoctor.properties")) {
       attributes.load(in);
     }
     return attributes;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/DocxFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/DocxFormatter.java
index 863b3ed..c6a936a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/DocxFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/DocxFormatter.java
@@ -17,19 +17,16 @@
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import org.docx4j.Docx4J;
 import org.docx4j.Docx4jProperties;
 import org.docx4j.convert.out.HTMLSettings;
 import org.docx4j.openpackaging.exceptions.Docx4JException;
 import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
 public class DocxFormatter implements StreamFormatter {
   public static final String NAME = "DOCX";
 
@@ -41,8 +38,14 @@
   }
 
   @Override
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection cfg, InputStream raw) throws IOException {
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection cfg,
+      InputStream raw)
+      throws IOException {
     // Docx4J tries to load some resources dynamically. This fails if the Gerrit
     // core classloader is used since it doesn't see the resources that are
     // contained in the plugin jar. To make the resource loading work we
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatter.java
index d7c6549..20fb533 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatter.java
@@ -17,5 +17,4 @@
 import com.google.gerrit.extensions.annotations.ExtensionPoint;
 
 @ExtensionPoint
-public interface Formatter {
-}
+public interface Formatter {}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/FormatterUtil.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/FormatterUtil.java
index 4e2993b..93dbf51 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/FormatterUtil.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/FormatterUtil.java
@@ -31,9 +31,17 @@
 import com.google.gerrit.server.project.ProjectState;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectLoader;
 import org.eclipse.jgit.lib.Repository;
@@ -46,17 +54,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
 @Singleton
 public class FormatterUtil {
   private static final Logger log = LoggerFactory.getLogger(FormatterUtil.class);
@@ -69,7 +66,8 @@
   private final Map<String, String> defaultCss;
 
   @Inject
-  FormatterUtil(@PluginName String pluginName,
+  FormatterUtil(
+      @PluginName String pluginName,
       @PluginData File baseDir,
       GitRepositoryManager repoManager,
       ProjectCache projectCache,
@@ -83,18 +81,18 @@
   }
 
   /**
-   * Returns the CSS from the file "<plugin-name>/<name>-<theme>.css" in the
-   * refs/meta/config branch of the project.
+   * Returns the CSS from the file "<plugin-name>/<name>-<theme>.css" in the refs/meta/config branch
+   * of the project.
    *
-   * If theme is <code>null</code> or empty, the CSS from the file
-   * "<plugin-name>/<name>.css" is returned.
+   * <p>If theme is <code>null</code> or empty, the CSS from the file "<plugin-name>/<name>.css" is
+   * returned.
    *
-   * @param name the name of the file in the "<plugin-name>/" folder without
-   *        theme and without the ".css" file extension
-   * @param theme the name of the CSS theme, may be <code>null</code>, if given
-   *        it is included into the CSS file name: '<name>-<theme>.css'
-   * @return the CSS from the file; HTML characters are escaped;
-   *         <code>null</code> if the file doesn't exist
+   * @param name the name of the file in the "<plugin-name>/" folder without theme and without the
+   *     ".css" file extension
+   * @param theme the name of the CSS theme, may be <code>null</code>, if given it is included into
+   *     the CSS file name: '<name>-<theme>.css'
+   * @return the CSS from the file; HTML characters are escaped; <code>null</code> if the file
+   *     doesn't exist
    */
   public String getCss(String projectName, String name, String theme) {
     return Strings.isNullOrEmpty(theme)
@@ -103,13 +101,13 @@
   }
 
   /**
-   * Returns the CSS from the file "<plugin-name>/<name>.css" in the
-   * refs/meta/config branch of the project.
+   * Returns the CSS from the file "<plugin-name>/<name>.css" in the refs/meta/config branch of the
+   * project.
    *
-   * @param name the name of the file in the "<plugin-name>/" folder without the
-   *        ".css" file extension
-   * @return the CSS from the file; HTML characters are escaped;
-   *         <code>null</code> if the file doesn't exist
+   * @param name the name of the file in the "<plugin-name>/" folder without the ".css" file
+   *     extension
+   * @return the CSS from the file; HTML characters are escaped; <code>null</code> if the file
+   *     doesn't exist
    */
   public String getCss(String projectName, String name) {
     return escapeHtml(getMetaConfigFile(projectName, name + ".css"));
@@ -118,33 +116,29 @@
   /**
    * Returns the inherited CSS.
    *
-   * If the project has a parent project the CSS of the parent project is
-   * returned; if there is no parent project the global CSS is returned.
+   * <p>If the project has a parent project the CSS of the parent project is returned; if there is
+   * no parent project the global CSS is returned.
    *
    * @param projectName the name of the project
-   * @param formatterName the name of the formatter for which the CSS should be
-   *        returned
-   * @param name the name of the CSS file without theme and without the ".css"
-   *        file extension
-   * @param theme the name of the CSS theme, may be <code>null</code>, if given
-   *        it is included into the CSS file name: '<name>-<theme>.css'
-   * @return the inherited CSS; HTML characters are escaped; <code>null</code>
-   *         if there is no inherited CSS
-   * @throws IOException thrown in case of an I/O Error while reading the global
-   *         CSS file
+   * @param formatterName the name of the formatter for which the CSS should be returned
+   * @param name the name of the CSS file without theme and without the ".css" file extension
+   * @param theme the name of the CSS theme, may be <code>null</code>, if given it is included into
+   *     the CSS file name: '<name>-<theme>.css'
+   * @return the inherited CSS; HTML characters are escaped; <code>null</code> if there is no
+   *     inherited CSS
+   * @throws IOException thrown in case of an I/O Error while reading the global CSS file
    */
-  public String getInheritedCss(String projectName, String formatterName,
-      String name, String theme) throws IOException {
-    return getInheritedCss(projectCache.get(new Project.NameKey(projectName)),
-        formatterName, name, theme);
+  public String getInheritedCss(String projectName, String formatterName, String name, String theme)
+      throws IOException {
+    return getInheritedCss(
+        projectCache.get(new Project.NameKey(projectName)), formatterName, name, theme);
   }
 
-  private String getInheritedCss(ProjectState project, String formatterName,
-    String name, String theme) throws IOException {
+  private String getInheritedCss(
+      ProjectState project, String formatterName, String name, String theme) throws IOException {
     for (ProjectState parent : project.parents()) {
       String css = getCss(parent.getProject().getName(), name, theme);
-      ConfigSection cfg =
-          formatters.getFormatterConfig(formatterName, parent);
+      ConfigSection cfg = formatters.getFormatterConfig(formatterName, parent);
       if (cfg.getBoolean(KEY_INHERIT_CSS, true)) {
         return joinCss(getInheritedCss(parent, formatterName, name, theme), css);
       } else {
@@ -165,36 +159,29 @@
   }
 
   /**
-   * Returns the CSS from the file
-   * "<review-site>/data/<plugin-name>/css/<name>-<theme>.css".
+   * Returns the CSS from the file "<review-site>/data/<plugin-name>/css/<name>-<theme>.css".
    *
-   * If theme is <code>null</code> or empty, the CSS from the file
+   * <p>If theme is <code>null</code> or empty, the CSS from the file
    * "<review-site>/data/<plugin-name>/css/<name>.css" is returned.
    *
-   * @param name the name of the CSS file without theme and without the ".css"
-   *        file extension
-   * @param theme the name of the CSS theme, may be <code>null</code>, if given
-   *        it is included into the CSS file name: '<name>-<theme>.css'
-   * @return the CSS from the file; HTML characters are escaped;
-   *         <code>null</code> if the file doesn't exist
-   * @throws IOException thrown in case of an I/O Error while reading the CSS
-   *         file
+   * @param name the name of the CSS file without theme and without the ".css" file extension
+   * @param theme the name of the CSS theme, may be <code>null</code>, if given it is included into
+   *     the CSS file name: '<name>-<theme>.css'
+   * @return the CSS from the file; HTML characters are escaped; <code>null</code> if the file
+   *     doesn't exist
+   * @throws IOException thrown in case of an I/O Error while reading the CSS file
    */
   public String getGlobalCss(String name, String theme) throws IOException {
-    return Strings.isNullOrEmpty(theme)
-        ? getGlobalCss(name)
-        : getGlobalCss(name + "-" + theme);
+    return Strings.isNullOrEmpty(theme) ? getGlobalCss(name) : getGlobalCss(name + "-" + theme);
   }
 
   /**
-   * Returns the CSS from the file
-   * "<review-site>/data/<plugin-name>/css/<name>.css".
+   * Returns the CSS from the file "<review-site>/data/<plugin-name>/css/<name>.css".
    *
    * @param name the name of the CSS file without the ".css" file extension
-   * @return the CSS from the file; HTML characters are escaped;
-   *         <code>null</code> if the file doesn't exist
-   * @throws IOException thrown in case of an I/O Error while reading the CSS
-   *         file
+   * @return the CSS from the file; HTML characters are escaped; <code>null</code> if the file
+   *     doesn't exist
+   * @throws IOException thrown in case of an I/O Error while reading the CSS file
    */
   public String getGlobalCss(String name) throws IOException {
     Path p = Paths.get(baseDir.getAbsolutePath(), "css", name + ".css");
@@ -205,31 +192,26 @@
     return null;
   }
 
-  public String applyCss(String html, String formatterName, String projectName)
-      throws IOException {
-    ConfigSection projectCfg =
-        formatters.getFormatterConfig(formatterName, projectName);
+  public String applyCss(String html, String formatterName, String projectName) throws IOException {
+    ConfigSection projectCfg = formatters.getFormatterConfig(formatterName, projectName);
     String cssName = formatterName.toLowerCase(Locale.US);
     String cssTheme = projectCfg.getString(KEY_CSS_THEME);
     String defaultCss = getDefaultCss(formatterName);
-    String inheritedCss =
-        getInheritedCss(projectName, formatterName, cssName, cssTheme);
+    String inheritedCss = getInheritedCss(projectName, formatterName, cssName, cssTheme);
     String projectCss = getCss(projectName, cssName, cssTheme);
     if (projectCfg.getBoolean(KEY_INHERIT_CSS, true)) {
-      return insertCss(html,
-          MoreObjects.firstNonNull(inheritedCss, defaultCss), projectCss);
+      return insertCss(html, MoreObjects.firstNonNull(inheritedCss, defaultCss), projectCss);
     } else {
-      return insertCss(html,
-          MoreObjects.firstNonNull(projectCss,
-              MoreObjects.firstNonNull(inheritedCss, defaultCss)));
+      return insertCss(
+          html,
+          MoreObjects.firstNonNull(projectCss, MoreObjects.firstNonNull(inheritedCss, defaultCss)));
     }
   }
 
   private String getDefaultCss(String formatterName) throws IOException {
-    String css = defaultCss.get(formatterName) ;
+    String css = defaultCss.get(formatterName);
     if (css == null) {
-      URL url = FormatterUtil.class.getResource(
-          formatterName.toLowerCase(Locale.US) + ".css");
+      URL url = FormatterUtil.class.getResource(formatterName.toLowerCase(Locale.US) + ".css");
       if (url != null) {
         try (InputStream in = url.openStream();
             TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(128 * 1024)) {
@@ -237,8 +219,7 @@
           css = new String(tmp.toByteArray(), UTF_8);
         }
       } else {
-        log.info(String.format("No default CSS for formatter '%s' found.",
-            formatterName));
+        log.info(String.format("No default CSS for formatter '%s' found.", formatterName));
         css = "";
       }
       defaultCss.put(formatterName, css);
@@ -296,16 +277,15 @@
   }
 
   /**
-   * Returns the content of the specified file from the "<plugin-name>/" folder
-   * of the ref/meta/config branch.
+   * Returns the content of the specified file from the "<plugin-name>/" folder of the
+   * ref/meta/config branch.
    *
    * @param projectName the name of the project
    * @param fileName the name of the file in the "<plugin-name>/" folder
    * @return the file content, <code>null</code> if the file doesn't exist
    */
   public String getMetaConfigFile(String projectName, String fileName) {
-    try (Repository repo = repoManager.openRepository(
-        new Project.NameKey(projectName))) {
+    try (Repository repo = repoManager.openRepository(new Project.NameKey(projectName))) {
       try (RevWalk rw = new RevWalk(repo)) {
         ObjectId id = repo.resolve(RefNames.REFS_CONFIG);
         if (id == null) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatters.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatters.java
index 4f953ed..def2f5b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatters.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/Formatters.java
@@ -26,27 +26,23 @@
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.registration.DynamicMap;
 import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.server.mime.FileTypeRegistry;
 import com.google.gerrit.server.change.FileContentUtil;
 import com.google.gerrit.server.config.PluginConfigFactory;
+import com.google.gerrit.server.mime.FileTypeRegistry;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.gerrit.server.project.ProjectState;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
 import com.googlesource.gerrit.plugins.xdocs.XDocGlobalConfig;
-
 import eu.medsea.mimeutil.MimeType;
-
+import java.util.Map.Entry;
 import org.apache.commons.io.FilenameUtils;
 import org.eclipse.jgit.lib.Config;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Map.Entry;
-
 @Singleton
 public class Formatters {
   private static final Logger log = LoggerFactory.getLogger(Formatters.class);
@@ -82,19 +78,19 @@
   }
 
   public FormatterProvider get(ProjectState project, String fileName) {
-    XDocGlobalConfig globalCfg = new XDocGlobalConfig(
-        pluginCfgFactory.getGlobalPluginConfig(pluginName));
-    MimeType mimeType = fileTypeRegistry.getMimeType(fileName, (byte[])null);
-    mimeType = new MimeType(FileContentUtil.resolveContentType(
-        project, fileName, FileMode.FILE, mimeType.toString()));
+    XDocGlobalConfig globalCfg =
+        new XDocGlobalConfig(pluginCfgFactory.getGlobalPluginConfig(pluginName));
+    MimeType mimeType = fileTypeRegistry.getMimeType(fileName, (byte[]) null);
+    mimeType =
+        new MimeType(
+            FileContentUtil.resolveContentType(
+                project, fileName, FileMode.FILE, mimeType.toString()));
     String extension = FilenameUtils.getExtension(fileName);
     FormatterProvider formatter = null;
     int formatterPrio = 0;
     for (String pluginName : formatters.plugins()) {
-      for (Entry<String, Provider<Formatter>> e :
-          formatters.byPlugin(pluginName).entrySet()) {
-        if (!globalCfg.getFormatterConfig(e.getKey())
-            .getBoolean(KEY_ENABLED, true)) {
+      for (Entry<String, Provider<Formatter>> e : formatters.byPlugin(pluginName).entrySet()) {
+        if (!globalCfg.getFormatterConfig(e.getKey()).getBoolean(KEY_ENABLED, true)) {
           continue;
         }
         ConfigSection formatterCfg = getFormatterConfig(e.getKey(), project);
@@ -123,8 +119,7 @@
             }
           }
         }
-        for (String ext :
-          formatterCfg.getStringList(KEY_EXT)) {
+        for (String ext : formatterCfg.getStringList(KEY_EXT)) {
           if (extension.equals(ext) || "*".equals(ext)) {
             int prio = formatterCfg.getInt(KEY_PRIO, 0);
             if (formatter == null || prio > formatterPrio) {
@@ -138,8 +133,7 @@
     return formatter;
   }
 
-  public ConfigSection getFormatterConfig(String formatterName,
-      String projectName) {
+  public ConfigSection getFormatterConfig(String formatterName, String projectName) {
     ProjectState project = projectCache.get(new Project.NameKey(projectName));
     if (project == null) {
       return null;
@@ -147,8 +141,7 @@
     return getFormatterConfig(formatterName, project);
   }
 
-  public ConfigSection getFormatterConfig(String formatterName,
-      ProjectState project) {
+  public ConfigSection getFormatterConfig(String formatterName, ProjectState project) {
     for (ProjectState p : project.tree()) {
       Config cfg = pluginCfgFactory.getProjectPluginConfig(p, pluginName);
       if (cfg.getSubsections(SECTION_FORMATTER).contains(formatterName)) {
@@ -156,8 +149,7 @@
       }
     }
 
-    return new XDocGlobalConfig(
-        pluginCfgFactory.getGlobalPluginConfig(pluginName))
+    return new XDocGlobalConfig(pluginCfgFactory.getGlobalPluginConfig(pluginName))
         .getFormatterConfig(formatterName);
   }
 
@@ -167,8 +159,7 @@
     }
 
     for (String pluginName : formatters.plugins()) {
-      for (Entry<String, Provider<Formatter>> e :
-          formatters.byPlugin(pluginName).entrySet()) {
+      for (Entry<String, Provider<Formatter>> e : formatters.byPlugin(pluginName).entrySet()) {
         if (formatterName.equals(e.getKey())) {
           return new FormatterProvider(formatterName, e.getValue());
         }
@@ -185,19 +176,22 @@
     XDocGlobalConfig globalCfg =
         new XDocGlobalConfig(pluginCfgFactory.getGlobalPluginConfig(pluginName));
     String formatterName =
-        globalCfg.getFormatterConfig(RAW_FORMATTER)
+        globalCfg
+            .getFormatterConfig(RAW_FORMATTER)
             .getString(KEY_FORMATTER, PlainTextFormatter.NAME);
     if (formatterName.equals(RAW_FORMATTER)) {
-      log.warn(String.format(
-          "%s plugin: Invalid '%s' formatter configuration, '%s' formatter cannot be set to '%s', using '%s' formatter",
-          pluginName, RAW_FORMATTER, RAW_FORMATTER, formatterName, PlainTextFormatter.NAME));
+      log.warn(
+          String.format(
+              "%s plugin: Invalid '%s' formatter configuration, '%s' formatter cannot be set to '%s', using '%s' formatter",
+              pluginName, RAW_FORMATTER, RAW_FORMATTER, formatterName, PlainTextFormatter.NAME));
       formatterName = PlainTextFormatter.NAME;
     }
     FormatterProvider formatter = getByName(formatterName);
     if (formatter == null) {
-      log.warn(String.format(
-          "%s plugin: Invalid '%s' formatter configuration, formatter '%s' not found, using '%s' formatter",
-          pluginName, RAW_FORMATTER, formatterName, PlainTextFormatter.NAME));
+      log.warn(
+          String.format(
+              "%s plugin: Invalid '%s' formatter configuration, formatter '%s' not found, using '%s' formatter",
+              pluginName, RAW_FORMATTER, formatterName, PlainTextFormatter.NAME));
       formatter = getByName(PlainTextFormatter.NAME);
     }
     return new FormatterProvider(RAW_FORMATTER, formatter.formatter);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/HtmlBuilder.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/HtmlBuilder.java
index 55b7964..33ef194 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/HtmlBuilder.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/HtmlBuilder.java
@@ -18,14 +18,12 @@
 
 import com.google.gerrit.server.GerritPersonIdent;
 import com.google.inject.Inject;
-
-import org.eclipse.jgit.lib.PersonIdent;
-
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
+import org.eclipse.jgit.lib.PersonIdent;
 
 public class HtmlBuilder {
   private final DateFormat rfc2822DateFormatter;
@@ -33,10 +31,8 @@
 
   @Inject
   HtmlBuilder(@GerritPersonIdent PersonIdent gerritIdent) {
-    rfc2822DateFormatter =
-        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
-    rfc2822DateFormatter.setCalendar(Calendar.getInstance(
-        gerritIdent.getTimeZone(), Locale.US));
+    rfc2822DateFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
+    rfc2822DateFormatter.setCalendar(Calendar.getInstance(gerritIdent.getTimeZone(), Locale.US));
   }
 
   public HtmlBuilder startDocument() {
@@ -105,12 +101,7 @@
   }
 
   public HtmlBuilder open(String tag, String styleName) {
-    html.append("<")
-        .append(tag)
-        .append(" ")
-        .append("class=")
-        .append(styleName)
-        .append(">");
+    html.append("<").append(tag).append(" ").append("class=").append(styleName).append(">");
     return this;
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ImageFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ImageFormatter.java
index 901f900..48fad03 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ImageFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ImageFormatter.java
@@ -20,14 +20,11 @@
 import com.google.gerrit.extensions.restapi.Url;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
 import com.googlesource.gerrit.plugins.xdocs.XDocServlet;
-
-import org.eclipse.jgit.lib.Constants;
-
 import java.io.IOException;
 import java.io.InputStream;
+import org.eclipse.jgit.lib.Constants;
 
 @Singleton
 public class ImageFormatter implements StreamFormatter {
@@ -41,8 +38,14 @@
   }
 
   @Override
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection cfg, InputStream raw) throws IOException {
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection cfg,
+      InputStream raw)
+      throws IOException {
     return "<img src=\"" + escapeHtml(getUrl(projectName, path, revision)) + "\"/>";
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatter.java
index df3a368..b5ef651 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatter.java
@@ -20,38 +20,38 @@
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
 import java.io.IOException;
 
 public class MarkdownFormatter implements StringFormatter {
-  public final static String NAME = "MARKDOWN";
+  public static final String NAME = "MARKDOWN";
 
   private final FormatterUtil util;
   private final Formatters formatters;
 
   @Inject
-  MarkdownFormatter(
-      FormatterUtil formatterUtil,
-      Formatters formatters) {
+  MarkdownFormatter(FormatterUtil formatterUtil, Formatters formatters) {
     this.util = formatterUtil;
     this.formatters = formatters;
   }
 
   @Override
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection globalCfg, String raw) throws IOException {
-    ConfigSection projectCfg =
-        formatters.getFormatterConfig(NAME, projectName);
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection globalCfg,
+      String raw)
+      throws IOException {
+    ConfigSection projectCfg = formatters.getFormatterConfig(NAME, projectName);
     com.google.gerrit.server.documentation.MarkdownFormatter f =
         new com.google.gerrit.server.documentation.MarkdownFormatter();
     if (!globalCfg.getBoolean(KEY_ALLOW_HTML, false)) {
       f.suppressHtml();
     }
     String cssTheme = projectCfg.getString(KEY_CSS_THEME);
-    String inheritedCss =
-        util.getInheritedCss(projectName, NAME, "markdown", cssTheme);
+    String inheritedCss = util.getInheritedCss(projectName, NAME, "markdown", cssTheme);
     String projectCss = util.getCss(projectName, "markdown", cssTheme);
     if (projectCfg.getBoolean(KEY_INHERIT_CSS, true)) {
       // if there is no inherited CSS and f.setCss(null) is invoked
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/PlainTextFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/PlainTextFormatter.java
index 8a3decd..44ea542 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/PlainTextFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/PlainTextFormatter.java
@@ -19,11 +19,16 @@
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
 
 public class PlainTextFormatter implements StringFormatter {
-  public final static String NAME = "PLAIN_TEXT";
+  public static final String NAME = "PLAIN_TEXT";
 
   @Override
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection cfg, String raw) {
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection cfg,
+      String raw) {
     return "<pre>" + escapeHtml(raw) + "</pre>";
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StreamFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StreamFormatter.java
index 4760248..34bbef1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StreamFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StreamFormatter.java
@@ -15,7 +15,6 @@
 package com.googlesource.gerrit.plugins.xdocs.formatter;
 
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -23,8 +22,7 @@
   /**
    * Formats the given raw text as html.
    *
-   * @param projectName the name of the project that contains the file to be
-   *        formatted
+   * @param projectName the name of the project that contains the file to be formatted
    * @param path the file path
    * @param revision the revision from which the file is loaded
    * @param abbrRev the abbreviated revision from which the file is loaded
@@ -33,6 +31,12 @@
    * @return the content from the given stream formatted as html
    * @throws IOException thrown if the formatting fails
    */
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection cfg, InputStream raw) throws IOException;
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection cfg,
+      InputStream raw)
+      throws IOException;
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StringFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StringFormatter.java
index cd528cc..47fb672 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StringFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/StringFormatter.java
@@ -15,7 +15,6 @@
 package com.googlesource.gerrit.plugins.xdocs.formatter;
 
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
 import java.io.IOException;
 
 public interface StringFormatter extends Formatter {
@@ -23,8 +22,7 @@
   /**
    * Formats the given raw text as html.
    *
-   * @param projectName the name of the project that contains the file to be
-   *        formatted
+   * @param projectName the name of the project that contains the file to be formatted
    * @param path the file path
    * @param revision the revision from which the file is loaded
    * @param abbrRev the abbreviated revision from which the file is loaded
@@ -33,6 +31,12 @@
    * @return the given text formatted as html
    * @throws IOException thrown if the formatting fails
    */
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection cfg, String raw) throws IOException;
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection cfg,
+      String raw)
+      throws IOException;
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ZipFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ZipFormatter.java
index 41a0edc..f758519 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ZipFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ZipFormatter.java
@@ -15,15 +15,12 @@
 package com.googlesource.gerrit.plugins.xdocs.formatter;
 
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
-import org.apache.commons.io.FileUtils;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
+import org.apache.commons.io.FileUtils;
 
 public class ZipFormatter implements StreamFormatter {
   public static final String NAME = "ZIP";
@@ -32,16 +29,19 @@
   private final HtmlBuilder html;
 
   @Inject
-  ZipFormatter(
-      FormatterUtil formatterUtil,
-      HtmlBuilder html) {
+  ZipFormatter(FormatterUtil formatterUtil, HtmlBuilder html) {
     this.util = formatterUtil;
     this.html = html;
   }
 
   @Override
-  public String format(String projectName, String path, String revision,
-      String abbrRev, ConfigSection globalCfg, InputStream raw)
+  public String format(
+      String projectName,
+      String path,
+      String revision,
+      String abbrRev,
+      ConfigSection globalCfg,
+      InputStream raw)
       throws IOException {
     html.startDocument()
         .openHead()
@@ -52,9 +52,8 @@
         .appendCellHeader("size")
         .appendCellHeader("last modified");
     try (ZipInputStream zip = new ZipInputStream(raw)) {
-      for (ZipEntry entry; (entry = zip.getNextEntry()) != null;) {
-        html.openRow()
-            .appendCell(entry.getName());
+      for (ZipEntry entry; (entry = zip.getNextEntry()) != null; ) {
+        html.openRow().appendCell(entry.getName());
         if (!entry.isDirectory()) {
           if (entry.getSize() != -1) {
             html.appendCell(FileUtils.byteCountToDisplaySize(entry.getSize()));
@@ -64,13 +63,10 @@
         } else {
           html.appendCell();
         }
-        html.appendDateCell(entry.getTime())
-            .closeRow();
+        html.appendDateCell(entry.getTime()).closeRow();
       }
     }
-    html.closeTable()
-        .closeBody()
-        .endDocument();
+    html.closeTable().closeBody().endDocument();
 
     return util.applyCss(html.toString(), NAME, projectName);
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatterTest.java b/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatterTest.java
index 89dddb4..9bda6a0 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatterTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/AsciidoctorFormatterTest.java
@@ -18,10 +18,7 @@
 import static org.junit.Assert.assertEquals;
 
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
-import java.io.File;
 import java.io.IOException;
-
 import org.apache.commons.lang.StringUtils;
 import org.easymock.IAnswer;
 import org.junit.Before;
@@ -37,15 +34,15 @@
     FormatterUtil util = createNiceMock(FormatterUtil.class);
 
     // To simplify things, make applyCss() a no-op and return the HTML code as-is.
-    expect(util.applyCss(anyObject(), anyObject(), anyObject())).andAnswer(
-      new IAnswer<String>() {
-        @Override
-        public String answer() throws Throwable {
-          // The first argument is the HTML code.
-          return (String) getCurrentArguments()[0];
-        }
-      }
-    );
+    expect(util.applyCss(anyObject(), anyObject(), anyObject()))
+        .andAnswer(
+            new IAnswer<String>() {
+              @Override
+              public String answer() throws Throwable {
+                // The first argument is the HTML code.
+                return (String) getCurrentArguments()[0];
+              }
+            });
 
     replay(util);
 
@@ -57,7 +54,8 @@
     Formatters formatters = createNiceMock(Formatters.class);
 
     // Avoid a NPE by just returning the ConfigSection mock object.
-    expect(formatters.getFormatterConfig((String) anyObject(), (String) anyObject())).andReturn(cfg);
+    expect(formatters.getFormatterConfig((String) anyObject(), (String) anyObject()))
+        .andReturn(cfg);
 
     replay(formatters);
 
@@ -66,28 +64,31 @@
 
   @Test
   public void emptyInputRendersNothing() throws IOException {
-    assertEquals(StringUtils.EMPTY, formatter.format(null, null, null, null, cfg, StringUtils.EMPTY));
+    assertEquals(
+        StringUtils.EMPTY, formatter.format(null, null, null, null, cfg, StringUtils.EMPTY));
   }
 
   @Test
   public void basicTextFormattingWorks() throws IOException {
     String raw = "_italic_ *bold* `monospace`";
-    String formatted = "<div class=\"paragraph\">\n<p><em>italic</em> <strong>bold</strong> <code>monospace</code></p>\n</div>";
+    String formatted =
+        "<div class=\"paragraph\">\n<p><em>italic</em> <strong>bold</strong> <code>monospace</code></p>\n</div>";
     assertEquals(formatted, formatter.format(null, null, null, null, cfg, raw));
   }
 
   @Test
   public void documentTitleIsNotRenderedAsPartOfSections() throws IOException {
-    String raw = "= Document Title (Level 0)\n\n== Level 1 Section Title\n\n=== Level 2 Section Title";
+    String raw =
+        "= Document Title (Level 0)\n\n== Level 1 Section Title\n\n=== Level 2 Section Title";
     String formatted =
-      "<div class=\"sect1\">\n" +
-      "<h2 id=\"_level_1_section_title\">Level 1 Section Title</h2>\n" +
-      "<div class=\"sectionbody\">\n" +
-      "<div class=\"sect2\">\n" +
-      "<h3 id=\"_level_2_section_title\">Level 2 Section Title</h3>\n\n" +
-      "</div>\n" +
-      "</div>\n" +
-      "</div>";
+        "<div class=\"sect1\">\n"
+            + "<h2 id=\"_level_1_section_title\">Level 1 Section Title</h2>\n"
+            + "<div class=\"sectionbody\">\n"
+            + "<div class=\"sect2\">\n"
+            + "<h3 id=\"_level_2_section_title\">Level 2 Section Title</h3>\n\n"
+            + "</div>\n"
+            + "</div>\n"
+            + "</div>";
     assertEquals(formatted, formatter.format(null, null, null, null, cfg, raw));
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatterTest.java b/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatterTest.java
index 931c04a..80b9b13 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatterTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/xdocs/formatter/MarkdownFormatterTest.java
@@ -18,16 +18,15 @@
 import static org.junit.Assert.assertEquals;
 
 import com.googlesource.gerrit.plugins.xdocs.ConfigSection;
-
 import java.io.IOException;
-
 import org.apache.commons.lang.StringUtils;
 import org.junit.Before;
 import org.junit.Test;
 
 public class MarkdownFormatterTest {
 
-  private static final String PROLOG = "<html><head><style type=\"text/css\">\n\n</style></head><body>\n";
+  private static final String PROLOG =
+      "<html><head><style type=\"text/css\">\n\n</style></head><body>\n";
   private static final String EPILOG = "\n</body></html>";
 
   private ConfigSection cfg;
@@ -50,7 +49,8 @@
     Formatters formatters = createNiceMock(Formatters.class);
 
     // Avoid a NPE by just returning the ConfigSection mock object.
-    expect(formatters.getFormatterConfig((String) anyObject(), (String) anyObject())).andReturn(cfg);
+    expect(formatters.getFormatterConfig((String) anyObject(), (String) anyObject()))
+        .andReturn(cfg);
 
     replay(formatters);
 
@@ -65,7 +65,8 @@
   @Test
   public void basicTextFormattingWorks() throws IOException {
     String raw = "*italic* **bold** `monospace`";
-    String formatted = PROLOG + "<p><em>italic</em> <strong>bold</strong> <code>monospace</code></p>" + EPILOG;
+    String formatted =
+        PROLOG + "<p><em>italic</em> <strong>bold</strong> <code>monospace</code></p>" + EPILOG;
     assertEquals(formatted, formatter.format(null, null, null, null, cfg, raw));
   }
 }