auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onTopicEdited ( com.google.gerrit.extensions.events.TopicEditedListener.Event ev ) { try { com.google.gerrit.reviewdb.client.Change change = getChange ( ev.getChange ( ) ) ; com.google.gerrit.server.events.TopicChangedEvent event = new com.google.gerrit.server.events.TopicChangedEvent ( change ) ; event.change = changeAttributeSupplier ( change ) ; event.changer = accountAttributeSupplier ( ev.getEditor ( ) ) ; event.oldTopic = ev.getOldTopic ( ) ; dispatcher.get ( ) . postEvent ( change , event , db.get ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.common.StreamEventsApiListener.log.error ( "Failed to dispatch event" , e ) ; } }

Target:
public void onTopicEdited ( com.google.gerrit.extensions.events.TopicEditedListener.Event ev ) { try { com.google.gerrit.reviewdb.client.Change change = getChange ( ev.getChange ( ) ) ; com.google.gerrit.server.events.TopicChangedEvent event = new com.google.gerrit.server.events.TopicChangedEvent ( change ) ; event.change = changeAttributeSupplier ( change ) ; event.changer = accountAttributeSupplier ( ev.getEditor ( ) ) ; event.oldTopic = ev.getOldTopic ( ) ; dispatcher.get ( ) . postEvent ( change , event ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.common.StreamEventsApiListener.log.error ( "Failed to dispatch event" , e ) ; } }
Source:
public void uploadPackSubsetOfBranchesVisibleNotIncludingHead ( ) throws java.lang.Exception { deny ( "refs/heads/master" , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; setApiUser ( user ) ; assertUploadPackRefs ( ( ( r2 ) + "1" ) , ( ( r2 ) + "meta" ) , ( ( r4 ) + "1" ) , ( ( r4 ) + "meta" ) , "refs/heads/branch" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }

Target:
public void uploadPackSubsetOfBranchesVisibleNotIncludingHead ( ) throws java.lang.Exception { deny ( "refs/heads/master" , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; allow ( "refs/heads/branch" , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; setApiUser ( user ) ; assertUploadPackRefs ( ( ( r2 ) + "1" ) , ( ( r2 ) + "meta" ) , ( ( r4 ) + "1" ) , ( ( r4 ) + "meta" ) , "refs/heads/branch" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }
Source:
public void setInfo ( java.lang.String msg ) { if ( ( ( info ) == null ) && ( ( titlePanel ) != null ) ) { info = new com.google.gwt.user.client.ui.Image ( Gerrit.RESOURCES.info ( ) ) ; titlePanel.add ( info ) ; } info.setTitle ( msg ) ; }

Target:
public void setInfo ( java.lang.String msg ) { if ( ( ( info ) == null ) && ( ( titlePanel ) != null ) ) { info = new com.google.gwt.user.client.ui.Image ( Gerrit.RESOURCES.info ( ) ) ; titlePanel.add ( info ) ; } if ( ( info ) != null ) { info.setTitle ( msg ) ; } }
Source:
public void setUp ( ) throws java.lang.Exception { group1 = group ( "users1" ) ; group2 = group ( "users2" ) ; group3 = group ( "users3" ) ; HEAD ( 6822 ) ; com.google.gerrit.acceptance.rest.change.c9 Update ; com.google.gerrit.acceptance.rest.change.plugin to ; com.google.gerrit.acceptance.rest.change.latest revision ; user1 = user ( "user1" , "First1 Last1" , group1 ) ; user2 = user ( "user2" , "First2 Last2" , group2 ) ; user3 = user ( "user3" , "First3 Last3" , group1 , group2 ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { group1 = group ( "users1" ) ; group2 = group ( "users2" ) ; group3 = group ( "users3" ) ; user1 = user ( "user1" , "First1 Last1" , group1 ) ; user2 = user ( "user2" , "First2 Last2" , group2 ) ; user3 = user ( "user3" , "First3 Last3" , group1 , group2 ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.RequestCleanup.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; bind ( com.google.gerrit.server.config.RequestScopedReviewDbProvider.class ) ; bind ( IdentifiedUser.RequestFactory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; bind ( com.google.gerrit.server.project.PerRequestProjectControlCache.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; bind ( ProjectControl.Factory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; factory ( SubmoduleOp.Factory.class ) ; factory ( MergeOp.Factory.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.RequestCleanup.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; bind ( com.google.gerrit.server.config.RequestScopedReviewDbProvider.class ) ; bind ( IdentifiedUser.RequestFactory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; bind ( com.google.gerrit.server.project.PerRequestProjectControlCache.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; bind ( ProjectControl.Factory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; }
Source:
private void limitThreads ( ) { org.eclipse.jgit.lib.Config cfg = dbInjector.getInstance ( com.google.inject.Key.get ( org.eclipse.jgit.lib.Config.class , com.google.gerrit.server.config.GerritServerConfig.class ) ) ; boolean usePool = cfg.getBoolean ( "database" , "connectionpool" , dbInjector.getInstance ( com.google.gerrit.server.schema.DataSourceType.class ) . usePool ( ) ) ; int poolLimit = cfg.getInt ( "database" , "poollimit" , DataSourceProvider.DEFAULT_POOL_LIMIT ) ; if ( usePool && ( ( threads ) > poolLimit ) ) { com.google.gerrit.pgm.Reindex.log.warn ( ( ( "Limiting reindexing to " + poolLimit ) + " threads due to database.poolLimit" ) ) ; threads = poolLimit ; } }

Target:
private void limitThreads ( ) { boolean usePool = cfg.getBoolean ( "database" , "connectionpool" , dbInjector.getInstance ( com.google.gerrit.server.schema.DataSourceType.class ) . usePool ( ) ) ; int poolLimit = cfg.getInt ( "database" , "poollimit" , DataSourceProvider.DEFAULT_POOL_LIMIT ) ; if ( usePool && ( ( threads ) > poolLimit ) ) { com.google.gerrit.pgm.Reindex.log.warn ( ( ( "Limiting reindexing to " + poolLimit ) + " threads due to database.poolLimit" ) ) ; threads = poolLimit ; } }
Source:
public void testProjectNotVisible ( ) throws java.lang.Exception { final com.google.gerrit.server.project.NoSuchProjectException err = new com.google.gerrit.server.project.NoSuchProjectException ( name ) ; validate ( ) . andThrow ( err ) ; doReplay ( ) ; try { new com.google.gerrit.httpd.rpc.project.ListBranches ( pcf , grm , name ) . call ( ) ; fail ( "did not throw when expected not authorized" ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e2 ) { assertSame ( err , e2 ) ; } doVerify ( ) ; }

Target:
public void testProjectNotVisible ( ) throws java.lang.Exception { final com.google.gerrit.server.project.NoSuchProjectException err = new com.google.gerrit.server.project.NoSuchProjectException ( name ) ; validate ( ) . andThrow ( err ) ; doReplay ( ) ; try { new com.google.gerrit.httpd.rpc.project.ListBranches ( pcf , grm , name ) . call ( ) ; org.junit.Assert.fail ( "did not throw when expected not authorized" ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e2 ) { org.junit.Assert.assertSame ( err , e2 ) ; } doVerify ( ) ; }
Source:
public void permissionLacksRef ( ) throws java.lang.Exception { exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( "must set 'ref'" ) ; com.google.gerrit.extensions.api.config.AccessCheckInput in = new com.google.gerrit.extensions.api.config.AccessCheckInput ( ) ; in.account = user.email ; in.permission = "forge_author" ; gApi.projects ( ) . name ( normalProject.get ( ) ) . checkAccess ( in ) ; }

Target:
public void permissionLacksRef ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.config.AccessCheckInput in = new com.google.gerrit.extensions.api.config.AccessCheckInput ( ) ; in.account = user.email ; in.permission = "forge_author" ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( "must set 'ref'" ) ; gApi.projects ( ) . name ( normalProject.get ( ) ) . checkAccess ( in ) ; }
Source:
public com.google.common.util.concurrent.ListenableFuture < ? > rebuildAsync ( final com.google.gerrit.reviewdb.client.Change.Id id , com.google.common.util.concurrent.ListeningExecutorService executor ) { return executor.submit ( new java.util.concurrent.Callable < java.lang.Void > ( ) { @ java.lang.Override public java.lang.Void call ( ) throws java.lang.Exception { try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { rebuild ( db , id ) ; } return null ; } } ) ; }

Target:
public final com.google.common.util.concurrent.ListenableFuture < ? > rebuildAsync ( final com.google.gerrit.reviewdb.client.Change.Id id , com.google.common.util.concurrent.ListeningExecutorService executor ) { return executor.submit ( new java.util.concurrent.Callable < java.lang.Void > ( ) { @ java.lang.Override public java.lang.Void call ( ) throws java.lang.Exception { try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { rebuild ( db , id ) ; } return null ; } } ) ; }
Source:
protected void onLoad ( ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.ObjectId rev = getRevision ( ) ; if ( rev == null ) { return ; } org.eclipse.jgit.revwalk.RevWalk walk = new org.eclipse.jgit.revwalk.RevWalk ( reader ) ; try ( com.google.gerrit.server.notedb.DraftCommentNotesParser parser = new com.google.gerrit.server.notedb.DraftCommentNotesParser ( getChangeId ( ) , walk , rev , repoManager , draftsProject , author ) ) { parser.parseDraftComments ( ) ; buildCommentTable ( draftBaseComments , parser.draftBaseComments ) ; buildCommentTable ( draftPsComments , parser.draftPsComments ) ; noteMap = parser.noteMap ; } finally { walk.release ( ) ; } }

Target:
protected void onLoad ( ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.ObjectId rev = getRevision ( ) ; if ( rev == null ) { return ; } try ( org.eclipse.jgit.revwalk.RevWalk walk = new org.eclipse.jgit.revwalk.RevWalk ( reader ) ; com.google.gerrit.server.notedb.DraftCommentNotesParser parser = new com.google.gerrit.server.notedb.DraftCommentNotesParser ( getChangeId ( ) , walk , rev , repoManager , draftsProject , author ) ) { parser.parseDraftComments ( ) ; buildCommentTable ( draftBaseComments , parser.draftBaseComments ) ; buildCommentTable ( draftPsComments , parser.draftPsComments ) ; noteMap = parser.noteMap ; } }
Source:
public java.lang.Object apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddMembers.PutMember.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddMembers.Input in = new com.google.gerrit.server.group.AddMembers.Input ( ) ; in._oneMember = id ; java.util.List < com.google.gerrit.server.group.MembersCollection.MemberInfo > list = put.get ( ) . apply ( resource , in ) ; if ( list.isEmpty ( ) ) { return com.google.gerrit.extensions.restapi.Response.none ( ) ; } else if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } else { throw new java.lang.IllegalStateException ( ) ; } }

Target:
public java.lang.Object apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddMembers.PutMember.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddMembers.Input in = new com.google.gerrit.server.group.AddMembers.Input ( ) ; in._oneMember = id ; java.util.List < com.google.gerrit.server.group.MembersCollection.MemberInfo > list = put.get ( ) . apply ( resource , in ) ; if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } else { throw new java.lang.IllegalStateException ( ) ; } }
Source:
public java.util.List < com.googlesource.gerrit.plugins.github.MenuEntry > getEntries ( ) { if ( ( ( userProvider.get ( ) ) instanceof com.google.gerrit.server.IdentifiedUser ) && ( authConfig.getAuthType ( ) . equals ( AuthType.HTTP ) ) ) { return menuEntries ; } else { return java.util.Collections.emptyList ( ) ; } }

Target:
public java.util.List < com.googlesource.gerrit.plugins.github.MenuEntry > getEntries ( ) { if ( ( ( userProvider.get ( ) ) instanceof com.google.gerrit.server.IdentifiedUser ) && ( authConfig.getAuthType ( ) . equals ( AuthType.HTTP ) ) ) { return menuEntries ; } return java.util.Collections.emptyList ( ) ; }
Source:
public void submitWithCherryPickIfFastForwardPossible ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result change = createChange ( git ) ; submit ( change.getChangeId ( ) ) ; assertCherryPick ( git , false ) ; com.google.common.truth.Truth.assertThat ( getRemoteHead ( ) . getParent ( 0 ) ) . isEqualTo ( change.getCommit ( ) . getParent ( 0 ) ) ; }

Target:
public void submitWithCherryPickIfFastForwardPossible ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result change = createChange ( ) ; submit ( change.getChangeId ( ) ) ; assertCherryPick ( git , false ) ; com.google.common.truth.Truth.assertThat ( getRemoteHead ( ) . getParent ( 0 ) ) . isEqualTo ( change.getCommit ( ) . getParent ( 0 ) ) ; }
Source:
private static java.lang.Class < ? extends com.google.inject.Module > load ( java.lang.String name , java.lang.ClassLoader pluginLoader ) throws java.lang.ClassNotFoundException { if ( com.google.common.base.Strings.isNullOrEmpty ( name ) ) { return null ; } java.lang.Class < ? > clazz = java.lang.Class.forName ( name , false , pluginLoader ) ; if ( ! ( com.google.inject.Module.class . isAssignableFrom ( clazz ) ) ) { throw new java.lang.ClassCastException ( java.lang.String.format ( "Class %s does not implement %s" , name , com.google.inject.Module.class . getName ( ) ) ) ; } return ( ( java.lang.Class < ? extends com.google.inject.Module > ) ( clazz ) ) ; }

Target:
protected static java.lang.Class < ? extends com.google.inject.Module > load ( java.lang.String name , java.lang.ClassLoader pluginLoader ) throws java.lang.ClassNotFoundException { if ( com.google.common.base.Strings.isNullOrEmpty ( name ) ) { return null ; } java.lang.Class < ? > clazz = java.lang.Class.forName ( name , false , pluginLoader ) ; if ( ! ( com.google.inject.Module.class . isAssignableFrom ( clazz ) ) ) { throw new java.lang.ClassCastException ( java.lang.String.format ( "Class %s does not implement %s" , name , com.google.inject.Module.class . getName ( ) ) ) ; } return ( ( java.lang.Class < ? extends com.google.inject.Module > ) ( clazz ) ) ; }
Source:
public java.lang.String diff ( org.eclipse.jgit.diff.RawText v0 , org.eclipse.jgit.diff.RawText v1 ) throws java.io.IOException { org.eclipse.jgit.diff.DiffAlgorithm algorithm = org.eclipse.jgit.diff.MyersDiff.INSTANCE ; org.eclipse.jgit.diff.EditList editList = algorithm.diff ( RawTextComparator.DEFAULT , v0 , v1 ) ; java.io.ByteArrayOutputStream os = new java.io.ByteArrayOutputStream ( ) ; org.eclipse.jgit.diff.DiffFormatter formatter = new org.eclipse.jgit.diff.DiffFormatter ( os ) ; formatter.format ( editList , v0 , v1 ) ; return os.toString ( com.googlesource.gerrit.plugins.serverconfig.UnifiedDiffer.CHARSET_NAME ) ; }

Target:
public java.lang.String diff ( org.eclipse.jgit.diff.RawText v0 , org.eclipse.jgit.diff.RawText v1 ) throws java.io.IOException { org.eclipse.jgit.diff.DiffAlgorithm algorithm = org.eclipse.jgit.diff.MyersDiff.INSTANCE ; org.eclipse.jgit.diff.EditList editList = algorithm.diff ( RawTextComparator.DEFAULT , v0 , v1 ) ; java.io.ByteArrayOutputStream os = new java.io.ByteArrayOutputStream ( ) ; try ( org.eclipse.jgit.diff.DiffFormatter formatter = new org.eclipse.jgit.diff.DiffFormatter ( os ) ) { formatter.format ( editList , v0 , v1 ) ; } return os.toString ( com.googlesource.gerrit.plugins.serverconfig.UnifiedDiffer.CHARSET_NAME ) ; }
Source:
private void fireEvent ( com.google.gerrit.reviewdb.client.Branch.NameKey branchName , com.google.gerrit.common.Event event ) { for ( com.google.gerrit.common.ChangeHookRunner.EventListenerHolder holder : listeners.values ( ) ) { if ( isVisibleTo ( branchName , holder.user ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }

Target:
private void fireEvent ( com.google.gerrit.common.Event event , com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.common.ChangeHookRunner.EventListenerHolder holder : listeners.values ( ) ) { if ( isVisibleTo ( event , holder.user , db ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.rpc.NativeMap < com.google.gerrit.client.diff.FileInfo > m ) { files.setRevisions ( null , new com.google.gerrit.reviewdb.client.PatchSet.Id ( changeId , rev._number ( ) ) ) ; files.setValue ( m , myLastReply , comments.get ( 0 ) , drafts.get ( 0 ) ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.NativeMap < com.google.gerrit.client.diff.FileInfo > m ) { files.setRevisions ( ( base != null ? new com.google.gerrit.reviewdb.client.PatchSet.Id ( changeId , base._number ( ) ) : null ) , new com.google.gerrit.reviewdb.client.PatchSet.Id ( changeId , rev._number ( ) ) ) ; files.setValue ( m , myLastReply , comments.get ( 0 ) , drafts.get ( 0 ) ) ; }
Source:
protected void rpc ( final java.lang.String name , java.lang.Class < ? extends com.google.gwtjsonrpc.client.RemoteJsonService > clazz ) { final com.google.inject.Key < com.google.gerrit.server.http.GerritJsonServlet > srv = com.google.inject.Key.get ( com.google.gerrit.server.http.GerritJsonServlet.class , com.google.inject.internal.UniqueAnnotations.create ( ) ) ; final com.google.gerrit.server.http.GerritJsonServletProvider provider = new com.google.gerrit.server.http.GerritJsonServletProvider ( clazz ) ; serve ( ( ( prefix ) + name ) ) . with ( srv ) ; bind ( srv ) . toProvider ( provider ) . in ( Scopes.SINGLETON ) ; }

Target:
protected void rpc ( final java.lang.String name , java.lang.Class < ? extends com.google.gwtjsonrpc.client.RemoteJsonService > clazz ) { final com.google.inject.Key < com.google.gerrit.server.http.GerritJsonServlet > srv = com.google.inject.Key.get ( com.google.gerrit.server.http.GerritJsonServlet.class , com.google.inject.internal.UniqueAnnotations.create ( ) ) ; final com.google.gerrit.server.http.GerritJsonServletProvider provider = new com.google.gerrit.server.http.GerritJsonServletProvider ( clazz ) ; bind ( clazz ) ; serve ( ( ( prefix ) + name ) ) . with ( srv ) ; bind ( srv ) . toProvider ( provider ) . in ( Scopes.SINGLETON ) ; }
Source:
public void setReviewed ( java.lang.String path , boolean reviewed ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.extensions.restapi.RestModifyView < com.google.gerrit.server.change.FileResource , com.google.gerrit.server.change.Reviewed.Input > view ; if ( reviewed ) { view = putReviewed ; } else { view = deleteReviewed ; } view.apply ( files.get ( ) . parse ( revision , com.google.gerrit.extensions.restapi.IdString.fromDecoded ( path ) ) , new com.google.gerrit.server.change.Reviewed.Input ( ) ) ; } catch ( java.lang.Exception e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot update reviewed flag" , e ) ; } }

Target:
public void setReviewed ( java.lang.String path , boolean reviewed ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.extensions.restapi.RestModifyView < com.google.gerrit.server.change.FileResource , com.google.gerrit.server.change.Reviewed.Input > view ; if ( reviewed ) { view = putReviewed ; } else { view = deleteReviewed ; } view.apply ( files.parse ( revision , com.google.gerrit.extensions.restapi.IdString.fromDecoded ( path ) ) , new com.google.gerrit.server.change.Reviewed.Input ( ) ) ; } catch ( java.lang.Exception e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot update reviewed flag" , e ) ; } }
Source:
protected void deny ( java.lang.String permission , com.google.gerrit.reviewdb.client.AccountGroup.UUID id , java.lang.String ref ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.deny ( cfg , permission , id , ref ) ; saveProjectConfig ( project , cfg ) ; }

Target:
protected void deny ( java.lang.String permission , com.google.gerrit.reviewdb.client.AccountGroup.UUID id , java.lang.String ref ) throws java.lang.Exception { deny ( project , permission , id , ref ) ; }
Source:
private com.google.inject.Module getIndexModule ( ) { switch ( com.google.gerrit.server.index.IndexModule.getIndexType ( dbInjector ) ) { case LUCENE : return com.google.gerrit.lucene.LuceneIndexModule.singleVersionWithExplicitVersions ( com.google.common.collect.ImmutableMap.of ( ) , threads ) ; case ELASTICSEARCH : return com.google.gerrit.elasticsearch.ElasticIndexModule.singleVersionWithExplicitVersions ( com.google.common.collect.ImmutableMap.of ( ) , threads ) ; default : throw new java.lang.IllegalStateException ( "unsupported index.type" ) ; } }

Target:
private com.google.inject.Module getIndexModule ( ) { switch ( com.google.gerrit.server.index.IndexModule.getIndexType ( dbInjector ) ) { case LUCENE : return com.google.gerrit.lucene.LuceneIndexModule.singleVersionWithExplicitVersions ( com.google.common.collect.ImmutableMap.of ( ) , threads , false ) ; case ELASTICSEARCH : return com.google.gerrit.elasticsearch.ElasticIndexModule.singleVersionWithExplicitVersions ( com.google.common.collect.ImmutableMap.of ( ) , threads , false ) ; default : throw new java.lang.IllegalStateException ( "unsupported index.type" ) ; } }
Source:
protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException , javax.servlet.ServletException { rsp.setContentType ( "text/html" ) ; rsp.setCharacterEncoding ( "UTF-8" ) ; final java.io.Writer out = rsp.getWriter ( ) ; out.write ( "<html>" ) ; out.write ( "<body>" ) ; out.write ( "<h2>Hello world!</h2>" ) ; out.write ( "</body>" ) ; out.write ( "</html>" ) ; out.close ( ) ; }

Target:
protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException , javax.servlet.ServletException { rsp.setContentType ( "text/html" ) ; rsp.setCharacterEncoding ( "UTF-8" ) ; try ( java.io.Writer out = rsp.getWriter ( ) ) { out.write ( "<html>" ) ; out.write ( "<body>" ) ; out.write ( "<h2>Hello world!</h2>" ) ; out.write ( "</body>" ) ; out.write ( "</html>" ) ; } }
Source:
void updateFastForward ( java.lang.String refName , org.eclipse.jgit.lib.ObjectId oldValue , org.eclipse.jgit.lib.ObjectId newValue ) { com.google.gerrit.server.git.TagSet.CachedRef ref = refs.get ( refName ) ; if ( ref != null ) { org.eclipse.jgit.lib.ObjectId cur = ref.get ( ) ; if ( cur.equals ( oldValue ) ) { ref.compareAndSet ( cur , newValue ) ; } } }

Target:
boolean updateFastForward ( java.lang.String refName , org.eclipse.jgit.lib.ObjectId oldValue , org.eclipse.jgit.lib.ObjectId newValue ) { com.google.gerrit.server.git.TagSet.CachedRef ref = refs.get ( refName ) ; if ( ref != null ) { org.eclipse.jgit.lib.ObjectId cur = ref.get ( ) ; if ( cur.equals ( oldValue ) ) { return ref.compareAndSet ( cur , newValue ) ; } } return false ; }
Source:
public com.google.gerrit.extensions.api.changes.IncludedInInfo apply ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.server.project.ChangeControl ctl = rsrc.getControl ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = psUtil.current ( db.get ( ) , rsrc.getNotes ( ) ) ; com.google.gerrit.reviewdb.client.Project.NameKey project = ctl.getProject ( ) . getNameKey ( ) ; return includedIn.apply ( project , ps.getRevision ( ) . get ( ) ) ; }

Target:
public com.google.gerrit.extensions.api.changes.IncludedInInfo apply ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.reviewdb.client.PatchSet ps = psUtil.current ( db.get ( ) , rsrc.getNotes ( ) ) ; return includedIn.apply ( rsrc.getProject ( ) , ps.getRevision ( ) . get ( ) ) ; }
Source:
private java.util.List < java.lang.String > getOrganisations ( java.util.List < com.googlesource.gerrit.plugins.github.replication.Destination > destinations ) { java.util.ArrayList < java.lang.String > organisations = new java.util.ArrayList < > ( ) ; for ( com.googlesource.gerrit.plugins.github.replication.Destination destination : destinations ) { for ( org.eclipse.jgit.transport.URIish urish : destination.getRemote ( ) . getURIs ( ) ) { java.lang.String [ ] uriPathParts = urish.getPath ( ) . split ( "/" ) ; organisations.add ( uriPathParts [ 0 ] ) ; } } return organisations ; }

Target:
private java.util.List < java.lang.String > getOrganisations ( java.util.List < com.googlesource.gerrit.plugins.github.replication.Destination > destinations ) { java.util.ArrayList < java.lang.String > result = new java.util.ArrayList < > ( ) ; for ( com.googlesource.gerrit.plugins.github.replication.Destination destination : destinations ) { for ( org.eclipse.jgit.transport.URIish urish : destination.getRemote ( ) . getURIs ( ) ) { java.lang.String [ ] uriPathParts = urish.getPath ( ) . split ( "/" ) ; result.add ( uriPathParts [ 0 ] ) ; } } return result ; }
Source:
protected void configure ( ) { bind ( java.util.concurrent.ScheduledExecutorService.class ) . annotatedWith ( com.googlesource.gerrit.plugins.webhooks.WebHooksExecutor.class ) . toProvider ( com.googlesource.gerrit.plugins.webhooks.ExecutorProvider.class ) ; bind ( com.googlesource.gerrit.plugins.webhooks.Configuration.class ) . in ( Scopes.SINGLETON ) ; bind ( org.apache.http.impl.client.CloseableHttpClient.class ) . toProvider ( com.googlesource.gerrit.plugins.webhooks.HttpClientProvider.class ) . in ( Scopes.SINGLETON ) ; factory ( PostTask.Factory.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.common.EventListener.class ) . to ( com.googlesource.gerrit.plugins.webhooks.EventHandler.class ) ; }

Target:
protected void configure ( ) { bind ( java.util.concurrent.ScheduledExecutorService.class ) . annotatedWith ( com.googlesource.gerrit.plugins.webhooks.WebHooksExecutor.class ) . toProvider ( com.googlesource.gerrit.plugins.webhooks.ExecutorProvider.class ) ; bind ( org.apache.http.impl.client.CloseableHttpClient.class ) . toProvider ( com.googlesource.gerrit.plugins.webhooks.HttpClientProvider.class ) . in ( Scopes.SINGLETON ) ; factory ( PostTask.Factory.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.common.EventListener.class ) . to ( com.googlesource.gerrit.plugins.webhooks.EventHandler.class ) ; }
Source:
public static void addMembers ( com.google.gerrit.reviewdb.client.AccountGroup.UUID groupUUID , java.util.Set < java.lang.String > members , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.rpc.NativeList < com.google.gerrit.client.groups.MemberInfo > > cb ) { com.google.gerrit.client.rpc.RestApi call = new com.google.gerrit.client.rpc.RestApi ( com.google.gerrit.client.groups.GroupApi.membersBase ( groupUUID ) ) ; com.google.gerrit.client.groups.GroupApi.MemberInput input = com.google.gerrit.client.groups.GroupApi.MemberInput.create ( ) ; for ( java.lang.String member : members ) { input.add_member ( member ) ; } call.data ( input ) . put ( cb ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.groups.MemberInfo result ) { cb.onSuccess ( com.google.gerrit.client.rpc.NativeList.of ( result ) ) ; }
Source:
private org.eclipse.jgit.lib.ObjectId emptyTree ( ) throws java.io.IOException { org.eclipse.jgit.lib.ObjectInserter oi = repo.newObjectInserter ( ) ; try { org.eclipse.jgit.lib.ObjectId id = oi.insert ( Constants.OBJ_TREE , new byte [ ] { } ) ; oi.flush ( ) ; return id ; } finally { oi.release ( ) ; } }

Target:
private org.eclipse.jgit.lib.ObjectId emptyTree ( ) throws java.io.IOException { try ( org.eclipse.jgit.lib.ObjectInserter oi = repo.newObjectInserter ( ) ) { org.eclipse.jgit.lib.ObjectId id = oi.insert ( Constants.OBJ_TREE , new byte [ ] { } ) ; oi.flush ( ) ; return id ; } }
Source:
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 ) ) ; } }

Target:
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 ) ; } }
Source:
public void mergeByReviewer ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; merge ( sc.changeId , sc.reviewer ) ; assertThat ( sender ) . sent ( "merged" , sc ) . notTo ( sc.reviewer ) . to ( sc.owner ) . to ( sc.reviewerByEmail ) . cc ( sc.ccer ) . cc ( sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; }

Target:
public void mergeByReviewer ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; merge ( sc.changeId , sc.reviewer ) ; assertThat ( sender ) . sent ( "merged" , sc ) . notTo ( sc.reviewer ) . to ( sc.owner ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; }
Source:
public static com.google.gerrit.client.rpc.RestApi revision ( com.google.gerrit.reviewdb.client.PatchSet.Id id ) { int cn = id.getParentKey ( ) . get ( ) ; java.lang.String revision = com.google.gerrit.client.changes.RevisionInfoCache.get ( id ) ; if ( revision != null ) { return com.google.gerrit.client.changes.ChangeApi.revision ( cn , revision ) ; } return com.google.gerrit.client.changes.ChangeApi.change ( cn ) . view ( "revisions" ) . id ( id.get ( ) ) ; }

Target:
public static com.google.gerrit.client.rpc.RestApi revision ( @ com.google.gerrit.common.Nullable java.lang.String project , com.google.gerrit.reviewdb.client.PatchSet.Id id ) { int cn = id.getParentKey ( ) . get ( ) ; java.lang.String revision = com.google.gerrit.client.changes.RevisionInfoCache.get ( id ) ; if ( revision != null ) { return com.google.gerrit.client.changes.ChangeApi.revision ( project , cn , revision ) ; } return com.google.gerrit.client.changes.ChangeApi.change ( project , cn ) . view ( "revisions" ) . id ( id.get ( ) ) ; }
Source:
public void absoluteLink ( ) throws java.lang.Exception { repo.branch ( "master" ) . commit ( ) . add ( "README.md" , "[c](/x)" ) . create ( ) ; java.lang.String html = buildHtml ( "/repo/+doc/master/README.md" ) ; org.junit.Assert.assertTrue ( html.contains ( "<a href=\"/b/repo/+show/master/x\">c</a>" ) ) ; }

Target:
public void absoluteLink ( ) throws java.lang.Exception { repo.branch ( "master" ) . commit ( ) . add ( "README.md" , "[c](/x)" ) . create ( ) ; java.lang.String html = buildHtml ( "/repo/+doc/master/README.md" ) ; com.google.common.truth.Truth.assertThat ( html ) . contains ( "<a href=\"/b/repo/+show/master/x\">c</a>" ) ; }
Source:
private static org.eclipse.jgit.treewalk.AbstractTreeIterator getTreeIterator ( org.eclipse.jgit.revwalk.RevWalk walk , org.eclipse.jgit.lib.ObjectId id ) throws java.io.IOException { if ( ! ( id.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) ) ) ) { org.eclipse.jgit.treewalk.CanonicalTreeParser p = new org.eclipse.jgit.treewalk.CanonicalTreeParser ( ) ; p.reset ( walk.getObjectReader ( ) , walk.parseTree ( id ) ) ; return p ; } else { return new org.eclipse.jgit.treewalk.EmptyTreeIterator ( ) ; } }

Target:
private static org.eclipse.jgit.treewalk.AbstractTreeIterator getTreeIterator ( org.eclipse.jgit.revwalk.RevWalk walk , org.eclipse.jgit.lib.ObjectId id ) throws java.io.IOException { if ( ! ( id.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) ) ) ) { org.eclipse.jgit.treewalk.CanonicalTreeParser p = new org.eclipse.jgit.treewalk.CanonicalTreeParser ( ) ; p.reset ( walk.getObjectReader ( ) , walk.parseTree ( id ) ) ; return p ; } return new org.eclipse.jgit.treewalk.EmptyTreeIterator ( ) ; }
Source:
public void testPreformat1 ( ) { final com.google.gwtexpui.safehtml.client.SafeHtml o = com.google.gwtexpui.safehtml.client.SafeHtml_WikifyPreformatTest.html ( "A\n\n This is pre\n formatted" ) ; final com.google.gwtexpui.safehtml.client.SafeHtml n = o.wikify ( ) ; assertNotSame ( o , n ) ; assertEquals ( ( ( ( ( "<p>A</p>" + "<p>" ) + ( com.google.gwtexpui.safehtml.client.SafeHtml_WikifyPreformatTest.pre ( " This is pre" ) ) ) + ( com.google.gwtexpui.safehtml.client.SafeHtml_WikifyPreformatTest.pre ( " formatted" ) ) ) + "</p>" ) , n.asString ( ) ) ; }

Target:
public void testPreformat1 ( ) { final com.google.gwtexpui.safehtml.client.SafeHtml o = com.google.gwtexpui.safehtml.client.SafeHtml_WikifyPreformatTest.html ( "A\n\n This is pre\n formatted" ) ; final com.google.gwtexpui.safehtml.client.SafeHtml n = o.wikify ( ) ; org.junit.Assert.assertNotSame ( o , n ) ; org.junit.Assert.assertEquals ( ( ( ( ( "<p>A</p>" + "<p>" ) + ( com.google.gwtexpui.safehtml.client.SafeHtml_WikifyPreformatTest.pre ( " This is pre" ) ) ) + ( com.google.gwtexpui.safehtml.client.SafeHtml_WikifyPreformatTest.pre ( " formatted" ) ) ) + "</p>" ) , n.asString ( ) ) ; }
Source:
public static GroupDescription.Internal forAccountGroup ( com.google.gerrit.reviewdb.client.AccountGroup group ) { return new com.google.gerrit.common.data.GroupDescription.Internal ( ) { @ java.lang.Override public AccountGroup.UUID getGroupUUID ( ) { return group.getGroupUUID ( ) ; } @ java.lang.Override public java.lang.String getName ( ) { return group.getName ( ) ; } @ java.lang.Override public com.google.gerrit.reviewdb.client.AccountGroup getAccountGroup ( ) { return group ; } @ java.lang.Override @ com.google.gerrit.common.Nullable public java.lang.String getEmailAddress ( ) { return null ; } @ java.lang.Override @ com.google.gerrit.common.Nullable public java.lang.String getUrl ( ) { return "#" + ( com.google.gerrit.common.PageLinks.toGroup ( getGroupUUID ( ) ) ) ; } } ; }

Target:
public AccountGroup.Id getId ( ) { return group.getId ( ) ; }
Source:
private java.lang.String getBranchUrl ( java.lang.String projectName , java.lang.String branchName ) { com.google.gerrit.server.project.ProjectState state = projectCache.get ( new com.google.gerrit.reviewdb.client.Project.NameKey ( projectName ) ) ; if ( state == null ) { return null ; } return getFileUrl ( projectName , branchName , cfgFactory.create ( state ) . getIndexFile ( ) ) ; }

Target:
private java.lang.String getBranchUrl ( java.lang.String projectName , java.lang.String branchName ) { com.google.gerrit.server.project.ProjectState state = projectCache.get ( new com.google.gerrit.reviewdb.client.Project.NameKey ( projectName ) ) ; if ( state == null ) { return null ; } return getFileUrl ( projectName , branchName , cfgFactory.create ( state ) . getIndexFile ( ) , true ) ; }
Source:
public com.google.gerrit.server.data.PatchSetAttribute get ( ) { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( change.getProject ( ) ) ; org.eclipse.jgit.revwalk.RevWalk revWalk = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { return eventFactory.asPatchSetAttribute ( revWalk , patchSet ) ; } catch ( java.io.IOException e ) { throw com.google.common.base.Throwables.propagate ( e ) ; } }

Target:
public com.google.gerrit.server.data.PatchSetAttribute get ( ) { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( notes.getChange ( ) . getProject ( ) ) ; org.eclipse.jgit.revwalk.RevWalk revWalk = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { return eventFactory.asPatchSetAttribute ( revWalk , notes , patchSet ) ; } catch ( java.io.IOException e ) { throw com.google.common.base.Throwables.propagate ( e ) ; } }
Source:
private java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > addUsersSelfSymref ( java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > refs ) { if ( projectCtl.getUser ( ) . isIdentifiedUser ( ) ) { org.eclipse.jgit.lib.Ref r = refs.get ( com.google.gerrit.reviewdb.client.RefNames.refsUsers ( projectCtl.getUser ( ) . getAccountId ( ) ) ) ; if ( r != null ) { org.eclipse.jgit.lib.SymbolicRef s = new org.eclipse.jgit.lib.SymbolicRef ( com.google.gerrit.reviewdb.client.RefNames.REFS_USERS_SELF , r ) ; refs = new java.util.HashMap ( refs ) ; refs.put ( s.getName ( ) , s ) ; } } return refs ; }

Target:
private java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > addUsersSelfSymref ( java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > refs ) { if ( user.get ( ) . isIdentifiedUser ( ) ) { org.eclipse.jgit.lib.Ref r = refs.get ( com.google.gerrit.reviewdb.client.RefNames.refsUsers ( user.get ( ) . getAccountId ( ) ) ) ; if ( r != null ) { org.eclipse.jgit.lib.SymbolicRef s = new org.eclipse.jgit.lib.SymbolicRef ( com.google.gerrit.reviewdb.client.RefNames.REFS_USERS_SELF , r ) ; refs = new java.util.HashMap ( refs ) ; refs.put ( s.getName ( ) , s ) ; } } return refs ; }
Source:
boolean isSingleProjectMatch ( ) { java.lang.String [ ] projects = config.getProjects ( ) ; boolean ret = ( projects.length ) == 1 ; if ( ret ) { java.lang.String projectMatch = projects [ 0 ] ; if ( ( com.googlesource.gerrit.plugins.replication.ReplicationFilter.getPatternType ( projectMatch ) ) != ( ReplicationFilter.PatternType.EXACT_MATCH ) ) { ret = false ; } } return ret ; }

Target:
boolean isSingleProjectMatch ( ) { java.util.List < java.lang.String > projects = config.getProjects ( ) ; boolean ret = ( projects.size ( ) ) == 1 ; if ( ret ) { java.lang.String projectMatch = projects.get ( 0 ) ; if ( ( com.googlesource.gerrit.plugins.replication.ReplicationFilter.getPatternType ( projectMatch ) ) != ( ReplicationFilter.PatternType.EXACT_MATCH ) ) { ret = false ; } } return ret ; }
Source:
private com.google.gerrit.client.reviewdb.SystemConfig.LoginType getLoginType ( ) { java.lang.String type = getGerritConfig ( ) . getString ( "auth" , null , "type" ) ; if ( type == null ) { return com.google.gerrit.client.reviewdb.SystemConfig.LoginType.OPENID ; } for ( com.google.gerrit.client.reviewdb.SystemConfig.LoginType t : SystemConfig.LoginType.values ( ) ) { if ( type.equalsIgnoreCase ( t.name ( ) ) ) { return t ; } } throw new java.lang.IllegalStateException ( ( "Unsupported auth.type: " + type ) ) ; }

Target:
public com.google.gerrit.client.reviewdb.SystemConfig.LoginType getLoginType ( ) { java.lang.String type = getGerritConfig ( ) . getString ( "auth" , null , "type" ) ; if ( type == null ) { return com.google.gerrit.client.reviewdb.SystemConfig.LoginType.OPENID ; } for ( com.google.gerrit.client.reviewdb.SystemConfig.LoginType t : SystemConfig.LoginType.values ( ) ) { if ( type.equalsIgnoreCase ( t.name ( ) ) ) { return t ; } } throw new java.lang.IllegalStateException ( ( "Unsupported auth.type: " + type ) ) ; }
Source:
public static com.google.gerrit.reviewdb.client.Change newChange ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.server.IdentifiedUser user ) { com.google.gerrit.reviewdb.client.Change.Id changeId = new com.google.gerrit.reviewdb.client.Change.Id ( 1 ) ; com.google.gerrit.reviewdb.client.Change c = new com.google.gerrit.reviewdb.client.Change ( new com.google.gerrit.reviewdb.client.Change.Key ( "Iabcd1234abcd1234abcd1234abcd1234abcd1234" ) , changeId , user.getAccount ( ) . getId ( ) , new com.google.gerrit.reviewdb.client.Branch.NameKey ( project , "master" ) , com.google.gerrit.server.util.TimeUtil.nowTs ( ) ) ; com.google.gerrit.testutil.TestChanges.incrementPatchSet ( c ) ; return c ; }

Target:
public static com.google.gerrit.reviewdb.client.Change newChange ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.server.IdentifiedUser user , int id ) { com.google.gerrit.reviewdb.client.Change.Id changeId = new com.google.gerrit.reviewdb.client.Change.Id ( id ) ; com.google.gerrit.reviewdb.client.Change c = new com.google.gerrit.reviewdb.client.Change ( new com.google.gerrit.reviewdb.client.Change.Key ( "Iabcd1234abcd1234abcd1234abcd1234abcd1234" ) , changeId , user.getAccount ( ) . getId ( ) , new com.google.gerrit.reviewdb.client.Branch.NameKey ( project , "master" ) , com.google.gerrit.server.util.TimeUtil.nowTs ( ) ) ; com.google.gerrit.testutil.TestChanges.incrementPatchSet ( c ) ; return c ; }
Source:
public com.google.gerrit.server.group.GroupJson.GroupInfo apply ( com.google.gerrit.server.group.GroupResource resource ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException { com.google.gerrit.reviewdb.client.AccountGroup group = resource.toAccountGroup ( ) ; if ( group == null ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } try { com.google.gerrit.server.account.GroupControl c = controlFactory.validateFor ( group.getOwnerGroupUUID ( ) ) ; return json.addOption ( com.google.gerrit.common.groups.ListGroupsOption.OWNER ) . format ( c.getGroup ( ) ) ; } catch ( com.google.gerrit.common.errors.NoSuchGroupException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } }

Target:
public com.google.gerrit.server.group.GroupJson.GroupInfo apply ( com.google.gerrit.server.group.GroupResource resource ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup group = resource.toAccountGroup ( ) ; if ( group == null ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } try { com.google.gerrit.server.account.GroupControl c = controlFactory.validateFor ( group.getOwnerGroupUUID ( ) ) ; return json.format ( c.getGroup ( ) ) ; } catch ( com.google.gerrit.common.errors.NoSuchGroupException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } }
Source:
private boolean canUpdate ( ) { if ( ( RefNames.REFS_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { if ( ! ( ( projectControl.getProjectState ( ) . isAllProjects ( ) ) && ( projectControl.isAdmin ( ) ) ) ) { return false ; } } return ( canPerform ( Permission.PUSH ) ) && ( isProjectStatePermittingWrite ( ) ) ; }

Target:
private boolean canUpdate ( ) { if ( ( RefNames.REFS_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { if ( ! ( ( projectControl.getProjectState ( ) . isAllProjects ( ) ) && ( projectControl.isAdmin ( ) ) ) ) { return false ; } } return canPerform ( Permission.PUSH ) ; }
Source:
public void testAddTooLongPath ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit c = makeCommit ( ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = com.googlesource.gerrit.plugins.uploadvalidator.MaxPathLengthValidator.performValidation ( repo , c , com.googlesource.gerrit.plugins.uploadvalidator.MaxPathLengthValidatorTest.getMaxPathLength ( ) ) ; java.util.Set < java.lang.String > expected = com.google.common.collect.ImmutableSet.of ( ( "ERROR: path too long: " + ( com.googlesource.gerrit.plugins.uploadvalidator.MaxPathLengthValidatorTest.TOO_LONG ) ) ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactlyElementsIn ( expected ) ; }

Target:
public void testAddTooLongPath ( ) throws java.lang.Exception { try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { org.eclipse.jgit.revwalk.RevCommit c = makeCommit ( rw ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = com.googlesource.gerrit.plugins.uploadvalidator.MaxPathLengthValidator.performValidation ( repo , c , rw , com.googlesource.gerrit.plugins.uploadvalidator.MaxPathLengthValidatorTest.getMaxPathLength ( ) ) ; java.util.Set < java.lang.String > expected = com.google.common.collect.ImmutableSet.of ( ( "ERROR: path too long: " + ( com.googlesource.gerrit.plugins.uploadvalidator.MaxPathLengthValidatorTest.TOO_LONG ) ) ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactlyElementsIn ( expected ) ; } }
Source:
public void onGitReferenceUpdated ( com.google.gerrit.extensions.events.GitReferenceUpdatedListener.Event event ) { for ( com.google.gerrit.extensions.events.GitReferenceUpdatedListener.Update u : event.getUpdates ( ) ) { if ( u.getRefName ( ) . startsWith ( "refs/changes/" ) ) { cache.invalidate ( new com.google.gerrit.reviewdb.client.Project.NameKey ( event.getProjectName ( ) ) ) ; break ; } } }

Target:
public void onGitReferenceUpdated ( com.google.gerrit.extensions.events.GitReferenceUpdatedListener.Event event ) { if ( event.getRefName ( ) . startsWith ( "refs/changes/" ) ) { cache.invalidate ( new com.google.gerrit.reviewdb.client.Project.NameKey ( event.getProjectName ( ) ) ) ; } }
Source:
protected void assertNoSubmitter ( java.lang.String changeId , int psId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.notedb.ChangeNotes cn = notesFactory.create ( db , com.google.common.collect.Iterables.getOnlyElement ( queryProvider.get ( ) . byKeyPrefix ( changeId ) ) . change ( ) ) ; com.google.gerrit.reviewdb.client.PatchSetApproval submitter = approvalsUtil.getSubmitter ( db , cn , new com.google.gerrit.reviewdb.client.PatchSet.Id ( cn.getChangeId ( ) , psId ) ) ; com.google.common.truth.Truth.assertThat ( submitter ) . isNull ( ) ; }

Target:
protected void assertNoSubmitter ( java.lang.String changeId , int psId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change c = com.google.common.collect.Iterables.getOnlyElement ( queryProvider.get ( ) . byKeyPrefix ( changeId ) ) . change ( ) ; com.google.gerrit.server.notedb.ChangeNotes cn = notesFactory.create ( db , c.getProject ( ) , c.getId ( ) ) ; com.google.gerrit.reviewdb.client.PatchSetApproval submitter = approvalsUtil.getSubmitter ( db , cn , new com.google.gerrit.reviewdb.client.PatchSet.Id ( cn.getChangeId ( ) , psId ) ) ; com.google.common.truth.Truth.assertThat ( submitter ) . isNull ( ) ; }