auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gwtjsonrpc.client.VoidResult run ( com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.Account me = db.accounts ( ) . get ( com.google.gerrit.client.rpc.Common.getAccountId ( ) ) ; me.setFullName ( fullName ) ; me.setPreferredEmail ( emailAddr ) ; me.setContactInformation ( info ) ; db.accounts ( ) . update ( java.util.Collections.singleton ( me ) ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; }

Target:
public com.google.gwtjsonrpc.client.VoidResult run ( com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.Account me = db.accounts ( ) . get ( com.google.gerrit.client.rpc.Common.getAccountId ( ) ) ; me.setFullName ( fullName ) ; me.setPreferredEmail ( emailAddr ) ; me.setContactInformation ( info ) ; db.accounts ( ) . update ( java.util.Collections.singleton ( me ) ) ; com.google.gerrit.client.rpc.Common.getAccountCache ( ) . invalidate ( me.getId ( ) ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; }
Source:
public void testBlockRule_ParentBlocksChild ( ) { grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/tags/*" ) ; grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/tags/*" ) . setBlock ( ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't force update tag" , u.controlForRef ( "refs/tags/V10" ) . canForceUpdate ( ) ) ; }

Target:
public void testBlockRule_ParentBlocksChild ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/tags/*" ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/tags/*" ) . setBlock ( ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't force update tag" , u.controlForRef ( "refs/tags/V10" ) . canForceUpdate ( ) ) ; }
Source:
protected void run ( ) throws com.google.gerrit.sshd.commands.Failure { try { checkPermission ( ) ; } catch ( com.google.gerrit.common.errors.PermissionDeniedException err ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( ( "fatal: " + ( err.getMessage ( ) ) ) ) ; } com.google.gerrit.sshd.commands.QueryShell shell = factory.create ( in , out ) ; shell.setOutputFormat ( format ) ; if ( ( query ) != null ) { shell.execute ( query ) ; } else { shell.run ( ) ; } }

Target:
protected void run ( ) throws com.google.gerrit.sshd.commands.Failure { try { checkPermission ( ) ; } catch ( com.google.gerrit.common.errors.PermissionDeniedException err ) { throw die ( err.getMessage ( ) ) ; } com.google.gerrit.sshd.commands.QueryShell shell = factory.create ( in , out ) ; shell.setOutputFormat ( format ) ; if ( ( query ) != null ) { shell.execute ( query ) ; } else { shell.run ( ) ; } }
Source:
private com.google.gerrit.server.notedb.ChangeUpdate newUpdate ( com.google.gerrit.reviewdb.client.Change c , com.google.gerrit.server.IdentifiedUser user ) throws java.lang.Exception { return new com.google.gerrit.server.notedb.ChangeUpdate ( serverIdent , repoManager , com.google.gerrit.server.notedb.NotesMigration.allEnabled ( ) , accountCache , null , com.google.gerrit.server.notedb.ChangeNotesTest.LABEL_TYPES , stubChangeControl ( c , user ) , com.google.gerrit.server.util.TimeUtil.nowTs ( ) ) ; }

Target:
private com.google.gerrit.server.notedb.ChangeUpdate newUpdate ( com.google.gerrit.reviewdb.client.Change c , final com.google.gerrit.server.IdentifiedUser user ) throws java.lang.Exception { return injector.createChildInjector ( new com.google.gerrit.server.config.FactoryModule ( ) { @ java.lang.Override public void configure ( ) { factory ( ChangeUpdate.Factory.class ) ; bind ( com.google.gerrit.server.IdentifiedUser.class ) . toInstance ( user ) ; } } ) . getInstance ( ChangeUpdate.Factory.class ) . create ( stubChangeControl ( c , user ) , com.google.gerrit.server.util.TimeUtil.nowTs ( ) , com.google.gerrit.server.notedb.ChangeNotesTest.LABEL_TYPES ) ; }
Source:
public static com.google.gerrit.git.WorkQueue.Task < ? > [ ] getTasks ( ) { final com.google.gerrit.git.WorkQueue.Executor p = com.google.gerrit.git.WorkQueue.getPool ( false ) ; final com.google.gerrit.git.WorkQueue.Task < ? > [ ] r ; r = ( p != null ) ? p.toTaskArray ( ) : new com.google.gerrit.git.WorkQueue.Task [ ] { } ; return r ; }

Target:
public static com.google.gerrit.git.WorkQueue.Task < ? > [ ] getTasks ( ) { final java.util.List < com.google.gerrit.git.WorkQueue.Task < ? > > r = new java.util.ArrayList < com.google.gerrit.git.WorkQueue.Task < ? > > ( ) ; for ( final com.google.gerrit.git.WorkQueue.Executor e : com.google.gerrit.git.WorkQueue.queues ) { e.addAllTo ( r ) ; } return r.toArray ( new com.google.gerrit.git.WorkQueue.Task [ r.size ( ) ] ) ; }
Source:
public boolean isVisible ( com.google.gerrit.server.change.RevisionResource resource ) { com.google.gerrit.reviewdb.client.PatchSet.Id current = resource.getChange ( ) . currentPatchSetId ( ) ; return ( ( resource.getChange ( ) . getStatus ( ) . isOpen ( ) ) && ( resource.getPatchSet ( ) . getId ( ) . equals ( current ) ) ) && ( isEnabled ( resource ) ) ; }

Target:
public UiAction.Description getDescription ( com.google.gerrit.server.change.RevisionResource resource ) { com.google.gerrit.reviewdb.client.PatchSet.Id current = resource.getChange ( ) . currentPatchSetId ( ) ; return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( java.lang.String.format ( "Submit Revision %d" , resource.getPatchSet ( ) . getPatchSetId ( ) ) ) . setVisible ( ( ( ( resource.getChange ( ) . getStatus ( ) . isOpen ( ) ) && ( resource.getPatchSet ( ) . getId ( ) . equals ( current ) ) ) && ( resource.getControl ( ) . canSubmit ( ) ) ) ) ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.ChangeDetail result ) { if ( result != null ) { detailCache.set ( result ) ; } else { com.google.gerrit.client.Gerrit.display ( PageLinks.MINE ) ; } }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; final com.google.gerrit.reviewdb.client.Change.Id id = patchSet.getId ( ) . getParentKey ( ) ; com.google.gerrit.client.changes.ChangeApi.deleteRevision ( id.get ( ) , patchSet.getRevision ( ) . get ( ) , com.google.gerrit.client.change.DraftActions.cs ( id ) ) ; }
Source:
public java.lang.String getBranchUrl ( java.lang.String projectName , java.lang.String branchName ) { return getPatchUrl ( projectName , branchName , "README.md" ) ; }

Target:
public java.lang.String getBranchUrl ( java.lang.String projectName , java.lang.String branchName ) { com.google.gerrit.server.project.ProjectState state = projectCache.get ( new com.google.gerrit.reviewdb.client.Project.NameKey ( projectName ) ) ; if ( state == null ) { return null ; } return getPatchUrl ( projectName , branchName , cfgFactory.create ( state ) . getIndexFile ( ) ) ; }
Source:
private void updateHead ( org.eclipse.jgit.transport.URIish replicateURI , java.lang.String newHead ) { if ( ! ( replicateURI.isRemote ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.updateHeadLocally ( replicateURI , newHead ) ; } else if ( com.googlesource.gerrit.plugins.replication.ReplicationQueue.isSSH ( replicateURI ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.updateHeadRemoteSsh ( replicateURI , newHead ) ; } else { com.googlesource.gerrit.plugins.replication.ReplicationQueue.log.warn ( java.lang.String.format ( ( "Cannot update HEAD of project on remote site %s." + ( " Only local paths and SSH URLs are supported" + " for remote HEAD update." ) ) , replicateURI ) ) ; } }

Target:
private void updateHead ( org.eclipse.jgit.transport.URIish replicateURI , java.lang.String newHead ) { if ( ! ( replicateURI.isRemote ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.updateHeadLocally ( replicateURI , newHead ) ; } else if ( com.googlesource.gerrit.plugins.replication.ReplicationQueue.isSSH ( replicateURI ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.updateHeadRemoteSsh ( replicateURI , newHead ) ; } else { com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.warn ( java.lang.String.format ( ( "Cannot update HEAD of project on remote site %s." + ( " Only local paths and SSH URLs are supported" + " for remote HEAD update." ) ) , replicateURI ) ) ; } }
Source:
public void preferDeleteAtLineBreak ( ) throws java.lang.Exception { java.lang.String a = " abc\n def\n" ; java.lang.String b = " abc\n def\n" ; java.util.List < org.eclipse.jgit.diff.Edit > expected = new org.eclipse.jgit.diff.EditList ( ) ; expected.add ( new org.eclipse.jgit.diff.Edit ( 0 , 2 , 0 , 0 ) ) ; expected.add ( new org.eclipse.jgit.diff.Edit ( 8 , 10 , 6 , 6 ) ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.patch.IntraLineLoaderTest.intraline ( a , b ) ) . isEqualTo ( expected ) ; }

Target:
com.google.gerrit.server.patch.IntraLineLoaderTest.Reference insert ( java.lang.String s ) { return replace ( "" , s ) ; }
Source:
protected void display ( com.google.gerrit.client.groups.GroupInfo group , boolean canModify ) { com.google.gerrit.client.groups.GroupApi.getAuditLog ( group.getGroupUUID ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwt.core.client.JsArray < com.google.gerrit.client.groups.GroupAuditEventInfo > > ( ) { @ java.lang.Override public void onSuccess ( com.google.gwt.core.client.JsArray < com.google.gerrit.client.groups.GroupAuditEventInfo > result ) { auditEventTable.display ( com.google.gerrit.client.rpc.Natives.asList ( result ) ) ; } } ) ; }

Target:
protected void display ( com.google.gerrit.client.info.GroupInfo group , boolean canModify ) { com.google.gerrit.client.groups.GroupApi.getAuditLog ( group.getGroupUUID ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwt.core.client.JsArray < com.google.gerrit.client.groups.GroupAuditEventInfo > > ( ) { @ java.lang.Override public void onSuccess ( com.google.gwt.core.client.JsArray < com.google.gerrit.client.groups.GroupAuditEventInfo > result ) { auditEventTable.display ( com.google.gerrit.client.rpc.Natives.asList ( result ) ) ; } } ) ; }
Source:
public boolean updateChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException { user = ctx.getUser ( ) . asIdentifiedUser ( ) ; notes = ctx.getNotes ( ) ; ps = psUtil.get ( ctx.getDb ( ) , ctx.getNotes ( ) , psId ) ; boolean dirty = false ; dirty |= insertComments ( ctx ) ; dirty |= updateLabels ( ctx ) ; dirty |= insertMessage ( ctx ) ; return dirty ; }

Target:
public boolean updateChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException { user = ctx.getIdentifiedUser ( ) ; notes = ctx.getNotes ( ) ; ps = psUtil.get ( ctx.getDb ( ) , ctx.getNotes ( ) , psId ) ; boolean dirty = false ; dirty |= insertComments ( ctx ) ; dirty |= updateLabels ( ctx ) ; dirty |= insertMessage ( ctx ) ; return dirty ; }
Source:
public boolean match ( final T object ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( that.isMatchable ( ) , ( "match invoked, but child predicate %s " + "doesn't implement %s" ) , that , com.google.gerrit.server.query.Matchable.class . getName ( ) ) ; return ! ( that.asMatchable ( ) . match ( object ) ) ; }

Target:
public boolean match ( final T object ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( that.isMatchable ( ) , "match invoked, but child predicate %s doesn't implement %s" , that , com.google.gerrit.server.query.Matchable.class . getName ( ) ) ; return ! ( that.asMatchable ( ) . match ( object ) ) ; }
Source:
protected com.google.common.base.Optional < com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken > createToken ( java.util.List < java.lang.String > values ) { if ( ( values.size ( ) ) != 3 ) { return com.google.common.base.Optional.absent ( ) ; } return com.google.common.base.Optional.of ( new com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken ( values.get ( 0 ) , org.eclipse.jgit.lfs.lib.LongObjectId.fromString ( values.get ( 1 ) ) , values.get ( 2 ) ) ) ; }

Target:
protected java.util.Optional < com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken > createToken ( java.util.List < java.lang.String > values ) { if ( ( values.size ( ) ) != 3 ) { return java.util.Optional.empty ( ) ; } return java.util.Optional.of ( new com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken ( values.get ( 0 ) , org.eclipse.jgit.lfs.lib.LongObjectId.fromString ( values.get ( 1 ) ) , values.get ( 2 ) ) ) ; }
Source:
private static java.lang.String getReviewCategoryDisplayInfo ( com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy reviewCategoryStrategy , com.google.gerrit.client.info.AccountInfo accountInfo ) { switch ( reviewCategoryStrategy ) { case NAME : return accountInfo.name ( ) ; case EMAIL : return accountInfo.email ( ) ; case USERNAME : return accountInfo.username ( ) ; case ABBREV : return com.google.gerrit.client.changes.ChangeTable.getAbbreviation ( accountInfo.name ( ) , " " ) ; default : return null ; } }

Target:
private static java.lang.String getReviewCategoryDisplayInfo ( com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy reviewCategoryStrategy , com.google.gerrit.client.info.AccountInfo accountInfo ) { switch ( reviewCategoryStrategy ) { case NAME : return accountInfo.name ( ) ; case EMAIL : return accountInfo.email ( ) ; case USERNAME : return accountInfo.username ( ) ; case ABBREV : return com.google.gerrit.client.changes.ChangeTable.getAbbreviation ( accountInfo.name ( ) , " " ) ; case NONE : default : return null ; } }
Source:
public void atomicUpdate ( byte [ ] key , com.google.gwtorm.client.AtomicUpdate < byte [ ] > update ) throws com.google.gwtorm.client.OrmException { db.lock.lock ( ) ; try { final byte [ ] oldData = fetchRow ( key ) ; final byte [ ] newData = update.update ( oldData ) ; if ( newData != null ) { upsert ( key , newData ) ; } else if ( oldData != null ) { delete ( key ) ; } } finally { db.lock.unlock ( ) ; } }

Target:
public void atomicUpdate ( byte [ ] key , com.google.gwtorm.server.AtomicUpdate < byte [ ] > update ) throws com.google.gwtorm.server.OrmException { db.lock.lock ( ) ; try { final byte [ ] oldData = fetchRow ( key ) ; final byte [ ] newData = update.update ( oldData ) ; if ( newData != null ) { upsert ( key , newData ) ; } else if ( oldData != null ) { delete ( key ) ; } } finally { db.lock.unlock ( ) ; } }
Source:
private com.google.gwt.user.client.ui.Button createChangeAction ( ) { final com.google.gwt.user.client.ui.Button createChange = new com.google.gwt.user.client.ui.Button ( Util.C.buttonCreateChange ( ) ) ; createChange.setTitle ( Util.C.buttonCreateChangeDescription ( ) ) ; createChange.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { com.google.gerrit.client.admin.CreateChangeAction.call ( createChange , getProjectKey ( ) . get ( ) ) ; } } ) ; return createChange ; }

Target:
private com.google.gwt.user.client.ui.Button createChangeAction ( ) { final com.google.gwt.user.client.ui.Button createChange = new com.google.gwt.user.client.ui.Button ( Util.C.buttonCreateChange ( ) ) ; createChange.setStyleName ( "" ) ; createChange.setTitle ( Util.C.buttonCreateChangeDescription ( ) ) ; createChange.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { com.google.gerrit.client.admin.CreateChangeAction.call ( createChange , getProjectKey ( ) . get ( ) ) ; } } ) ; return createChange ; }
Source:
public void merge ( final com.google.gerrit.reviewdb.Branch.NameKey branch ) { if ( start ( branch ) ) { mergeImpl ( branch ) ; } }

Target:
public < T > com.google.inject.Provider < T > scope ( final com.google.inject.Key < T > key , final com.google.inject.Provider < T > creator ) { return new com.google.inject.Provider < T > ( ) { public T get ( ) { return com.google.gerrit.server.git.ChangeMergeQueue.MyScope.getContext ( ) . get ( key , creator ) ; } @ java.lang.Override public java.lang.String toString ( ) { return java.lang.String.format ( "%s[%s]" , creator , com.google.gerrit.server.git.ChangeMergeQueue.MyScope.REQUEST ) ; } } ; }
Source:
public void replace ( com.google.gerrit.server.query.change.ChangeData cd ) throws java.io.IOException { org.apache.lucene.index.Term id = idTerm ( cd ) ; org.apache.lucene.document.Document doc = toDocument ( cd ) ; if ( cd.getChange ( ) . getStatus ( ) . isOpen ( ) ) { closedIndex.delete ( id ) ; openIndex.replace ( id , doc ) ; } else { openIndex.delete ( id ) ; closedIndex.replace ( id , doc ) ; } }

Target:
public com.google.common.util.concurrent.ListenableFuture < java.lang.Void > replace ( com.google.gerrit.server.query.change.ChangeData cd ) throws java.io.IOException { org.apache.lucene.index.Term id = com.google.gerrit.lucene.QueryBuilder.idTerm ( cd ) ; org.apache.lucene.document.Document doc = toDocument ( cd ) ; if ( cd.getChange ( ) . getStatus ( ) . isOpen ( ) ) { return com.google.gerrit.lucene.LuceneChangeIndex.allOf ( closedIndex.delete ( id ) , openIndex.replace ( id , doc ) ) ; } else { return com.google.gerrit.lucene.LuceneChangeIndex.allOf ( openIndex.delete ( id ) , closedIndex.replace ( id , doc ) ) ; } }
Source:
public void rescheduleOnError ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.BODY ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.ERR_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verify ( executor , org.mockito.Mockito.times ( 1 ) ) . schedule ( task , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.RETRY_INTERVAL , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }

Target:
public void rescheduleOnError ( ) 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.ERR_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verify ( executor , org.mockito.Mockito.times ( 1 ) ) . schedule ( task , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.RETRY_INTERVAL , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }
Source:
public static java.lang.String getRelativeStaticUrl ( java.lang.String url , int depth ) { java.lang.StringBuffer urlBuffer = new java.lang.StringBuffer ( ) ; for ( ; depth > 0 ; depth -- ) { urlBuffer.append ( "../" ) ; } urlBuffer.append ( "static/" ) ; urlBuffer.append ( url ) ; return urlBuffer.toString ( ) ; }

Target:
public static java.lang.String getRelativeStaticUrl ( java.lang.String url , int depth ) { java.lang.StringBuffer urlBuffer = new java.lang.StringBuffer ( ) ; for ( ; depth > 0 ; depth -- ) { urlBuffer.append ( "../" ) ; } urlBuffer.append ( "static/" ) ; urlBuffer.append ( url ) ; com.googlesource.gerrit.plugins.gitblit.app.StaticCodingStrategy.LOG.debug ( ( ( ( "Rewriting URL " + url ) + " to " ) + urlBuffer ) ) ; return urlBuffer.toString ( ) ; }
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 onFailure ( final java.lang.Throwable caught ) { com.google.gwt.core.client.GWT.log ( "ChangeTable.onSignIn myStarredChangeIds failed" , caught ) ; }
Source:
public void queryChangesOneTerm ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r1 = createChange ( ) ; com.google.gerrit.acceptance.PushOneCommit.Result r2 = createChange ( ) ; java.util.List < com.google.gerrit.extensions.common.ChangeInfo > results = query ( "status:open" ) ; org.junit.Assert.assertEquals ( 2 , results.size ( ) ) ; org.junit.Assert.assertEquals ( r2.getChangeId ( ) , results.get ( 0 ) . changeId ) ; org.junit.Assert.assertEquals ( r1.getChangeId ( ) , results.get ( 1 ) . changeId ) ; }

Target:
public void queryChangesMultipleTerms ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r1 = createChange ( ) ; createChange ( ) ; java.util.List < com.google.gerrit.extensions.common.ChangeInfo > results = query ( ( "status:open " + ( r1.getChangeId ( ) ) ) ) ; com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getOnlyElement ( results ) . changeId ) . isEqualTo ( r1.getChangeId ( ) ) ; }
Source:
public static synchronized void stopSshd ( ) { if ( ( com.google.gerrit.server.ssh.GerritSshDaemon.sshd ) != null ) { try { com.google.gerrit.server.ssh.GerritSshDaemon.sshd.stop ( ) ; com.google.gerrit.server.ssh.GerritSshDaemon.log.info ( ( "Stopped Gerrit SSHD on 0.0.0.0:" + ( com.google.gerrit.server.ssh.GerritSshDaemon.sshd.getPort ( ) ) ) ) ; } finally { com.google.gerrit.server.ssh.GerritSshDaemon.sshd = null ; com.google.gerrit.server.ssh.GerritSshDaemon.hostKeys = java.util.Collections.emptyList ( ) ; } } }

Target:
public static synchronized void stopSshd ( ) { if ( ( com.google.gerrit.server.ssh.GerritSshDaemon.sshd ) != null ) { try { com.google.gerrit.server.ssh.GerritSshDaemon.sshd.stop ( ) ; com.google.gerrit.server.ssh.GerritSshDaemon.log.info ( "Stopped Gerrit SSHD" ) ; } finally { com.google.gerrit.server.ssh.GerritSshDaemon.sshd = null ; com.google.gerrit.server.ssh.GerritSshDaemon.preferredAddress = null ; com.google.gerrit.server.ssh.GerritSshDaemon.hostKeys = java.util.Collections.emptyList ( ) ; } } }
Source:
public void testEventTypeRegistration ( ) { com.google.gerrit.server.events.EventTypes.registerClass ( new com.google.gerrit.server.events.EventTypesTest.TestEvent ( ) ) ; com.google.gerrit.server.events.EventTypes.registerClass ( new com.google.gerrit.server.events.EventTypesTest.AnotherTestEvent ( ) ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.events.EventTypes.getClass ( "test-event" ) ) . isEqualTo ( com.google.gerrit.server.events.EventTypesTest.TestEvent.class ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.events.EventTypes.getClass ( "another-test-event" ) ) . isEqualTo ( com.google.gerrit.server.events.EventTypesTest.AnotherTestEvent.class ) ; }

Target:
public void testEventTypeRegistration ( ) { com.google.gerrit.server.events.EventTypes.register ( com.google.gerrit.server.events.EventTypesTest.TestEvent.TYPE , com.google.gerrit.server.events.EventTypesTest.TestEvent.class ) ; com.google.gerrit.server.events.EventTypes.register ( com.google.gerrit.server.events.EventTypesTest.AnotherTestEvent.TYPE , com.google.gerrit.server.events.EventTypesTest.AnotherTestEvent.class ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.events.EventTypes.getClass ( com.google.gerrit.server.events.EventTypesTest.TestEvent.TYPE ) ) . isEqualTo ( com.google.gerrit.server.events.EventTypesTest.TestEvent.class ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.events.EventTypes.getClass ( com.google.gerrit.server.events.EventTypesTest.AnotherTestEvent.TYPE ) ) . isEqualTo ( com.google.gerrit.server.events.EventTypesTest.AnotherTestEvent.class ) ; }
Source:
public void unblockForceWithAllowNoForce_NotPossible ( ) { com.google.gerrit.common.data.PermissionRule r = 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/*" ) ; r.setForce ( true ) ; 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 ) ; assertCannotForceUpdate ( "refs/heads/master" , u ) ; }

Target:
public void unblockForceWithAllowNoForce_NotPossible ( ) { com.google.gerrit.common.data.PermissionRule r = 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/*" ) ; r.setForce ( true ) ; 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/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCannotForceUpdate ( "refs/heads/master" , u ) ; }
Source:
private java.lang.Runnable adjustGutters ( final net.codemirror.lib.CodeMirror cm ) { return new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { net.codemirror.lib.CodeMirror.FromTo fromTo = cm.getViewport ( ) ; int size = ( ( fromTo.getTo ( ) ) - ( fromTo.getFrom ( ) ) ) + 1 ; if ( ( cm.getOldViewportSize ( ) ) == size ) { return ; } cm.setOldViewportSize ( size ) ; diffTable.sidePanel.adjustGutters ( cmB ) ; } } ; }

Target:
private net.codemirror.lib.CodeMirror.GutterClickHandler onGutterClick ( final net.codemirror.lib.CodeMirror cm ) { return new net.codemirror.lib.CodeMirror.GutterClickHandler ( ) { @ java.lang.Override public void handle ( net.codemirror.lib.CodeMirror instance , int line , java.lang.String gutter , com.google.gwt.event.dom.client.MouseDownEvent clickEvent ) { instance.setCursor ( net.codemirror.lib.LineCharacter.create ( line ) ) ; instance.setActiveLine ( instance.getLineHandle ( line ) ) ; insertNewDraft ( instance ) . run ( ) ; } } ; }
Source:
private void assertDeleteForbidden ( ) throws java.lang.Exception { exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; branch ( ) . delete ( ) ; branch ( ) . get ( ) ; }

Target:
private void assertDeleteSucceeds ( ) throws java.lang.Exception { java.lang.String branchRev = branch ( ) . get ( ) . revision ; branch ( ) . delete ( ) ; eventRecorder.assertRefUpdatedEvents ( project.get ( ) , branch.get ( ) , null , branchRev , branchRev , null ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; branch ( ) . get ( ) ; }
Source:
private static java.lang.String addInvalidKey ( java.util.List < java.util.Optional < com.google.gerrit.reviewdb.client.AccountSshKey > > keys , java.lang.String pub ) { com.google.gerrit.reviewdb.client.AccountSshKey.Id keyId = new com.google.gerrit.reviewdb.client.AccountSshKey.Id ( new com.google.gerrit.reviewdb.client.Account.Id ( 1 ) , ( ( keys.size ( ) ) + 1 ) ) ; com.google.gerrit.reviewdb.client.AccountSshKey key = new com.google.gerrit.reviewdb.client.AccountSshKey ( keyId , pub ) ; key.setInvalid ( ) ; keys.add ( java.util.Optional.of ( key ) ) ; return ( ( AuthorizedKeys.INVALID_KEY_COMMENT_PREFIX ) + ( key.getSshPublicKey ( ) ) ) + "\n" ; }

Target:
private static java.lang.String addInvalidKey ( java.util.List < java.util.Optional < com.google.gerrit.server.account.AccountSshKey > > keys , java.lang.String pub ) { com.google.gerrit.server.account.AccountSshKey.Id keyId = new com.google.gerrit.server.account.AccountSshKey.Id ( new com.google.gerrit.reviewdb.client.Account.Id ( 1 ) , ( ( keys.size ( ) ) + 1 ) ) ; com.google.gerrit.server.account.AccountSshKey key = new com.google.gerrit.server.account.AccountSshKey ( keyId , pub ) ; key.setInvalid ( ) ; keys.add ( java.util.Optional.of ( key ) ) ; return ( ( AuthorizedKeys.INVALID_KEY_COMMENT_PREFIX ) + ( key.getSshPublicKey ( ) ) ) + "\n" ; }
Source:
private void disableLuceneAutomaticCommit ( ) { org.eclipse.jgit.lib.Config cfg = dbInjector.getInstance ( com.google.inject.Key.get ( org.eclipse.jgit.lib.Config.class , com.google.gerrit.server.config.GerritServerConfig.class ) ) ; if ( ( com.google.gerrit.server.index.IndexModule.getIndexType ( dbInjector ) ) == ( com.google.gerrit.server.index.IndexModule.IndexType.LUCENE ) ) { cfg.setLong ( "index" , "changes_open" , "commitWithin" , ( - 1 ) ) ; cfg.setLong ( "index" , "changes_closed" , "commitWithin" , ( - 1 ) ) ; } }

Target:
private void disableLuceneAutomaticCommit ( ) { if ( ( com.google.gerrit.server.index.IndexModule.getIndexType ( dbInjector ) ) == ( com.google.gerrit.server.index.IndexModule.IndexType.LUCENE ) ) { globalConfig.setLong ( "index" , "changes_open" , "commitWithin" , ( - 1 ) ) ; globalConfig.setLong ( "index" , "changes_closed" , "commitWithin" , ( - 1 ) ) ; } }
Source:
private boolean canUpdate ( ) { if ( ( RefNames.REFS_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { if ( ! ( ( projectControl.getProjectState ( ) . isAllProjects ( ) ) && ( getUser ( ) . getCapabilities ( ) . isAdmin_DoNotUse ( ) ) ) ) { return false ; } } return ( canPerform ( Permission.PUSH ) ) && ( isProjectStatePermittingWrite ( ) ) ; }

Target:
private boolean canUpdate ( ) { if ( ( RefNames.REFS_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { if ( ! ( ( projectControl.getProjectState ( ) . isAllProjects ( ) ) && ( projectControl.isAdmin ( ) ) ) ) { return false ; } } return ( canPerform ( Permission.PUSH ) ) && ( isProjectStatePermittingWrite ( ) ) ; }
Source:
public void subsetOfBranchesVisibleNotIncludingHead ( ) throws java.lang.Exception { deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; assertRefs ( ( ( r2 ) + "1" ) , ( ( r2 ) + "meta" ) , "refs/heads/branch" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }

Target:
public void subsetOfBranchesVisibleNotIncludingHead ( ) throws java.lang.Exception { deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; setApiUser ( user ) ; assertRefs ( ( ( r2 ) + "1" ) , ( ( r2 ) + "meta" ) , "refs/heads/branch" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }
Source:
static com.google.gerrit.common.data.ParamertizedString paramString ( org.eclipse.jgit.lib.Config c , java.lang.String n , java.lang.String d ) { java.lang.String expression = com.google.gerrit.server.auth.ldap.LdapRealm.optdef ( c , n , d ) ; if ( expression == null ) { return null ; } else if ( expression.contains ( "${" ) ) { return new com.google.gerrit.common.data.ParamertizedString ( expression ) ; } else { return new com.google.gerrit.common.data.ParamertizedString ( ( ( "${" + expression ) + "}" ) ) ; } }

Target:
static com.google.gerrit.common.data.ParameterizedString paramString ( org.eclipse.jgit.lib.Config c , java.lang.String n , java.lang.String d ) { java.lang.String expression = com.google.gerrit.server.auth.ldap.LdapRealm.optdef ( c , n , d ) ; if ( expression == null ) { return null ; } else if ( expression.contains ( "${" ) ) { return new com.google.gerrit.common.data.ParameterizedString ( expression ) ; } else { return new com.google.gerrit.common.data.ParameterizedString ( ( ( "${" + expression ) + "}" ) ) ; } }
Source:
private org.apache.lucene.search.Sort getSort ( ) { if ( useDocValuesForSorting ) { return new org.apache.lucene.search.Sort ( new org.apache.lucene.search.SortField ( com.google.gerrit.lucene.LuceneChangeIndex.UPDATED_SORT_FIELD , SortField.Type.LONG , true ) , new org.apache.lucene.search.SortField ( idSortField , SortField.Type.LONG , true ) ) ; } else { return new org.apache.lucene.search.Sort ( new org.apache.lucene.search.SortField ( ChangeField.UPDATED.getName ( ) , SortField.Type.LONG , true ) , new org.apache.lucene.search.SortField ( ChangeField.LEGACY_ID.getName ( ) , SortField.Type.INT , true ) ) ; } }

Target:
private org.apache.lucene.search.Sort getSort ( ) { if ( useDocValuesForSorting ) { return new org.apache.lucene.search.Sort ( new org.apache.lucene.search.SortField ( com.google.gerrit.lucene.LuceneChangeIndex.UPDATED_SORT_FIELD , SortField.Type.LONG , true ) , new org.apache.lucene.search.SortField ( idSortField , SortField.Type.LONG , true ) ) ; } else { return new org.apache.lucene.search.Sort ( new org.apache.lucene.search.SortField ( ChangeField.UPDATED.getName ( ) , SortField.Type.LONG , true ) , new org.apache.lucene.search.SortField ( "_id" , SortField.Type.INT , true ) ) ; } }
Source:
public void onSuccess ( com.google.gerrit.client.rpc.T result ) { results.put ( cb , result ) ; this . onSuccess ( ) ; }

Target:
private < T > com.google.gerrit.client.rpc.CallbackGroup.Callback < T > handleAdd ( com.google.gwt.user.client.rpc.AsyncCallback < T > cb ) { if ( failed ) { cb.onFailure ( failedThrowable ) ; return com.google.gerrit.client.rpc.CallbackGroup.emptyCallback ( ) ; } com.google.gerrit.client.rpc.CallbackGroup.CallbackImpl < T > wrapper = new com.google.gerrit.client.rpc.CallbackGroup.CallbackImpl < T > ( cb ) ; callbacks.add ( wrapper ) ; remaining.add ( wrapper ) ; return wrapper ; }
Source:
private com.google.inject.AbstractModule createIndexModule ( ) { if ( slave ) { return new com.google.gerrit.server.index.DummyIndexModule ( ) ; } com.google.gerrit.server.index.IndexModule.IndexType indexType = com.google.gerrit.server.index.IndexModule.getIndexType ( cfgInjector ) ; switch ( indexType ) { case LUCENE : return ( luceneModule ) != null ? luceneModule : new com.google.gerrit.lucene.LuceneIndexModule ( ) ; case SOLR : return new com.google.gerrit.solr.SolrIndexModule ( ) ; default : throw new java.lang.IllegalStateException ( ( "unsupported index.type = " + indexType ) ) ; } }

Target:
private void initIndexType ( ) { indexType = com.google.gerrit.server.index.IndexModule.getIndexType ( cfgInjector ) ; switch ( indexType ) { case LUCENE : break ; default : throw new java.lang.IllegalStateException ( ( "unsupported index.type = " + ( indexType ) ) ) ; } }
Source:
private com.google.gerrit.server.restapi.change.ReviewersUtil.VisibilityControl getVisibility ( com.google.gerrit.server.change.ChangeResource rsrc ) { com.google.gerrit.server.permissions.PermissionBackend.ForRef perm = permissionBackend.user ( self ) . ref ( rsrc.getChange ( ) . getDest ( ) ) ; return new com.google.gerrit.server.restapi.change.ReviewersUtil.VisibilityControl ( ) { @ java.lang.Override public boolean isVisibleTo ( com.google.gerrit.reviewdb.client.Account.Id account ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser who = identifiedUserFactory.create ( account ) ; return perm.user ( who ) . testOrFalse ( RefPermission.READ ) ; } } ; }

Target:
private com.google.gerrit.server.restapi.change.ReviewersUtil.VisibilityControl getVisibility ( com.google.gerrit.server.change.ChangeResource rsrc ) { com.google.gerrit.server.permissions.PermissionBackend.ForRef perm = permissionBackend.currentUser ( ) . ref ( rsrc.getChange ( ) . getDest ( ) ) ; return new com.google.gerrit.server.restapi.change.ReviewersUtil.VisibilityControl ( ) { @ java.lang.Override public boolean isVisibleTo ( com.google.gerrit.reviewdb.client.Account.Id account ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser who = identifiedUserFactory.create ( account ) ; return perm.user ( who ) . testOrFalse ( RefPermission.READ ) ; } } ; }
Source:
private void assertNotBlocked ( java.lang.String p , java.lang.String ref , com.google.gerrit.server.permissions.ProjectControl u ) { com.google.common.truth.Truth.assertThat ( u.controlForRef ( ref ) . canPerform ( p ) ) . named ( ( ( p + " is blocked for " ) + ref ) ) . isTrue ( ) ; }

Target:
public void unblockVoteMoreSpecificRefWithExclusiveFlag ( ) { java.lang.String perm = ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ; com.google.gerrit.server.project.testing.Util.block ( local , perm , ( - 1 ) , 1 , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allowExclusive ( local , perm , ( - 2 ) , 2 , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/master" ) ; com.google.gerrit.server.permissions.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; com.google.gerrit.common.data.PermissionRange range = u.controlForRef ( "refs/heads/master" ) . getRange ( perm ) ; assertCanVote ( ( - 2 ) , range ) ; }
Source:
private void setUp ( ) { try { getEventsDb ( ) . createDBIfNotCreated ( ) ; } catch ( java.sql.SQLException e ) { com.ericsson.gerrit.plugins.eventslog.SQLStore.log.warn ( ( "Cannot start the database. Events will be stored locally " + "until database connection can be established" ) , e ) ; setOnline ( false ) ; } removeOldEvents ( ) ; }

Target:
private void setUp ( ) { try { getEventsDb ( ) . createDBIfNotCreated ( ) ; } catch ( java.sql.SQLException e ) { com.ericsson.gerrit.plugins.eventslog.SQLStore.log.warn ( ( "Cannot start the database. Events will be stored locally " + "until database connection can be established" ) , e ) ; setOnline ( false ) ; } if ( online ) { restoreEventsFromLocal ( ) ; } removeOldEvents ( ) ; }
Source:
public void testSubscriptionToExistingRepo ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; allowSubmoduleSubscription ( "subscribed-to-project" , "refs/heads/master" , "super-project" , "refs/heads/master" ) ; pushChangeTo ( subRepo , "master" ) ; createSubmoduleSubscription ( superRepo , "master" , "subscribed-to-project" , "master" ) ; org.eclipse.jgit.lib.ObjectId subHEAD = pushChangeTo ( subRepo , "master" ) ; expectToHaveSubmoduleState ( superRepo , "master" , "subscribed-to-project" , subHEAD ) ; }

Target:
public void testSubscriptionToExistingRepo ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; allowSubmoduleSubscription ( "subscribed-to-project" , "refs/heads/master" , "super-project" , "refs/heads/master" ) ; pushChangeTo ( subRepo , "master" ) ; createSubmoduleSubscription ( superRepo , "master" , "subscribed-to-project" , "master" ) ; org.eclipse.jgit.lib.ObjectId subHEAD = pushChangeTo ( subRepo , "master" ) ; com.google.common.truth.Truth.assertThat ( hasSubmodule ( superRepo , "master" , "subscribed-to-project" ) ) . isTrue ( ) ; expectToHaveSubmoduleState ( superRepo , "master" , "subscribed-to-project" , subHEAD ) ; }
Source:
public void onSuccess ( java.lang.Void result ) { if ( ( ( prefs.syntaxHighlighting ( ) ) && ( java.util.Objects.equals ( mode , getSelectedMode ( ) ) ) ) && ( view.isAttached ( ) ) ) { view.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { view.getCmFromSide ( DisplaySide.A ) . setOption ( "mode" , mode ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "mode" , mode ) ; } } ) ; } }

Target:
void onSyntaxHighlighting ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.syntaxHighlighting ( e.getValue ( ) ) ; if ( ( view ) != null ) { mode.setEnabled ( prefs.syntaxHighlighting ( ) ) ; if ( prefs.syntaxHighlighting ( ) ) { setMode ( view.getContentType ( ) ) ; } view.setSyntaxHighlighting ( prefs.syntaxHighlighting ( ) ) ; } }
Source:
private static com.google.gerrit.extensions.client.GeneralPreferencesInfo parseDefaultPreferences ( org.eclipse.jgit.lib.Config defaultCfg , com.google.gerrit.extensions.client.GeneralPreferencesInfo input ) throws org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.extensions.client.GeneralPreferencesInfo allUserPrefs = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; com.google.gerrit.server.config.ConfigUtil.loadSection ( defaultCfg , UserConfigSections.GENERAL , null , allUserPrefs , com.google.gerrit.extensions.client.GeneralPreferencesInfo.defaults ( ) , input ) ; return com.google.gerrit.server.account.PreferencesConfig.updateDefaults ( allUserPrefs ) ; }

Target:
private static com.google.gerrit.extensions.client.GeneralPreferencesInfo parseDefaultGeneralPreferences ( org.eclipse.jgit.lib.Config defaultCfg , com.google.gerrit.extensions.client.GeneralPreferencesInfo input ) throws org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.extensions.client.GeneralPreferencesInfo allUserPrefs = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; com.google.gerrit.server.config.ConfigUtil.loadSection ( defaultCfg , UserConfigSections.GENERAL , null , allUserPrefs , com.google.gerrit.extensions.client.GeneralPreferencesInfo.defaults ( ) , input ) ; return com.google.gerrit.server.account.PreferencesConfig.updateGeneralPreferencesDefaults ( allUserPrefs ) ; }
Source:
public void testUnblockVisibilityByREGISTEREDUsers ( ) { grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.REGISTERED ) ; assertTrue ( "u can read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }

Target:
public void testUnblockVisibilityByREGISTEREDUsers ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.REGISTERED ) ; assertTrue ( "u can read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }
Source:
private com.google.gwtexpui.safehtml.client.SafeHtml showTabAfterSpace ( com.google.gwtexpui.safehtml.client.SafeHtml src ) { src = src.replaceFirst ( "^( *\t)" , "<span class=\"wse\">$1</span>" ) ; src = src.replaceAll ( "\n( *\t)" , "\n<span class=\"wse\">$1</span>" ) ; return src ; }

Target:
private com.google.gwtexpui.safehtml.client.SafeHtml showTabAfterSpace ( com.google.gwtexpui.safehtml.client.SafeHtml src ) { final java.lang.String m = "( ( |<span[^>]*>|</span>)*\t)" ; final java.lang.String r = "<span class=\"wse\">$1</span>" ; src = src.replaceFirst ( ( "^" + m ) , r ) ; src = src.replaceAll ( ( "\n" + m ) , ( "\n" + r ) ) ; return src ; }
Source:
public void modifyFile ( java.lang.String filePath , com.google.gerrit.extensions.restapi.RawInput newContent ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeEditResource changeEditResource = getOrCreateChangeEditResource ( filePath ) ; com.google.gerrit.server.change.ChangeEdits.Put.Input input = new com.google.gerrit.server.change.ChangeEdits.Put.Input ( ) ; input.content = newContent ; changeEditsPut.apply ( changeEditResource , input ) ; } catch ( java.io.IOException | com.google.gerrit.server.project.InvalidChangeOperationException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot modify file of change edit" , e ) ; } }

Target:
public void modifyFile ( java.lang.String filePath , com.google.gerrit.extensions.restapi.RawInput newContent ) throws com.google.gerrit.extensions.restapi.RestApiException { try { changeEditsPut.apply ( changeResource.getControl ( ) , filePath , newContent ) ; } catch ( java.io.IOException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot modify file of change edit" , e ) ; } }
Source:
public boolean testRemoveReviewer ( com.google.gerrit.server.query.change.ChangeData cd , com.google.gerrit.server.CurrentUser currentUser , com.google.gerrit.reviewdb.client.Account.Id reviewer , int value ) throws com.google.gerrit.server.permissions.PermissionBackendException , com.google.gerrit.server.project.NoSuchProjectException , com.google.gwtorm.server.OrmException , java.io.IOException { if ( canRemoveReviewerWithoutPermissionCheck ( cd.change ( ) , currentUser , reviewer , value ) ) { return true ; } return permissionBackend.user ( currentUser ) . change ( cd ) . database ( dbProvider ) . test ( ChangePermission.REMOVE_REVIEWER ) ; }

Target:
public boolean testRemoveReviewer ( com.google.gerrit.server.query.change.ChangeData cd , com.google.gerrit.server.CurrentUser currentUser , com.google.gerrit.reviewdb.client.Account.Id reviewer , int value ) throws com.google.gerrit.server.permissions.PermissionBackendException , com.google.gwtorm.server.OrmException { if ( com.google.gerrit.server.project.RemoveReviewerControl.canRemoveReviewerWithoutPermissionCheck ( permissionBackend , cd.change ( ) , currentUser , reviewer , value ) ) { return true ; } return permissionBackend.user ( currentUser ) . change ( cd ) . database ( dbProvider ) . test ( ChangePermission.REMOVE_REVIEWER ) ; }
Source:
private static org.eclipse.jgit.dircache.DirCache createTree ( org.eclipse.jgit.lib.ObjectReader reader , org.eclipse.jgit.revwalk.RevCommit prevEdit ) throws java.io.IOException { org.eclipse.jgit.dircache.DirCache dc = org.eclipse.jgit.dircache.DirCache.newInCore ( ) ; org.eclipse.jgit.dircache.DirCacheBuilder b = dc.builder ( ) ; b.addTree ( new byte [ 0 ] , DirCacheEntry.STAGE_0 , reader , prevEdit.getTree ( ) . getId ( ) ) ; b.finish ( ) ; return dc ; }

Target:
private static org.eclipse.jgit.dircache.DirCache readTree ( org.eclipse.jgit.lib.ObjectReader reader , org.eclipse.jgit.revwalk.RevCommit prevEdit ) throws java.io.IOException { org.eclipse.jgit.dircache.DirCache dc = org.eclipse.jgit.dircache.DirCache.newInCore ( ) ; org.eclipse.jgit.dircache.DirCacheBuilder b = dc.builder ( ) ; b.addTree ( new byte [ 0 ] , DirCacheEntry.STAGE_0 , reader , prevEdit.getTree ( ) ) ; b.finish ( ) ; return dc ; }
Source:
private boolean canRebase ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { return ( ( ( isOwner ( ) ) || ( getRefControl ( ) . canSubmit ( isOwner ( ) ) ) ) || ( getRefControl ( ) . canRebase ( ) ) ) && ( ! ( isPatchSetLocked ( db ) ) ) ; }

Target:
private boolean canRebase ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { return ( ( ( ( isOwner ( ) ) || ( getRefControl ( ) . canSubmit ( isOwner ( ) ) ) ) || ( getRefControl ( ) . canRebase ( ) ) ) && ( getRefControl ( ) . canUpload ( ) ) ) && ( ! ( isPatchSetLocked ( db ) ) ) ; }