auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AccountGroup.Id call ( ) throws com.google.gerrit.common.errors.NameAlreadyUsedException , com.google.gwtorm.client.OrmException { final com.google.gerrit.server.account.PerformCreateGroup performCreateGroup = performCreateGroupFactory.create ( ) ; final com.google.gerrit.reviewdb.Account.Id me = user.getAccountId ( ) ; return performCreateGroup.createGroup ( groupName , null , null , me ) ; }

Target:
public AccountGroup.Id call ( ) throws com.google.gerrit.common.errors.NameAlreadyUsedException , com.google.gwtorm.client.OrmException { final com.google.gerrit.server.account.PerformCreateGroup performCreateGroup = performCreateGroupFactory.create ( ) ; final com.google.gerrit.reviewdb.Account.Id me = user.getAccountId ( ) ; return performCreateGroup.createGroup ( groupName , null , false , null , me ) ; }
Source:
public synchronized void addWriteIndex ( com.google.gerrit.server.index.ChangeIndex index ) { int version = index.getSchema ( ) . getVersion ( ) ; for ( com.google.gerrit.server.index.ChangeIndex i : writeIndexes ) { if ( ( i.getSchema ( ) . getVersion ( ) ) == version ) { throw new java.lang.IllegalArgumentException ( ( ( "Write index version " + version ) + " already in list" ) ) ; } } writeIndexes.add ( index ) ; }

Target:
public synchronized com.google.gerrit.server.index.ChangeIndex addWriteIndex ( com.google.gerrit.server.index.ChangeIndex index ) { int version = index.getSchema ( ) . getVersion ( ) ; for ( int i = 0 ; i < ( writeIndexes.size ( ) ) ; i ++ ) { if ( ( writeIndexes.get ( i ) . getSchema ( ) . getVersion ( ) ) == version ) { return writeIndexes.set ( i , index ) ; } } writeIndexes.add ( index ) ; return null ; }
Source:
private void addDiffChunk ( net.codemirror.lib.CodeMirror cmToPad , int lineOnOther , int chunkSize , boolean edit ) { chunks.add ( new com.google.gerrit.client.diff.DiffChunkInfo ( host.otherCm ( cmToPad ) . side ( ) , ( ( lineOnOther - chunkSize ) + 1 ) , lineOnOther , edit ) ) ; }

Target:
private void addDiffChunk ( net.codemirror.lib.CodeMirror cmToPad , int line , int lineOnOther , int chunkSize , boolean edit ) { chunks.add ( new com.google.gerrit.client.diff.DiffChunkInfo ( host.otherCm ( cmToPad ) . side ( ) , ( ( lineOnOther - chunkSize ) + 1 ) , ( ( line - chunkSize ) + 1 ) , lineOnOther , edit ) ) ; }
Source:
public void listTagsOfNonVisibleProjectWithApi ( ) throws java.lang.Exception { blockRead ( project , "refs/*" ) ; setApiUser ( user ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; gApi.projects ( ) . name ( project.get ( ) ) . tags ( ) . get ( ) ; }

Target:
public void listTagsOfNonVisibleProjectWithApi ( ) throws java.lang.Exception { blockRead ( "refs/*" ) ; setApiUser ( user ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; gApi.projects ( ) . name ( project.get ( ) ) . tags ( ) . get ( ) ; }
Source:
private com.google.gerrit.server.query.Predicate < T > [ ] children ( final org.antlr.runtime.tree.Tree r ) throws com.google.gerrit.server.query.QueryParseException , java.lang.IllegalArgumentException { final com.google.gerrit.server.query.Predicate < T > [ ] p = new com.google.gerrit.server.query.Predicate [ r.getChildCount ( ) ] ; for ( int i = 0 ; i < ( p.length ) ; i ++ ) { p [ i ] = toPredicate ( r.getChild ( i ) ) ; } return p ; }

Target:
private java.util.List < com.google.gerrit.server.query.Predicate < T > > children ( final org.antlr.runtime.tree.Tree r ) throws com.google.gerrit.server.query.QueryParseException , java.lang.IllegalArgumentException { java.util.List < com.google.gerrit.server.query.Predicate < T > > p = new java.util.ArrayList ( r.getChildCount ( ) ) ; for ( int i = 0 ; i < ( r.getChildCount ( ) ) ; i ++ ) { p.add ( toPredicate ( r.getChild ( i ) ) ) ; } return p ; }
Source:
public void run ( ) { try { com.google.gerrit.server.mail.CreateChangeSender cm = createChangeSenderFactory.create ( change.getId ( ) ) ; cm.setFrom ( change.getOwner ( ) ) ; cm.setPatchSet ( patchSet , patchSetInfo ) ; cm.setNotify ( notify ) ; cm.addReviewers ( reviewers ) ; cm.addExtraCC ( extraCC ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.change.ChangeInserter.log.error ( ( "Cannot send email for new change " + ( change.getId ( ) ) ) , e ) ; } }

Target:
public void run ( ) { try { com.google.gerrit.server.mail.CreateChangeSender cm = createChangeSenderFactory.create ( change.getProject ( ) , change.getId ( ) ) ; cm.setFrom ( change.getOwner ( ) ) ; cm.setPatchSet ( patchSet , patchSetInfo ) ; cm.setNotify ( notify ) ; cm.addReviewers ( reviewers ) ; cm.addExtraCC ( extraCC ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.change.ChangeInserter.log.error ( ( "Cannot send email for new change " + ( change.getId ( ) ) ) , e ) ; } }
Source:
public final void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { if ( isAttached ( ) ) { if ( ( ( result.size ( ) ) == 1 ) && ( com.google.gerrit.client.changes.QueryScreen.isSingleQuery ( query ) ) ) { com.google.gerrit.client.changes.ChangeInfo c = result.get ( 0 ) ; com.google.gerrit.reviewdb.client.Change.Id id = c.legacy_id ( ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( id ) , new com.google.gerrit.client.changes.ChangeScreen ( id ) ) ; } else { display ( result ) ; this . display ( ) ; } } }

Target:
public final 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.changes.ChangeInfo c = result.get ( 0 ) ; com.google.gerrit.reviewdb.client.Change.Id id = c.legacy_id ( ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( id ) , new com.google.gerrit.client.changes.ChangeScreen ( id ) ) ; } else { display ( result ) ; this . display ( ) ; } } }
Source:
private void addIssuesOccurrence ( java.lang.String text , java.lang.String occurrence , java.util.Map < java.lang.String , java.util.Set < java.lang.String > > map ) { for ( java.lang.String issue : getIssueIds ( text ) ) { java.util.Set < java.lang.String > occurrences = map.computeIfAbsent ( issue , ( k ) -> com.google.common.collect.Sets.newLinkedHashSet ( ) ) ; occurrences.add ( occurrence ) ; } }

Target:
private void addIssuesOccurrence ( java.lang.String text , java.lang.String occurrence , java.util.Map < java.lang.String , java.util.Set < java.lang.String > > map ) { for ( java.lang.String issue : getIssueIds ( text ) ) { java.util.Set < java.lang.String > occurrences = map.get ( issue ) ; if ( occurrences == null ) { occurrences = com.google.common.collect.Sets.newLinkedHashSet ( ) ; map.put ( issue , occurrences ) ; } occurrences.add ( occurrence ) ; } }
Source:
private java.lang.String createDraftChangeWith2PS ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) ) ; com.google.gerrit.acceptance.PushOneCommit.Result result = push.to ( git , "refs/drafts/master" ) ; push = pushFactory.create ( db , admin.getIdent ( ) , PushOneCommit.SUBJECT , "b.txt" , "4711" , result.getChangeId ( ) ) ; return push.to ( git , "refs/drafts/master" ) . getChangeId ( ) ; }

Target:
private java.lang.String createDraftChangeWith2PS ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , git ) ; com.google.gerrit.acceptance.PushOneCommit.Result result = push.to ( "refs/drafts/master" ) ; push = pushFactory.create ( db , admin.getIdent ( ) , git , PushOneCommit.SUBJECT , "b.txt" , "4711" , result.getChangeId ( ) ) ; return push.to ( "refs/drafts/master" ) . getChangeId ( ) ; }
Source:
static com.google.gerrit.server.query.change.ChangeData createForTest ( com.google.gerrit.reviewdb.client.Change.Id id , int currentPatchSetId ) { com.google.gerrit.server.query.change.ChangeData cd = new com.google.gerrit.server.query.change.ChangeData ( null , null , null , null , null , null , null , null , null , id ) ; cd.currentPatchSet = new com.google.gerrit.reviewdb.client.PatchSet ( new com.google.gerrit.reviewdb.client.PatchSet.Id ( id , currentPatchSetId ) ) ; return cd ; }

Target:
static com.google.gerrit.server.query.change.ChangeData createForTest ( com.google.gerrit.reviewdb.client.Change.Id id , int currentPatchSetId ) { com.google.gerrit.server.query.change.ChangeData cd = new com.google.gerrit.server.query.change.ChangeData ( null , null , null , null , null , null , null , null , null , null , id ) ; cd.currentPatchSet = new com.google.gerrit.reviewdb.client.PatchSet ( new com.google.gerrit.reviewdb.client.PatchSet.Id ( id , currentPatchSetId ) ) ; return cd ; }
Source:
private void setOpen ( boolean open ) { if ( open ) { removeStyleName ( res.style ( ) . close ( ) ) ; addStyleName ( res.style ( ) . open ( ) ) ; } else { removeStyleName ( res.style ( ) . open ( ) ) ; addStyleName ( res.style ( ) . close ( ) ) ; } }

Target:
protected void setOpen ( boolean open ) { if ( open ) { removeStyleName ( res.style ( ) . close ( ) ) ; addStyleName ( res.style ( ) . open ( ) ) ; } else { removeStyleName ( res.style ( ) . open ( ) ) ; addStyleName ( res.style ( ) . close ( ) ) ; } }
Source:
private static com.google.gerrit.client.changes.AccountInfo asInfo ( com.google.gerrit.reviewdb.client.Account acct ) { return com.google.gerrit.client.changes.AccountInfo.create ( acct.getId ( ) . get ( ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) ) ; }

Target:
private static com.google.gerrit.client.changes.AccountInfo asInfo ( com.google.gerrit.reviewdb.client.Account acct ) { if ( acct == null ) { return com.google.gerrit.client.changes.AccountInfo.create ( 0 , null , null ) ; } return com.google.gerrit.client.changes.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) ) ; }
Source:
public com.google.gerrit.common.data.Capable canPushToAtLeastOneRef ( ) { if ( ( ( ! ( canPerformOnAnyRef ( Permission.PUSH ) ) ) && ( ! ( canPerformOnAnyRef ( Permission.CREATE_TAG ) ) ) ) && ( ! ( isOwner ( ) ) ) ) { return new com.google.gerrit.common.data.Capable ( ( ( "Upload denied for project '" + ( state.getName ( ) ) ) + "'" ) ) ; } if ( state.isUseContributorAgreements ( ) ) { return verifyActiveContributorAgreement ( ) ; } return com.google.gerrit.common.data.Capable.OK ; }

Target:
public com.google.gerrit.common.data.Capable canPushToAtLeastOneRef ( ) { if ( ( ( ! ( canPerformOnAnyRef ( Permission.PUSH ) ) ) && ( ! ( canPerformOnAnyRef ( Permission.CREATE_TAG ) ) ) ) && ( ! ( isOwner ( ) ) ) ) { return new com.google.gerrit.common.data.Capable ( ( ( "Upload denied for project '" + ( state.getName ( ) ) ) + "'" ) ) ; } return com.google.gerrit.common.data.Capable.OK ; }
Source:
public com.google.gerrit.client.reviewdb.AccountGroup lookup ( final java.lang.String groupName ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.client.reviewdb.AccountGroup.NameKey nameKey = new com.google.gerrit.client.reviewdb.AccountGroup.NameKey ( groupName ) ; final com.google.gerrit.client.reviewdb.AccountGroup group = db.accountGroups ( ) . get ( nameKey ) ; if ( group != null ) { return group ; } else { return null ; } } finally { db.close ( ) ; } }

Target:
private com.google.gerrit.client.reviewdb.AccountGroup lookup ( final com.google.gerrit.client.reviewdb.AccountGroup.NameKey groupName ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.ReviewDb db = schema.open ( ) ; try { return db.accountGroups ( ) . get ( groupName ) ; } finally { db.close ( ) ; } }
Source:
protected java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > getAdvertisedRefs ( org.eclipse.jgit.lib.Repository repository , org.eclipse.jgit.revwalk.RevWalk revWalk ) throws org.eclipse.jgit.transport.ServiceMayNotContinueException { try { return filter ( repository.getRefDatabase ( ) . getRefs ( RefDatabase.ALL ) ) ; } catch ( java.io.IOException e ) { org.eclipse.jgit.transport.ServiceMayNotContinueException ex = new org.eclipse.jgit.transport.ServiceMayNotContinueException ( e.getMessage ( ) ) ; ex.initCause ( e ) ; throw ex ; } }

Target:
protected java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > getAdvertisedRefs ( org.eclipse.jgit.lib.Repository repository , org.eclipse.jgit.revwalk.RevWalk revWalk ) throws org.eclipse.jgit.transport.ServiceMayNotContinueException { try { return filter ( repository.getRefDatabase ( ) . getRefs ( RefDatabase.ALL ) ) ; } catch ( org.eclipse.jgit.transport.ServiceMayNotContinueException e ) { throw e ; } catch ( java.io.IOException e ) { org.eclipse.jgit.transport.ServiceMayNotContinueException ex = new org.eclipse.jgit.transport.ServiceMayNotContinueException ( ) ; ex.initCause ( e ) ; throw ex ; } }
Source:
private void initUserAuth ( final org.apache.sshd.server.PasswordAuthenticator pass , final org.apache.sshd.server.PublickeyAuthenticator pubkey ) { setUserAuthFactories ( java.util.Arrays.< org.apache.sshd.common.NamedFactory < org.apache.sshd.server.UserAuth > > asList ( new org.apache.sshd.server.auth.UserAuthPublicKey.Factory ( ) , new org.apache.sshd.server.auth.UserAuthPassword.Factory ( ) ) ) ; setPasswordAuthenticator ( pass ) ; setPublickeyAuthenticator ( pubkey ) ; }

Target:
private void initUserAuth ( final org.apache.sshd.server.PublickeyAuthenticator pubkey ) { setUserAuthFactories ( java.util.Arrays.< org.apache.sshd.common.NamedFactory < org.apache.sshd.server.UserAuth > > asList ( new org.apache.sshd.server.auth.UserAuthPublicKey.Factory ( ) ) ) ; setPublickeyAuthenticator ( pubkey ) ; }
Source:
private static com.google.gwt.user.client.ui.InlineHyperlink createIcon ( com.google.gwt.resources.client.ImageResource res , java.lang.String tooltip , java.lang.String target ) { com.google.gwt.user.client.ui.InlineHyperlink l = new com.google.gwt.user.client.ui.InlineHyperlink ( com.google.gwt.user.client.ui.AbstractImagePrototype.create ( res ) . getHTML ( ) , true , target ) ; if ( tooltip != null ) { l.setTitle ( tooltip ) ; } return l ; }

Target:
protected static com.google.gwt.user.client.ui.InlineHyperlink createIcon ( com.google.gwt.resources.client.ImageResource res , java.lang.String tooltip , java.lang.String target ) { com.google.gwt.user.client.ui.InlineHyperlink l = new com.google.gwt.user.client.ui.InlineHyperlink ( com.google.gwt.user.client.ui.AbstractImagePrototype.create ( res ) . getHTML ( ) , true , target ) ; if ( tooltip != null ) { l.setTitle ( tooltip ) ; } return l ; }
Source:
public void setUp ( ) throws java.lang.Exception { com.google.gerrit.server.git.WorkQueue workQueueMock = org.mockito.Mockito.mock ( com.google.gerrit.server.git.WorkQueue.class ) ; org.mockito.Mockito.when ( workQueueMock.createQueue ( 4 , "Forward-stream-event" ) ) . thenReturn ( executorMock ) ; com.ericsson.gerrit.plugins.highavailability.Configuration configMock = org.mockito.Mockito.mock ( com.ericsson.gerrit.plugins.highavailability.Configuration.class ) ; org.mockito.Mockito.when ( configMock.getEventThreadPoolSize ( ) ) . thenReturn ( 4 ) ; eventsExecutorProvider = new com.ericsson.gerrit.plugins.highavailability.event.EventExecutorProvider ( workQueueMock , configMock ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { com.google.gerrit.server.git.WorkQueue workQueueMock = org.mockito.Mockito.mock ( com.google.gerrit.server.git.WorkQueue.class ) ; org.mockito.Mockito.when ( workQueueMock.createQueue ( 1 , "Forward-stream-event" ) ) . thenReturn ( executorMock ) ; eventsExecutorProvider = new com.ericsson.gerrit.plugins.highavailability.event.EventExecutorProvider ( workQueueMock ) ; }