auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static java.lang.String refsDraftComments ( com.google.gerrit.reviewdb.client.Account.Id accountId , com.google.gerrit.reviewdb.client.Change.Id changeId ) { java.lang.StringBuilder r = com.google.gerrit.reviewdb.client.RefNames.buildRefsPrefix ( com.google.gerrit.reviewdb.client.RefNames.REFS_DRAFT_COMMENTS , accountId.get ( ) ) ; r.append ( changeId.get ( ) ) ; return r.toString ( ) ; }

Target:
public static java.lang.String changeMetaRef ( com.google.gerrit.reviewdb.client.Change.Id id ) { java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES ) ; int n = id.get ( ) ; int m = n % 100 ; if ( m < 10 ) { r.append ( '0' ) ; } r.append ( m ) ; r.append ( '/' ) ; r.append ( n ) ; r.append ( com.google.gerrit.reviewdb.client.RefNames.META_SUFFIX ) ; return r.toString ( ) ; }
Source:
public void onSend ( ) { com.google.gerrit.client.changes.ChangeApi.restore ( changeDetail.getChange ( ) . getChangeId ( ) , getMessageText ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.changes.ChangeInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo result ) { sent = true ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( new com.google.gerrit.reviewdb.client.Change.Id ( result._number ( ) ) ) ) ; hide ( ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { enableButtons ( true ) ; super . onFailure ( caught ) ; } } ) ; }

Target:
public void onSend ( ) { com.google.gerrit.client.changes.ChangeApi.abandon ( changeDetail.getChange ( ) . getChangeId ( ) , getMessageText ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.changes.ChangeInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo result ) { sent = true ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( new com.google.gerrit.reviewdb.client.Change.Id ( result._number ( ) ) ) ) ; hide ( ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { enableButtons ( true ) ; super . onFailure ( caught ) ; } } ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString result ) { java.lang.String action = result.asString ( ) ; try { com.google.gerrit.reviewdb.client.Project.SubmitType type = Project.SubmitType.valueOf ( action ) ; submitActionText.setInnerText ( com.google.gerrit.client.admin.Util.toLongString ( type ) ) ; } catch ( java.lang.IllegalArgumentException e ) { submitActionText.setInnerText ( action ) ; } }

Target:
private void renderSubmitType ( java.lang.String action ) { try { com.google.gerrit.reviewdb.client.Project.SubmitType type = Project.SubmitType.valueOf ( action ) ; submitActionText.setInnerText ( com.google.gerrit.client.admin.Util.toLongString ( type ) ) ; } catch ( java.lang.IllegalArgumentException e ) { submitActionText.setInnerText ( action ) ; } }
Source:
public void onSuccess ( final com.google.gerrit.common.data.HostPageData result ) { com.google.gwt.dom.client.Document.get ( ) . getElementById ( "gerrit_hostpagedata" ) . removeFromParent ( ) ; com.google.gerrit.client.Gerrit.myConfig = result.config ; com.google.gerrit.client.Gerrit.myTheme = result.theme ; com.google.gerrit.client.Gerrit.isNoteDbEnabled = result.isNoteDbEnabled ; if ( ( result.account ) != null ) { com.google.gerrit.client.Gerrit.myAccount = result.account ; com.google.gerrit.client.Gerrit.xGerritAuth = result.xGerritAuth ; } if ( ( result.accountDiffPref ) != null ) { com.google.gerrit.client.Gerrit.myAccountDiffPref = result.accountDiffPref ; com.google.gerrit.client.Gerrit.applyUserPreferences ( ) ; } onModuleLoad2 ( result ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.documentation.DocInfo indexInfo ) { com.google.gerrit.client.Gerrit.hasDocumentation = indexInfo != null ; com.google.gerrit.client.Gerrit.docUrl = com.google.gerrit.client.Gerrit.selfRedirect ( "/Documentation/" ) ; }
Source:
private static java.lang.Iterable < com.google.gerrit.reviewdb.client.Change > bumpLastUpdatedOn ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) { com.google.gerrit.reviewdb.client.Change c = ctx.getChange ( ) ; if ( c.getLastUpdatedOn ( ) . before ( ctx.getWhen ( ) ) ) { c.setLastUpdatedOn ( ctx.getWhen ( ) ) ; } return java.util.Collections.singleton ( c ) ; }

Target:
private static java.lang.Iterable < com.google.gerrit.reviewdb.client.Change > changesToUpdate ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) { com.google.gerrit.reviewdb.client.Change c = ctx.getChange ( ) ; if ( ( ctx.bumpLastUpdatedOn ) && ( c.getLastUpdatedOn ( ) . before ( ctx.getWhen ( ) ) ) ) { c.setLastUpdatedOn ( ctx.getWhen ( ) ) ; } return java.util.Collections.singleton ( c ) ; }
Source:
public void testUnblockForceWithAllowNoForce_NotPossible ( ) { com.google.gerrit.common.data.PermissionRule r = grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) ; r.setBlock ( ) ; r.setForce ( true ) ; grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }

Target:
public void testUnblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) ; r.setBlock ( ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertTrue ( "u can force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }
Source:
private void openRepos ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.git.IntegrationException { for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { try { openRepo ( project ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException noProject ) { logWarn ( ( ( ( "Project " + ( noProject.project ( ) ) ) + " no longer exists, " ) + "abandoning open changes" ) ) ; abandonAllOpenChangeForDeletedProject ( noProject.project ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.IntegrationException ( ( "Error opening project " + project ) , e ) ; } } }

Target:
private void openRepos ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.git.IntegrationException { for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { try { orm.openRepo ( project , true ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException noProject ) { logWarn ( ( ( ( "Project " + ( noProject.project ( ) ) ) + " no longer exists, " ) + "abandoning open changes" ) ) ; abandonAllOpenChangeForDeletedProject ( noProject.project ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.IntegrationException ( ( "Error opening project " + project ) , e ) ; } } }
Source:
public com.google.gerrit.extensions.common.RevisionInfo getRevisionInfo ( com.google.gerrit.server.project.ChangeControl ctl , com.google.gerrit.reviewdb.client.PatchSet in ) throws com.google.gerrit.server.GpgException , com.google.gerrit.server.patch.PatchListNotAvailableException , com.google.gwtorm.server.OrmException , java.io.IOException { accountLoader = accountLoaderFactory.create ( has ( com.google.gerrit.extensions.client.ListChangesOption.DETAILED_ACCOUNTS ) ) ; com.google.gerrit.extensions.common.RevisionInfo rev = toRevisionInfo ( ctl , in ) ; accountLoader.fill ( ) ; return rev ; }

Target:
public com.google.gerrit.extensions.common.RevisionInfo getRevisionInfo ( com.google.gerrit.server.project.ChangeControl ctl , com.google.gerrit.reviewdb.client.PatchSet in ) throws com.google.gerrit.server.GpgException , com.google.gerrit.server.patch.PatchListNotAvailableException , com.google.gwtorm.server.OrmException , java.io.IOException { accountLoader = accountLoaderFactory.create ( has ( com.google.gerrit.extensions.client.ListChangesOption.DETAILED_ACCOUNTS ) ) ; try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( ctl.getProject ( ) . getNameKey ( ) ) ) { com.google.gerrit.extensions.common.RevisionInfo rev = toRevisionInfo ( ctl , changeDataFactory.create ( db.get ( ) , ctl ) , in , repo ) ; accountLoader.fill ( ) ; return rev ; } }
Source:
public com.google.gerrit.extensions.api.changes.ChangeApi create ( com.google.gerrit.extensions.common.ChangeInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.extensions.common.ChangeInfo out = createChange.apply ( TopLevelResource.INSTANCE , in ) . value ( ) ; return api.create ( changes.parse ( new com.google.gerrit.reviewdb.client.Change.Id ( out._number ) ) ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException | com.google.gerrit.server.project.InvalidChangeOperationException | com.google.gerrit.server.update.UpdateException | com.google.gerrit.server.permissions.PermissionBackendException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot create change" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.changes.ChangeApi create ( com.google.gerrit.extensions.common.ChangeInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.extensions.common.ChangeInfo out = createChange.apply ( TopLevelResource.INSTANCE , in ) . value ( ) ; return api.create ( changes.parse ( new com.google.gerrit.reviewdb.client.Change.Id ( out._number ) ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot create change" , e ) ; } }
Source:
private com.google.gerrit.reviewdb.client.PatchSet insertPatchSet ( com.google.gerrit.reviewdb.client.Change c ) throws java.lang.Exception { db.changes ( ) . upsert ( java.util.Collections.singleton ( c ) ) ; org.eclipse.jgit.revwalk.RevCommit commit = repo.branch ( c.currentPatchSetId ( ) . toRefName ( ) ) . commit ( ) . parent ( tip ) . create ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , commit , userId ) ; updatePatchSetRef ( ps ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( ps ) ) ; return ps ; }

Target:
private com.google.gerrit.reviewdb.client.Change insertChange ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( project , adminId ) ; db.changes ( ) . insert ( java.util.Collections.singleton ( c ) ) ; return c ; }
Source:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { if ( ( ! ( allowDrafts ) ) && ( ( object.change ( ) . getStatus ( ) ) == ( Change.Status.DRAFT ) ) ) { return false ; } for ( com.google.gerrit.reviewdb.client.Account.Id accountId : object.reviewers ( ) . values ( ) ) { if ( id.equals ( accountId ) ) { return true ; } } return false ; }

Target:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { if ( ( ! ( allowDrafts ) ) && ( ( object.change ( ) . getStatus ( ) ) == ( Change.Status.DRAFT ) ) ) { return false ; } for ( com.google.gerrit.reviewdb.client.Account.Id accountId : object.reviewers ( ) . all ( ) ) { if ( id.equals ( accountId ) ) { return true ; } } return false ; }
Source:
private com.google.gerrit.extensions.restapi.Response < ? > apply ( com.google.gerrit.server.CurrentUser u , com.google.gerrit.reviewdb.client.Change c , com.google.gerrit.reviewdb.client.PatchSet.Id psId , com.google.gerrit.reviewdb.client.PatchSet ps ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException { try ( com.google.gerrit.server.git.BatchUpdate bu = updateFactory.create ( dbProvider.get ( ) , c.getProject ( ) , u , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ) { bu.addOp ( c.getId ( ) , new com.google.gerrit.server.change.PublishDraftPatchSet.Op ( psId , ps ) ) ; bu.execute ( ) ; } return com.google.gerrit.extensions.restapi.Response.none ( ) ; }

Target:
private com.google.gerrit.extensions.restapi.Response < ? > apply ( com.google.gerrit.server.CurrentUser u , com.google.gerrit.reviewdb.client.Change c , com.google.gerrit.reviewdb.client.PatchSet.Id psId , com.google.gerrit.reviewdb.client.PatchSet ps ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.update.UpdateException { try ( com.google.gerrit.server.update.BatchUpdate bu = updateFactory.create ( dbProvider.get ( ) , c.getProject ( ) , u , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ) { bu.addOp ( c.getId ( ) , new com.google.gerrit.server.change.PublishDraftPatchSet.Op ( psId , ps ) ) ; bu.execute ( ) ; } return com.google.gerrit.extensions.restapi.Response.none ( ) ; }
Source:
public void checkChanges ( java.lang.Iterable < com.google.gerrit.reviewdb.client.Change.Id > changeIds ) throws java.lang.Exception { checkActual ( readExpected ( changeIds ) , new java.util.ArrayList < java.lang.String > ( ) ) ; }

Target:
private java.util.List < com.google.gerrit.server.notedb.ChangeBundle > readExpected ( java.util.stream.Stream < com.google.gerrit.reviewdb.client.Change.Id > changeIds ) throws java.lang.Exception { boolean old = notesMigration.readChanges ( ) ; try { notesMigration.setReadChanges ( false ) ; return changeIds.sorted ( java.util.Comparator.comparing ( IntKey :: get ) ) . map ( this :: readBundleUnchecked ) . collect ( java.util.stream.Collectors.toList ( ) ) ; } finally { notesMigration.setReadChanges ( old ) ; } }
Source:
private com.google.inject.Key < javax.servlet.http.HttpServlet > screen ( final java.lang.String target ) { return key ( new javax.servlet.http.HttpServlet ( ) { @ java.lang.Override protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { toGerrit ( target , req , rsp ) ; } } ) ; }

Target:
private com.google.inject.Key < javax.servlet.http.HttpServlet > screen ( final java.lang.String target ) { return key ( new javax.servlet.http.HttpServlet ( ) { private static final long serialVersionUID = 1L ; @ java.lang.Override protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { toGerrit ( target , req , rsp ) ; } } ) ; }
Source:
public void setUp ( ) { listenerMock = org.mockito.Mockito.mock ( com.google.gerrit.common.EventListener.class ) ; com.google.gerrit.extensions.registration.DynamicSet < com.google.gerrit.common.EventListener > listeners = com.google.gerrit.extensions.registration.DynamicSet.emptySet ( ) ; listeners.add ( listenerMock ) ; broker = new com.ericsson.gerrit.plugins.highavailability.forwarder.ForwardedAwareEventBroker ( null , listeners , null , null , null , null ) ; }

Target:
public void setUp ( ) { listenerMock = org.mockito.Mockito.mock ( com.google.gerrit.server.events.EventListener.class ) ; com.google.gerrit.extensions.registration.DynamicSet < com.google.gerrit.server.events.EventListener > listeners = com.google.gerrit.extensions.registration.DynamicSet.emptySet ( ) ; listeners.add ( listenerMock ) ; broker = new com.ericsson.gerrit.plugins.highavailability.forwarder.ForwardedAwareEventBroker ( null , listeners , null , null , null , null ) ; }
Source:
public com.google.gerrit.extensions.restapi.BinaryResult apply ( com.google.gerrit.server.change.FileResource rsrc ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException , java.io.IOException { return apply ( rsrc.getRevision ( ) . getControl ( ) . getProject ( ) . getNameKey ( ) , rsrc.getRevision ( ) . getPatchSet ( ) . getRevision ( ) . get ( ) , rsrc.getPatchKey ( ) . get ( ) ) ; }

Target:
public com.google.gerrit.extensions.restapi.BinaryResult apply ( com.google.gerrit.server.change.FileResource rsrc ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException , java.io.IOException { return fileContentUtil.getContent ( rsrc.getRevision ( ) . getControl ( ) . getProject ( ) . getNameKey ( ) , rsrc.getRevision ( ) . getPatchSet ( ) . getRevision ( ) . get ( ) , rsrc.getPatchKey ( ) . get ( ) ) ; }
Source:
public java.lang.String getString ( java.lang.String name , java.lang.String defaultValue ) { if ( defaultValue == null ) { return cfg.getString ( com.google.gerrit.server.config.PluginConfig.PLUGIN , pluginName , name ) ; } else { return com.google.common.base.Objects.firstNonNull ( cfg.getString ( com.google.gerrit.server.config.PluginConfig.PLUGIN , pluginName , name ) , defaultValue ) ; } }

Target:
public java.lang.String getString ( java.lang.String name , java.lang.String defaultValue ) { if ( defaultValue == null ) { return cfg.getString ( com.google.gerrit.server.config.PluginConfig.PLUGIN , pluginName , name ) ; } else { return com.google.common.base.MoreObjects.firstNonNull ( cfg.getString ( com.google.gerrit.server.config.PluginConfig.PLUGIN , pluginName , name ) , defaultValue ) ; } }
Source:
private void setTable ( com.google.gerrit.client.change.FileTable.MyTable table ) { clear ( ) ; add ( table ) ; this . table = table ; if ( register ) { table.setRegisterKeys ( true ) ; } }

Target:
private void setTable ( com.google.gerrit.client.change.FileTable.MyTable table ) { clear ( ) ; add ( table ) ; this . table = table ; if ( register ) { table.setRegisterKeys ( true ) ; } if ( ( reviewed ) != null ) { table.markReviewed ( reviewed ) ; reviewed = null ; } if ( ( scrollToPath ) != null ) { table.scrollToPath ( scrollToPath ) ; scrollToPath = null ; } }
Source:
private java.util.List < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > parseScopes ( java.lang.String scopesString ) { java.util.ArrayList < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > scopes = new java.util.ArrayList < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > ( ) ; if ( ( com.google.common.base.Strings.emptyToNull ( scopesString ) ) != null ) { java.lang.String [ ] scopesStrings = scopesString.split ( "," ) ; for ( java.lang.String scope : scopesStrings ) { scopes.add ( java.lang.Enum.valueOf ( com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope.class , scope ) ) ; } } return scopes ; }

Target:
private java.util.List < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > parseScopesString ( java.lang.String scopesString ) { java.util.ArrayList < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > scopes = new java.util.ArrayList < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > ( ) ; if ( ( com.google.common.base.Strings.emptyToNull ( scopesString ) ) != null ) { java.lang.String [ ] scopesStrings = scopesString.split ( "," ) ; for ( java.lang.String scope : scopesStrings ) { scopes.add ( java.lang.Enum.valueOf ( com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope.class , scope ) ) ; } } return scopes ; }
Source:
public void save ( ) throws java.lang.Exception { com.google.gerrit.server.git.gpg.TestKey key1 = com.google.gerrit.server.git.gpg.TestKey.key1 ( ) ; com.google.gerrit.server.git.gpg.TestKey key2 = com.google.gerrit.server.git.gpg.TestKey.key2 ( ) ; store.add ( key1.getPublicKeyRing ( ) ) ; store.add ( key2.getPublicKeyRing ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) , key1 ) ; assertKeys ( key2.getKeyId ( ) , key2 ) ; }

Target:
public void save ( ) 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 ( ) ; store.add ( key1.getPublicKeyRing ( ) ) ; store.add ( key2.getPublicKeyRing ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) , key1 ) ; assertKeys ( key2.getKeyId ( ) , key2 ) ; }
Source:
private java.util.Set < java.lang.String > fields ( com.google.gerrit.server.query.change.QueryOptions opts ) { if ( ( schemaHasRequestedField ( ChangeField.LEGACY_ID2 , opts.fields ( ) ) ) || ( schemaHasRequestedField ( ChangeField.CHANGE , opts.fields ( ) ) ) ) { return opts.fields ( ) ; } return com.google.common.collect.Sets.union ( opts.fields ( ) , com.google.common.collect.ImmutableSet.of ( com.google.gerrit.server.index.ChangeField.LEGACY_ID2.getName ( ) ) ) ; }

Target:
private java.util.Set < java.lang.String > fields ( com.google.gerrit.server.query.change.QueryOptions opts ) { if ( ( schemaHasRequestedField ( ChangeField.LEGACY_ID , opts.fields ( ) ) ) || ( schemaHasRequestedField ( ChangeField.CHANGE , opts.fields ( ) ) ) ) { return opts.fields ( ) ; } return com.google.common.collect.Sets.union ( opts.fields ( ) , com.google.common.collect.ImmutableSet.of ( com.google.gerrit.server.index.ChangeField.LEGACY_ID.getName ( ) ) ) ; }
Source:
private int adjustCommitMessageLine ( int line ) { int offset = 6 ; if ( diff.text_b ( ) . startsWith ( "Merge" ) ) { offset += 1 ; } if ( line <= offset ) { return 1 ; } else { return line - offset ; } }

Target:
private int adjustCommitMessageLine ( int line ) { int offset = 6 ; if ( diff.textB ( ) . startsWith ( "Merge" ) ) { offset += 1 ; } if ( line <= offset ) { return 1 ; } else { return line - offset ; } }
Source:
public void addReviewerToReviewableChangeByOtherCcingSelfInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.TestAccount other = accounts.create ( "other" , "other@example.com" , "other" ) ; forAll ( ( adder ) -> { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; com.google.gerrit.acceptance.TestAccount reviewer = accounts.create ( "added" , "added@example.com" , "added" ) ; addReviewer ( adder , sc.changeId , other , reviewer.email , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.CC_ON_OWN_COMMENTS , null ) ; assertThat ( sender ) . sent ( "newchange" , sc ) . to ( reviewer ) . cc ( sc.owner , sc.reviewer , other ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( sc.starrer ) ; } ) ; }

Target:
public void addReviewerToReviewableChangeByOtherCcingSelfInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.TestAccount other = accountCreator.create ( "other" , "other@example.com" , "other" ) ; forAll ( ( adder ) -> { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; com.google.gerrit.acceptance.TestAccount reviewer = accountCreator.create ( "added" , "added@example.com" , "added" ) ; addReviewer ( adder , sc.changeId , other , reviewer.email , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.CC_ON_OWN_COMMENTS , null ) ; assertThat ( sender ) . sent ( "newchange" , sc ) . to ( reviewer ) . cc ( sc.owner , sc.reviewer , other ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . noOneElse ( ) ; } ) ; }
Source:
protected com.google.gerrit.reviewdb.client.Change newChange ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( project , changeOwner.getAccountId ( ) ) ; com.google.gerrit.server.notedb.ChangeUpdate u = newUpdate ( c , changeOwner ) ; u.setChangeId ( c.getKey ( ) . get ( ) ) ; u.setBranch ( c.getDest ( ) . get ( ) ) ; u.commit ( ) ; return c ; }

Target:
protected com.google.gerrit.reviewdb.client.Change newChange ( boolean workInProgress ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( project , changeOwner.getAccountId ( ) ) ; com.google.gerrit.server.notedb.ChangeUpdate u = newUpdate ( c , changeOwner ) ; u.setChangeId ( c.getKey ( ) . get ( ) ) ; u.setBranch ( c.getDest ( ) . get ( ) ) ; u.setWorkInProgress ( workInProgress ) ; u.commit ( ) ; return c ; }
Source:
private static void initVimKeys ( ) { net.codemirror.lib.KeyMap km = net.codemirror.lib.CodeMirror.cloneKeyMap ( "vim" ) ; for ( java.lang.String s : new java.lang.String [ ] { "A" , "C" , "O" , "R" , "U" , "Ctrl-C" } ) { km.remove ( s ) ; } net.codemirror.lib.CodeMirror.addKeyMap ( "vim_ro" , km ) ; }

Target:
private static void initVimKeys ( ) { net.codemirror.lib.KeyMap km = net.codemirror.lib.CodeMirror.cloneKeyMap ( "vim" ) ; for ( java.lang.String s : new java.lang.String [ ] { "A" , "C" , "O" , "R" , "U" , "Ctrl-C" , "Ctrl-O" } ) { km.remove ( s ) ; } net.codemirror.lib.CodeMirror.addKeyMap ( "vim_ro" , km ) ; }
Source:
protected void onLoad ( ) { super . onLoad ( ) ; com.google.gerrit.client.groups.GroupMap.all ( new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.groups.GroupMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.groups.GroupMap result ) { groups.display ( result ) ; groups.finishDisplay ( ) ; } } ) ; }

Target:
protected void onLoad ( ) { super . onLoad ( ) ; refresh ( ) ; }
Source:
private void deleteActionCategories ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { try { java.sql.Statement stmt = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . createStatement ( ) ; try { stmt.executeUpdate ( "DELETE FROM approval_categories WHERE position < 0" ) ; } finally { stmt.close ( ) ; } } catch ( java.sql.SQLException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } }

Target:
private void deleteActionCategories ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws java.sql.SQLException { try ( java.sql.Statement stmt = newStatement ( db ) ) { stmt.executeUpdate ( "DELETE FROM approval_categories WHERE position < 0" ) ; } }
Source:
public int shutdown ( ) { int cnt = 0 ; if ( ( pool ) != null ) { for ( java.lang.Runnable r : pool.getQueue ( ) ) { com.googlesource.gerrit.plugins.replication.Destination.repLog.warn ( java.lang.String.format ( "Cancelling replication event %s" , r ) ) ; } cnt = pool.shutdownNow ( ) . size ( ) ; pool = null ; } return cnt ; }

Target:
public int shutdown ( ) { int cnt = 0 ; if ( ( pool ) != null ) { com.googlesource.gerrit.plugins.replication.Destination.repLog.warn ( java.lang.String.format ( "Cancelling replication events" ) ) ; cnt = pool.shutdownNow ( ) . size ( ) ; pool = null ; } return cnt ; }
Source:
private void autoSubmitIfMergeable ( com.google.gerrit.server.data.ChangeAttribute change ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.project.NoSuchChangeException , com.google.gerrit.server.update.UpdateException , com.google.gwtorm.server.OrmException , java.io.IOException { if ( atomicityHelper.isSubmittable ( change.project , change.number ) ) { com.criteo.gerrit.plugins.automerge.AutomaticMerger.log.info ( java.lang.String.format ( "Change %d is submittable. Will try to merge all related changes." , change.number ) ) ; attemptToMerge ( change ) ; } }

Target:
private void autoSubmitIfMergeable ( com.google.gerrit.server.data.ChangeAttribute change ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.project.NoSuchChangeException , com.google.gerrit.server.update.UpdateException , com.google.gwtorm.server.OrmException , java.io.IOException { if ( atomicityHelper.isSubmittable ( change.project , change.number ) ) { if ( atomicityHelper.isAtomicReview ( change ) ) { com.criteo.gerrit.plugins.automerge.AutomaticMerger.log.info ( java.lang.String.format ( "Change %d is submittable. Will try to merge all related changes." , change.number ) ) ; attemptToMergeAtomic ( change ) ; } else { com.criteo.gerrit.plugins.automerge.AutomaticMerger.log.info ( java.lang.String.format ( "Change %d is submittable. Submitting ..." , change.number ) ) ; atomicityHelper.mergeReview ( change.project , change.number ) ; } } }
Source:
public com.google.gerrit.server.change.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Ignore" ) . setTitle ( "Ignore the change" ) . setVisible ( ( ( ! ( rsrc.isUserOwner ( ) ) ) && ( ! ( isIgnored ( rsrc ) ) ) ) ) ; }

Target:
private boolean canIgnore ( com.google.gerrit.server.change.ChangeResource rsrc ) { return ( ! ( rsrc.isUserOwner ( ) ) ) && ( ! ( isIgnored ( rsrc ) ) ) ; }
Source:
private void notifyDraftDelta ( final int delta ) { com.google.gwt.user.client.ui.Widget p = getParent ( ) ; if ( p != null ) { p = p.getParent ( ) ; if ( p != null ) { ( ( com.google.gerrit.client.patches.AbstractPatchContentTable ) ( p ) ) . notifyDraftDelta ( delta ) ; } } }

Target:
private void notifyDraftDelta ( final int delta ) { com.google.gerrit.client.patches.CommentEditorContainer c = getContainer ( ) ; if ( c != null ) { c.notifyDraftDelta ( delta ) ; } }
Source:
public void assertHasNoPackFile ( com.google.gerrit.reviewdb.client.Project ... projects ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { for ( com.google.gerrit.reviewdb.client.Project.NameKey p : projects ) { com.google.common.truth.Truth.assert_ ( ) . withFailureMessage ( ( ( "Project " + ( p.get ( ) ) ) + " has pack files." ) ) . that ( getPackFiles ( p ) ) . isEmpty ( ) ; } }

Target:
public void assertHasNoPackFile ( com.google.gerrit.reviewdb.client.Project ... projects ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { for ( com.google.gerrit.reviewdb.client.Project.NameKey p : projects ) { com.google.common.truth.Truth.assert_ ( ) . withMessage ( ( ( "Project " + ( p.get ( ) ) ) + " has pack files." ) ) . that ( getPackFiles ( p ) ) . isEmpty ( ) ; } }
Source:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( new com.google.gerrit.server.GerritServerModule ( ) ) ; final com.google.gerrit.server.GerritServer gs = injector.getInstance ( com.google.gerrit.server.GerritServer.class ) ; gs.getSchemaFactory ( ) . open ( ) . close ( ) ; java.lang.System.out.println ( "Gerrit2 schema initialized" ) ; return 0 ; }

Target:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( new com.google.gerrit.server.GerritServerModule ( ) ) ; injector.injectMembers ( this ) ; injector.getInstance ( com.google.gerrit.server.GerritServer.class ) ; schema.open ( ) . close ( ) ; java.lang.System.out.println ( "Gerrit2 schema initialized" ) ; return 0 ; }
Source:
private void removeActiveLineHighlight ( net.codemirror.lib.CodeMirror cm ) { if ( cm.hasActiveLine ( ) ) { net.codemirror.lib.CodeMirror.LineHandle activeLine = cm.getActiveLine ( ) ; cm.removeLineClass ( activeLine , LineClassWhere.WRAP , DiffTable.style.activeLine ( ) ) ; cm.removeLineClass ( activeLine , LineClassWhere.BACKGROUND , DiffTable.style.activeLineBg ( ) ) ; } }

Target:
private void clearActiveLine ( net.codemirror.lib.CodeMirror cm ) { if ( cm.hasActiveLine ( ) ) { net.codemirror.lib.CodeMirror.LineHandle activeLine = cm.getActiveLine ( ) ; cm.removeLineClass ( activeLine , LineClassWhere.WRAP , DiffTable.style.activeLine ( ) ) ; cm.removeLineClass ( activeLine , LineClassWhere.BACKGROUND , DiffTable.style.activeLineBg ( ) ) ; cm.setActiveLine ( null ) ; } }
Source:
public boolean cleanUp ( ) { java.io.File gitDirectory = destinationDirectory ; if ( ! ( gitDirectory.exists ( ) ) ) { return false ; } try { org.apache.commons.io.FileUtils.deleteDirectory ( gitDirectory ) ; return true ; } catch ( java.io.IOException e ) { com.googlesrouce.gerrit.plugins.github.git.GitClone.log.error ( ( "Cannot clean-up output Git directory " + gitDirectory ) ) ; return false ; } }

Target:
private void setProjectSettings ( ) { com.google.gerrit.reviewdb.client.Project project = config.getProject ( ) ; project.setDescription ( description ) ; project.setSubmitType ( SubmitType.MERGE_IF_NECESSARY ) ; project.setUseContributorAgreements ( InheritableBoolean.INHERIT ) ; project.setUseSignedOffBy ( InheritableBoolean.INHERIT ) ; project.setUseContentMerge ( InheritableBoolean.INHERIT ) ; project.setRequireChangeID ( InheritableBoolean.INHERIT ) ; }
Source:
protected void setUseContentMerge ( ) throws java.io.IOException { com.google.gerrit.server.project.PutConfig.Input in = new com.google.gerrit.server.project.PutConfig.Input ( ) ; in.useContentMerge = com.google.gerrit.extensions.common.InheritableBoolean.TRUE ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/projects/" + ( project.get ( ) ) ) + "/config" ) , in ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; r.consume ( ) ; }

Target:
protected void setUseContentMerge ( ) throws java.io.IOException { com.google.gerrit.server.project.PutConfig.Input in = new com.google.gerrit.server.project.PutConfig.Input ( ) ; in.useContentMerge = com.google.gerrit.extensions.client.InheritableBoolean.TRUE ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/projects/" + ( project.get ( ) ) ) + "/config" ) , in ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; r.consume ( ) ; }
Source:
private void updatePublishedComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) throws com.google.gwtorm.server.OrmException { verifyComment ( c ) ; if ( ( notes ) == null ) { notes = getChangeNotes ( ) . load ( ) ; } if ( migration.readComments ( ) ) { com.google.common.base.Preconditions.checkArgument ( ( ! ( notes.containsCommentPublished ( c ) ) ) , "Cannot update a comment that has already been published and saved" ) ; } if ( ( c.getSide ( ) ) == 0 ) { commentsForBase.add ( c ) ; } else { commentsForPs.add ( c ) ; } }

Target:
private void updatePublishedComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) throws com.google.gwtorm.server.OrmException { verifyComment ( c ) ; if ( ( notes ) == null ) { notes = getChangeNotes ( ) . load ( ) ; } if ( migration.readChanges ( ) ) { com.google.common.base.Preconditions.checkArgument ( ( ! ( notes.containsCommentPublished ( c ) ) ) , "Cannot update a comment that has already been published and saved" ) ; } if ( ( c.getSide ( ) ) == 0 ) { commentsForBase.add ( c ) ; } else { commentsForPs.add ( c ) ; } }
Source:
public com.google.gerrit.reviewdb.AccountGroup createEntry ( final com.google.gerrit.reviewdb.AccountGroup.NameKey key ) throws java.lang.Exception { return lookup ( key ) ; }

Target:
public com.google.gerrit.reviewdb.AccountGroup createEntry ( final com.google.gerrit.reviewdb.AccountGroup.NameKey key ) throws java.lang.Exception { final com.google.gerrit.reviewdb.AccountGroupName r ; final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { r = db.accountGroupNames ( ) . get ( key ) ; if ( r != null ) { return db.accountGroups ( ) . get ( r.getId ( ) ) ; } else { return null ; } } finally { db.close ( ) ; } }
Source:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { return object.notes ( ) . load ( ) . getHashtags ( ) . contains ( getValue ( ) ) ; }

Target:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { for ( java.lang.String hashtag : object.notes ( ) . load ( ) . getHashtags ( ) ) { if ( hashtag.equalsIgnoreCase ( getValue ( ) ) ) { return true ; } } return false ; }
Source:
public void onKeyPress ( final com.google.gwt.event.dom.client.KeyPressEvent event ) { for ( int row = getCurrentRow ( ) ; 0 <= row ; row -- ) { final java.lang.Object item = getRowItem ( row ) ; if ( item instanceof com.google.gerrit.client.patches.PatchLine ) { onInsertComment ( ( ( com.google.gerrit.client.patches.PatchLine ) ( item ) ) ) ; return ; } else if ( item instanceof com.google.gerrit.client.patches.AbstractPatchContentTable.CommentList ) { continue ; } else { return ; } } }

Target:
public void onKeyPress ( final com.google.gwt.event.dom.client.KeyPressEvent event ) { ensurePointerVisible ( ) ; for ( int row = getCurrentRow ( ) ; 0 <= row ; row -- ) { final java.lang.Object item = getRowItem ( row ) ; if ( item instanceof com.google.gerrit.client.patches.PatchLine ) { onInsertComment ( ( ( com.google.gerrit.client.patches.PatchLine ) ( item ) ) ) ; return ; } else if ( item instanceof com.google.gerrit.client.patches.AbstractPatchContentTable.CommentList ) { continue ; } else { return ; } } }
Source:
private static com.google.gerrit.extensions.auth.oauth.OAuthUserInfo getAsOAuthUserInfo ( com.googlesource.gerrit.plugins.cfoauth.UserInfo userInfo ) { return new com.google.gerrit.extensions.auth.oauth.OAuthUserInfo ( userInfo.getExternalId ( ) , userInfo.getUserName ( ) , userInfo.getEmailAddress ( ) , userInfo.getDisplayName ( ) , null ) ; }

Target:
private com.google.gerrit.extensions.auth.oauth.OAuthUserInfo getAsOAuthUserInfo ( com.googlesource.gerrit.plugins.cfoauth.AccessToken accessToken ) { com.googlesource.gerrit.plugins.cfoauth.UserInfo userInfo = accessToken.getUserInfo ( ) ; userInfo.setDisplayName ( uaaClient.getDisplayName ( accessToken.getValue ( ) ) ) ; return new com.google.gerrit.extensions.auth.oauth.OAuthUserInfo ( userInfo.getExternalId ( ) , userInfo.getUserName ( ) , userInfo.getEmailAddress ( ) , userInfo.getDisplayName ( ) , null ) ; }
Source:
public void onClick ( com.google.gwt.user.client.ui.Widget sender ) { Util.MANAGE_SVC.patchSetAction ( max.getId ( ) , patchSet.getId ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( com.google.gwtjsonrpc.client.VoidResult result ) { actionsPanel.remove ( b ) ; } } ) ; }

Target:
public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; super . onFailure ( caught ) ; }
Source:
private java.util.List < com.google.gerrit.extensions.api.projects.TagInfo > listTags ( com.google.gerrit.server.api.projects.ListRefsRequest < com.google.gerrit.extensions.api.projects.TagInfo > request ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.project.ListTags list = listTagsProvider.get ( ) ; list.setLimit ( request.getLimit ( ) ) ; list.setStart ( request.getStart ( ) ) ; try { return list.apply ( checkExists ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot list tags" , e ) ; } }

Target:
private java.util.List < com.google.gerrit.extensions.api.projects.TagInfo > listTags ( com.google.gerrit.server.api.projects.ListRefsRequest < com.google.gerrit.extensions.api.projects.TagInfo > request ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.project.ListTags list = listTagsProvider.get ( ) ; list.setLimit ( request.getLimit ( ) ) ; list.setStart ( request.getStart ( ) ) ; list.setMatchSubstring ( request.getSubstring ( ) ) ; list.setMatchRegex ( request.getRegex ( ) ) ; try { return list.apply ( checkExists ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot list tags" , e ) ; } }
Source:
public com.google.gerrit.server.change.ChangeEditResource parse ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.extensions.restapi.IdString id ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( rsrc.getChange ( ) ) ; if ( ! ( edit.isPresent ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } return new com.google.gerrit.server.change.ChangeEditResource ( rsrc , edit.get ( ) , id.get ( ) ) ; }

Target:
public com.google.gerrit.server.change.ChangeEditResource parse ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.extensions.restapi.IdString id ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gwtorm.server.OrmException , java.io.IOException { java.util.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( rsrc.getChange ( ) ) ; if ( ! ( edit.isPresent ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } return new com.google.gerrit.server.change.ChangeEditResource ( rsrc , edit.get ( ) , id.get ( ) ) ; }
Source:
void onExpandAllComments ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.expandAllComments ( e.getValue ( ) ) ; if ( ( view ) != null ) { view.getCommentManager ( ) . setExpandAllComments ( prefs.expandAllComments ( ) ) ; } }

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 testCUSTOM_NullUser ( ) { setFrom ( "A ${user} B <my.server@email.address>" ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( null ) ; assertNotNull ( r ) ; assertEquals ( ident.getName ( ) , r.name ) ; assertEquals ( "my.server@email.address" , r.email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }

Target:
public void testMIXED_NoPreferredEmailUser ( ) { setFrom ( "MIXED" ) ; final java.lang.String name = "A U. Thor" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( name , null ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; org.junit.Assert.assertNotNull ( r ) ; org.junit.Assert.assertEquals ( ( name + " (Code Review)" ) , r.name ) ; org.junit.Assert.assertEquals ( ident.getEmailAddress ( ) , r.email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }
Source:
private com.google.gerrit.server.account.AuthResult byAccountId ( final java.lang.String idStr ) { final com.google.gerrit.reviewdb.client.Account.Id id ; try { id = Account.Id.parse ( idStr ) ; } catch ( java.lang.NumberFormatException nfe ) { return null ; } try ( com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ) { return auth ( db.accounts ( ) . get ( id ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { getServletContext ( ) . log ( "cannot query database" , e ) ; return null ; } }

Target:
private com.google.gerrit.server.account.AuthResult byAccountId ( final java.lang.String idStr ) { final com.google.gerrit.reviewdb.client.Account.Id id ; try { id = Account.Id.parse ( idStr ) ; } catch ( java.lang.NumberFormatException nfe ) { return null ; } try ( com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ) { return auth ( accounts.get ( db , id ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { getServletContext ( ) . log ( "cannot query database" , e ) ; return null ; } }
Source:
public boolean isVisible ( ) { com.google.gerrit.reviewdb.client.AccountGroup accountGroup = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( group ) ; return ( ( ( accountGroup != null ) && ( accountGroup.isVisibleToAll ( ) ) ) || ( user.getEffectiveGroups ( ) . contains ( group.getGroupUUID ( ) ) ) ) || ( isOwner ( ) ) ; }

Target:
public boolean isVisible ( ) { com.google.gerrit.reviewdb.client.AccountGroup accountGroup = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( group ) ; return ( ( ( ( accountGroup != null ) && ( accountGroup.isVisibleToAll ( ) ) ) || ( ( user ) instanceof com.google.gerrit.server.InternalUser ) ) || ( user.getEffectiveGroups ( ) . contains ( group.getGroupUUID ( ) ) ) ) || ( isOwner ( ) ) ; }
Source:
public void testFindInCommon ( ) { com.google.gerrit.client.diff.LineMapper mapper = new com.google.gerrit.client.diff.LineMapper ( ) ; mapper.appendCommon ( 10 ) ; org.junit.Assert.assertEquals ( new com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo ( 9 , true ) , mapper.lineOnOther ( Side.PARENT , 9 ) ) ; org.junit.Assert.assertEquals ( new com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo ( 9 , true ) , mapper.lineOnOther ( Side.REVISION , 9 ) ) ; }

Target:
public void testFindInCommon ( ) { com.google.gerrit.client.diff.LineMapper mapper = new com.google.gerrit.client.diff.LineMapper ( ) ; mapper.appendCommon ( 10 ) ; org.junit.Assert.assertEquals ( new com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo ( 9 , true ) , mapper.lineOnOther ( DisplaySide.A , 9 ) ) ; org.junit.Assert.assertEquals ( new com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo ( 9 , true ) , mapper.lineOnOther ( DisplaySide.B , 9 ) ) ; }
Source:
public void start ( final org.apache.sshd.server.Environment env ) { startThread ( new com.google.gerrit.plugins.CommandRunnable ( ) { @ java.lang.Override public void run ( ) throws com.google.gerrit.plugins.Failure { parseCommandLine ( ) ; final java.io.PrintWriter stdout = toPrintWriter ( out ) ; stdout.println ( "Hello world!" ) ; stdout.flush ( ) ; } } ) ; }

Target:
public void run ( ) throws com.google.gerrit.plugins.Failure , com.google.gerrit.plugins.UnloggedFailure , java.lang.Exception { final java.lang.String greeting = ( french ) ? "Bonjour " : "Hello " ; stdout.print ( ( ( greeting + ( name ) ) + "!\n" ) ) ; }
Source:
public void listOneGroupMember ( ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( GET_ONE ( "/groups/Administrators/members/admin" ) . name ) . isEqualTo ( admin.fullName ) ; }

Target:
public void listOneGroupMember ( ) throws java.lang.Exception { java.lang.String group = createGroup ( "group" ) ; java.lang.String user = createAccount ( "user1" , group ) ; assertMembers ( GET ( ( ( "/groups/" + group ) + "/members/" ) ) , user ) ; com.google.common.truth.Truth.assertThat ( GET_ONE ( ( ( ( "/groups/" + group ) + "/members/" ) + user ) ) . name ) . isEqualTo ( user ) ; }
Source:
void addReviewer ( final java.lang.String nameOrEmail ) throws org.kohsuke.args4j.CmdLineException { reviewerId.add ( toAccountId ( nameOrEmail ) ) ; }

Target:
void addReviewer ( final java.lang.String nameOrEmail ) throws org.kohsuke.args4j.CmdLineException { try { reviewerId.add ( toAccountId ( nameOrEmail ) ) ; } catch ( javax.security.auth.login.AccountNotFoundException e ) { throw new org.kohsuke.args4j.CmdLineException ( e.getMessage ( ) ) ; } catch ( com.google.gwtorm.client.OrmException e ) { throw new org.kohsuke.args4j.CmdLineException ( "database is down" ) ; } }
Source:
public void testExpiredTime ( ) throws java.lang.Exception { org.joda.time.DateTime now = org.joda.time.DateTime.now ( ) . toDateTime ( DateTimeZone.UTC ) ; com.google.common.truth.Truth.assertThat ( auth.onTime ( com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.DATE_TIME.print ( now.minusSeconds ( 1 ) ) , "o" , "id" ) ) . isFalse ( ) ; }

Target:
public void testVerifyAuthInfo ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.AuthInfo info = auth.generateAuthInfo ( "o" , org.eclipse.jgit.lfs.lib.LongObjectId.zeroId ( ) , 1 ) ; com.google.common.truth.Truth.assertThat ( auth.verifyAuthInfo ( info.authToken , "o" , org.eclipse.jgit.lfs.lib.LongObjectId.zeroId ( ) ) ) . isTrue ( ) ; }