auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( com.google.inject.Stage.PRODUCTION , new com.google.gerrit.server.config.DatabaseModule ( ) , new com.google.gerrit.server.config.GerritServerModule ( ) , new com.google.gerrit.server.ssh.SshDaemonModule ( ) , new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; com.google.gerrit.client.rpc.Common.setGerritConfig ( injector.getInstance ( com.google.gerrit.client.data.GerritConfig.class ) ) ; injector.getInstance ( com.google.gerrit.server.ssh.SshDaemon.class ) . start ( ) ; return never ( ) ; }

Target:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( com.google.inject.Stage.PRODUCTION , new com.google.gerrit.server.config.DatabaseModule ( ) , new com.google.gerrit.server.config.GerritGlobalModule ( ) , new com.google.gerrit.server.ssh.SshDaemonModule ( ) , new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; com.google.gerrit.client.rpc.Common.setGerritConfig ( injector.getInstance ( com.google.gerrit.client.data.GerritConfig.class ) ) ; injector.getInstance ( com.google.gerrit.server.ssh.SshDaemon.class ) . start ( ) ; return never ( ) ; }
Source:
public void fire ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.PatchSet patchSet , com.google.gerrit.reviewdb.client.Account.Id uploader ) { if ( ! ( listeners.iterator ( ) . hasNext ( ) ) ) { return ; } try { fire ( util.changeInfo ( change ) , util.revisionInfo ( change.getProject ( ) , patchSet ) , util.accountInfo ( uploader ) ) ; } catch ( com.google.gerrit.server.patch.PatchListNotAvailableException | com.google.gerrit.server.GpgException | java.io.IOException | com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.extensions.events.RevisionCreated.log.error ( "Couldn't fire event" , e ) ; } }

Target:
public void fire ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.PatchSet patchSet , com.google.gerrit.reviewdb.client.Account.Id uploader , java.sql.Timestamp when ) { if ( ! ( listeners.iterator ( ) . hasNext ( ) ) ) { return ; } try { fire ( util.changeInfo ( change ) , util.revisionInfo ( change.getProject ( ) , patchSet ) , util.accountInfo ( uploader ) , when ) ; } catch ( com.google.gerrit.server.patch.PatchListNotAvailableException | com.google.gerrit.server.GpgException | java.io.IOException | com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.extensions.events.RevisionCreated.log.error ( "Couldn't fire event" , e ) ; } }
Source:
public com.google.gerrit.server.index.ChangeIndex getWriteIndex ( int version ) { return writeIndexes.get ( version ) ; }

Target:
public synchronized void removeWriteIndex ( int version ) { int removeIndex = - 1 ; for ( int i = 0 ; i < ( writeIndexes.size ( ) ) ; i ++ ) { if ( ( writeIndexes.get ( i ) . getSchema ( ) . getVersion ( ) ) == version ) { removeIndex = i ; break ; } } if ( removeIndex >= 0 ) { writeIndexes.remove ( removeIndex ) ; } }
Source:
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.get ( id ) . map ( AccountState :: getGeneralPreferences ) . orElseThrow ( ( ) -> new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( com.google.gerrit.extensions.restapi.IdString.fromDecoded ( id.toString ( ) ) ) ) ; }

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.currentUser ( ) . check ( GlobalPermission.MODIFY_ACCOUNT ) ; } com.google.gerrit.reviewdb.client.Account.Id id = rsrc.getUser ( ) . getAccountId ( ) ; return accountCache.get ( id ) . map ( AccountState :: getGeneralPreferences ) . orElseThrow ( ( ) -> new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( com.google.gerrit.extensions.restapi.IdString.fromDecoded ( id.toString ( ) ) ) ) ; }
Source:
public synchronized void stop ( ) { if ( ( daemonAcceptor ) != null ) { try { daemonAcceptor.close ( true ) . await ( ) ; com.google.gerrit.sshd.SshDaemon.log.info ( "Stopped Gerrit SSHD" ) ; } catch ( java.lang.InterruptedException e ) { com.google.gerrit.sshd.SshDaemon.log.warn ( "Exception caught while closing" , e ) ; } finally { daemonAcceptor = null ; } } }

Target:
public synchronized void stop ( ) { if ( ( daemonAcceptor ) != null ) { try { daemonAcceptor.close ( true ) . await ( ) ; com.google.gerrit.sshd.SshDaemon.sshDaemonLog.info ( "Stopped Gerrit SSHD" ) ; } catch ( java.io.IOException e ) { com.google.gerrit.sshd.SshDaemon.sshDaemonLog.warn ( "Exception caught while closing" , e ) ; } finally { daemonAcceptor = null ; } } }
Source:
public void testPushForMasterAsDraft ( ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.git.ssh.PushForReviewIT.PushOneCommit push = new com.google.gerrit.acceptance.git.ssh.PushForReviewIT.PushOneCommit ( ) ; java.lang.String ref = "refs/drafts/master" ; org.eclipse.jgit.transport.PushResult r = push.to ( ref ) ; com.google.gerrit.acceptance.git.ssh.PushForReviewIT.assertOkStatus ( r , ref ) ; assertChange ( push.changeId , Change.Status.DRAFT , com.google.gerrit.acceptance.git.ssh.PushForReviewIT.PushOneCommit.SUBJECT , null ) ; push = new com.google.gerrit.acceptance.git.ssh.PushForReviewIT.PushOneCommit ( ) ; ref = "refs/for/master%draft" ; r = push.to ( ref ) ; com.google.gerrit.acceptance.git.ssh.PushForReviewIT.assertOkStatus ( r , ref ) ; assertChange ( push.changeId , Change.Status.DRAFT , com.google.gerrit.acceptance.git.ssh.PushForReviewIT.PushOneCommit.SUBJECT , null ) ; }

Target:
public void testPushForMasterAsDraft ( ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.git.PushForReviewIT.PushOneCommit push = new com.google.gerrit.acceptance.git.PushForReviewIT.PushOneCommit ( ) ; java.lang.String ref = "refs/drafts/master" ; org.eclipse.jgit.transport.PushResult r = push.to ( ref ) ; com.google.gerrit.acceptance.git.PushForReviewIT.assertOkStatus ( r , ref ) ; assertChange ( push.changeId , Change.Status.DRAFT , com.google.gerrit.acceptance.git.PushForReviewIT.PushOneCommit.SUBJECT , null ) ; push = new com.google.gerrit.acceptance.git.PushForReviewIT.PushOneCommit ( ) ; ref = "refs/for/master%draft" ; r = push.to ( ref ) ; com.google.gerrit.acceptance.git.PushForReviewIT.assertOkStatus ( r , ref ) ; assertChange ( push.changeId , Change.Status.DRAFT , com.google.gerrit.acceptance.git.PushForReviewIT.PushOneCommit.SUBJECT , null ) ; }
Source:
public static com.google.gerrit.client.account.AccountInfo asInfo ( com.google.gerrit.reviewdb.client.Account acct ) { if ( acct == null ) { return com.google.gerrit.client.account.AccountInfo.create ( 0 , null , null , null ) ; } return com.google.gerrit.client.account.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) , acct.getUserName ( ) ) ; }

Target:
public static com.google.gerrit.client.info.AccountInfo asInfo ( com.google.gerrit.reviewdb.client.Account acct ) { if ( acct == null ) { return com.google.gerrit.client.info.AccountInfo.create ( 0 , null , null , null ) ; } return com.google.gerrit.client.info.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) , acct.getUserName ( ) ) ; }
Source:
private com.google.gerrit.reviewdb.client.Change loadChangeFromDb ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( changeId ) ; com.google.common.base.Preconditions.checkNotNull ( change , "change %s not found in ReviewDb" , changeId ) ; com.google.common.base.Preconditions.checkArgument ( change.getProject ( ) . equals ( project ) , ( "passed project %s when creating ChangeNotes for %s, but actual" + " project is %s" ) , project , changeId , change.getProject ( ) ) ; return change ; }

Target:
private com.google.gerrit.reviewdb.client.Change loadChangeFromDb ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.server.notedb.ChangeNotes.readOneReviewDbChange ( db , changeId ) ; com.google.common.base.Preconditions.checkArgument ( ( project != null ) , "project is required" ) ; com.google.common.base.Preconditions.checkNotNull ( change , "change %s not found in ReviewDb" , changeId ) ; com.google.common.base.Preconditions.checkArgument ( change.getProject ( ) . equals ( project ) , ( "passed project %s when creating ChangeNotes for %s, but actual" + " project is %s" ) , project , changeId , change.getProject ( ) ) ; return change ; }
Source:
public void onShowView ( ) { super . onShowView ( ) ; if ( intralineFailure ) { intralineFailure = false ; new com.google.gerrit.client.ErrorDialog ( PatchUtil.C.intralineFailure ( ) ) . show ( ) ; } if ( ( ( topView ) != null ) && ( prefs.get ( ) . isRetainHeader ( ) ) ) { setTopView ( topView ) ; } }

Target:
public void onShowView ( ) { super . onShowView ( ) ; if ( intralineFailure ) { intralineFailure = false ; new com.google.gerrit.client.ErrorDialog ( PatchUtil.C.intralineFailure ( ) ) . show ( ) ; } else if ( intralineTimeout ) { intralineTimeout = false ; new com.google.gerrit.client.ErrorDialog ( PatchUtil.C.intralineTimeout ( ) ) . show ( ) ; } if ( ( ( topView ) != null ) && ( prefs.get ( ) . isRetainHeader ( ) ) ) { setTopView ( topView ) ; } }
Source:
public com.google.gerrit.common.data.GroupReference getValue ( ) { java.lang.String name = suggestBox.getText ( ) ; if ( ( name != null ) && ( ! ( name.isEmpty ( ) ) ) ) { return new com.google.gerrit.common.data.GroupReference ( oracle.getUUID ( name ) , name ) ; } else { return null ; } }

Target:
private com.google.gerrit.common.data.GroupReference toValue ( java.lang.String name ) { if ( ( name != null ) && ( ! ( name.isEmpty ( ) ) ) ) { return new com.google.gerrit.common.data.GroupReference ( oracle.getUUID ( name ) , name ) ; } return null ; }
Source:
private static java.lang.String time ( final long now , final long delay ) { final java.util.Date when = new java.util.Date ( ( now + delay ) ) ; if ( delay < ( ( ( 24 * 60 ) * 60 ) * 1000L ) ) { return new java.text.SimpleDateFormat ( "HH:mm:ss.SSS" ) . format ( when ) ; } return new java.text.SimpleDateFormat ( "MMM-dd HH:mm" ) . format ( when ) ; }

Target:
private static java.lang.String time ( final long now , final long delay ) { final java.util.Date when = new java.util.Date ( ( now + delay ) ) ; return com.google.gerrit.sshd.commands.ShowQueue.format ( when , delay ) ; }
Source:
com.google.gerrit.server.account.externalids.ExternalId get ( com.google.gerrit.server.account.externalids.ExternalId.Key key , org.eclipse.jgit.lib.ObjectId rev ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { checkReadEnabled ( ) ; if ( rev.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) ) ) { return null ; } try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsersName ) ; org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { return com.google.gerrit.server.account.externalids.ExternalIdReader.parse ( key , rw , rev ) ; } }

Target:
com.google.gerrit.server.account.externalids.ExternalId get ( com.google.gerrit.server.account.externalids.ExternalId.Key key ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { checkReadEnabled ( ) ; try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsersName ) ) { return com.google.gerrit.server.account.externalids.ExternalIdNotes.loadReadOnly ( repo ) . get ( key ) . orElse ( null ) ; } }
Source:
public void testSubmodulesParseWithSubProjectFound ( ) throws java.lang.Exception { java.util.Map < java.lang.String , com.google.gerrit.server.util.SubmoduleSection > sectionsToReturn = new java.util.TreeMap < > ( ) ; sectionsToReturn.put ( "a/b" , new com.google.gerrit.server.util.SubmoduleSection ( "ssh://localhost/a/b" , "a/b" , "." ) ) ; java.util.Map < java.lang.String , java.lang.String > reposToBeFound = new java.util.HashMap < > ( ) ; reposToBeFound.put ( "a/b" , "a/b" ) ; reposToBeFound.put ( "b" , "b" ) ; com.google.gerrit.reviewdb.client.Branch.NameKey superBranchNameKey = new com.google.gerrit.reviewdb.client.Branch.NameKey ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "super-project" ) , "refs/heads/master" ) ; com.google.gerrit.server.util.List < com.google.gerrit.reviewdb.client.SubmoduleSubscription > expectedSubscriptions = new com.google.gerrit.server.util.ArrayList ( ) ; expectedSubscriptions.add ( new com.google.gerrit.reviewdb.client.SubmoduleSubscription ( superBranchNameKey , new com.google.gerrit.reviewdb.client.Branch.NameKey ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "a/b" ) , "refs/heads/master" ) , "a/b" ) ) ; execute ( superBranchNameKey , sectionsToReturn , reposToBeFound , expectedSubscriptions ) ; }

Target:
public void testSubmodulesParseWithSubProjectFound ( ) throws java.lang.Exception { java.util.Map < java.lang.String , com.google.gerrit.server.util.SubmoduleSectionParserTest.SubmoduleSection > sectionsToReturn = new java.util.TreeMap < > ( ) ; sectionsToReturn.put ( "a/b" , new com.google.gerrit.server.util.SubmoduleSectionParserTest.SubmoduleSection ( "ssh://localhost/a/b" , "a/b" , "." ) ) ; java.util.Map < java.lang.String , java.lang.String > reposToBeFound = new java.util.HashMap < > ( ) ; reposToBeFound.put ( "a/b" , "a/b" ) ; reposToBeFound.put ( "b" , "b" ) ; com.google.gerrit.reviewdb.client.Branch.NameKey superBranchNameKey = new com.google.gerrit.reviewdb.client.Branch.NameKey ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "super-project" ) , "refs/heads/master" ) ; java.util.Set < com.google.gerrit.reviewdb.client.SubmoduleSubscription > expectedSubscriptions = com.google.common.collect.Sets.newHashSet ( ) ; expectedSubscriptions.add ( new com.google.gerrit.reviewdb.client.SubmoduleSubscription ( superBranchNameKey , new com.google.gerrit.reviewdb.client.Branch.NameKey ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "a/b" ) , "refs/heads/master" ) , "a/b" ) ) ; execute ( superBranchNameKey , sectionsToReturn , reposToBeFound , expectedSubscriptions ) ; }
Source:
public boolean canSeeMember ( com.google.gerrit.reviewdb.Account.Id id ) { return isVisible ( ) ; }

Target:
public boolean canSeeMember ( com.google.gerrit.reviewdb.Account.Id id ) { if ( ( ( user ) instanceof com.google.gerrit.server.IdentifiedUser ) && ( ( ( com.google.gerrit.server.IdentifiedUser ) ( user ) ) . getAccountId ( ) . equals ( id ) ) ) { return true ; } return canSeeMembers ( ) ; }
Source:
private void cleanCache ( ) { java.lang.ref.Reference < ? extends java.lang.ClassLoader > ref ; while ( ( ref = DEAD.poll ( ) ) != null ) { org.eclipse.jgit.lib.ObjectId key = ( ( com.google.gerrit.server.project.RulesCache.LoaderRef ) ( ref ) ) . key ; if ( ( classLoaderCache.get ( key ) ) == ref ) { classLoaderCache.remove ( key ) ; } } }

Target:
private void cleanCache ( ) { java.lang.ref.Reference < ? extends java.lang.ClassLoader > ref ; while ( ( ref = DEAD.poll ( ) ) != null ) { org.eclipse.jgit.lib.ObjectId key = ( ( com.google.gerrit.rules.RulesCache.LoaderRef ) ( ref ) ) . key ; if ( ( classLoaderCache.get ( key ) ) == ref ) { classLoaderCache.remove ( key ) ; } } }
Source:
public void changeProjectAccess ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ProjectAccess > cb ) { org.eclipse.jgit.lib.ObjectId base ; if ( ( baseRevision != null ) && ( ! ( baseRevision.isEmpty ( ) ) ) ) { base = org.eclipse.jgit.lib.ObjectId.fromString ( baseRevision ) ; } else { base = null ; } changeProjectAccessFactory.create ( projectName , base , sections , msg ) . to ( cb ) ; }

Target:
public void changeProjectAccess ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwtjsonrpc.common.AsyncCallback < com.google.gerrit.common.data.ProjectAccess > cb ) { org.eclipse.jgit.lib.ObjectId base ; if ( ( baseRevision != null ) && ( ! ( baseRevision.isEmpty ( ) ) ) ) { base = org.eclipse.jgit.lib.ObjectId.fromString ( baseRevision ) ; } else { base = null ; } changeProjectAccessFactory.create ( projectName , base , sections , msg ) . to ( cb ) ; }
Source:
private void checkResult ( org.eclipse.jgit.lib.RefUpdate.Result result ) throws com.google.gwtorm.server.OrmException { if ( ! ( refUpdated ( result ) ) ) { throw new com.google.gwtorm.server.OrmException ( ( ( ( "failed to update " + ( refName ) ) + ": " ) + result ) ) ; } }

Target:
private void checkResult ( org.eclipse.jgit.lib.RefUpdate.Result result ) throws com.google.gwtorm.server.OrmException { if ( ( ! ( refUpdated ( result ) ) ) && ( result != ( org.eclipse.jgit.lib.RefUpdate.Result.NO_CHANGE ) ) ) { throw new com.google.gwtorm.server.OrmException ( ( ( ( "failed to update " + ( refName ) ) + ": " ) + result ) ) ; } }
Source:
static void deleteSessionCookie ( ) { com.google.gerrit.client.Gerrit.myAccount = null ; com.google.gerrit.client.Gerrit.myAccountDiffPref = null ; com.google.gerrit.client.Gerrit.xGerritAuth = null ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; com.google.gwt.user.client.Cookies.removeCookie ( "GerritAccount" ) ; }

Target:
static void deleteSessionCookie ( ) { com.google.gerrit.client.Gerrit.myAccount = com.google.gerrit.client.info.AccountInfo.create ( 0 , null , null , null ) ; com.google.gerrit.client.Gerrit.myAccountDiffPref = null ; com.google.gerrit.client.Gerrit.editPrefs = null ; com.google.gerrit.client.Gerrit.myPrefs = com.google.gerrit.client.info.GeneralPreferences.createDefault ( ) ; com.google.gerrit.client.Gerrit.urlAliasMatcher.clearUserAliases ( ) ; com.google.gerrit.client.Gerrit.xGerritAuth = null ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; com.google.gwt.user.client.Cookies.removeCookie ( "GerritAccount" ) ; }
Source:
public boolean updateChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change change = ctx.getChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId = change.currentPatchSetId ( ) ; com.google.gerrit.reviewdb.client.ChangeMessage changeMessage = com.google.gerrit.server.ChangeMessagesUtil.newMessage ( ctx , ( "Created a revert of this change as I" + ( computedChangeId.name ( ) ) ) ) ; cmUtil.addChangeMessage ( ctx.getDb ( ) , ctx.getUpdate ( patchSetId ) , changeMessage ) ; return true ; }

Target:
public boolean updateChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change change = ctx.getChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId = change.currentPatchSetId ( ) ; com.google.gerrit.reviewdb.client.ChangeMessage changeMessage = com.google.gerrit.server.ChangeMessagesUtil.newMessage ( ctx , ( "Created a revert of this change as I" + ( computedChangeId.name ( ) ) ) , ChangeMessagesUtil.TAG_REVERT ) ; cmUtil.addChangeMessage ( ctx.getDb ( ) , ctx.getUpdate ( patchSetId ) , changeMessage ) ; return true ; }
Source:
protected void applyDataRowStyle ( final int row ) { super . applyDataRowStyle ( row ) ; final com.google.gwt.user.client.ui.HTMLTable.CellFormatter fmt = table.getCellFormatter ( ) ; fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_STAR , com.google.gerrit.client.changes.S_ICON_CELL ) ; for ( int i = com.google.gerrit.client.changes.ChangeTable.C_ID ; i < ( com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; i ++ ) { fmt.addStyleName ( row , i , com.google.gerrit.client.changes.S_DATA_CELL ) ; } fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_ID , com.google.gerrit.client.changes.ChangeTable.S_C_ID ) ; fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_SUBJECT , com.google.gerrit.client.changes.ChangeTable.S_C_SUBJECT ) ; }

Target:
protected void applyDataRowStyle ( final int row ) { super . applyDataRowStyle ( row ) ; final com.google.gwt.user.client.ui.HTMLTable.CellFormatter fmt = table.getCellFormatter ( ) ; fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_STAR , com.google.gerrit.client.changes.S_ICON_CELL ) ; for ( int i = com.google.gerrit.client.changes.ChangeTable.C_ID ; i < ( com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; i ++ ) { fmt.addStyleName ( row , i , com.google.gerrit.client.changes.S_DATA_CELL ) ; } fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_ID , com.google.gerrit.client.changes.ChangeTable.S_C_ID ) ; fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_SUBJECT , com.google.gerrit.client.changes.ChangeTable.S_C_SUBJECT ) ; fmt.addStyleName ( row , com.google.gerrit.client.changes.ChangeTable.C_LAST_UPDATE , com.google.gerrit.client.changes.ChangeTable.S_C_LAST_UPDATE ) ; }
Source:
public void subsetOfBranchesVisibleIncludingHead ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; setApiUser ( user ) ; assertRefs ( "HEAD" , ( ( r1 ) + "1" ) , ( ( r1 ) + "meta" ) , "refs/heads/master" , "refs/tags/master-tag" ) ; }

Target:
public void uploadPackSubsetOfBranchesVisibleIncludingHead ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; setApiUser ( user ) ; assertUploadPackRefs ( "HEAD" , ( ( r1 ) + "1" ) , ( ( r1 ) + "meta" ) , "refs/heads/master" , "refs/tags/master-tag" ) ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.HostPageData result ) { com.google.gwt.dom.client.Document.get ( ) . getElementById ( "gerrit_hostpagedata" ) . removeFromParent ( ) ; com.google.gerrit.client.Gerrit.myConfig = result.config ; com.google.gerrit.client.Gerrit.myTheme = result.theme ; if ( ( result.account ) != null ) { com.google.gerrit.client.Gerrit.myAccount = result.account ; com.google.gerrit.client.Gerrit.xGerritAuth = result.xGerritAuth ; } if ( ( result.accountDiffPref ) != null ) { com.google.gerrit.client.Gerrit.myAccountDiffPref = result.accountDiffPref ; com.google.gerrit.client.Gerrit.applyUserPreferences ( ) ; } onModuleLoad2 ( result ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.account.EditPreferences prefs ) { com.google.gerrit.extensions.client.EditPreferencesInfo prefsInfo = new com.google.gerrit.extensions.client.EditPreferencesInfo ( ) ; prefs.copyTo ( prefsInfo ) ; com.google.gerrit.client.Gerrit.editPrefs = prefsInfo ; }
Source:
public void go ( ) { if ( ( com.google.gerrit.client.Gerrit.patchScreen ) != null ) { com.google.gerrit.client.Gerrit.patchScreen.setTopView ( PatchScreen.TopView.MAIN ) ; if ( type == ( com.google.gerrit.client.Gerrit.patchScreen.getPatchScreenType ( ) ) ) { com.google.gwt.dom.client.AnchorElement.as ( getElement ( ) ) . blur ( ) ; } else { new com.google.gerrit.client.ui.PatchLink ( "" , type , com.google.gerrit.client.Gerrit.patchScreen ) . go ( ) ; } } }

Target:
public void onScreenLoad ( com.google.gerrit.client.ui.ScreenLoadEvent event ) { com.google.gerrit.client.ui.Screen screen = event.getScreen ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectKey ; if ( screen instanceof com.google.gerrit.client.admin.ProjectScreen ) { projectKey = ( ( com.google.gerrit.client.admin.ProjectScreen ) ( screen ) ) . getProjectKey ( ) ; } else { projectKey = com.google.gerrit.client.admin.ProjectScreen.getSavedKey ( ) ; } if ( projectKey != null ) { setVisible ( true ) ; setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( projectKey , panel ) ) ; } else { setVisible ( false ) ; } super . onScreenLoad ( event ) ; }
Source:
void doReply ( ) { if ( ! ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) ) { com.google.gerrit.client.Gerrit.doSignIn ( getDiffScreen ( ) . getToken ( ) ) ; } else if ( ( replyBox ) == null ) { com.google.gerrit.client.diff.DraftBox box = addReplyBox ( ) ; if ( ! ( getCommentInfo ( ) . has_line ( ) ) ) { getDiffScreen ( ) . addFileCommentBox ( box ) ; } } else { openReplyBox ( ) ; } }

Target:
void doReply ( ) { if ( ! ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) ) { com.google.gerrit.client.Gerrit.doSignIn ( getCommentManager ( ) . getSideBySide2 ( ) . getToken ( ) ) ; } else if ( ( replyBox ) == null ) { com.google.gerrit.client.diff.DraftBox box = addReplyBox ( ) ; if ( ! ( getCommentInfo ( ) . has_line ( ) ) ) { getCommentManager ( ) . addFileCommentBox ( box ) ; } } else { openReplyBox ( ) ; } }
Source:
public void isEnabledForMultipleRefs ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig config = getConfig ( ( "[plugin \"uploadvalidator\"]\n" + ( ( " ref = refs/heads/branch1\n" + " ref = refs/heads/branch2\n" ) + " blockedFileExtension = jar" ) ) ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( projectName , "refs/heads/branch1" , "blockedFileExtension" ) ) . isTrue ( ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( projectName , "refs/heads/branch2" , "blockedFileExtension" ) ) . isTrue ( ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( projectName , "refs/heads/branch3" , "blockedFileExtension" ) ) . isFalse ( ) ; }

Target:
public void isEnabledForRegexRef ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig config = getConfig ( ( "[plugin \"uploadvalidator\"]\n" + ( " ref = ^refs/heads/mybranch.*\n" + " blockedFileExtension = jar" ) ) ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( anyUser , projectName , "refs/heads/anotherref" , "blockedFileExtension" ) ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( anyUser , projectName , "refs/heads/mybranch123" , "blockedFileExtension" ) ) . isTrue ( ) ; }
Source:
public void parsePatchSetId ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( "\n" + "Patch-Set: 1\n" ) ) ) ; assertParseFails ( ( "Update change\n" + "\n" ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Patch-Set: 1\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( "\n" + "Patch-Set: 1\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( "\n" + "Patch-Set: x\n" ) ) ) ; }

Target:
public void parsePatchSetId ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( "\n" + "Branch: refs/heads/master\n" ) + "Patch-Set: 1\n" ) ) ) ; assertParseFails ( ( "Update change\n" + "\n" ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Patch-Set: 1\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( "\n" + "Branch: refs/heads/master\n" ) + "Patch-Set: 1\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( "\n" + "Patch-Set: x\n" ) ) ) ; }
Source:
private java.util.List < com.google.gerrit.server.project.ChangeControl > asChangeControls ( java.util.List < com.google.gerrit.server.query.change.ChangeData > cds ) throws com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.server.project.ChangeControl > ctls = new java.util.ArrayList ( cds.size ( ) ) ; for ( com.google.gerrit.server.query.change.ChangeData cd : cds ) { ctls.add ( cd.changeControl ( user.get ( ) ) ) ; } return ctls ; }

Target:
public java.util.List < com.google.gerrit.server.project.ChangeControl > findChanges ( com.google.gerrit.reviewdb.client.Change.Id id , com.google.gerrit.server.CurrentUser user ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.InternalChangeQuery query = queryProvider.get ( ) . setRequestedFields ( com.google.common.collect.ImmutableSet.< java.lang.String > of ( ) ) ; return asChangeControls ( query.byLegacyChangeId ( id ) , user ) ; }
Source:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > submitRecords ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( ( submitRecords ) == null ) { submitRecords = new java.util.HashMap < > ( ) ; } java.util.List < com.google.gerrit.common.data.SubmitRecord > records = submitRecords.get ( cd.getId ( ) ) ; if ( records == null ) { records = new com.google.gerrit.server.project.SubmitRuleEvaluator ( cd ) . setFastEvalLabels ( true ) . setAllowDraft ( true ) . evaluate ( ) ; submitRecords.put ( cd.getId ( ) , records ) ; } return records ; }

Target:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > submitRecords ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { return cd.submitRecords ( com.google.gerrit.server.change.ChangeJson.SUBMIT_RULE_OPTIONS ) ; }
Source:
public void abandonWipChangeNotifyAll ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; abandon ( sc.changeId , sc.owner , com.google.gerrit.extensions.api.changes.NotifyHandling.ALL ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . notTo ( sc.owner ) . cc ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }

Target:
public void abandonWipChangeNotifyAll ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; abandon ( sc.changeId , sc.owner , com.google.gerrit.acceptance.server.mail.ALL ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . notTo ( sc.owner ) . cc ( sc.reviewer , sc.ccer ) . to ( sc.reviewerByEmail ) . cc ( sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }
Source:
private com.google.gerrit.server.change.ReviewerJson.PostResult putAccount ( com.google.gerrit.server.change.ReviewerResource rsrc ) throws com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.reviewdb.client.Account member = rsrc.getUser ( ) . getAccount ( ) ; com.google.gerrit.server.project.ChangeControl control = rsrc.getControl ( ) ; com.google.gerrit.server.change.ReviewerJson.PostResult result = new com.google.gerrit.server.change.ReviewerJson.PostResult ( ) ; if ( isValidReviewer ( member , control ) ) { addReviewers ( rsrc , result , com.google.common.collect.ImmutableMap.of ( member.getId ( ) , control ) ) ; } return result ; }

Target:
private com.google.gerrit.server.change.ReviewerJson.PostResult putAccount ( com.google.gerrit.server.change.ReviewerResource rsrc ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Account member = rsrc.getReviewerUser ( ) . getAccount ( ) ; com.google.gerrit.server.project.ChangeControl control = rsrc.getReviewerControl ( ) ; com.google.gerrit.server.change.ReviewerJson.PostResult result = new com.google.gerrit.server.change.ReviewerJson.PostResult ( ) ; if ( isValidReviewer ( member , control ) ) { addReviewers ( rsrc.getChangeResource ( ) , result , com.google.common.collect.ImmutableMap.of ( member.getId ( ) , control ) ) ; } return result ; }
Source:
public void doFilter ( javax.servlet.ServletRequest request , javax.servlet.ServletResponse response , javax.servlet.FilterChain chain ) throws java.io.IOException , javax.servlet.ServletException { if ( ( user.get ( ) ) instanceof com.google.gerrit.server.IdentifiedUser ) { chain.doFilter ( request , response ) ; } else { javax.servlet.http.HttpServletResponse res = ( ( javax.servlet.http.HttpServletResponse ) ( response ) ) ; res.sendError ( HttpServletResponse.SC_UNAUTHORIZED ) ; } }

Target:
public void doFilter ( javax.servlet.ServletRequest request , javax.servlet.ServletResponse response , javax.servlet.FilterChain chain ) throws java.io.IOException , javax.servlet.ServletException { if ( user.get ( ) . isIdentifiedUser ( ) ) { chain.doFilter ( request , response ) ; } else { javax.servlet.http.HttpServletResponse res = ( ( javax.servlet.http.HttpServletResponse ) ( response ) ) ; res.sendError ( HttpServletResponse.SC_UNAUTHORIZED ) ; } }
Source:
protected void configure ( ) { bind ( ChangeIndex.Manager.class ) . to ( com.google.gerrit.lucene.LuceneChangeIndexManager.class ) ; bind ( com.google.gerrit.server.index.ChangeIndexer.class ) . to ( com.google.gerrit.server.index.ChangeIndexerImpl.class ) ; bind ( com.google.gerrit.server.query.change.IndexRewrite.class ) . to ( com.google.gerrit.server.query.change.IndexRewriteImpl.class ) ; listener ( ) . to ( com.google.gerrit.lucene.LuceneChangeIndexManager.class ) ; if ( checkVersion ) { listener ( ) . to ( com.google.gerrit.lucene.IndexVersionCheck.class ) ; } }

Target:
protected void configure ( ) { install ( new com.google.gerrit.server.index.IndexModule ( threads ) ) ; bind ( ChangeIndex.Manager.class ) . to ( com.google.gerrit.lucene.LuceneChangeIndexManager.class ) ; listener ( ) . to ( com.google.gerrit.lucene.LuceneChangeIndexManager.class ) ; if ( checkVersion ) { listener ( ) . to ( com.google.gerrit.lucene.IndexVersionCheck.class ) ; } }
Source:
private void review ( com.google.gerrit.acceptance.TestAccount account , java.lang.String changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy strategy , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.NotifyHandling notify ) throws java.lang.Exception { setEmailStrategy ( account , strategy ) ; com.google.gerrit.extensions.api.changes.ReviewInput in = com.google.gerrit.extensions.api.changes.ReviewInput.recommend ( ) ; in.notify = notify ; gApi.changes ( ) . id ( changeId ) . revision ( "current" ) . review ( in ) ; }

Target:
private void review ( com.google.gerrit.acceptance.TestAccount account , java.lang.String changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy strategy , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.NotifyHandling notify , @ com.google.gerrit.common.Nullable java.lang.String tag ) throws java.lang.Exception { setEmailStrategy ( account , strategy ) ; com.google.gerrit.extensions.api.changes.ReviewInput in = com.google.gerrit.extensions.api.changes.ReviewInput.recommend ( ) ; in.notify = notify ; in.tag = tag ; gApi.changes ( ) . id ( changeId ) . revision ( "current" ) . review ( in ) ; }
Source:
private void assertChangeUpToDate ( boolean expected , com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openMetadataRepository ( project ) ) { com.google.gerrit.reviewdb.client.Change c = unwrapDb ( ) . changes ( ) . get ( id ) ; com.google.common.truth.Truth.assertThat ( c ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( c.getNoteDbState ( ) ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.notedb.NoteDbChangeState.parse ( c ) . isChangeUpToDate ( repo ) ) . isEqualTo ( expected ) ; } }

Target:
private void assertChangeUpToDate ( boolean expected , com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( project ) ) { com.google.gerrit.reviewdb.client.Change c = unwrapDb ( ) . changes ( ) . get ( id ) ; com.google.common.truth.Truth.assertThat ( c ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( c.getNoteDbState ( ) ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.notedb.NoteDbChangeState.parse ( c ) . isChangeUpToDate ( repo ) ) . isEqualTo ( expected ) ; } }
Source:
public void projectDetail ( final com.google.gerrit.reviewdb.Project.NameKey projectName , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ProjectDetail > callback ) { projectDetailFactory.create ( projectName ) . to ( callback ) ; }

Target:
public void changeProjectAccess ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwtjsonrpc.common.AsyncCallback < com.google.gerrit.common.data.ProjectAccess > cb ) { org.eclipse.jgit.lib.ObjectId base ; if ( ( baseRevision != null ) && ( ! ( baseRevision.isEmpty ( ) ) ) ) { base = org.eclipse.jgit.lib.ObjectId.fromString ( baseRevision ) ; } else { base = null ; } changeProjectAccessFactory.create ( projectName , base , sections , msg ) . to ( cb ) ; }
Source:
protected org.eclipse.jgit.junit.TestRepository < ? > createProjectWithPush ( java.lang.String name , @ com.google.gerrit.common.Nullable com.google.gerrit.reviewdb.client.Project.NameKey parent , com.google.gerrit.extensions.client.SubmitType submitType ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Project.NameKey project = createProject ( name , parent , submitType ) ; grant ( Permission.PUSH , project , "refs/heads/*" ) ; grant ( Permission.SUBMIT , project , "refs/for/refs/heads/*" ) ; return cloneProject ( project ) ; }

Target:
protected org.eclipse.jgit.junit.TestRepository < ? > createProjectWithPush ( java.lang.String name , @ com.google.gerrit.common.Nullable com.google.gerrit.reviewdb.client.Project.NameKey parent , boolean createEmptyCommit , com.google.gerrit.extensions.client.SubmitType submitType ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Project.NameKey project = createProject ( name , parent , createEmptyCommit , submitType ) ; grant ( Permission.PUSH , project , "refs/heads/*" ) ; grant ( Permission.SUBMIT , project , "refs/for/refs/heads/*" ) ; return cloneProject ( project ) ; }
Source:
private java.util.List < com.google.gerrit.extensions.api.projects.BranchInfo > listBranches ( com.google.gerrit.server.api.projects.ListRefsRequest < com.google.gerrit.extensions.api.projects.BranchInfo > request ) throws com.google.gerrit.extensions.restapi.RestApiException { listBranches.setLimit ( request.getLimit ( ) ) ; listBranches.setStart ( request.getStart ( ) ) ; listBranches.setMatchSubstring ( request.getSubstring ( ) ) ; listBranches.setMatchRegex ( request.getRegex ( ) ) ; try { return listBranches.apply ( checkExists ( ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot list branches" , e ) ; } }

Target:
public java.util.List < com.google.gerrit.extensions.api.projects.BranchInfo > get ( ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return listBranches.get ( ) . request ( this ) . apply ( checkExists ( ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot list branches" , e ) ; } }
Source:
public void noRescheduleOnSuccess ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.OK_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verifyZeroInteractions ( executor ) ; }

Target:
public void noRescheduleOnSuccess ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( remote ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.OK_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verifyZeroInteractions ( executor ) ; }
Source:
public void testHeadRefReplicated ( ) throws java.net.URISyntaxException { org.easymock.EasyMock.reset ( dispatcherMock ) ; com.googlesource.gerrit.plugins.replication.RefReplicatedEvent expectedEvent = new com.googlesource.gerrit.plugins.replication.RefReplicatedEvent ( "someProject" , "refs/heads/master" , "someHost" , com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult.SUCCEEDED ) ; dispatcherMock.postEvent ( org.easymock.EasyMock.anyObject ( Branch.NameKey.class ) , com.googlesource.gerrit.plugins.replication.RefReplicatedEventEquals.eqEvent ( expectedEvent ) ) ; org.easymock.EasyMock.expectLastCall ( ) . once ( ) ; org.easymock.EasyMock.replay ( dispatcherMock ) ; gitUpdateProcessing.onRefReplicatedToOneNode ( "someProject" , "refs/heads/master" , new org.eclipse.jgit.transport.URIish ( "git://someHost/someProject.git" ) , RefPushResult.SUCCEEDED ) ; org.easymock.EasyMock.verify ( dispatcherMock ) ; }

Target:
public void testHeadRefReplicated ( ) throws java.net.URISyntaxException { org.easymock.EasyMock.reset ( dispatcherMock ) ; com.googlesource.gerrit.plugins.replication.RefReplicatedEvent expectedEvent = new com.googlesource.gerrit.plugins.replication.RefReplicatedEvent ( "someProject" , "refs/heads/master" , "someHost" , com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult.SUCCEEDED , RemoteRefUpdate.Status.OK ) ; dispatcherMock.postEvent ( org.easymock.EasyMock.anyObject ( Branch.NameKey.class ) , com.googlesource.gerrit.plugins.replication.RefReplicatedEventEquals.eqEvent ( expectedEvent ) ) ; org.easymock.EasyMock.expectLastCall ( ) . once ( ) ; org.easymock.EasyMock.replay ( dispatcherMock ) ; gitUpdateProcessing.onRefReplicatedToOneNode ( "someProject" , "refs/heads/master" , new org.eclipse.jgit.transport.URIish ( "git://someHost/someProject.git" ) , RefPushResult.SUCCEEDED , RemoteRefUpdate.Status.OK ) ; org.easymock.EasyMock.verify ( dispatcherMock ) ; }
Source:
public void onSuccess ( final java.util.List < com.google.gerrit.reviewdb.client.Project.NameKey > result ) { final java.util.ArrayList < com.google.gerrit.client.ui.ProjectNameSuggestOracle.ProjectNameSuggestion > r = new java.util.ArrayList < com.google.gerrit.client.ui.ProjectNameSuggestOracle.ProjectNameSuggestion > ( result.size ( ) ) ; for ( final com.google.gerrit.reviewdb.client.Project.NameKey p : result ) { r.add ( new com.google.gerrit.client.ui.ProjectNameSuggestOracle.ProjectNameSuggestion ( p ) ) ; } callback.onSuggestionsReady ( req , new com.google.gerrit.client.ui.Response ( r ) ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.projects.ProjectMap map ) { callback.onSuggestionsReady ( req , new com.google.gerrit.client.ui.Response ( map.values ( ) . asList ( ) ) ) ; }
Source:
public com.google.gerrit.reviewdb.client.PatchSetApproval getSubmitter ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.reviewdb.client.PatchSet.Id c ) { if ( c == null ) { return null ; } try { return com.google.gerrit.server.ApprovalsUtil.getSubmitter ( c , byPatchSet ( db , notes , c ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { return null ; } }

Target:
public com.google.gerrit.reviewdb.client.PatchSetApproval getSubmitter ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.reviewdb.client.PatchSet.Id c ) { if ( c == null ) { return null ; } try { return com.google.gerrit.server.ApprovalsUtil.getSubmitter ( c , byChange ( db , notes ) . get ( c ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { return null ; } }
Source:
javax.naming.directory.DirContext authenticate ( java.lang.String dn , java.lang.String password ) throws com.google.gerrit.server.account.AccountException { final java.util.Properties env = createContextProperties ( ) ; env.put ( javax.naming.Context.SECURITY_AUTHENTICATION , "simple" ) ; env.put ( javax.naming.Context.SECURITY_PRINCIPAL , dn ) ; env.put ( javax.naming.Context.SECURITY_CREDENTIALS , password ) ; env.put ( javax.naming.Context.REFERRAL , referral ) ; try { return new javax.naming.directory.InitialDirContext ( env ) ; } catch ( javax.naming.NamingException e ) { throw new com.google.gerrit.server.account.AuthenticationFailedException ( "Incorrect username or password" , e ) ; } }

Target:
void close ( javax.naming.directory.DirContext ctx ) { try { javax.naming.ldap.StartTlsResponse tls = ( ( javax.naming.ldap.StartTlsResponse ) ( ctx.removeFromEnvironment ( com.google.gerrit.server.auth.ldap.Helper.STARTTLS_PROPERTY ) ) ) ; if ( tls != null ) { tls.close ( ) ; } } catch ( java.io.IOException | javax.naming.NamingException e ) { com.google.gerrit.server.auth.ldap.Helper.log.warn ( "Cannot close LDAP startTls handle" , e ) ; } try { ctx.close ( ) ; } catch ( javax.naming.NamingException e ) { com.google.gerrit.server.auth.ldap.Helper.log.warn ( "Cannot close LDAP handle" , e ) ; } }
Source:
public void noChangeMessage ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChange ( ) ; com.google.gerrit.server.notedb.ChangeUpdate update = newUpdate ( c , changeOwner ) ; update.putReviewer ( changeOwner.getAccount ( ) . getId ( ) , com.google.gerrit.server.notedb.ReviewerState.REVIEWER ) ; update.commit ( ) ; org.eclipse.jgit.revwalk.RevWalk walk = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ; try { org.eclipse.jgit.revwalk.RevCommit commit = walk.parseCommit ( update.getRevision ( ) ) ; walk.parseBody ( commit ) ; org.junit.Assert.assertEquals ( ( "Update patch set 1\n" + ( ( "\n" + "Patch-set: 1\n" ) + "Reviewer: Change Owner <1@gerrit>\n" ) ) , commit.getFullMessage ( ) ) ; } finally { walk.release ( ) ; } com.google.gerrit.server.notedb.ChangeNotes notes = newNotes ( c ) ; com.google.common.collect.ListMultimap < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.ChangeMessage > changeMessages = notes.getChangeMessages ( ) ; org.junit.Assert.assertEquals ( 0 , changeMessages.keySet ( ) . size ( ) ) ; }

Target:
public void noChangeMessage ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChange ( ) ; com.google.gerrit.server.notedb.ChangeUpdate update = newUpdate ( c , changeOwner ) ; update.putReviewer ( changeOwner.getAccount ( ) . getId ( ) , com.google.gerrit.server.notedb.ReviewerState.REVIEWER ) ; update.commit ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = newNotes ( c ) ; com.google.common.collect.ListMultimap < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.ChangeMessage > changeMessages = notes.getChangeMessages ( ) ; org.junit.Assert.assertEquals ( 0 , changeMessages.keySet ( ) . size ( ) ) ; }