)]}'
{
  "commit": "bd7602523971487416a4e987a0925f8a57ebfbe0",
  "tree": "2ad597b4679c049e0847e8c8011c860de72c69e5",
  "parents": [
    "f94abd64a288e5c25adee4d3e88bf79990f77c5b"
  ],
  "author": {
    "name": "Luca Milanesio",
    "email": "luca.milanesio@gmail.com",
    "time": "Fri Apr 19 12:33:48 2024 +0100"
  },
  "committer": {
    "name": "Luca Milanesio",
    "email": "luca.milanesio@gmail.com",
    "time": "Fri Apr 19 13:29:12 2024 +0100"
  },
  "message": "Fix OutOfScopeException getting the serverName from HTTP request\n\nWhenever the caller was coming from an HTTP thread that was not\ncoming from a Guice filter (e.g. GitHub OAuth filter) the request\nfor the canonicalWebUrl was throwing an OutOfScopeException.\n\nOne sample scenario was the following stack of calls:\n\nc.g.g.m.v.VirtualHostHttpCanonicalWebUrlProvider.lambda$getServerName\njava.base/java.util.Optional.map\nc.g.g.m.v.VirtualHostHttpCanonicalWebUrlProvider.getServerName\nc.g.g.m.v.VirtualHostHttpCanonicalWebUrlProvider.get\nc.g.g.p.g.o.CanonicalWebUrls.getCannonicalWebUrl\nc.g.g.p.g.o.CanonicalWebUrls.getOAuthFinalRedirectUrl\nc.g.g.p.g.o.OAuthProtocol.getAuthorizationUrl\nc.g.g.p.g.o.OAuthProtocol.loginPhase1\nc.g.g.p.g.o.GitHubLogin.login\nc.g.g.p.g.o.OAuthWebFilter.login\nc.g.g.p.g.o.OAuthWebFilter.doFilter\nc.g.g.p.g.o.OAuthFilter.doFilter\norg.eclipse.jetty.servlet.FilterHolder.doFilter\n\nBecause the request for a canonical web url was coming\nfrom OAuthFilter.doFilter invoked directly from Jetty,\nthe Guice filter did not manage to inject the current\nrequest, making the lamba execution of the map to\nthrow an unchecked exception.\n\nBy swapping the check between the local thread the scoped HTTP\nrequest and catching the OutOfScopeException, the above condition\nwould just return into an empty server name.\n\nChange-Id: Ie645fa3e07d128d6fbdbd0624196e7c43d35929c\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c2f19e0f6389d1166d203b2b04ed75d3c46ecffa",
      "old_mode": 33188,
      "old_path": "src/main/java/com/gerritforge/gerrit/modules/virtualhost/VirtualHostHttpCanonicalWebUrlProvider.java",
      "new_id": "77e599569ecfbc55a30ccb3d832b8b8af80ed23d",
      "new_mode": 33188,
      "new_path": "src/main/java/com/gerritforge/gerrit/modules/virtualhost/VirtualHostHttpCanonicalWebUrlProvider.java"
    }
  ]
}
