auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void unblockLargerScope_Fails ( ) { com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/master" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertCannotUpdate ( "refs/heads/master" , u ) ; }

Target:
public void unblockOtherPermissionWithMoreSpecificRefAndExclusiveFlag_Fails ( ) { com.google.gerrit.server.project.testing.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/master" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/master" , true ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCannotUpdate ( "refs/heads/master" , u ) ; }
Source:
private java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.server.PatchSetVerification > scanLabels ( com.google.gerrit.server.change.RevisionResource resource , com.googlesource.gerrit.plugins.verifystatus.server.CiDb db ) throws com.google.gwtorm.server.OrmException { java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.server.PatchSetVerification > current = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.googlesource.gerrit.plugins.verifystatus.server.PatchSetVerification v : db.patchSetVerifications ( ) . byPatchSet ( resource.getPatchSet ( ) . getId ( ) ) ) { current.put ( v.getLabelId ( ) . get ( ) , v ) ; } return current ; }

Target:
private java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.server.PatchSetVerification > scanLabels ( com.google.gerrit.server.change.RevisionResource resource , com.googlesource.gerrit.plugins.verifystatus.server.CiDb db ) throws com.google.gwtorm.server.OrmException { java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.server.PatchSetVerification > current = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.googlesource.gerrit.plugins.verifystatus.server.PatchSetVerification v : db.patchSetVerifications ( ) . byPatchSet ( resource.getPatchSet ( ) . getId ( ) ) ) { current.put ( v.getJobId ( ) . get ( ) , v ) ; } return current ; }
Source:
private static java.util.List < java.lang.String > getMatchingRefNames ( java.util.Set < org.eclipse.jgit.lib.Ref > matchingRefs , java.util.Set < org.eclipse.jgit.lib.Ref > allRefs ) { java.util.List < java.lang.String > refNames = new java.util.ArrayList < java.lang.String > ( ) ; for ( org.eclipse.jgit.lib.Ref matchingRef : matchingRefs ) { if ( allRefs.contains ( matchingRef ) ) { refNames.add ( org.eclipse.jgit.lib.Repository.shortenRefName ( matchingRef.getName ( ) ) ) ; } } return refNames ; }

Target:
private static java.util.List < java.lang.String > getMatchingRefNames ( java.util.Set < java.lang.String > matchingRefs , java.util.Collection < org.eclipse.jgit.lib.Ref > allRefs ) { java.util.List < java.lang.String > refNames = com.google.common.collect.Lists.newArrayListWithCapacity ( matchingRefs.size ( ) ) ; for ( org.eclipse.jgit.lib.Ref r : allRefs ) { if ( matchingRefs.contains ( r.getName ( ) ) ) { refNames.add ( org.eclipse.jgit.lib.Repository.shortenRefName ( r.getName ( ) ) ) ; } } return refNames ; }
Source:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.git.ProjectConfig cfg ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { com.google.gerrit.server.git.MetaDataUpdate md = new com.google.gerrit.server.git.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , cfg.getProject ( ) . getNameKey ( ) , db ) ; util.tick ( 5 ) ; util.setAuthorAndCommitter ( md.getCommitBuilder ( ) ) ; md.setMessage ( "Edit\n" ) ; cfg.commit ( md ) ; org.eclipse.jgit.lib.Ref ref = db.getRef ( GitRepositoryManager.REF_CONFIG ) ; return util.getRevWalk ( ) . parseCommit ( ref.getObjectId ( ) ) ; }

Target:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.git.ProjectConfig cfg ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { com.google.gerrit.server.git.MetaDataUpdate md = new com.google.gerrit.server.git.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , cfg.getProject ( ) . getNameKey ( ) , db ) ; util.tick ( 5 ) ; util.setAuthorAndCommitter ( md.getCommitBuilder ( ) ) ; md.setMessage ( "Edit\n" ) ; cfg.commit ( md ) ; org.eclipse.jgit.lib.Ref ref = db.getRef ( RefNames.REFS_CONFIG ) ; return util.getRevWalk ( ) . parseCommit ( ref.getObjectId ( ) ) ; }
Source:
public void testCreate_NonEmpty ( ) throws java.io.IOException { final java.io.File root = random ( ) ; final java.io.File txt = new java.io.File ( root , "test.txt" ) ; try { assertTrue ( root.mkdir ( ) ) ; assertTrue ( txt.createNewFile ( ) ) ; final com.google.gerrit.server.config.SitePaths site = new com.google.gerrit.server.config.SitePaths ( root ) ; assertFalse ( site.isNew ) ; assertEquals ( root , site.site_path ) ; } finally { txt.delete ( ) ; root.delete ( ) ; } }

Target:
public void testCreate_NonEmpty ( ) throws java.io.IOException { final java.io.File root = com.google.gerrit.server.config.SitePathsTest.random ( ) ; final java.io.File txt = new java.io.File ( root , "test.txt" ) ; try { assertTrue ( root.mkdir ( ) ) ; assertTrue ( txt.createNewFile ( ) ) ; final com.google.gerrit.server.config.SitePaths site = new com.google.gerrit.server.config.SitePaths ( root ) ; assertFalse ( site.isNew ) ; assertEquals ( root , site.site_path ) ; } finally { txt.delete ( ) ; root.delete ( ) ; } }
Source:
private void updateMeter ( ) { progress.setValue ( ( ( 100 * ( row ) ) / ( list.length ( ) ) ) ) ; }

Target:
private boolean longRunning ( int i ) { if ( ( ( i % 10 ) == 0 ) && ( ( ( java.lang.System.currentTimeMillis ( ) ) - ( start ) ) > 100 ) ) { progress.setValue ( ( ( 100 * ( row ) ) / ( list.length ( ) ) ) ) ; return true ; } return false ; }
Source:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION ) ; org.junit.Assert.assertEquals ( expectedId.name ( ) , c.current_revision ) ; org.junit.Assert.assertEquals ( expectedNum , c.revisions.get ( expectedId.name ( ) ) . _number ) ; }

Target:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION ) ; org.junit.Assert.assertEquals ( expectedId.name ( ) , c.currentRevision ) ; org.junit.Assert.assertEquals ( expectedNum , c.revisions.get ( expectedId.name ( ) ) . _number ) ; }
Source:
private void fireEvent ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.server.events.ProjectCreatedEvent event ) { for ( com.google.gerrit.common.ChangeHookRunner.EventListenerHolder holder : listeners.values ( ) ) { if ( isVisibleTo ( project , event , holder.user ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }

Target:
private void fireEvent ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.server.events.ChangeEvent 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 ( change , holder.user , db ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }
Source:
public java.util.Set < com.google.gerrit.common.data.GroupReference > getAllGroups ( ) { final java.util.Set < com.google.gerrit.common.data.GroupReference > all = new java.util.HashSet < com.google.gerrit.common.data.GroupReference > ( ) ; for ( final com.google.gerrit.server.project.SectionMatcher matcher : access ( ) ) { final com.google.gerrit.common.data.AccessSection section = matcher.section ; for ( final com.google.gerrit.common.data.Permission permission : section.getPermissions ( ) ) { for ( final com.google.gerrit.common.data.PermissionRule rule : permission.getRules ( ) ) { all.add ( rule.getGroup ( ) ) ; } } } return all ; }

Target:
public java.util.Set < com.google.gerrit.common.data.GroupReference > getAllGroups ( ) { return com.google.gerrit.server.project.ProjectControl.getGroups ( access ( ) ) ; }
Source:
public int compareTo ( com.google.gerrit.server.notedb.ChangeRebuilder.Event other ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( com.google.gerrit.server.notedb.ChangeRebuilder.round ( when ) , com.google.gerrit.server.notedb.ChangeRebuilder.round ( other.when ) ) . compare ( who.get ( ) , other.who.get ( ) ) . compare ( psId.get ( ) , other.psId.get ( ) ) . result ( ) ; }

Target:
abstract boolean uniquePerUpdate ( ) ;
Source:
private boolean canPerformOnAllRefs ( java.lang.String permission , java.util.Set < java.lang.String > except ) { boolean canPerform = false ; java.util.Set < java.lang.String > patterns = allRefPatterns ( permission ) ; if ( patterns.contains ( AccessSection.ALL ) ) { for ( final java.lang.String pattern : patterns ) { if ( controlForRef ( pattern ) . canPerform ( permission ) ) { canPerform = true ; } else if ( except.contains ( pattern ) ) { continue ; } else { return false ; } } } return canPerform ; }

Target:
private boolean canPerformOnAllRefs ( java.lang.String permission , java.util.Set < java.lang.String > ignore ) { boolean canPerform = false ; java.util.Set < java.lang.String > patterns = allRefPatterns ( permission ) ; if ( patterns.contains ( AccessSection.ALL ) ) { for ( final java.lang.String pattern : patterns ) { if ( controlForRef ( pattern ) . canPerform ( permission ) ) { canPerform = true ; } else if ( ignore.contains ( pattern ) ) { continue ; } else { return false ; } } } return canPerform ; }
Source:
private void loadMessages ( final com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gwtorm.client.OrmException { detail.setMessages ( db.changeMessages ( ) . byChange ( changeId ) . toList ( ) ) ; for ( final com.google.gerrit.client.reviewdb.ChangeMessage m : detail.getMessages ( ) ) { acc.want ( m.getAuthor ( ) ) ; } }

Target:
private void loadPatchSets ( ) throws com.google.gwtorm.client.OrmException { detail.setPatchSets ( db.patchSets ( ) . byChange ( changeId ) . toList ( ) ) ; }
Source:
public int compare ( final com.google.gerrit.server.git.CodeReviewCommit a , final com.google.gerrit.server.git.CodeReviewCommit b ) { return ( a.originalOrder ) - ( b.originalOrder ) ; }

Target:
public java.util.List < com.google.gerrit.server.git.CodeReviewCommit > reduceToMinimalMerge ( com.google.gerrit.server.git.MergeSorter mergeSorter , java.util.Collection < com.google.gerrit.server.git.CodeReviewCommit > toSort ) throws com.google.gerrit.server.git.MergeException { java.util.List < com.google.gerrit.server.git.CodeReviewCommit > result = new java.util.ArrayList < > ( ) ; try { result.addAll ( mergeSorter.sort ( toSort ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.MergeException ( "Branch head sorting failed" , e ) ; } java.util.Collections.sort ( result , CodeReviewCommit.ORDER ) ; return result ; }
Source:
public void onShowView ( ) { super . onShowView ( ) ; if ( intralineFailure ) { intralineFailure = false ; new com.google.gerrit.client.ErrorDialog ( PatchUtil.C.intralineFailure ( ) ) . show ( ) ; } }

Target:
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 ) ; } }
Source:
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 ) ) ; }

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 ) , fileTableMode ) ; }
Source:
public static org.eclipse.jgit.api.Git cloneProject ( java.lang.String url , boolean checkout ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { final java.io.File gitDir = com.google.gerrit.acceptance.TempFileUtil.createTempDirectory ( ) ; final org.eclipse.jgit.api.CloneCommand cloneCmd = org.eclipse.jgit.api.Git.cloneRepository ( ) ; cloneCmd.setURI ( url ) ; cloneCmd.setDirectory ( gitDir ) ; cloneCmd.setNoCheckout ( ( ! checkout ) ) ; return cloneCmd.call ( ) ; }

Target:
public static org.eclipse.jgit.api.Git cloneProject ( java.lang.String url , boolean checkout ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { final java.io.File gitDir = com.google.gerrit.testutil.TempFileUtil.createTempDirectory ( ) ; final org.eclipse.jgit.api.CloneCommand cloneCmd = org.eclipse.jgit.api.Git.cloneRepository ( ) ; cloneCmd.setURI ( url ) ; cloneCmd.setDirectory ( gitDir ) ; cloneCmd.setNoCheckout ( ( ! checkout ) ) ; return cloneCmd.call ( ) ; }
Source:
private boolean isSignedOffBy ( java.util.List < org.eclipse.jgit.revwalk.FooterLine > footers , java.lang.String email ) { for ( final org.eclipse.jgit.revwalk.FooterLine line : footers ) { if ( ( line.matches ( FooterKey.SIGNED_OFF_BY ) ) && ( email.equals ( line.getEmailAddress ( ) ) ) ) { return true ; } } return false ; }

Target:
private boolean isSubmitForMissingCommitsStillPossible ( final com.google.gerrit.server.git.CodeReviewCommit commit ) { if ( ( ( commit.missing ) == null ) || ( commit.missing.isEmpty ( ) ) ) { return false ; } for ( com.google.gerrit.server.git.CodeReviewCommit missingCommit : commit.missing ) { loadChangeInfo ( missingCommit ) ; if ( ( missingCommit.patchsetId ) == null ) { return false ; } if ( ! ( missingCommit.change.currentPatchSetId ( ) . equals ( missingCommit.patchsetId ) ) ) { return false ; } } return true ; }
Source:
public boolean canUpdate ( ) { if ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { return false ; } return ( canPerform ( Permission.PUSH ) ) && ( canWrite ( ) ) ; }

Target:
public boolean canUpdate ( ) { if ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { if ( ! ( ( projectControl.getProjectState ( ) . isAllProjects ( ) ) && ( getCurrentUser ( ) . getCapabilities ( ) . canAdministrateServer ( ) ) ) ) { return false ; } } return ( canPerform ( Permission.PUSH ) ) && ( canWrite ( ) ) ; }
Source:
private static java.io.File url2file ( final java.lang.String urlString ) throws java.io.IOException { final java.net.URL url = new java.net.URL ( urlString ) ; try { return new java.io.File ( url.toURI ( ) ) ; } catch ( java.net.URISyntaxException e ) { return new java.io.File ( url.getPath ( ) ) ; } }

Target:
private static java.nio.file.Path url2file ( final java.lang.String urlString ) throws java.io.IOException { final java.net.URL url = new java.net.URL ( urlString ) ; try { return java.nio.file.Paths.get ( url.toURI ( ) ) ; } catch ( java.net.URISyntaxException e ) { return java.nio.file.Paths.get ( url.getPath ( ) ) ; } }
Source:
private java.util.concurrent.atomic.AtomicInteger getAndIncrementAccountGroupIdLock ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ) { synchronized ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.IndexGroupRestApiServlet.accountGroupIdLocks ) { java.util.concurrent.atomic.AtomicInteger accountGroupIdLock = com.ericsson.gerrit.plugins.highavailability.forwarder.rest.IndexGroupRestApiServlet.accountGroupIdLocks.get ( uuid ) ; if ( accountGroupIdLock == null ) { accountGroupIdLock = new java.util.concurrent.atomic.AtomicInteger ( 1 ) ; com.ericsson.gerrit.plugins.highavailability.forwarder.rest.IndexGroupRestApiServlet.accountGroupIdLocks.put ( uuid , accountGroupIdLock ) ; } else { accountGroupIdLock.incrementAndGet ( ) ; } return accountGroupIdLock ; } }

Target:
void index ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.Operation operation ) throws java.io.IOException { indexer.index ( uuid ) ; com.ericsson.gerrit.plugins.highavailability.forwarder.rest.IndexGroupRestApiServlet.logger.debug ( "Group successfully indexed" , uuid ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { if ( isAttached ( ) ) { if ( ( ( result.length ( ) ) == 1 ) && ( com.google.gerrit.client.changes.QueryScreen.isSingleQuery ( query ) ) ) { com.google.gerrit.client.info.ChangeInfo c = result.get ( 0 ) ; com.google.gerrit.reviewdb.client.Change.Id id = c.legacyId ( ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( id ) ) ; } else { display ( result ) ; this . display ( ) ; } } }

Target:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { if ( isAttached ( ) ) { if ( ( ( result.length ( ) ) == 1 ) && ( com.google.gerrit.client.changes.QueryScreen.isSingleQuery ( query ) ) ) { com.google.gerrit.client.info.ChangeInfo c = result.get ( 0 ) ; com.google.gerrit.reviewdb.client.Change.Id id = c.legacyId ( ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( c.projectNameKey ( ) , id ) ) ; } else { display ( result ) ; this . display ( ) ; } } }
Source:
protected void run ( ) throws com.google.gerrit.sshd.plugin.Failure , com.google.gerrit.sshd.plugin.UnloggedFailure , java.lang.Exception { com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.LfsSshPluginAuth pluginAuth = auth.get ( ) ; if ( pluginAuth == null ) { throw new com.google.gerrit.sshd.plugin.Failure ( 1 , ( "Server configuration error:" + " LFS auth over SSH is not properly configured." ) ) ; } stdout.print ( pluginAuth.authenticate ( user.get ( ) , args ) ) ; }

Target:
protected void run ( ) throws com.google.gerrit.sshd.plugin.UnloggedFailure , java.lang.Exception { com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.LfsSshPluginAuth pluginAuth = auth.get ( ) ; if ( pluginAuth == null ) { com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.log.warn ( com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.CONFIGURATION_ERROR ) ; throw new com.google.gerrit.sshd.plugin.UnloggedFailure ( 1 , com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.CONFIGURATION_ERROR ) ; } stdout.print ( pluginAuth.authenticate ( user.get ( ) , args ) ) ; }
Source:
public void noRescheduleOnNonRecoverableException ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.HEADERS , remote , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.BODY ) ) . thenThrow ( javax.net.ssl.SSLException.class ) ; 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 com.google.gerrit.extensions.restapi.Response < ? extends java.util.Set < java.lang.String > > apply ( com.google.gerrit.server.change.ChangeResource req ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = control.getNotes ( ) . load ( ) ; java.util.Set < java.lang.String > hashtags = notes.getHashtags ( ) ; if ( hashtags == null ) { hashtags = com.google.common.collect.ImmutableSet.of ( ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( new java.util.TreeSet < java.lang.String > ( hashtags ) ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < ? extends java.util.Set < java.lang.String > > apply ( com.google.gerrit.server.change.ChangeResource req ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = control.getNotes ( ) . load ( ) ; java.util.Set < java.lang.String > hashtags = notes.getHashtags ( ) ; if ( hashtags == null ) { hashtags = java.util.Collections.emptySet ( ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( new java.util.TreeSet < java.lang.String > ( hashtags ) ) ; }
Source:
private void parseCommands ( final java.util.Collection < org.eclipse.jgit.transport.ReceiveCommand > commands ) { for ( final org.eclipse.jgit.transport.ReceiveCommand cmd : commands ) { if ( ( cmd.getResult ( ) ) != ( org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED ) ) { continue ; } if ( ( ! ( org.eclipse.jgit.lib.Repository.isValidRefName ( cmd.getRefName ( ) ) ) ) || ( cmd.getRefName ( ) . contains ( "//" ) ) ) { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd , "not valid ref" ) ; continue ; } if ( cmd.getRefName ( ) . startsWith ( com.google.gerrit.server.git.ReceiveCommits.NEW_CHANGE ) ) { parseNewChangeCommand ( cmd ) ; continue ; } final java.util.regex.Matcher m = com.google.gerrit.server.git.ReceiveCommits.NEW_PATCHSET.matcher ( cmd.getRefName ( ) ) ; if ( m.matches ( ) ) { final com.google.gerrit.reviewdb.Change.Id changeId = Change.Id.parse ( m.group ( 1 ) ) ; parseReplaceCommand ( cmd , changeId ) ; continue ; } switch ( cmd.getType ( ) ) { case CREATE : parseCreate ( cmd ) ; continue ; case UPDATE : parseUpdate ( cmd ) ; continue ; case DELETE : parseDelete ( cmd ) ; continue ; case UPDATE_NONFASTFORWARD : parseRewind ( cmd ) ; continue ; } com.google.gerrit.server.git.ReceiveCommits.reject ( cmd ) ; } }

Target:
private void parseUpdate ( final org.eclipse.jgit.transport.ReceiveCommand cmd ) { com.google.gerrit.server.project.RefControl ctl = projectControl.controlForRef ( cmd.getRefName ( ) ) ; if ( ctl.canUpdate ( ) ) { if ( ( com.google.gerrit.server.git.ReceiveCommits.isHead ( cmd ) ) && ( ! ( isCommit ( cmd ) ) ) ) { return ; } validateNewCommits ( ctl , cmd ) ; } else { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd , "can not update the reference as a fast forward" ) ; } }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; parent = new com.google.gerrit.server.git.ProjectConfig ( new com.google.gerrit.reviewdb.Project.NameKey ( "parent" ) ) ; parent.createInMemory ( ) ; local = new com.google.gerrit.server.git.ProjectConfig ( new com.google.gerrit.reviewdb.Project.NameKey ( "local" ) ) ; local.createInMemory ( ) ; local.getProject ( ) . setParentName ( parent.getProject ( ) . getName ( ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; parent = new com.google.gerrit.server.git.ProjectConfig ( new com.google.gerrit.reviewdb.Project.NameKey ( "parent" ) ) ; parent.createInMemory ( ) ; local = new com.google.gerrit.server.git.ProjectConfig ( new com.google.gerrit.reviewdb.Project.NameKey ( "local" ) ) ; local.createInMemory ( ) ; local.getProject ( ) . setParentName ( parent.getProject ( ) . getName ( ) ) ; sectionSorter = new com.google.gerrit.server.project.PermissionCollection.Factory ( new com.google.gerrit.server.project.SectionSortCache ( new com.google.gerrit.server.cache.ConcurrentHashMapCache < com.google.gerrit.server.project.SectionSortCache.EntryKey , com.google.gerrit.server.project.SectionSortCache.EntryVal > ( ) ) ) ; }
Source:
public void run ( ) { if ( ( prefs.context ( ) ) == ( com.google.gerrit.extensions.client.DiffPreferencesInfo.WHOLE_FILE_CONTEXT ) ) { contextEntireFile.setValue ( true ) ; } if ( view.canEnableRenderEntireFile ( prefs ) ) { renderEntireFile.setEnabled ( true ) ; } else { if ( prefs.renderEntireFile ( ) ) { prefs.renderEntireFile ( false ) ; renderEntireFile.setValue ( false ) ; view.updateRenderEntireFile ( ) ; } renderEntireFile.setEnabled ( false ) ; } view.setContext ( prefs.context ( ) ) ; }

Target:
void onMatchBrackets ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.matchBrackets ( e.getValue ( ) ) ; view.getCmFromSide ( DisplaySide.A ) . setOption ( "matchBrackets" , prefs.matchBrackets ( ) ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "matchBrackets" , prefs.matchBrackets ( ) ) ; }
Source:
public void signatureByExpiredKeyBeforeExpiration ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key3 = com.google.gerrit.gpg.testutil.TestKeys.expiredKey ( ) ; java.util.Date now = new java.text.SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss Z" ) . parse ( "2005-07-10 12:00:00 -0400" ) ; org.eclipse.jgit.transport.PushCertificate cert = newSignedCert ( validNonce ( ) , key3 , now ) ; assertNoProblems ( cert ) ; }

Target:
public void signatureByExpiredKeyBeforeExpiration ( ) throws java.lang.Exception { com.google.gerrit.gpg.testing.TestKey key3 = com.google.gerrit.gpg.testing.TestKeys.expiredKey ( ) ; java.util.Date now = new java.text.SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss Z" ) . parse ( "2005-07-10 12:00:00 -0400" ) ; org.eclipse.jgit.transport.PushCertificate cert = newSignedCert ( validNonce ( ) , key3 , now ) ; assertNoProblems ( cert ) ; }
Source:
private void loadCommit ( final com.google.gerrit.client.changes.ChangeInfo.RevisionInfo rev , com.google.gerrit.client.rpc.CallbackGroup group ) { com.google.gerrit.client.changes.ChangeApi.revision ( changeId.get ( ) , rev.name ( ) ) . view ( "commit" ) . get ( group.add ( new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.ChangeInfo.CommitInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo.CommitInfo info ) { rev.set_commit ( info ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ) ; }

Target:
private void loadCommit ( final com.google.gerrit.client.changes.ChangeInfo.RevisionInfo rev , com.google.gerrit.client.rpc.CallbackGroup group ) { if ( rev.is_edit ( ) ) { return ; } com.google.gerrit.client.changes.ChangeApi.revision ( changeId.get ( ) , rev.name ( ) ) . view ( "commit" ) . get ( group.add ( new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.ChangeInfo.CommitInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo.CommitInfo info ) { rev.set_commit ( info ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ) ; }
Source:
private void assertSearchReturns ( java.util.List < ? > expected , java.lang.String re , java.util.List < java.lang.String > inputs ) { org.junit.Assert.assertTrue ( com.google.common.collect.Ordering.natural ( ) . isOrdered ( inputs ) ) ; org.junit.Assert.assertEquals ( expected , com.google.common.collect.ImmutableList.copyOf ( com.google.gerrit.server.util.RegexListSearcher.ofStrings ( re ) . search ( inputs ) ) ) ; }

Target:
private void assertSearchReturns ( java.util.List < ? > expected , java.lang.String re , java.util.List < java.lang.String > inputs ) { com.google.common.truth.Truth.assertThat ( inputs ) . isOrdered ( ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.util.RegexListSearcher.ofStrings ( re ) . search ( inputs ) ) . containsExactlyElementsIn ( expected ) . inOrder ( ) ; }
Source:
private static void cache ( javax.servlet.http.HttpServletResponse res , java.lang.String type , long age , java.util.concurrent.TimeUnit unit ) { res.setHeader ( "Cache-Control" , java.lang.String.format ( "%s, max-age=%d" , type , com.google.gwtexpui.server.CacheHeaders.maxAgeSeconds ( age , unit ) ) ) ; }

Target:
private static void cache ( javax.servlet.http.HttpServletResponse res , java.lang.String type , long age , java.util.concurrent.TimeUnit unit , boolean revalidate ) { res.setHeader ( "Cache-Control" , java.lang.String.format ( "%s, max-age=%d%s" , type , com.google.gwtexpui.server.CacheHeaders.maxAgeSeconds ( age , unit ) , ( revalidate ? ", must-revalidate" : "" ) ) ) ; }
Source:
protected void configure ( ) { final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < java.lang.String , java.util.List > > type = new com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < java.lang.String , java.util.List > > ( ) { } ; core ( type , "openid" ) . timeToIdle ( 5 , java.util.concurrent.TimeUnit.MINUTES ) . timeToLive ( 5 , java.util.concurrent.TimeUnit.MINUTES ) . memoryLimit ( 64 ) ; }

Target:
protected void configure ( ) { final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < java.lang.String , java.util.List > > type = new com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < java.lang.String , java.util.List > > ( ) { } ; core ( type , "openid" ) . maxAge ( 5 , java.util.concurrent.TimeUnit.MINUTES ) . memoryLimit ( 64 ) ; }
Source:
public static void applyUserPreferences ( ) { if ( ( com.google.gerrit.client.Gerrit.myAccount ) != null ) { final com.google.gerrit.reviewdb.client.AccountGeneralPreferences p = com.google.gerrit.client.Gerrit.myAccount.getGeneralPreferences ( ) ; com.google.gwtexpui.clippy.client.CopyableLabel.setFlashEnabled ( p.isUseFlashClipboard ( ) ) ; if ( ( com.google.gerrit.client.Gerrit.siteHeader ) != null ) { com.google.gerrit.client.Gerrit.siteHeader.setVisible ( p.isShowSiteHeader ( ) ) ; } if ( ( com.google.gerrit.client.Gerrit.siteFooter ) != null ) { com.google.gerrit.client.Gerrit.siteFooter.setVisible ( p.isShowSiteHeader ( ) ) ; } com.google.gerrit.client.FormatUtil.setPreferences ( com.google.gerrit.client.Gerrit.myAccount.getGeneralPreferences ( ) ) ; } }

Target:
private static void applyUserPreferences ( ) { com.google.gwtexpui.clippy.client.CopyableLabel.setFlashEnabled ( com.google.gerrit.client.Gerrit.myPrefs.useFlashClipboard ( ) ) ; if ( ( com.google.gerrit.client.Gerrit.siteHeader ) != null ) { com.google.gerrit.client.Gerrit.siteHeader.setVisible ( com.google.gerrit.client.Gerrit.myPrefs.showSiteHeader ( ) ) ; } if ( ( com.google.gerrit.client.Gerrit.siteFooter ) != null ) { com.google.gerrit.client.Gerrit.siteFooter.setVisible ( com.google.gerrit.client.Gerrit.myPrefs.showSiteHeader ( ) ) ; } com.google.gerrit.client.FormatUtil.setPreferences ( com.google.gerrit.client.Gerrit.myPrefs ) ; }
Source:
private boolean can ( com.google.gerrit.server.permissions.LabelPermission perm ) { com.google.gerrit.common.data.PermissionRange r = label ( perm.permissionName ( ) . get ( ) ) ; return ( ( r.getMin ( ) ) < 0 ) || ( ( r.getMax ( ) ) > 0 ) ; }

Target:
private boolean can ( com.google.gerrit.server.permissions.LabelPermission.WithValue perm ) { com.google.gerrit.common.data.PermissionRange r = label ( perm.permissionName ( ) . get ( ) ) ; if ( ( ( perm.forUser ( ) ) == ( com.google.gerrit.server.permissions.LabelPermission.ForUser.ON_BEHALF_OF ) ) && ( r.isEmpty ( ) ) ) { return false ; } return r.contains ( perm.value ( ) ) ; }
Source:
public void patchSetAction ( final com.google.gerrit.client.reviewdb.ApprovalCategoryValue.Id value , final com.google.gerrit.client.reviewdb.PatchSet.Id patchSetId , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gwtjsonrpc.client.VoidResult > cb ) { if ( ( ApprovalCategory.SUBMIT.equals ( value ) ) && ( ( value.get ( ) ) == 1 ) ) { submitAction.create ( patchSetId ) . to ( cb ) ; } else { cb.onFailure ( new java.lang.IllegalArgumentException ( ( value + " not supported" ) ) ) ; } }

Target:
public void patchSetAction ( final com.google.gerrit.client.reviewdb.ApprovalCategoryValue.Id value , final com.google.gerrit.client.reviewdb.PatchSet.Id patchSetId , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gwtjsonrpc.client.VoidResult > cb ) { final com.google.gerrit.client.reviewdb.ApprovalCategory.Id category = value.getParentKey ( ) ; if ( ( ApprovalCategory.SUBMIT.equals ( category ) ) && ( ( value.get ( ) ) == 1 ) ) { submitAction.create ( patchSetId ) . to ( cb ) ; } else { cb.onFailure ( new java.lang.IllegalArgumentException ( ( value + " not supported" ) ) ) ; } }
Source:
public java.util.Set < com.google.gerrit.client.reviewdb.AccountGroup.Id > getEffectiveGroups ( ) { return state ( ) . getEffectiveGroups ( ) ; }

Target:
public java.util.Set < com.google.gerrit.client.reviewdb.AccountGroup.Id > getEffectiveGroups ( ) { if ( ( effectiveGroups ) == null ) { if ( authConfig.isIdentityTrustable ( state ( ) . getExternalIds ( ) ) ) { effectiveGroups = realm.groups ( state ( ) ) ; } else { effectiveGroups = authConfig.getRegisteredGroups ( ) ; } } return effectiveGroups ; }
Source:
private boolean canPushWithForce ( ) { if ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( getProjectControl ( ) . isOwner ( ) ) ) ) { return false ; } for ( com.google.gerrit.common.data.PermissionRule rule : access ( Permission.PUSH ) ) { if ( rule.getForce ( ) ) { return true ; } } return false ; }

Target:
private boolean canPushWithForce ( ) { if ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { return false ; } for ( com.google.gerrit.common.data.PermissionRule rule : access ( Permission.PUSH ) ) { if ( rule.getForce ( ) ) { return true ; } } return false ; }
Source:
public void testRepositoryIndex ( ) throws java.lang.Exception { com.google.gitiles.GitilesView view = getView ( "/repo" ) ; assertEquals ( Type.REPOSITORY_INDEX , view.getType ( ) ) ; assertEquals ( "repo" , view.getRepositoryName ( ) ) ; assertEquals ( Revision.NULL , view.getRevision ( ) ) ; assertEquals ( Revision.NULL , view.getOldRevision ( ) ) ; assertNull ( view.getTreePath ( ) ) ; }

Target:
public void testRepositoryIndex ( ) throws java.lang.Exception { com.google.gitiles.GitilesView view = getView ( "/repo" ) ; assertEquals ( Type.REPOSITORY_INDEX , view.getType ( ) ) ; assertEquals ( "repo" , view.getRepositoryName ( ) ) ; assertEquals ( Revision.NULL , view.getRevision ( ) ) ; assertEquals ( Revision.NULL , view.getOldRevision ( ) ) ; assertNull ( view.getPathPart ( ) ) ; }
Source:
public void testItsAssociationPolicyMandatory ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getEnum ( "commentLink" , "ItsTestName" , "association" , ItsAssociationPolicy.OPTIONAL ) ) . andReturn ( ItsAssociationPolicy.MANDATORY ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated associated policy do not match" , ItsAssociationPolicy.MANDATORY , itsConfig.getItsAssociationPolicy ( ) ) ; }

Target:
public void testPatternNullMatch ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "commentlink" , "ItsTestName" , "match" ) ) . andReturn ( null ) . atLeastOnce ( ) ; replayMocks ( ) ; assertNull ( "Pattern for null match is not null" , itsConfig.getIssuePattern ( ) ) ; }
Source:
private void checkMergeResult ( com.google.gerrit.extensions.common.ChangeInfo change ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.BranchInfo branch = gApi.projects ( ) . name ( change.project ) . branch ( change.branch ) . get ( ) ; com.google.gerrit.server.events.ChangeMergedEvent event = eventRecorder.getOneChangeMerged ( change.project , change.branch , java.lang.Integer.toString ( change._number ) ) ; com.google.common.truth.Truth.assertThat ( event.newRev ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( branch.revision ) . isEqualTo ( event.newRev ) ; }

Target:
protected void assertRefUpdatedEvents ( org.eclipse.jgit.revwalk.RevCommit ... expected ) throws java.lang.Exception { eventRecorder.assertRefUpdatedEvents ( project.get ( ) , "refs/heads/master" , expected ) ; }
Source:
public void onSignIn ( ) { final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final com.google.gerrit.client.data.ChangeInfo c = getChangeInfo ( row ) ; if ( c != null ) { setStar ( row , c ) ; } } }

Target:
public void onSuccess ( final java.util.Set < com.google.gerrit.client.reviewdb.Change.Id > result ) { if ( result != null ) { final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final com.google.gerrit.client.data.ChangeInfo c = getChangeInfo ( row ) ; if ( c != null ) { c.setStarred ( result.contains ( c.getId ( ) ) ) ; setStar ( row , c ) ; } } } }
Source:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { com.google.gerrit.reviewdb.client.Change.Status status = rsrc.getChange ( ) . getStatus ( ) ; com.google.gerrit.server.permissions.PermissionBackend.ForChange perm = rsrc.permissions ( ) . database ( db ) ; return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Delete" ) . setTitle ( ( "Delete change " + ( rsrc.getId ( ) ) ) ) . setVisible ( ( ( couldDeleteWhenIn ( status ) ) && ( perm.testOrFalse ( ChangePermission.DELETE ) ) ) ) ; }

Target:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { com.google.gerrit.reviewdb.client.Change.Status status = rsrc.getChange ( ) . getStatus ( ) ; com.google.gerrit.server.permissions.PermissionBackend.ForChange perm = rsrc.permissions ( ) . database ( db ) ; return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Delete" ) . setTitle ( ( "Delete change " + ( rsrc.getId ( ) ) ) ) . setVisible ( com.google.gerrit.extensions.conditions.BooleanCondition.and ( couldDeleteWhenIn ( status ) , perm.testCond ( ChangePermission.DELETE ) ) ) ; }
Source:
private java.lang.String expand ( com.google.gerrit.common.data.ParameterizedString parameterizedRef , java.lang.String userName ) { return parameterizedRef.replace ( java.util.Collections.singletonMap ( RefPattern.USERNAME , userName ) ) ; }

Target:
private java.lang.String expand ( com.google.gerrit.common.data.ParameterizedString parameterizedRef , java.lang.String userName , com.google.gerrit.reviewdb.client.Account.Id accountId ) { java.util.Map < java.lang.String , java.lang.String > params = new java.util.HashMap < > ( ) ; params.put ( RefPattern.USERNAME , userName ) ; if ( accountId != null ) { params.put ( RefPattern.USERID_SHARDED , com.google.gerrit.reviewdb.client.RefNames.shard ( accountId.get ( ) ) ) ; } return parameterizedRef.replace ( params ) ; }
Source:
public boolean isVisible ( com.google.gerrit.reviewdb.client.Account account ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser who = identifiedUserFactory.create ( reviewDbProvider , account.getId ( ) ) ; return changeControl.forUser ( who ) . isVisible ( reviewDbProvider.get ( ) ) ; }

Target:
public java.util.List < com.google.gerrit.common.data.GroupReference > run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) { com.google.gerrit.server.project.ProjectControl projectControl = null ; if ( project != null ) { try { projectControl = projectControlFactory.controlFor ( project ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e ) { return java.util.Collections.emptyList ( ) ; } } return suggestAccountGroup ( projectControl , query , limit ) ; }
Source:
public void testGetMultiple ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key1 = com.google.gerrit.gpg.testutil.TestKey.key1 ( ) ; com.google.gerrit.gpg.testutil.TestKey key2 = com.google.gerrit.gpg.testutil.TestKey.key2 ( ) ; tr.branch ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) . commit ( ) . add ( com.google.gerrit.gpg.PublicKeyStore.keyObjectId ( key1.getKeyId ( ) ) . name ( ) , ( ( key1.getPublicKeyArmored ( ) ) + ( key2.getPublicKeyArmored ( ) ) ) ) . create ( ) ; assertKeys ( key1.getKeyId ( ) , key1 , key2 ) ; }

Target:
public void testGetMultiple ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key1 = com.google.gerrit.gpg.testutil.TestKeys.key1 ( ) ; com.google.gerrit.gpg.testutil.TestKey key2 = com.google.gerrit.gpg.testutil.TestKeys.key2 ( ) ; tr.branch ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) . commit ( ) . add ( com.google.gerrit.gpg.PublicKeyStore.keyObjectId ( key1.getKeyId ( ) ) . name ( ) , ( ( key1.getPublicKeyArmored ( ) ) + ( key2.getPublicKeyArmored ( ) ) ) ) . create ( ) ; assertKeys ( key1.getKeyId ( ) , key1 , key2 ) ; }
Source:
private void loadFileContent ( ) { com.google.gerrit.client.changes.ChangeFileApi.getContent ( id , getText ( ) , new com.google.gerrit.client.rpc.GerritCallback < java.lang.String > ( ) { @ java.lang.Override public void onSuccess ( java.lang.String result ) { textArea.setText ( result ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { if ( com.google.gerrit.client.rpc.RestApi.isNotFound ( caught ) ) { } else { super . onFailure ( caught ) ; } } } ) ; }

Target:
private void loadFileContent ( ) { com.google.gerrit.client.changes.ChangeFileApi.getContent ( id , getText ( ) , new com.google.gerrit.client.rpc.HttpCallback < com.google.gerrit.client.rpc.NativeString > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.rpc.HttpResponse < com.google.gerrit.client.rpc.NativeString > result ) { textArea.setText ( result.getResult ( ) . asString ( ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { if ( com.google.gerrit.client.rpc.RestApi.isNotFound ( caught ) ) { } else { com.google.gerrit.client.rpc.GerritCallback.showFailure ( caught ) ; } } } ) ; }
Source:
private com.google.gerrit.extensions.common.ApprovalInfo approvalInfo ( com.google.gerrit.reviewdb.client.Account.Id id , java.lang.Integer value , java.lang.String tag , java.sql.Timestamp date ) { com.google.gerrit.extensions.common.ApprovalInfo ai = new com.google.gerrit.extensions.common.ApprovalInfo ( id.get ( ) ) ; ai.value = value ; ai.date = date ; ai.tag = tag ; accountLoader.put ( ai ) ; return ai ; }

Target:
private com.google.gerrit.extensions.common.ApprovalInfo approvalInfo ( com.google.gerrit.reviewdb.client.Account.Id id , java.lang.Integer value , java.lang.String tag , java.sql.Timestamp date ) { com.google.gerrit.extensions.common.ApprovalInfo ai = com.google.gerrit.server.change.ChangeJson.getApprovalInfo ( id , value , tag , date ) ; accountLoader.put ( ai ) ; return ai ; }
Source:
private void initReplyButton ( ) { reply.setTitle ( com.google.gerrit.client.Gerrit.getConfig ( ) . getReplyTitle ( ) ) ; reply.setHTML ( new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . openDiv ( ) . append ( com.google.gerrit.client.Gerrit.getConfig ( ) . getReplyLabel ( ) ) . closeDiv ( ) ) ; }

Target:
private void initReplyButton ( com.google.gerrit.client.changes.ChangeInfo info , java.lang.String revision ) { if ( ! ( info.revision ( revision ) . is_edit ( ) ) ) { reply.setTitle ( com.google.gerrit.client.Gerrit.getConfig ( ) . getReplyTitle ( ) ) ; reply.setHTML ( new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . openDiv ( ) . append ( com.google.gerrit.client.Gerrit.getConfig ( ) . getReplyLabel ( ) ) . closeDiv ( ) ) ; reply.setVisible ( true ) ; } }
Source:
public void publishDraftChange ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.lang.String changeId = createDraftChange ( ) ; com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId ) ; org.junit.Assert.assertEquals ( ( "p~master~" + changeId ) , c.id ) ; org.junit.Assert.assertEquals ( Change.Status.DRAFT , c.status ) ; com.google.gerrit.acceptance.RestResponse r = publishChange ( changeId ) ; org.junit.Assert.assertEquals ( 204 , r.getStatusCode ( ) ) ; c = getChange ( changeId ) ; org.junit.Assert.assertEquals ( Change.Status.NEW , c.status ) ; }

Target:
public void publishDraftChange ( ) throws com.google.gerrit.extensions.restapi.RestApiException , java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.lang.String changeId = createDraftChange ( ) ; java.lang.String triplet = "p~master~" + changeId ; com.google.gerrit.extensions.common.ChangeInfo c = get ( triplet ) ; org.junit.Assert.assertEquals ( triplet , c.id ) ; org.junit.Assert.assertEquals ( ChangeStatus.DRAFT , c.status ) ; com.google.gerrit.acceptance.RestResponse r = publishChange ( changeId ) ; org.junit.Assert.assertEquals ( 204 , r.getStatusCode ( ) ) ; c = get ( triplet ) ; org.junit.Assert.assertEquals ( ChangeStatus.NEW , c.status ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { index = new com.google.gerrit.server.index.change.FakeChangeIndex ( FakeChangeIndex.V2 ) ; indexes = new com.google.gerrit.server.index.change.ChangeIndexCollection ( ) ; indexes.setSearchIndex ( index ) ; queryBuilder = new com.google.gerrit.server.index.change.FakeQueryBuilder ( indexes ) ; rewrite = new com.google.gerrit.server.index.change.IndexRewriter ( indexes , com.google.gerrit.server.index.IndexConfig.create ( 0 , 0 , 3 ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { index = new com.google.gerrit.server.index.change.FakeChangeIndex ( FakeChangeIndex.V2 ) ; indexes = new com.google.gerrit.server.index.change.ChangeIndexCollection ( ) ; indexes.setSearchIndex ( index ) ; queryBuilder = new com.google.gerrit.server.index.change.FakeQueryBuilder ( indexes ) ; rewrite = new com.google.gerrit.server.index.change.ChangeIndexRewriter ( indexes , com.google.gerrit.server.index.IndexConfig.create ( 0 , 0 , 3 ) ) ; }