auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onSuccess ( com.google.gerrit.client.diff.DiffInfo info ) { new net.codemirror.lib.ModeInjector ( ) . add ( getContentType ( info.meta_a ( ) ) ) . add ( getContentType ( info.meta_b ( ) ) ) . inject ( com.google.gerrit.client.rpc.CallbackGroup.< java.lang.Void > emptyCallback ( ) ) ; }

Target:
public void handle ( final net.codemirror.lib.CodeMirror instance , final net.codemirror.lib.CodeMirror.LineHandle handle , com.google.gwt.dom.client.Element element ) { if ( lineActiveBoxMap.containsKey ( handle ) ) { lineActiveBoxMap.get ( handle ) . resizePaddingWidget ( ) ; } if ( linePaddingOnOtherSideMap.containsKey ( handle ) ) { defer ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { resizePaddingOnOtherSide ( side , instance.getLineNumber ( handle ) ) ; } } ) ; } }
Source:
private com.google.gerrit.server.query.change.ChangeData toChangeData ( org.apache.lucene.document.Document doc ) { org.apache.lucene.util.BytesRef cb = doc.getBinaryValue ( com.google.gerrit.lucene.LuceneChangeIndex.CHANGE_FIELD ) ; int id = doc.getField ( com.google.gerrit.lucene.ID_FIELD ) . numericValue ( ) . intValue ( ) ; return changeDataFactory.create ( db.get ( ) , new com.google.gerrit.reviewdb.client.Change.Id ( id ) ) ; BRANCH ( 87.0F ) ; }

Target:
public void close ( ) { com.google.common.util.concurrent.MoreExecutors.shutdownAndAwaitTermination ( executor , java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; try { openIndex.close ( ) ; } finally { closedIndex.close ( ) ; } }
Source:
public void run ( ) { try { for ( com.google.gerrit.reviewdb.client.Project.NameKey nameKey : projectCache.all ( ) ) { replication.scheduleFullSync ( nameKey , urlMatch ) ; } } catch ( java.lang.Exception e ) { com.googlesource.gerrit.plugins.replication.PushAll.log.error ( "Cannot enumerate known projects" , e ) ; } }

Target:
public void run ( ) { try { for ( com.google.gerrit.reviewdb.client.Project.NameKey nameKey : projectCache.all ( ) ) { replication.scheduleFullSync ( nameKey , urlMatch , state ) ; } } catch ( java.lang.Exception e ) { com.googlesource.gerrit.plugins.replication.PushAll.wrappedLog.error ( "Cannot enumerate known projects" , e , state ) ; } state.markAllPushTasksScheduled ( ) ; }
Source:
public void ignore ( com.google.gerrit.reviewdb.client.Account.Id accountId , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { star ( accountId , project , changeId , com.google.common.collect.ImmutableSet.of ( com.google.gerrit.server.StarredChangesUtil.IGNORE_LABEL ) , com.google.common.collect.ImmutableSet.of ( ) ) ; }

Target:
public void ignore ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gwtorm.server.OrmException { star ( rsrc.getUser ( ) . asIdentifiedUser ( ) . getAccountId ( ) , rsrc.getProject ( ) , rsrc.getChange ( ) . getId ( ) , com.google.common.collect.ImmutableSet.of ( com.google.gerrit.server.StarredChangesUtil.IGNORE_LABEL ) , com.google.common.collect.ImmutableSet.of ( ) ) ; }
Source:
public void testErrorWhileSendingUnhealthyResponse ( ) throws java.io.IOException { javax.servlet.http.HttpServletResponse responseMock = mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; responseMock = mock ( javax.servlet.http.HttpServletResponse.class ) ; doThrow ( new java.io.IOException ( "someError" ) ) . when ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE ) ; servlet.doGet ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }

Target:
public void testErrorDuringTransitionToUnhealty ( ) throws java.io.IOException { tempFolder.delete ( ) ; javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }
Source:
public void testBlockPushDraftsUnblockAdmin ( ) { com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ADMIN , "refs/drafts/*" ) ; org.junit.Assert.assertTrue ( "push is blocked for anonymous to refs/drafts/master" , util.user ( local ) . controlForRef ( "refs/drafts/refs/heads/master" ) . isBlocked ( com.google.gerrit.common.data.Permission.PUSH ) ) ; org.junit.Assert.assertFalse ( "push is blocked for admin refs/drafts/master" , util.user ( local , "a" , com.google.gerrit.server.project.Util.ADMIN ) . controlForRef ( "refs/drafts/refs/heads/master" ) . isBlocked ( com.google.gerrit.common.data.Permission.PUSH ) ) ; }

Target:
public void testBlockPushDraftsUnblockAdmin ( ) { com.google.gerrit.server.project.Util.block ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) ; com.google.gerrit.server.project.Util.allow ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ADMIN , "refs/drafts/*" ) ; org.junit.Assert.assertTrue ( "push is blocked for anonymous to refs/drafts/master" , util.user ( local ) . controlForRef ( "refs/drafts/refs/heads/master" ) . isBlocked ( com.google.gerrit.common.data.Permission.PUSH ) ) ; org.junit.Assert.assertFalse ( "push is blocked for admin refs/drafts/master" , util.user ( local , "a" , com.google.gerrit.server.project.Util.ADMIN ) . controlForRef ( "refs/drafts/refs/heads/master" ) . isBlocked ( com.google.gerrit.common.data.Permission.PUSH ) ) ; }
Source:
protected java.util.List createEntry ( final java.lang.String url ) throws java.lang.Exception { try { final java.util.List < ? > list = manager.discover ( url ) ; return ( list != null ) && ( ! ( list.isEmpty ( ) ) ) ? list : null ; } catch ( org.openid4java.discovery.DiscoveryException e ) { return null ; } }

Target:
protected java.util.List createEntry ( final java.lang.String url ) throws java.lang.Exception { try { final java.util.List < ? > list = manager.discover ( url ) ; return ( list != null ) && ( ! ( list.isEmpty ( ) ) ) ? list : null ; } catch ( org.openid4java.discovery.DiscoveryException e ) { com.google.gerrit.httpd.auth.openid.OpenIdServiceImpl.log.error ( ( "Cannot discover OpenID " + url ) , e ) ; return null ; } }
Source:
public void ignore ( boolean ignore ) throws com.google.gerrit.extensions.restapi.RestApiException { try { if ( ignore ) { this . ignore.apply ( change , new com.google.gerrit.server.change.Ignore.Input ( ) ) ; } else { unignore.apply ( change , new com.google.gerrit.server.change.Unignore.Input ( ) ) ; } } catch ( com.google.gwtorm.server.OrmException | com.google.gerrit.server.StarredChangesUtil.IllegalLabelException e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot ignore change" , e ) ; } }

Target:
public void ignore ( boolean ignore ) throws com.google.gerrit.extensions.restapi.RestApiException { try { if ( ignore ) { this . ignore.apply ( change , new com.google.gerrit.extensions.common.Input ( ) ) ; } else { unignore.apply ( change , new com.google.gerrit.extensions.common.Input ( ) ) ; } } catch ( com.google.gwtorm.server.OrmException | com.google.gerrit.server.StarredChangesUtil.IllegalLabelException e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot ignore change" , e ) ; } }
Source:
public static int limitThreads ( com.google.inject.Injector dbInjector , int threads ) { return com.google.gerrit.pgm.util.ThreadLimiter.limitThreads ( dbInjector.getInstance ( com.google.inject.Key.get ( org.eclipse.jgit.lib.Config.class , com.google.gerrit.server.config.GerritServerConfig.class ) ) , dbInjector.getInstance ( com.google.gerrit.server.schema.DataSourceType.class ) , threads ) ; }

Target:
public static int limitThreads ( com.google.inject.Injector dbInjector , int threads ) { return com.google.gerrit.pgm.util.ThreadLimiter.limitThreads ( dbInjector.getInstance ( com.google.inject.Key.get ( org.eclipse.jgit.lib.Config.class , com.google.gerrit.server.config.GerritServerConfig.class ) ) , dbInjector.getInstance ( com.google.gerrit.server.schema.DataSourceType.class ) , dbInjector.getInstance ( com.google.gerrit.server.config.ThreadSettingsConfig.class ) , threads ) ; }
Source:
public void close ( ) { java.util.List < com.google.common.util.concurrent.ListenableFuture < ? > > closeFutures = com.google.common.collect.Lists.newArrayListWithCapacity ( 2 ) ; closeFutures.add ( executor.submit ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { openIndex.close ( ) ; } } ) ) ; closeFutures.add ( executor.submit ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { closedIndex.close ( ) ; } } ) ) ; com.google.common.util.concurrent.Futures.getUnchecked ( com.google.common.util.concurrent.Futures.allAsList ( closeFutures ) ) ; }

Target:
public void close ( ) { com.google.common.util.concurrent.MoreExecutors.shutdownAndAwaitTermination ( executor , java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; try { openIndex.close ( ) ; } finally { closedIndex.close ( ) ; } }
Source:
public void reindexEmptySite ( ) throws java.lang.Exception { initSite ( ) ; org.eclipse.jgit.storage.file.FileBasedConfig cfg = gerritConfig ( ) ; cfg.load ( ) ; cfg.setBoolean ( "gerrit-test" , null , "bypassAutoRecheckMergeable" , true ) ; cfg.save ( ) ; com.google.gerrit.acceptance.pgm.ReindexIT.runGerrit ( "reindex" , "-d" , sitePath.toString ( ) , "--show-stack-trace" ) ; }

Target:
private void initSite ( ) throws java.lang.Exception { com.google.gerrit.acceptance.pgm.ReindexIT.runGerrit ( "init" , "-d" , sitePath.getPath ( ) , "--batch" , "--no-auto-start" , "--skip-plugins" , "--show-stack-trace" ) ; }
Source:
public com.google.gerrit.reviewdb.client.Change submit ( com.google.gerrit.server.change.RevisionResource rsrc , com.google.gerrit.server.IdentifiedUser caller , boolean force ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException , java.io.IOException { java.lang.String topic = rsrc.getChange ( ) . getTopic ( ) ; if ( ( submitWholeTopic ) && ( ! ( com.google.common.base.Strings.isNullOrEmpty ( topic ) ) ) ) { return submitWholeTopic ( rsrc , caller , force , topic ) ; } else { return submitThisChange ( rsrc , caller , force ) ; } }

Target:
public java.util.List < com.google.gerrit.reviewdb.client.Change > submit ( com.google.gerrit.server.change.RevisionResource rsrc , com.google.gerrit.server.IdentifiedUser caller , boolean force ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException , java.io.IOException { java.lang.String topic = rsrc.getChange ( ) . getTopic ( ) ; if ( ( submitWholeTopic ) && ( ! ( com.google.common.base.Strings.isNullOrEmpty ( topic ) ) ) ) { return submitWholeTopic ( rsrc , caller , force , topic ) ; } else { return java.util.Arrays.asList ( submitThisChange ( rsrc , caller , force ) ) ; } }
Source:
private void configureCmdLineParser ( ) { factory ( CmdLineParser.Factory.class ) ; registerOptionHandler ( Account.Id.class , com.google.gerrit.sshd.args4j.AccountIdHandler.class ) ; registerOptionHandler ( AccountGroup.Id.class , com.google.gerrit.sshd.args4j.AccountGroupIdHandler.class ) ; registerOptionHandler ( PatchSet.Id.class , com.google.gerrit.sshd.args4j.PatchSetIdHandler.class ) ; registerOptionHandler ( com.google.gerrit.server.project.ProjectControl.class , com.google.gerrit.sshd.args4j.ProjectControlHandler.class ) ; registerOptionHandler ( java.net.SocketAddress.class , com.google.gerrit.sshd.args4j.SocketAddressHandler.class ) ; }

Target:
private void configureCmdLineParser ( ) { factory ( CmdLineParser.Factory.class ) ; registerOptionHandler ( Account.Id.class , com.google.gerrit.sshd.args4j.AccountIdHandler.class ) ; registerOptionHandler ( AccountGroup.Id.class , com.google.gerrit.sshd.args4j.AccountGroupIdHandler.class ) ; registerOptionHandler ( AccountGroup.UUID.class , com.google.gerrit.sshd.args4j.AccountGroupUUIDHandler.class ) ; registerOptionHandler ( PatchSet.Id.class , com.google.gerrit.sshd.args4j.PatchSetIdHandler.class ) ; registerOptionHandler ( com.google.gerrit.server.project.ProjectControl.class , com.google.gerrit.sshd.args4j.ProjectControlHandler.class ) ; registerOptionHandler ( java.net.SocketAddress.class , com.google.gerrit.sshd.args4j.SocketAddressHandler.class ) ; }
Source:
protected PushOneCommit.Result amendChange ( java.lang.String changeId , java.lang.String ref ) throws java.lang.Exception { java.util.Collections.shuffle ( com.google.gerrit.acceptance.AbstractDaemonTest.RANDOM ) ; com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , testRepo , PushOneCommit.SUBJECT , PushOneCommit.FILE_NAME , new java.lang.String ( com.google.common.primitives.Chars.toArray ( com.google.gerrit.acceptance.AbstractDaemonTest.RANDOM ) ) , changeId ) ; return push.to ( ref ) ; }

Target:
protected PushOneCommit.Result createChange ( org.eclipse.jgit.junit.TestRepository < ? > repo , java.lang.String branch , java.lang.String subject , java.lang.String fileName , java.lang.String content , java.lang.String topic ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , repo , subject , fileName , content ) ; return push.to ( ( ( ( "refs/for/" + branch ) + "/" ) + ( name ( topic ) ) ) ) ; }
Source:
public java.lang.Iterable < com.google.gerrit.common.data.EditList.Hunk > getHunks ( ) { return new com.google.gerrit.common.data.EditList ( edits , getContext ( ) , a.size ( ) , b.size ( ) ) . getHunks ( ) ; }

Target:
public com.google.gerrit.prettify.common.SparseHtmlFile getSparseHtmlFileA ( ) { com.google.gerrit.prettify.common.PrettySettings s = new com.google.gerrit.prettify.common.PrettySettings ( settings.getPrettySettings ( ) ) ; s.setFileName ( a.getPath ( ) ) ; s.setShowWhiteSpaceErrors ( false ) ; com.google.gerrit.prettify.common.PrettyFormatter f = ClientSideFormatter.FACTORY.get ( ) ; f.setPrettySettings ( s ) ; f.setEditFilter ( PrettyFormatter.A ) ; f.setEditList ( getEditList ( ) ) ; f.format ( a ) ; return f ; }
Source:
public void create_Empty ( ) throws java.io.IOException { final java.nio.file.Path root = com.google.gerrit.server.config.SitePathsTest.random ( ) ; try { java.nio.file.Files.createDirectory ( root ) ; final com.google.gerrit.server.config.SitePaths site = new com.google.gerrit.server.config.SitePaths ( root ) ; com.google.common.truth.Truth.assertThat ( site.isNew ) . isTrue ( ) ; com.google.gerrit.extensions.common.PathSubject.assertThat ( site.site_path ) . isEqualTo ( root ) ; } finally { java.nio.file.Files.delete ( root ) ; } }

Target:
public void create_Empty ( ) throws java.io.IOException { final java.nio.file.Path root = com.google.gerrit.server.config.SitePathsTest.random ( ) ; try { java.nio.file.Files.createDirectory ( root ) ; final com.google.gerrit.server.config.SitePaths site = new com.google.gerrit.server.config.SitePaths ( root ) ; com.google.common.truth.Truth.assertThat ( site.isNew ) . isTrue ( ) ; com.google.gerrit.extensions.common.testing.PathSubject.assertThat ( site.site_path ) . isEqualTo ( root ) ; } finally { java.nio.file.Files.delete ( root ) ; } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.config.SitePaths.class ) ; bind ( org.eclipse.jgit.lib.Config.class ) . annotatedWith ( com.google.gerrit.server.config.GerritServerConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritServerConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.config.SitePaths.class ) ; bind ( com.google.gerrit.server.config.TrackingFooters.class ) . toProvider ( com.google.gerrit.server.config.TrackingFootersProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; bind ( org.eclipse.jgit.lib.Config.class ) . annotatedWith ( com.google.gerrit.server.config.GerritServerConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritServerConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; }
Source:
public void onError ( final com.google.gwt.http.client.Request request , final java.lang.Throwable exception ) { com.google.gwtjsonrpc.client.JsonUtil.fireOnCallEnd ( ) ; if ( ( ( exception.getClass ( ) ) == ( java.lang.RuntimeException.class ) ) && ( exception.getMessage ( ) . contains ( "XmlHttpRequest.status" ) ) ) { callback.onFailure ( new com.google.gwtjsonrpc.client.ServerUnavailableException ( ) ) ; } else { callback.onFailure ( exception ) ; } }

Target:
public void onError ( final com.google.gwt.http.client.Request request , final java.lang.Throwable exception ) { fireEvent ( RpcCompleteEvent.e ) ; if ( ( ( exception.getClass ( ) ) == ( java.lang.RuntimeException.class ) ) && ( exception.getMessage ( ) . contains ( "XmlHttpRequest.status" ) ) ) { callback.onFailure ( new com.google.gwtjsonrpc.client.ServerUnavailableException ( ) ) ; } else { callback.onFailure ( exception ) ; } }
Source:
public void createEditByDeletingExistingFileRest ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.delete ( urlEditFile ( ) ) ; org.junit.Assert.assertEquals ( org.apache.http.HttpStatus.SC_NO_CONTENT , r.getStatusCode ( ) ) ; com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( change ) ; try { fileUtil.getContent ( edit.get ( ) . getChange ( ) . getProject ( ) , edit.get ( ) . getRevision ( ) . get ( ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME ) ; org.junit.Assert.fail ( "ResourceNotFoundException expected" ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException rnfe ) { } }

Target:
public void deletingNonExistingEditRest ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.delete ( urlEdit ( ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( org.apache.http.HttpStatus.SC_NOT_FOUND ) ; }
Source:
public void hostIndex ( ) throws java.lang.Exception { com.google.gitiles.GitilesView view = getView ( "/" ) ; org.junit.Assert.assertEquals ( Type.HOST_INDEX , view.getType ( ) ) ; org.junit.Assert.assertEquals ( "test-host" , view.getHostName ( ) ) ; org.junit.Assert.assertNull ( view.getRepositoryName ( ) ) ; org.junit.Assert.assertEquals ( Revision.NULL , view.getRevision ( ) ) ; org.junit.Assert.assertEquals ( Revision.NULL , view.getOldRevision ( ) ) ; org.junit.Assert.assertNull ( view.getPathPart ( ) ) ; }

Target:
public void repositoryIndex ( ) throws java.lang.Exception { com.google.gitiles.GitilesView view = getView ( "/repo" ) ; com.google.common.truth.Truth.assertThat ( view.getType ( ) ) . isEqualTo ( Type.REPOSITORY_INDEX ) ; com.google.common.truth.Truth.assertThat ( view.getRepositoryName ( ) ) . isEqualTo ( "repo" ) ; com.google.common.truth.Truth.assertThat ( view.getRevision ( ) ) . isEqualTo ( Revision.NULL ) ; com.google.common.truth.Truth.assertThat ( view.getOldRevision ( ) ) . isEqualTo ( Revision.NULL ) ; com.google.common.truth.Truth.assertThat ( view.getPathPart ( ) ) . isNull ( ) ; }
Source:
public void deleteBranchByRestWithoutRefsHeadsPrefix ( ) throws java.lang.Exception { grantDelete ( ) ; java.lang.String ref = branch.getShortName ( ) ; com.google.common.truth.Truth.assertThat ( ref ) . doesNotMatch ( org.eclipse.jgit.lib.Constants.R_HEADS ) ; com.google.gerrit.acceptance.RestResponse r = userRestSession.delete ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/branches/" ) + ref ) ) ; r.assertNoContent ( ) ; }

Target:
private void assertDeleteByRestSucceeds ( java.lang.String ref ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = userRestSession.delete ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/branches/" ) + ref ) ) ; r.assertNoContent ( ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; branch ( ) . get ( ) ; }
Source:
public void fooBarSubdirJson ( ) throws java.lang.Exception { java.util.Map < java.lang.String , com.google.gitiles.RepositoryDescription > res = buildJson ( "/foo/bar/" , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.google.gitiles.RepositoryDescription > > ( ) { } . getType ( ) ) ; org.junit.Assert.assertEquals ( 1 , res.size ( ) ) ; com.google.gitiles.RepositoryDescription d = res.get ( "repo" ) ; org.junit.Assert.assertNotNull ( "repo exists" , d ) ; org.junit.Assert.assertEquals ( repo.getRepository ( ) . getDescription ( ) . getRepositoryName ( ) , d.name ) ; }

Target:
public void fooBarSubdirJson ( ) throws java.lang.Exception { java.util.Map < java.lang.String , com.google.gitiles.RepositoryDescription > res = buildJson ( "/foo/bar/" , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.google.gitiles.RepositoryDescription > > ( ) { } . getType ( ) ) ; com.google.common.truth.Truth.assertThat ( res ) . hasSize ( 1 ) ; com.google.common.truth.Truth.assertThat ( res ) . containsKey ( "repo" ) ; com.google.gitiles.RepositoryDescription d = res.get ( "repo" ) ; com.google.common.truth.Truth.assertThat ( d.name ) . isEqualTo ( repo.getRepository ( ) . getDescription ( ) . getRepositoryName ( ) ) ; }
Source:
java.util.List < java.util.List < java.lang.String > > getValues ( ) { java.util.List < java.util.List < java.lang.String > > values = new java.util.ArrayList < > ( ) ; for ( int row = 2 ; row < ( table.getRowCount ( ) ) ; row ++ ) { values.add ( getValues ( row ) ) ; } return values ; }

Target:
java.util.List < java.util.List < java.lang.String > > getValues ( ) { java.util.List < java.util.List < java.lang.String > > values = new java.util.ArrayList < > ( ) ; for ( int row = 2 ; row < ( table.getRowCount ( ) ) ; row ++ ) { values.add ( getRowItem ( row ) ) ; } return values ; }
Source:
public void emptyPermissionRangeKeepsResult ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.PatchSetApproval cr = psa ( userId , "Code-Review" , 1 ) ; com.google.gerrit.reviewdb.client.PatchSetApproval v = psa ( userId , "Verified" , 1 ) ; org.junit.Assert.assertEquals ( com.google.gerrit.server.git.LabelNormalizer.Result.create ( com.google.gerrit.server.git.LabelNormalizerTest.list ( cr , v ) , com.google.gerrit.server.git.LabelNormalizerTest.list ( ) , com.google.gerrit.server.git.LabelNormalizerTest.list ( ) ) , norm.normalize ( notes , com.google.gerrit.server.git.LabelNormalizerTest.list ( cr , v ) ) ) ; }

Target:
public void emptyPermissionRangeKeepsResult ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.PatchSetApproval cr = psa ( userId , "Code-Review" , 1 ) ; com.google.gerrit.reviewdb.client.PatchSetApproval v = psa ( userId , "Verified" , 1 ) ; org.junit.Assert.assertEquals ( com.google.gerrit.server.change.LabelNormalizer.Result.create ( com.google.gerrit.server.change.LabelNormalizerTest.list ( cr , v ) , com.google.gerrit.server.change.LabelNormalizerTest.list ( ) , com.google.gerrit.server.change.LabelNormalizerTest.list ( ) ) , norm.normalize ( notes , com.google.gerrit.server.change.LabelNormalizerTest.list ( cr , v ) ) ) ; }
Source:
public java.lang.Object apply ( com.google.gerrit.server.project.ProjectResource resource , com.google.gerrit.server.project.SetDashboard.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.ResourceConflictException , java.lang.Exception { com.google.gerrit.server.project.SetDefaultDashboard set = setDefault.get ( ) ; set.inherited = inherited ; return com.google.gerrit.extensions.restapi.Response.created ( set.apply ( com.google.gerrit.server.project.DashboardResource.projectDefault ( resource.getControl ( ) ) , input ) ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < com.google.gerrit.server.project.DashboardsCollection.DashboardInfo > apply ( com.google.gerrit.server.project.ProjectResource resource , com.google.gerrit.server.project.SetDashboard.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , java.io.IOException { com.google.gerrit.server.project.SetDefaultDashboard set = setDefault.get ( ) ; set.inherited = inherited ; return set.apply ( com.google.gerrit.server.project.DashboardResource.projectDefault ( resource.getControl ( ) ) , input ) ; }
Source:
private static org.apache.lucene.search.Query not ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) throws com.google.gerrit.server.query.QueryParseException { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > n = p.getChild ( 0 ) ; if ( n instanceof com.google.gerrit.server.index.TimestampRangePredicate ) { return com.google.gerrit.lucene.QueryBuilder.notTimestamp ( ( ( com.google.gerrit.server.index.TimestampRangePredicate < com.google.gerrit.server.query.change.ChangeData > ) ( n ) ) ) ; } org.apache.lucene.search.BooleanQuery q = new org.apache.lucene.search.BooleanQuery ( ) ; q.add ( new org.apache.lucene.search.MatchAllDocsQuery ( ) , org.apache.lucene.search.BooleanClause.Occur.MUST ) ; q.add ( com.google.gerrit.lucene.QueryBuilder.toQuery ( n ) , org.apache.lucene.search.BooleanClause.Occur.MUST_NOT ) ; return q ; }

Target:
private static org.apache.lucene.search.Query not ( com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > schema , com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) throws com.google.gerrit.server.query.QueryParseException { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > n = p.getChild ( 0 ) ; if ( n instanceof com.google.gerrit.server.index.TimestampRangePredicate ) { return com.google.gerrit.lucene.QueryBuilder.notTimestamp ( ( ( com.google.gerrit.server.index.TimestampRangePredicate < com.google.gerrit.server.query.change.ChangeData > ) ( n ) ) ) ; } org.apache.lucene.search.BooleanQuery q = new org.apache.lucene.search.BooleanQuery ( ) ; q.add ( new org.apache.lucene.search.MatchAllDocsQuery ( ) , org.apache.lucene.search.BooleanClause.Occur.MUST ) ; q.add ( com.google.gerrit.lucene.QueryBuilder.toQuery ( schema , n ) , org.apache.lucene.search.BooleanClause.Occur.MUST_NOT ) ; return q ; }
Source:
boolean wouldPushRef ( java.lang.String ref ) { if ( ( ! ( replicatePermissions ) ) && ( GitRepositoryManager.REF_CONFIG.equals ( ref ) ) ) { return false ; } for ( org.eclipse.jgit.transport.RefSpec s : remote.getPushRefSpecs ( ) ) { if ( s.matchSource ( ref ) ) { return true ; } } return false ; }

Target:
boolean requestRunway ( com.googlesource.gerrit.plugins.replication.PushOne op ) { synchronized ( stateLock ) { if ( op.wasCanceled ( ) ) { return false ; } pending.remove ( op.getURI ( ) ) ; if ( inFlight.containsKey ( op.getURI ( ) ) ) { return false ; } inFlight.put ( op.getURI ( ) , op ) ; } return true ; }
Source:
private void testGetGroup ( java.lang.String url , com.google.gerrit.reviewdb.client.AccountGroup expectedGroup ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = session.get ( url ) ; com.google.gerrit.acceptance.rest.group.GroupInfo group = new com.google.gson.Gson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < com.google.gerrit.acceptance.rest.group.GroupInfo > ( ) { } . getType ( ) ) ; com.google.gerrit.acceptance.rest.group.GroupAssert.assertGroupInfo ( expectedGroup , group ) ; }

Target:
private void testGetGroup ( java.lang.String url , com.google.gerrit.reviewdb.client.AccountGroup expectedGroup ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = session.get ( url ) ; com.google.gerrit.server.group.GroupJson.GroupInfo group = newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.server.group.GroupJson.GroupInfo.class ) ; com.google.gerrit.acceptance.rest.group.GroupAssert.assertGroupInfo ( expectedGroup , group ) ; }
Source:
private boolean add ( com.google.gerrit.server.mail.send.ProjectWatch.Watchers matching , com.google.gerrit.reviewdb.client.Account.Id accountId , com.google.gerrit.server.account.WatchConfig.ProjectWatchKey key , java.util.Set < com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType > watchedTypes , com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType type ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser user = args.identifiedUserFactory.create ( accountId ) ; try { if ( filterMatch ( user , key.filter ( ) ) ) { if ( watchedTypes.contains ( type ) ) { matching.bcc.accounts.add ( accountId ) ; } return true ; } } catch ( com.google.gerrit.server.query.QueryParseException e ) { } return false ; }

Target:
private boolean add ( com.google.gerrit.server.mail.send.ProjectWatch.Watchers matching , com.google.gerrit.reviewdb.client.Account.Id accountId , com.google.gerrit.server.account.WatchConfig.ProjectWatchKey key , java.util.Set < com.google.gerrit.server.account.WatchConfig.NotifyType > watchedTypes , com.google.gerrit.server.account.WatchConfig.NotifyType type ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser user = args.identifiedUserFactory.create ( accountId ) ; try { if ( filterMatch ( user , key.filter ( ) ) ) { if ( watchedTypes.contains ( type ) ) { matching.bcc.accounts.add ( accountId ) ; } return true ; } } catch ( com.google.gerrit.server.query.QueryParseException e ) { } return false ; }
Source:
public java.lang.Iterable < com.google.gerrit.extensions.common.WebLinkInfo > getPatchSetLinks ( java.lang.String project , java.lang.String commit ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.extensions.webui.PatchSetWebLink webLink : patchSetLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getPatchSetUrl ( project , commit ) , webLink.getTarget ( ) ) ) ; } return links ; }

Target:
public java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > getPatchSetLinks ( java.lang.String project , java.lang.String commit ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = new java.util.ArrayList < > ( 4 ) ; for ( com.google.gerrit.extensions.webui.PatchSetWebLink webLink : patchSetLinks ) { links.add ( webLink.getPathSetWebLink ( project , commit ) ) ; } return links ; }
Source:
public void singlePeeledTagText ( ) throws java.lang.Exception { com.google.gitiles.FakeHttpServletRequest req = com.google.gitiles.FakeHttpServletRequest.newRequest ( ) ; req.setPathInfo ( "/test/+refs/tags/atag" ) ; req.setQueryString ( "format=TEXT" ) ; com.google.gitiles.FakeHttpServletResponse res = new com.google.gitiles.FakeHttpServletResponse ( ) ; servlet.service ( req , res ) ; org.junit.Assert.assertEquals ( 200 , res.getStatus ( ) ) ; org.junit.Assert.assertEquals ( ( ( ( ( id ( "refs/tags/atag" ) ) + " refs/tags/atag\n" ) + ( peeled ( "refs/tags/atag" ) ) ) + " refs/tags/atag^{}\n" ) , res.getActualBodyString ( ) ) ; }

Target:
public void singlePeeledTagText ( ) throws java.lang.Exception { setUpSimpleRefs ( ) ; com.google.gitiles.FakeHttpServletRequest req = com.google.gitiles.FakeHttpServletRequest.newRequest ( ) ; req.setPathInfo ( "/test/+refs/tags/atag" ) ; req.setQueryString ( "format=TEXT" ) ; com.google.gitiles.FakeHttpServletResponse res = new com.google.gitiles.FakeHttpServletResponse ( ) ; servlet.service ( req , res ) ; org.junit.Assert.assertEquals ( 200 , res.getStatus ( ) ) ; org.junit.Assert.assertEquals ( ( ( ( ( id ( "refs/tags/atag" ) ) + " refs/tags/atag\n" ) + ( peeled ( "refs/tags/atag" ) ) ) + " refs/tags/atag^{}\n" ) , res.getActualBodyString ( ) ) ; }
Source:
public void serverConfigWithPlugin ( ) throws java.lang.Exception { java.nio.file.Path plugins = tempSiteDir.newFolder ( "plugins" ) . toPath ( ) ; java.nio.file.Path jsplugin = plugins.resolve ( "js-plugin-1.js" ) ; java.nio.file.Files.write ( jsplugin , "Gerrit.install(function(self){});\n" . getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; adminSshSession.exec ( "gerrit plugin reload" ) ; com.google.gerrit.extensions.common.ServerInfo i = getServerConfig ( ) ; com.google.common.truth.Truth.assertThat ( i.plugin.jsResourcePaths ) . hasSize ( 1 ) ; }

Target:
public void serverConfigWithPlugin ( ) throws java.lang.Exception { java.nio.file.Path plugins = tempSiteDir.newFolder ( "plugins" ) . toPath ( ) ; java.nio.file.Path jsplugin = plugins.resolve ( "js-plugin-1.js" ) ; java.nio.file.Files.write ( jsplugin , "Gerrit.install(function(self){});\n" . getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; adminSshSession.exec ( "gerrit plugin reload" ) ; com.google.gerrit.extensions.common.ServerInfo i = gApi.config ( ) . server ( ) . getInfo ( ) ; com.google.common.truth.Truth.assertThat ( i.plugin.jsResourcePaths ) . hasSize ( 1 ) ; }
Source:
protected void renderJson ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , java.lang.Object src , java.lang.reflect.Type typeOfSrc ) throws java.io.IOException { setApiHeaders ( res , com.google.gitiles.FormatType.JSON ) ; res.setStatus ( javax.servlet.http.HttpServletResponse.SC_OK ) ; java.io.Writer writer = getWriter ( res ) ; new com.google.gson.GsonBuilder ( ) . setFieldNamingPolicy ( com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES ) . setPrettyPrinting ( ) . generateNonExecutableJson ( ) . create ( ) . toJson ( src , typeOfSrc , writer ) ; writer.write ( '\n' ) ; writer.close ( ) ; }

Target:
protected com.google.gson.GsonBuilder newGsonBuilder ( javax.servlet.http.HttpServletRequest req ) throws java.io.IOException { return new com.google.gson.GsonBuilder ( ) . setFieldNamingPolicy ( com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES ) . setPrettyPrinting ( ) . generateNonExecutableJson ( ) ; }
Source:
public void configureServlets ( ) { serveRegex ( "^/gerrit_ui/(?!rpc/)(.*)$" ) . with ( com.google.inject.Key.get ( javax.servlet.http.HttpServlet.class , com.google.inject.name.Names.named ( com.google.gerrit.httpd.raw.StaticModule.GWT_UI_SERVLET ) ) ) ; com.google.gerrit.httpd.raw.StaticModule.Paths p = getPaths ( ) ; if ( ( ( p.warFs ) == null ) && ( ( p.buckOut ) != null ) ) { filter ( "/" ) . through ( new com.google.gerrit.httpd.raw.RecompileGwtUiFilter ( p.buckOut , p.unpackedWar ) ) ; } }

Target:
private java.nio.file.Path webappSourcePath ( java.lang.String name ) { com.google.gerrit.httpd.raw.StaticModule.Paths p = getPaths ( ) ; if ( ( p.unpackedWar ) != null ) { return p.unpackedWar.resolve ( name ) ; } return p.buckOut.resolveSibling ( "gerrit-war" ) . resolve ( "src" ) . resolve ( "main" ) . resolve ( "webapp" ) . resolve ( name ) ; }
Source:
private static void replyUncompressed ( javax.servlet.http.HttpServletResponse res , java.io.OutputStream dst , com.google.gerrit.extensions.restapi.BinaryResult bin , long len ) throws java.io.IOException { if ( ( 0 <= len ) && ( len < ( java.lang.Integer.MAX_VALUE ) ) ) { res.setContentLength ( ( ( int ) ( len ) ) ) ; } else if ( 0 <= len ) { res.setHeader ( "Content-Length" , java.lang.Long.toString ( len ) ) ; } bin.writeTo ( dst ) ; }

Target:
private static com.google.gerrit.extensions.restapi.BinaryResult asBinaryResult ( final org.eclipse.jgit.util.TemporaryBuffer.Heap buf ) { return new com.google.gerrit.extensions.restapi.BinaryResult ( ) { @ java.lang.Override public void writeTo ( java.io.OutputStream os ) throws java.io.IOException { buf.writeTo ( os , null ) ; } } . setContentLength ( buf.length ( ) ) ; }
Source:
public void queryChangesOwnerWithDifferentUsers ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getOnlyElement ( query ( "owner:self" ) ) . changeId ) . isEqualTo ( r.getChangeId ( ) ) ; setApiUser ( user ) ; com.google.common.truth.Truth.assertThat ( query ( "owner:self" ) ) . isEmpty ( ) ; }

Target:
public void queryChangesOwnerWithDifferentUsers ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getOnlyElement ( query ( ( ( "project:{" + ( project.get ( ) ) ) + "} owner:self" ) ) ) . changeId ) . isEqualTo ( r.getChangeId ( ) ) ; setApiUser ( user ) ; com.google.common.truth.Truth.assertThat ( query ( "owner:self" ) ) . isEmpty ( ) ; }
Source:
public com.google.gerrit.server.change.GetRelated.RelatedInfo getRelated ( com.google.gerrit.server.change.RevisionResource rsrc ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { try ( org.eclipse.jgit.lib.Repository git = gitMgr.openRepository ( rsrc.getChange ( ) . getProject ( ) ) ; org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( git ) ) { org.eclipse.jgit.lib.Ref ref = git.getRef ( rsrc.getChange ( ) . getDest ( ) . get ( ) ) ; com.google.gerrit.server.change.GetRelated.RelatedInfo info = new com.google.gerrit.server.change.GetRelated.RelatedInfo ( ) ; info.changes = walk ( rsrc , rw , ref ) ; return info ; } }

Target:
public com.google.gerrit.server.change.GetRelated.RelatedInfo getRelated ( com.google.gerrit.server.change.RevisionResource rsrc ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { try ( org.eclipse.jgit.lib.Repository git = gitMgr.openRepository ( rsrc.getChange ( ) . getProject ( ) ) ; org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( git ) ) { org.eclipse.jgit.lib.Ref ref = git.getRefDatabase ( ) . exactRef ( rsrc.getChange ( ) . getDest ( ) . get ( ) ) ; com.google.gerrit.server.change.GetRelated.RelatedInfo info = new com.google.gerrit.server.change.GetRelated.RelatedInfo ( ) ; info.changes = walk ( rsrc , rw , ref ) ; return info ; } }
Source:
private void restoreSelection ( ) { if ( ( ( getFromTo ( ) ) != null ) && ( ( comment.in_reply_to ( ) ) == null ) ) { getCm ( ) . setSelection ( getFromTo ( ) . getFrom ( ) , getFromTo ( ) . getTo ( ) ) ; } }

Target:
private void restoreSelection ( ) { if ( ( ( getFromTo ( ) ) != null ) && ( ( comment.in_reply_to ( ) ) == null ) ) { getCm ( ) . setSelection ( getFromTo ( ) . from ( ) , getFromTo ( ) . to ( ) ) ; } }
Source:
private com.google.gerrit.server.patch.PatchScriptBuilder newBuilder ( ) throws com.google.gerrit.client.rpc.BaseServiceImplementation.Failure { final com.google.gerrit.server.patch.PatchScriptBuilder b = new com.google.gerrit.server.patch.PatchScriptBuilder ( ) ; b.setRepository ( git ) ; b.setPatch ( patch ) ; if ( ( context ) == ( com.google.gerrit.client.reviewdb.Account.WHOLE_FILE_CONTEXT ) ) b.setContext ( PatchScriptBuilder.MAX_CONTEXT ) ; else if ( ( 0 <= ( context ) ) && ( ( context ) <= ( PatchScriptBuilder.MAX_CONTEXT ) ) ) b.setContext ( context ) ; else throw new com.google.gerrit.client.rpc.BaseServiceImplementation.Failure ( new com.google.gerrit.client.rpc.NoSuchEntityException ( ) ) ; return b ; }

Target:
private com.google.gerrit.server.patch.PatchScriptBuilder newBuilder ( ) throws com.google.gerrit.client.rpc.BaseServiceImplementation.Failure { final com.google.gerrit.server.patch.PatchScriptBuilder b = new com.google.gerrit.server.patch.PatchScriptBuilder ( ) ; b.setRepository ( git ) ; b.setPatch ( patch ) ; if ( ( context ) == ( com.google.gerrit.client.reviewdb.AccountGeneralPreferences.WHOLE_FILE_CONTEXT ) ) b.setContext ( PatchScriptBuilder.MAX_CONTEXT ) ; else if ( ( 0 <= ( context ) ) && ( ( context ) <= ( PatchScriptBuilder.MAX_CONTEXT ) ) ) b.setContext ( context ) ; else throw new com.google.gerrit.client.rpc.BaseServiceImplementation.Failure ( new com.google.gerrit.client.rpc.NoSuchEntityException ( ) ) ; return b ; }
Source:
protected void allowGlobalCapability ( java.lang.String capabilityName , com.google.gerrit.reviewdb.client.AccountGroup.UUID id ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( allProjects ) . getConfig ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , capabilityName , id ) ; saveProjectConfig ( allProjects , cfg ) ; }

Target:
protected void allowGlobalCapabilities ( com.google.gerrit.reviewdb.client.AccountGroup.UUID id , java.lang.Iterable < java.lang.String > capabilityNames ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( allProjects ) . getConfig ( ) ; for ( java.lang.String capabilityName : capabilityNames ) { com.google.gerrit.server.project.Util.allow ( cfg , capabilityName , id ) ; } saveProjectConfig ( allProjects , cfg ) ; }
Source:
public void deleteReviewerByEmailFromWipChangeInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( ) ; gApi.changes ( ) . id ( sc.changeId ) . reviewer ( sc.reviewerByEmail ) . remove ( ) ; assertThat ( sender ) . notSent ( ) ; }

Target:
public void deleteReviewerByEmailFromWipChangeInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChangeWithExtraReviewer ( ) ; gApi.changes ( ) . id ( sc.changeId ) . reviewer ( sc.reviewerByEmail ) . remove ( ) ; assertThat ( sender ) . notSent ( ) ; }
Source:
protected void configure ( ) { bind ( com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil.class ) ; bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil.KEY_BINARY_TYPES ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Binary Types" , null , ProjectConfigEntry.Type.ARRAY , null , false , ( "At the moment, there is no ideal solution to detect binary " + ( ( ( "files. But some checks shouldn't run on binary files " + "(e. g. InvalidLineEndingCheck). Because of that you can " ) + "enter content types to avoid that these checks run on " ) + "files with one of the entered content types." ) ) ) ) ; }

Target:
protected void configure ( ) { bind ( com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil.class ) ; bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil.KEY_BINARY_TYPES ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Binary Types" , null , com.google.gerrit.extensions.api.projects.ProjectConfigEntryType.ARRAY , null , false , ( "At the moment, there is no ideal solution to detect binary " + ( ( ( "files. But some checks shouldn't run on binary files " + "(e. g. InvalidLineEndingCheck). Because of that you can " ) + "enter content types to avoid that these checks run on " ) + "files with one of the entered content types." ) ) ) ) ; }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.ChangeMessage > messages ( com.google.inject.Provider < com.google.gerrit.reviewdb.server.ReviewDb > db ) throws com.google.gwtorm.server.OrmException { if ( ( messages ) == null ) { messages = db.get ( ) . changeMessages ( ) . byChange ( legacyId ) . toList ( ) ; } return messages ; }

Target:
public java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > comments ( ) throws com.google.gwtorm.server.OrmException { if ( ( comments ) == null ) { comments = db.patchComments ( ) . byChange ( legacyId ) . toList ( ) ; } return comments ; }
Source:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.account.AccountResource rsrc ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.server.permissions.PermissionBackendException { if ( ( self.get ( ) ) != ( rsrc.getUser ( ) ) ) { permissionBackend.user ( self ) . check ( GlobalPermission.MODIFY_ACCOUNT ) ; } com.google.gerrit.reviewdb.client.Account.Id id = rsrc.getUser ( ) . getAccountId ( ) ; return accountCache.get ( id ) . getGeneralPreferences ( ) ; }

Target:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.account.AccountResource rsrc ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.permissions.PermissionBackendException { if ( ( self.get ( ) ) != ( rsrc.getUser ( ) ) ) { permissionBackend.user ( self ) . check ( GlobalPermission.MODIFY_ACCOUNT ) ; } com.google.gerrit.reviewdb.client.Account.Id id = rsrc.getUser ( ) . getAccountId ( ) ; return accountCache.maybeGet ( id ) . map ( AccountState :: getGeneralPreferences ) . orElseThrow ( ( ) -> new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( com.google.gerrit.extensions.restapi.IdString.fromDecoded ( id.toString ( ) ) ) ) ; }
Source:
private java.lang.String getOwerGroupName ( com.google.gerrit.server.project.ProjectState project ) { java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > owners = project.getAllOwners ( ) ; if ( ! ( owners.isEmpty ( ) ) ) { return groupCache.get ( owners.iterator ( ) . next ( ) ) . getName ( ) ; } return java.lang.String.format ( "no owners for project %s" , project.getProject ( ) . getName ( ) ) ; }

Target:
private java.lang.String getOwerGroupName ( com.google.gerrit.server.project.ProjectState project ) { java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > owners = project.getAllOwners ( ) ; if ( ! ( owners.isEmpty ( ) ) ) { java.util.Optional < com.google.gerrit.server.group.InternalGroup > owner = groupCache.get ( owners.iterator ( ) . next ( ) ) ; if ( owner.isPresent ( ) ) { return owner.get ( ) . getName ( ) ; } } return java.lang.String.format ( "no owners for project %s" , project.getProject ( ) . getName ( ) ) ; }
Source:
protected void renderJson ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , java.lang.Object src , java.lang.reflect.Type typeOfSrc ) throws java.io.IOException { setApiHeaders ( res , com.google.gitiles.FormatType.JSON ) ; res.setStatus ( javax.servlet.http.HttpServletResponse.SC_OK ) ; java.io.Writer writer = getWriter ( res ) ; new com.google.gson.GsonBuilder ( ) . setFieldNamingPolicy ( com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES ) . setPrettyPrinting ( ) . generateNonExecutableJson ( ) . create ( ) . toJson ( src , typeOfSrc , writer ) ; writer.write ( '\n' ) ; writer.close ( ) ; }

Target:
protected void renderJson ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , java.lang.Object src , java.lang.reflect.Type typeOfSrc ) throws java.io.IOException { setApiHeaders ( res , com.google.gitiles.FormatType.JSON ) ; res.setStatus ( javax.servlet.http.HttpServletResponse.SC_OK ) ; java.io.Writer writer = getWriter ( res ) ; newGsonBuilder ( req ) . create ( ) . toJson ( src , typeOfSrc , writer ) ; writer.write ( '\n' ) ; writer.close ( ) ; }