From 77b0af18c85e1d44c0fcf542efcedadb825baf2c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 4 Apr 2017 11:11:54 +0900 Subject: [PATCH] Format Java files with google-java-format Change-Id: Id0cce149584fa4887eaaf4ecfc22da29a9daecfd --- .../google/gerrit/httpd/raw/IndexServlet.java | 18 +++++++++++------- .../google/gerrit/httpd/raw/StaticModule.java | 6 +++--- .../gerrit/httpd/raw/IndexServletTest.java | 13 ++++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/IndexServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/IndexServlet.java index d7f7a8a9ce..bf1339f5cd 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/IndexServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/IndexServlet.java @@ -22,8 +22,8 @@ import com.google.gerrit.common.Nullable; import com.google.template.soy.SoyFileSet; import com.google.template.soy.data.SanitizedContent; import com.google.template.soy.data.SoyMapData; -import com.google.template.soy.tofu.SoyTofu; import com.google.template.soy.data.UnsafeSanitizedContentOrdainer; +import com.google.template.soy.tofu.SoyTofu; import java.io.IOException; import java.io.OutputStream; import java.net.URI; @@ -39,10 +39,13 @@ public class IndexServlet extends HttpServlet { String resourcePath = "com/google/gerrit/httpd/raw/index.html.soy"; SoyFileSet.Builder builder = SoyFileSet.builder(); builder.add(Resources.getResource(resourcePath)); - SoyTofu.Renderer renderer = builder.build().compileToTofu() - .newRenderer("com.google.gerrit.httpd.raw.Index") - .setContentKind(SanitizedContent.ContentKind.HTML) - .setData(getTemplateData(canonicalURL, cdnPath)); + SoyTofu.Renderer renderer = + builder + .build() + .compileToTofu() + .newRenderer("com.google.gerrit.httpd.raw.Index") + .setContentKind(SanitizedContent.ContentKind.HTML) + .setData(getTemplateData(canonicalURL, cdnPath)); indexSource = renderer.render().getBytes(); } @@ -75,8 +78,9 @@ public class IndexServlet extends HttpServlet { // The resource path must be typed as safe for use in a script src. // TODO(wyatta): Upgrade this to use an appropriate safe URL type. - SanitizedContent sanitizedStaticPath = UnsafeSanitizedContentOrdainer.ordainAsSafe(staticPath, - SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI); + SanitizedContent sanitizedStaticPath = + UnsafeSanitizedContentOrdainer.ordainAsSafe( + staticPath, SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI); return new SoyMapData( "canonicalPath", canonicalPath, diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/StaticModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/StaticModule.java index 6e055a9b96..d0d905de73 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/StaticModule.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/StaticModule.java @@ -33,7 +33,6 @@ import com.google.gerrit.server.config.GerritServerConfig; import com.google.gerrit.server.config.SitePaths; import com.google.inject.Inject; import com.google.inject.Key; -import com.google.inject.Provider; import com.google.inject.Provides; import com.google.inject.ProvisionException; import com.google.inject.Singleton; @@ -252,8 +251,9 @@ public class StaticModule extends ServletModule { @Provides @Singleton @Named(POLYGERRIT_INDEX_SERVLET) - HttpServlet getPolyGerritUiIndexServlet(@CanonicalWebUrl @Nullable String canonicalUrl, - @GerritServerConfig Config cfg) throws URISyntaxException { + HttpServlet getPolyGerritUiIndexServlet( + @CanonicalWebUrl @Nullable String canonicalUrl, @GerritServerConfig Config cfg) + throws URISyntaxException { String cdnPath = cfg.getString("gerrit", null, "cdnPath"); return new IndexServlet(canonicalUrl, cdnPath); } diff --git a/gerrit-httpd/src/test/java/com/google/gerrit/httpd/raw/IndexServletTest.java b/gerrit-httpd/src/test/java/com/google/gerrit/httpd/raw/IndexServletTest.java index ffdbc0b568..7133cf6e9e 100644 --- a/gerrit-httpd/src/test/java/com/google/gerrit/httpd/raw/IndexServletTest.java +++ b/gerrit-httpd/src/test/java/com/google/gerrit/httpd/raw/IndexServletTest.java @@ -14,13 +14,12 @@ package com.google.gerrit.httpd.raw; -import com.google.gerrit.common.Nullable; +import static com.google.common.truth.Truth.assertThat; + import com.google.template.soy.data.SoyMapData; import java.net.URISyntaxException; import org.junit.Test; -import static com.google.common.truth.Truth.assertThat; - public class IndexServletTest { @Test public void noPathAndNoCDN() throws URISyntaxException { @@ -38,8 +37,8 @@ public class IndexServletTest { @Test public void noPathAndCDN() throws URISyntaxException { - SoyMapData data = IndexServlet.getTemplateData("http://example.com/", - "http://my-cdn.com/foo/bar/"); + SoyMapData data = + IndexServlet.getTemplateData("http://example.com/", "http://my-cdn.com/foo/bar/"); assertThat(data.getSingle("canonicalPath").stringValue()).isEqualTo(""); assertThat(data.getSingle("staticResourcePath").stringValue()) .isEqualTo("http://my-cdn.com/foo/bar/"); @@ -47,8 +46,8 @@ public class IndexServletTest { @Test public void pathAndCDN() throws URISyntaxException { - SoyMapData data = IndexServlet.getTemplateData("http://example.com/gerrit", - "http://my-cdn.com/foo/bar/"); + SoyMapData data = + IndexServlet.getTemplateData("http://example.com/gerrit", "http://my-cdn.com/foo/bar/"); assertThat(data.getSingle("canonicalPath").stringValue()).isEqualTo("/gerrit"); assertThat(data.getSingle("staticResourcePath").stringValue()) .isEqualTo("http://my-cdn.com/foo/bar/");