auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void abandonWipChangeInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; abandon ( sc.changeId , sc.owner ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . notTo ( sc.owner ) . cc ( sc.reviewer , sc.ccer ) . to ( sc.reviewerByEmail ) . cc ( sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }

Target:
public void abandonWipChangeNotifyAll ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; abandon ( sc.changeId , sc.owner , com.google.gerrit.extensions.api.changes.NotifyHandling.ALL ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . notTo ( sc.owner ) . cc ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }
Source:
protected < K , V > com.google.gerrit.server.cache.NamedCacheBinding < K , V > core ( final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < K , V > > type , final java.lang.String name ) { return core ( com.google.inject.Key.get ( type , com.google.inject.name.Names.named ( name ) ) , type ) . name ( name ) ; }

Target:
protected < K , V > com.google.gerrit.server.cache.NamedCacheBinding < K , V > cache ( final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < K , V > > type , final java.lang.String name ) { return cache ( com.google.inject.Key.get ( type , com.google.inject.name.Names.named ( name ) ) , type ) . name ( name ) ; }
Source:
public void onSuccess ( com.google.gwt.core.client.JavaScriptObject msg ) { if ( com.google.gerrit.client.rpc.NativeString.is ( msg ) ) { com.google.gerrit.client.rpc.NativeString str = ( ( com.google.gerrit.client.rpc.NativeString ) ( msg ) ) ; if ( ! ( str.asString ( ) . isEmpty ( ) ) ) { com.google.gwt.user.client.Window.alert ( str.asString ( ) ) ; } } com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( id ) ) ; }

Target:
static void invoke ( com.google.gerrit.client.changes.ChangeInfo change , com.google.gerrit.client.actions.ActionInfo action , com.google.gerrit.client.rpc.RestApi api ) { com.google.gerrit.client.api.DefaultActions.invoke ( action , api , com.google.gerrit.client.api.DefaultActions.callback ( com.google.gerrit.common.PageLinks.toChange ( change.legacy_id ( ) ) ) ) ; }
Source:
public static com.google.gerrit.reviewdb.client.Change newChange ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Account.Id userId , int id ) { com.google.gerrit.reviewdb.client.Change.Id changeId = new com.google.gerrit.reviewdb.client.Change.Id ( id ) ; com.google.gerrit.reviewdb.client.Change c = new com.google.gerrit.reviewdb.client.Change ( new com.google.gerrit.reviewdb.client.Change.Key ( "Iabcd1234abcd1234abcd1234abcd1234abcd1234" ) , changeId , userId , new com.google.gerrit.reviewdb.client.Branch.NameKey ( project , "master" ) , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; com.google.gerrit.testutil.TestChanges.incrementPatchSet ( c ) ; return c ; }

Target:
public static com.google.gerrit.reviewdb.client.Change newChange ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Account.Id userId , int id ) { com.google.gerrit.reviewdb.client.Change.Id changeId = new com.google.gerrit.reviewdb.client.Change.Id ( id ) ; com.google.gerrit.reviewdb.client.Change c = new com.google.gerrit.reviewdb.client.Change ( new com.google.gerrit.reviewdb.client.Change.Key ( "Iabcd1234abcd1234abcd1234abcd1234abcd1234" ) , changeId , userId , new com.google.gerrit.reviewdb.client.Branch.NameKey ( project , "master" ) , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; com.google.gerrit.testing.TestChanges.incrementPatchSet ( c ) ; return c ; }
Source:
private static void editTree ( com.google.gerrit.server.edit.ChangeEditModifier.TreeOperation op , org.eclipse.jgit.lib.Repository repo , org.eclipse.jgit.revwalk.RevWalk rw , org.eclipse.jgit.revwalk.RevCommit base , org.eclipse.jgit.dircache.DirCacheEditor dce , org.eclipse.jgit.lib.ObjectInserter ins , java.lang.String path , byte [ ] content ) throws com.google.gerrit.server.project.InvalidChangeOperationException , java.io.IOException { switch ( op ) { case DELETE_ENTRY : dce.add ( new org.eclipse.jgit.dircache.DirCacheEditor.DeletePath ( path ) ) ; break ; case CHANGE_ENTRY : case RESTORE_ENTRY : dce.add ( com.google.gerrit.server.edit.ChangeEditModifier.getPathEdit ( op , repo , rw , base , path , ins , content ) ) ; break ; } dce.finish ( ) ; }

Target:
private static org.eclipse.jgit.lib.ObjectId toBlob ( org.eclipse.jgit.lib.ObjectInserter ins , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.restapi.RawInput content ) throws java.io.IOException { if ( content == null ) { return null ; } long len = content.getContentLength ( ) ; java.io.InputStream in = content.getInputStream ( ) ; if ( len < 0 ) { return ins.insert ( org.eclipse.jgit.lib.Constants.OBJ_BLOB , com.google.common.io.ByteStreams.toByteArray ( in ) ) ; } return ins.insert ( org.eclipse.jgit.lib.Constants.OBJ_BLOB , len , in ) ; }
Source:
void addComments ( java.util.List < com.google.gerrit.client.changes.CommentInfo > list ) { if ( isOpen ( ) ) { renderComments ( list ) ; comments.setVisible ( ( ( comments.getWidgetCount ( ) ) > 0 ) ) ; commentList = java.util.Collections.emptyList ( ) ; } else { commentList = list ; } }

Target:
void addComments ( java.util.List < com.google.gerrit.client.changes.CommentInfo > list ) { if ( isOpen ( ) ) { renderComments ( list ) ; comments.setVisible ( ( ( comments.getWidgetCount ( ) ) > 0 ) ) ; commentList = java.util.Collections.emptyList ( ) ; } else { commentList = list ; if ( ( autoOpen ) && ( ! ( commentList.isEmpty ( ) ) ) ) { setOpen ( true ) ; } } }
Source:
public void testGiveUpAtTimeout ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.wireMockRule.givenThat ( com.github.tomakehurst.wiremock.client.WireMock.post ( com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo ( com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.ENDPOINT ) ) . inScenario ( com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.RETRY_AT_DELAY ) . whenScenarioStateIs ( Scenario.STARTED ) . willSetStateTo ( com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.REQUEST_MADE ) . willReturn ( com.github.tomakehurst.wiremock.client.WireMock.aResponse ( ) . withStatus ( com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.ERROR ) . withFixedDelay ( com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.TIMEOUT ) ) ) ; com.google.common.truth.Truth.assertThat ( httpSession.post ( com.ericsson.gerrit.plugins.syncindex.HttpSessionTest.ENDPOINT ) . isSuccessful ( ) ) . isFalse ( ) ; }

Target:
public void testGiveUpAtTimeout ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.wireMockRule.givenThat ( com.github.tomakehurst.wiremock.client.WireMock.post ( com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo ( com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.ENDPOINT ) ) . inScenario ( com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.RETRY_AT_DELAY ) . whenScenarioStateIs ( Scenario.STARTED ) . willSetStateTo ( com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.REQUEST_MADE ) . willReturn ( com.github.tomakehurst.wiremock.client.WireMock.aResponse ( ) . withStatus ( com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.ERROR ) . withFixedDelay ( com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.TIMEOUT ) ) ) ; com.google.common.truth.Truth.assertThat ( httpSession.post ( com.ericsson.gerrit.plugins.multimaster.HttpSessionTest.ENDPOINT ) . isSuccessful ( ) ) . isFalse ( ) ; }
Source:
protected void setupVelocityContext ( ) { super . setupVelocityContext ( ) ; velocityContext.put ( "projectName" , branch.getParentKey ( ) . get ( ) ) ; velocityContext.put ( "branch" , branch ) ; }

Target:
private void setListIdHeader ( ) { setHeader ( "List-Id" , ( ( ( ( "<gerrit-" + ( branch.getParentKey ( ) . get ( ) . replace ( '/' , '-' ) ) ) + "." ) + ( getGerritHost ( ) ) ) + ">" ) ) ; if ( ( getSettingsUrl ( ) ) != null ) { setHeader ( "List-Unsubscribe" , ( ( "<" + ( getSettingsUrl ( ) ) ) + ">" ) ) ; } }
Source:
public void onDoubleClick ( com.google.gwt.event.dom.client.DoubleClickEvent event ) { if ( patchTableHeader.listB.fileExists ) { onCellDoubleClick ( 0 , com.google.gerrit.client.patches.SideBySideTable.B ) ; } }

Target:
private void populateTableHeader ( final com.google.gerrit.common.data.PatchScript script , final com.google.gerrit.common.data.PatchSetDetail detail ) { initHeaders ( script , detail ) ; table.setWidget ( com.google.gerrit.client.patches.R_HEAD , com.google.gerrit.client.patches.SideBySideTable.A , headerSideA ) ; table.setWidget ( com.google.gerrit.client.patches.R_HEAD , com.google.gerrit.client.patches.SideBySideTable.B , headerSideB ) ; if ( headerSideA.isFile ( ) ) { table.setWidget ( com.google.gerrit.client.patches.R_HEAD , ( ( com.google.gerrit.client.patches.SideBySideTable.A ) - 1 ) , iconA ) ; } if ( headerSideB.isFile ( ) ) { table.setWidget ( com.google.gerrit.client.patches.R_HEAD , ( ( com.google.gerrit.client.patches.SideBySideTable.B ) + 1 ) , iconB ) ; } }
Source:
private boolean shouldReplicate ( com.google.gerrit.server.project.ProjectControl projectControl ) { return ( projectControl.isReadable ( ) ) && ( ( ! ( projectControl.isHidden ( ) ) ) || ( config.replicateHiddenProjects ( ) ) ) ; }

Target:
private boolean shouldReplicate ( com.google.gerrit.server.project.ProjectControl ctl ) throws com.google.gerrit.server.permissions.PermissionBackendException { if ( ( ! ( config.replicateHiddenProjects ( ) ) ) && ( ( ctl.getProject ( ) . getState ( ) ) == ( com.google.gerrit.extensions.client.ProjectState.HIDDEN ) ) ) { return false ; } try { permissionBackend.user ( ctl.getUser ( ) ) . project ( ctl.getProject ( ) . getNameKey ( ) ) . check ( ProjectPermission.ACCESS ) ; return true ; } catch ( com.google.gerrit.extensions.restapi.AuthException e ) { return false ; } }
Source:
protected void applyDataRowStyle ( final int newRow ) { table.getCellFormatter ( ) . addStyleName ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , com.google.gerrit.client.ui.FancyFlexTable.S_ICON_CELL ) ; }

Target:
protected void movePointerTo ( final int newRow ) { if ( newRow >= 0 ) { table.setWidget ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , pointer ) ; table.getCellFormatter ( ) . getElement ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW ) . scrollIntoView ( ) ; } else if ( ( currentRow ) >= 0 ) { table.setWidget ( currentRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , null ) ; } currentRow = newRow ; }
Source:
private com.google.gerrit.reviewdb.client.AccountSshKey readSshKey ( com.google.gerrit.reviewdb.client.Account.Id id ) throws java.io.IOException { java.lang.String defaultPublicSshKeyFile = ( ( ( ( java.lang.System.getProperty ( "user.home" ) ) + ( java.io.File.separator ) ) + ".ssh" ) + ( java.io.File.separator ) ) + "id_rsa.pub" ; if ( ! ( java.nio.file.Files.exists ( java.nio.file.Paths.get ( defaultPublicSshKeyFile ) ) ) ) { defaultPublicSshKeyFile = "" ; } java.lang.String publicSshKeyFile = ui.readString ( defaultPublicSshKeyFile , "public SSH key file" ) ; return ! ( com.google.common.base.Strings.isNullOrEmpty ( publicSshKeyFile ) ) ? createSshKey ( id , publicSshKeyFile ) : null ; }

Target:
private com.google.gerrit.reviewdb.client.AccountSshKey readSshKey ( com.google.gerrit.reviewdb.client.Account.Id id ) throws java.io.IOException { java.lang.String defaultPublicSshKeyFile = "" ; java.nio.file.Path defaultPublicSshKeyPath = java.nio.file.Paths.get ( java.lang.System.getProperty ( "user.home" ) , ".ssh" , "id_rsa.pub" ) ; if ( java.nio.file.Files.exists ( defaultPublicSshKeyPath ) ) { defaultPublicSshKeyFile = defaultPublicSshKeyPath.toString ( ) ; } java.lang.String publicSshKeyFile = ui.readString ( defaultPublicSshKeyFile , "public SSH key file" ) ; return ! ( com.google.common.base.Strings.isNullOrEmpty ( publicSshKeyFile ) ) ? createSshKey ( id , publicSshKeyFile ) : null ; }
Source:
public void onSuccess ( com.google.gerrit.client.info.ChangeInfo result ) { display ( result ) ; }

Target:
public void onSuccess ( com.google.gwt.core.client.JsArrayString result ) { hashtagTextBox.setEnabled ( true ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( error , false ) ; error.setInnerText ( "" ) ; hashtagTextBox.setText ( "" ) ; if ( ( result != null ) && ( ( result.length ( ) ) > 0 ) ) { updateHashtagList ( result ) ; } }
Source:
private void addMembers ( com.google.gerrit.server.group.GroupResource rsrc ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.server.group.AddMembers.Input input = AddMembers.Input.fromMembers ( initialMembers.stream ( ) . map ( java.lang.Object :: toString ) . collect ( java.util.stream.Collectors.toList ( ) ) ) ; addMembers.apply ( rsrc , input ) ; }

Target:
private void addMembers ( com.google.gerrit.server.group.GroupResource rsrc ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.server.restapi.group.AddMembers.Input input = AddMembers.Input.fromMembers ( initialMembers.stream ( ) . map ( java.lang.Object :: toString ) . collect ( java.util.stream.Collectors.toList ( ) ) ) ; addMembers.apply ( rsrc , input ) ; }
Source:
public void handle ( net.codemirror.lib.CodeMirror instance , int line , java.lang.String gutter , com.google.gwt.dom.client.NativeEvent clickEvent ) { instance.setCursor ( net.codemirror.lib.LineCharacter.create ( line ) ) ; instance.setActiveLine ( instance.getLineHandle ( line ) ) ; insertNewDraft ( instance ) . run ( ) ; }

Target:
public void run ( ) { com.google.gerrit.client.Gerrit.doSignIn ( getToken ( ) ) ; }
Source:
public void testCreateProjectWithBranches ( ) throws java.io.IOException { final java.lang.String newProjectName = "newProject" ; com.google.gerrit.acceptance.rest.project.CreateProjectIT.ProjectInput in = new com.google.gerrit.acceptance.rest.project.CreateProjectIT.ProjectInput ( ) ; in.create_empty_commit = true ; in.branches = com.google.common.collect.Lists.newArrayListWithCapacity ( 3 ) ; in.branches.add ( "refs/heads/test" ) ; in.branches.add ( "refs/heads/master" ) ; in.branches.add ( "release" ) ; session.put ( ( "/projects/" + newProjectName ) , in ) ; assertHead ( newProjectName , "refs/heads/test" ) ; assertEmptyCommit ( newProjectName , "refs/heads/test" , "refs/heads/master" , "refs/heads/release" ) ; }

Target:
public void testCreateProjectWithBranches ( ) throws java.io.IOException { final java.lang.String newProjectName = "newProject" ; com.google.gerrit.server.project.CreateProject.Input in = new com.google.gerrit.server.project.CreateProject.Input ( ) ; in.createEmptyCommit = true ; in.branches = com.google.common.collect.Lists.newArrayListWithCapacity ( 3 ) ; in.branches.add ( "refs/heads/test" ) ; in.branches.add ( "refs/heads/master" ) ; in.branches.add ( "release" ) ; session.put ( ( "/projects/" + newProjectName ) , in ) ; assertHead ( newProjectName , "refs/heads/test" ) ; assertEmptyCommit ( newProjectName , "refs/heads/test" , "refs/heads/master" , "refs/heads/release" ) ; }
Source:
private Account.Id parseIdent ( org.eclipse.jgit.revwalk.RevCommit commit ) throws org.eclipse.jgit.errors.ConfigInvalidException { return parseIdent ( commit.getCommitterIdent ( ) ) ; }

Target:
private PatchSet.Id parsePatchSetId ( org.eclipse.jgit.revwalk.RevCommit commit ) throws org.eclipse.jgit.errors.ConfigInvalidException { java.util.List < java.lang.String > psIdLines = commit.getFooterLines ( com.google.gerrit.server.notedb.ChangeNoteUtil.FOOTER_PATCH_SET ) ; if ( ( psIdLines.size ( ) ) != 1 ) { throw expectedOneFooter ( com.google.gerrit.server.notedb.ChangeNoteUtil.FOOTER_PATCH_SET , psIdLines ) ; } java.lang.Integer psId = com.google.common.primitives.Ints.tryParse ( psIdLines.get ( 0 ) ) ; if ( psId == null ) { throw invalidFooter ( com.google.gerrit.server.notedb.ChangeNoteUtil.FOOTER_PATCH_SET , psIdLines.get ( 0 ) ) ; } return new com.google.gerrit.reviewdb.client.PatchSet.Id ( changeId , psId ) ; }
Source:
public void isEnabledForRegexRef ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig config = getConfig ( ( "[plugin \"uploadvalidator\"]\n" + ( " ref = ^refs/heads/mybranch.*\n" + " blockedFileExtension = jar" ) ) ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( projectName , "refs/heads/anotherref" , "blockedFileExtension" ) ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( projectName , "refs/heads/mybranch123" , "blockedFileExtension" ) ) . isTrue ( ) ; }

Target:
public void isEnabledForRegexRef ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig config = getConfig ( ( "[plugin \"uploadvalidator\"]\n" + ( " ref = ^refs/heads/mybranch.*\n" + " blockedFileExtension = jar" ) ) ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( anyUser , projectName , "refs/heads/anotherref" , "blockedFileExtension" ) ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( config.isEnabledForRef ( anyUser , projectName , "refs/heads/mybranch123" , "blockedFileExtension" ) ) . isTrue ( ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.pgm.init.api.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.Objects.firstNonNull ( getInstallPlugins ( ) , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.api.InstallPlugins.class ) . toInstance ( plugins ) ; bind ( com.google.gerrit.pgm.init.PluginsDistribution.class ) . toInstance ( pluginsDistribution ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.pgm.init.api.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.MoreObjects.firstNonNull ( getInstallPlugins ( ) , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.api.InstallPlugins.class ) . toInstance ( plugins ) ; bind ( com.google.gerrit.pgm.init.PluginsDistribution.class ) . toInstance ( pluginsDistribution ) ; }
Source:
public com.google.gerrit.reviewdb.AccountDiffPreference getAccountDiffPreference ( ) { com.google.gerrit.reviewdb.AccountDiffPreference diffPref ; try { diffPref = dbProvider.get ( ) . accountDiffPreferences ( ) . get ( getAccountId ( ) ) ; if ( diffPref == null ) { diffPref = com.google.gerrit.reviewdb.AccountDiffPreference.createDefault ( getAccountId ( ) ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { com.google.gerrit.server.IdentifiedUser.log.warn ( "Cannot query account diff preferences" , e ) ; diffPref = com.google.gerrit.reviewdb.AccountDiffPreference.createDefault ( getAccountId ( ) ) ; } return diffPref ; }

Target:
public com.google.gerrit.reviewdb.client.AccountDiffPreference getAccountDiffPreference ( ) { com.google.gerrit.reviewdb.client.AccountDiffPreference diffPref ; try { diffPref = dbProvider.get ( ) . accountDiffPreferences ( ) . get ( getAccountId ( ) ) ; if ( diffPref == null ) { diffPref = com.google.gerrit.reviewdb.client.AccountDiffPreference.createDefault ( getAccountId ( ) ) ; } } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.IdentifiedUser.log.warn ( "Cannot query account diff preferences" , e ) ; diffPref = com.google.gerrit.reviewdb.client.AccountDiffPreference.createDefault ( getAccountId ( ) ) ; } return diffPref ; }
Source:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.common.changes.ListChangesOption.CURRENT_REVISION ) ; org.junit.Assert.assertEquals ( expectedId.name ( ) , c.current_revision ) ; org.junit.Assert.assertEquals ( expectedNum , c.revisions.get ( expectedId.name ( ) ) . _number ) ; }

Target:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION ) ; org.junit.Assert.assertEquals ( expectedId.name ( ) , c.current_revision ) ; org.junit.Assert.assertEquals ( expectedNum , c.revisions.get ( expectedId.name ( ) ) . _number ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.extensions.config.CapabilityDefinition.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.deleteproject.DeleteProjectCapability.DELETE_PROJECT ) ) . to ( com.googlesource.gerrit.plugins.deleteproject.DeleteProjectCapability.class ) ; }

Target:
protected void configure ( ) { bind ( com.googlesource.gerrit.plugins.deleteproject.cache.CacheDeleteHandler.class ) ; bind ( com.google.gerrit.extensions.config.CapabilityDefinition.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.deleteproject.DeleteProjectCapability.DELETE_PROJECT ) ) . to ( com.googlesource.gerrit.plugins.deleteproject.DeleteProjectCapability.class ) ; bind ( com.googlesource.gerrit.plugins.deleteproject.database.DatabaseDeleteHandler.class ) . to ( registerDatabaseHandler ( ) ) ; bind ( com.googlesource.gerrit.plugins.deleteproject.fs.FilesystemDeleteHandler.class ) ; }
Source:
private boolean isIdentityTrustable ( final com.google.gerrit.client.reviewdb.ReviewDb db , final com.google.gerrit.client.reviewdb.Account.Id accountId ) throws com.google.gwtorm.client.OrmException { switch ( com.google.gerrit.client.rpc.Common.getGerritConfig ( ) . getLoginType ( ) ) { case HTTP : return true ; case OPENID : default : return com.google.gerrit.client.reviewdb.TrustedExternalId.isIdentityTrustable ( getTrustedIds ( db ) , db.accountExternalIds ( ) . byAccount ( accountId ) ) ; } }

Target:
private boolean isIdentityTrustable ( final com.google.gerrit.client.reviewdb.ReviewDb db , final com.google.gerrit.client.reviewdb.Account.Id accountId ) throws com.google.gwtorm.client.OrmException { switch ( com.google.gerrit.client.rpc.Common.getGerritConfig ( ) . getLoginType ( ) ) { case HTTP : return true ; case OPENID : default : return com.google.gerrit.client.reviewdb.TrustedExternalId.isIdentityTrustable ( getTrustedExternalIds ( db ) , db.accountExternalIds ( ) . byAccount ( accountId ) ) ; } }
Source:
private java.util.Set < java.lang.String > getInvalidFilenames ( ) { java.util.Set < java.lang.String > filenames = new java.util.HashSet < > ( ) ; filenames.add ( "test#" ) ; filenames.add ( "test%" ) ; filenames.add ( "test*" ) ; filenames.add ( "test:" ) ; filenames.add ( "test@" ) ; return filenames ; }

Target:
private java.util.Set < java.lang.String > getInvalidFilenames ( ) { java.util.Set < java.lang.String > filenames = new java.util.HashSet < > ( ) ; filenames.add ( "test#" ) ; filenames.add ( "test%" ) ; filenames.add ( "test*" ) ; filenames.add ( "test:" ) ; filenames.add ( "test@" ) ; filenames.add ( "test[" ) ; filenames.add ( "test]" ) ; return filenames ; }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.AccountSshKey > getKeys ( ) { com.google.common.base.Preconditions.checkState ( ( ( keys ) != null ) , "SSH keys not loaded yet" ) ; java.util.List < com.google.gerrit.reviewdb.client.AccountSshKey > result = new java.util.ArrayList < > ( ) ; for ( com.google.common.base.Optional < com.google.gerrit.reviewdb.client.AccountSshKey > key : keys.values ( ) ) { if ( key.isPresent ( ) ) { result.add ( key.get ( ) ) ; } } return result ; }

Target:
private java.util.List < com.google.gerrit.reviewdb.client.AccountSshKey > getKeys ( ) { checkLoaded ( ) ; return com.google.common.collect.Lists.newArrayList ( com.google.common.base.Optional.presentInstances ( keys ) ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.GerritApi.class ) . to ( com.google.gerrit.server.api.GerritApiImpl.class ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.GerritApi.class ) . to ( com.google.gerrit.server.api.GerritApiImpl.class ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; bind ( com.google.gerrit.extensions.api.plugins.Plugins.class ) . to ( com.google.gerrit.server.api.plugins.PluginsImpl.class ) ; factory ( PluginApiImpl.Factory.class ) ; }
Source:
public void noExternalIds ( ) throws java.lang.Exception { db.accountExternalIds ( ) . delete ( db.accountExternalIds ( ) . byAccount ( user.getAccountId ( ) ) ) ; reloadUser ( ) ; assertProblems ( com.google.gerrit.gpg.testutil.TestKey.key5 ( ) , ( "No identities found for user; check" + " http://test/#/settings/web-identities" ) ) ; }

Target:
public void noExternalIds ( ) throws java.lang.Exception { db.accountExternalIds ( ) . delete ( db.accountExternalIds ( ) . byAccount ( user.getAccountId ( ) ) ) ; reloadUser ( ) ; com.google.gerrit.gpg.testutil.TestKey key = com.google.gerrit.gpg.testutil.TestKeys.key5 ( ) ; com.google.gerrit.gpg.GerritPublicKeyChecker checker = checkerFactory.create ( user ) ; assertProblems ( checker.check ( key.getPublicKey ( ) ) , Status.BAD , ( "No identities found for user; check" + " http://test/#/settings/web-identities" ) ) ; checker = checkerFactory.create ( ) ; assertProblems ( checker.check ( key.getPublicKey ( ) ) , Status.BAD , "Key is not associated with any users" ) ; db.accountExternalIds ( ) . insert ( java.util.Collections.singleton ( new com.google.gerrit.reviewdb.client.AccountExternalId ( user.getAccountId ( ) , com.google.gerrit.gpg.GerritPublicKeyChecker.toExtIdKey ( key.getPublicKey ( ) ) ) ) ) ; reloadUser ( ) ; assertProblems ( checker.check ( key.getPublicKey ( ) ) , Status.BAD , "No identities found for user" ) ; }
Source:
public void onKeyDown ( com.google.gwt.event.dom.client.KeyDownEvent e ) { if ( ( e.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE ) ) { onCancel ( null ) ; } else if ( ( e.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { onAdd ( null ) ; } }

Target:
public void onKeyDown ( com.google.gwt.event.dom.client.KeyDownEvent e ) { if ( ( e.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE ) ) { onCancel ( null ) ; } else if ( ( e.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { onAdd ( null ) ; } }
Source:
public static void registerEmail ( java.lang.String account , java.lang.String email , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.account.EmailInfo > cb ) { com.google.gwt.core.client.JavaScriptObject in = com.google.gwt.core.client.JavaScriptObject.createObject ( ) ; new com.google.gerrit.client.rpc.RestApi ( "/accounts/" ) . id ( account ) . view ( "emails" ) . id ( email ) . ifNoneMatch ( ) . put ( in , cb ) ; }

Target:
public static void registerEmail ( java.lang.String account , java.lang.String email , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.account.EmailInfo > cb ) { com.google.gwt.core.client.JavaScriptObject in = com.google.gwt.core.client.JavaScriptObject.createObject ( ) ; com.google.gerrit.client.account.AccountApi.accounts ( ) . id ( account ) . view ( "emails" ) . id ( email ) . ifNoneMatch ( ) . put ( in , cb ) ; }
Source:
private void assertStatus ( org.eclipse.jgit.transport.RemoteRefUpdate.Status expectedStatus , java.lang.String expectedMessage ) { org.eclipse.jgit.transport.RemoteRefUpdate refUpdate = result.getRemoteUpdate ( ref ) ; com.google.common.truth.Truth.assertThat ( refUpdate.getStatus ( ) ) . named ( message ( refUpdate ) ) . isEqualTo ( expectedStatus ) ; com.google.common.truth.Truth.assertThat ( refUpdate.getMessage ( ) ) . isEqualTo ( expectedMessage ) ; }

Target:
private void assertStatus ( org.eclipse.jgit.transport.RemoteRefUpdate.Status expectedStatus , java.lang.String expectedMessage ) { org.eclipse.jgit.transport.RemoteRefUpdate refUpdate = result.getRemoteUpdate ( ref ) ; com.google.common.truth.Truth.assertThat ( refUpdate ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( refUpdate.getStatus ( ) ) . named ( message ( refUpdate ) ) . isEqualTo ( expectedStatus ) ; com.google.common.truth.Truth.assertThat ( refUpdate.getMessage ( ) ) . isEqualTo ( expectedMessage ) ; }
Source:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { if ( topic.canEdit ( ) ) { topic.onEdit ( ) ; } } else { com.google.gerrit.client.Gerrit.doSignIn ( getToken ( ) ) ; } }

Target:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { if ( ( event.getNativeEvent ( ) . getCharCode ( ) ) == 0 ) { Window.Location.reload ( ) ; return ; } if ( topic.canEdit ( ) ) { topic.onEdit ( ) ; } } else { com.google.gerrit.client.Gerrit.doSignIn ( getToken ( ) ) ; } }
Source:
public void generatesExpectedMessage ( ) throws java.lang.Exception { mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.author = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockEvent.comment = "This is the first line\nAnd the second line." ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = "{\"text\": \"Unit Tester commented\\n>>>" + ( ( "testproject (master): This is the first line\n" + "And the second line. (https://change/)\"," ) + "\"channel\": \"#testchannel\",\"username\": \"testuser\"}\n" ) ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }

Target:
public void generatesExpectedMessage ( ) throws java.lang.Exception { mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.author = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockEvent.comment = "This is the first line\nAnd the second line." ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockChange.owner = mockOwner ; mockOwner.name = "Owner" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = "{\"text\": \"Unit Tester commented to Owner\\n>>>" + ( ( "testproject (master): This is the first line\n" + "And the second line. (https://change/)\"," ) + "\"channel\": \"#testchannel\",\"username\": \"testuser\"}\n" ) ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }
Source:
public void indexerThrowsExceptionTryingToDeleteChange ( ) throws java.lang.Exception { setupDeleteMocks ( com.ericsson.gerrit.plugins.syncindex.SyncIndexRestApiServletTest.THROW_IO_EXCEPTION ) ; verifyDelete ( ) ; }

Target:
public void indexerThrowsExceptionTryingToDeleteChange ( ) throws java.lang.Exception { org.mockito.Mockito.doThrow ( new java.io.IOException ( "io-error" ) ) . when ( indexer ) . delete ( id ) ; syncIndexRestApiServlet.doDelete ( req , rsp ) ; org.mockito.Mockito.verify ( rsp ) . sendError ( javax.servlet.http.HttpServletResponse.SC_CONFLICT , "io-error" ) ; }
Source:
public void includeExistingGroup_OK ( ) throws java.lang.Exception { java.lang.String p = group ( "parent" ) ; java.lang.String g = group ( "newGroup" ) ; gApi.groups ( ) . id ( p ) . addGroups ( g ) ; assertIncludes ( p , g ) ; gApi.groups ( ) . id ( p ) . addGroups ( g ) ; assertIncludes ( p , g ) ; }

Target:
public void includeExistingGroup_OK ( ) throws java.lang.Exception { java.lang.String p = createGroup ( "parent" ) ; java.lang.String g = createGroup ( "newGroup" ) ; gApi.groups ( ) . id ( p ) . addGroups ( g ) ; assertIncludes ( p , g ) ; gApi.groups ( ) . id ( p ) . addGroups ( g ) ; assertIncludes ( p , g ) ; }
Source:
protected void run ( java.lang.String [ ] args ) throws com.google.gerrit.server.ssh.Failure { final com.google.gerrit.server.GroupCache gc = getGerritServer ( ) . getGroupCache ( ) ; if ( gc.isAdministrator ( getAccountId ( ) ) ) { gc.flush ( ) ; } else { throw new com.google.gerrit.server.ssh.Failure ( 1 , "fatal: Not a Gerrit administrator" ) ; } }

Target:
protected void run ( java.lang.String [ ] args ) throws com.google.gerrit.server.ssh.Failure { final com.google.gerrit.client.data.GroupCache gc = getGerritServer ( ) . getGroupCache ( ) ; if ( gc.isAdministrator ( getAccountId ( ) ) ) { gc.flush ( ) ; } else { throw new com.google.gerrit.server.ssh.Failure ( 1 , "fatal: Not a Gerrit administrator" ) ; } }
Source:
public synchronized void add ( java.lang.String event ) throws java.io.IOException { long next = ( getHead ( ) ) + 1 ; java.nio.file.Path epath = paths.event ( next ) ; com.googlesource.gerrit.plugins.events.fsstore.Fs.createDirectories ( epath.getParent ( ) ) ; java.nio.file.Files.write ( epath , ( event + "\n" ) . getBytes ( ) ) ; stores.head.spinIncrement ( com.googlesource.gerrit.plugins.events.fsstore.FsStore.MAX_INCREMENT_SPINS ) ; }

Target:
public void add ( java.lang.String event ) throws java.io.IOException { stores.head.spinSubmit ( ( event + "\n" ) , com.googlesource.gerrit.plugins.events.fsstore.FsStore.MAX_SUBMIT_SPINS ) ; }
Source:
public void patchSetObjectAndRefMissingWithFix ( ) throws java.lang.Exception { java.lang.String rev = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ; com.google.gerrit.server.project.ChangeControl ctl = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = insertMissingPatchSet ( ctl , rev ) ; ctl = reload ( ctl ) ; java.lang.String refName = ps.getId ( ) . toRefName ( ) ; assertProblems ( ctl , new com.google.gerrit.extensions.api.changes.FixInput ( ) , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Ref missing: " + refName ) ) , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Object missing: patch set 2: " + rev ) ) ) ; }

Target:
public void patchSetObjectAndRefMissing ( ) throws java.lang.Exception { java.lang.String rev = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ; com.google.gerrit.server.notedb.ChangeNotes notes = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = insertMissingPatchSet ( notes , rev ) ; notes = reload ( notes ) ; assertProblems ( notes , null , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Ref missing: " + ( ps.getId ( ) . toRefName ( ) ) ) ) , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( "Object missing: patch set 2: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) ) ; }
Source:
public java.util.List < com.google.gerrit.server.update.BatchUpdate > batchUpdates ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException { java.util.List < com.google.gerrit.server.update.BatchUpdate > updates = new java.util.ArrayList ( projects.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { updates.add ( getRepo ( project ) . getUpdate ( ) ) ; } return updates ; }

Target:
public java.util.List < com.google.gerrit.server.update.BatchUpdate > batchUpdates ( com.google.gerrit.server.update.BatchUpdate.Factory batchUpdateFactory , java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException { java.util.List < com.google.gerrit.server.update.BatchUpdate > updates = new java.util.ArrayList ( projects.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { updates.add ( getRepo ( project ) . getUpdate ( batchUpdateFactory ) ) ; } return updates ; }
Source:
private void addProjectOwnersAsReviewers ( com.google.gerrit.server.change.ChangeResource rsrc ) { final java.lang.String projectOwners = groupBackend.get ( SystemGroupBackend.PROJECT_OWNERS ) . getName ( ) ; try { com.google.gerrit.extensions.api.changes.AddReviewerInput input = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; input.reviewer = projectOwners ; reviewersProvider.get ( ) . apply ( rsrc , input ) ; } catch ( java.io.IOException | com.google.gwtorm.server.OrmException | com.google.gerrit.extensions.restapi.RestApiException | com.google.gerrit.server.update.UpdateException | com.google.gerrit.server.permissions.PermissionBackendException e ) { } }

Target:
private void addProjectOwnersAsReviewers ( com.google.gerrit.server.change.ChangeResource rsrc ) { final java.lang.String projectOwners = groupBackend.get ( SystemGroupBackend.PROJECT_OWNERS ) . getName ( ) ; try { com.google.gerrit.extensions.api.changes.AddReviewerInput input = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; input.reviewer = projectOwners ; reviewersProvider.get ( ) . apply ( rsrc , input ) ; } catch ( java.lang.Exception e ) { com.google.common.base.Throwables.throwIfUnchecked ( e ) ; } }
Source:
private java.util.Set < com.google.gerrit.reviewdb.RefRight > resolveOwnerGroups ( final com.google.gerrit.reviewdb.RefRight refRight ) { final java.util.Set < com.google.gerrit.reviewdb.RefRight > resolvedRefRights = new java.util.HashSet < com.google.gerrit.reviewdb.RefRight > ( ) ; if ( AccountGroup.PROJECT_OWNERS.equals ( refRight.getAccountGroupUUID ( ) ) ) { for ( final com.google.gerrit.reviewdb.AccountGroup.UUID ownerGroup : getProjectState ( ) . getOwners ( ) ) { if ( ! ( AccountGroup.PROJECT_OWNERS.equals ( ownerGroup ) ) ) { resolvedRefRights.add ( new com.google.gerrit.reviewdb.RefRight ( refRight , ownerGroup ) ) ; } } } else { resolvedRefRights.add ( refRight ) ; } return resolvedRefRights ; }

Target:
public boolean equals ( java.lang.Object other ) { if ( other instanceof com.google.gerrit.server.project.RefControl.SeenRule ) { com.google.gerrit.server.project.RefControl.SeenRule a = this ; com.google.gerrit.server.project.RefControl.SeenRule b = ( ( com.google.gerrit.server.project.RefControl.SeenRule ) ( other ) ) ; return ( ( a.refPattern.equals ( b.refPattern ) ) && ( a.permissionName.equals ( b.permissionName ) ) ) && ( eq ( a.group , b.group ) ) ; } return false ; }
Source:
private com.google.inject.AbstractModule createIndexModule ( ) { 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 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 ) ) ; } }
Source:
protected void add ( final com.google.gerrit.server.mail.RecipientType rt , final com.google.gerrit.reviewdb.client.Account.Id to ) { try { if ( ( ! ( rcptTo.contains ( to ) ) ) && ( isVisibleTo ( to ) ) ) { rcptTo.add ( to ) ; add ( rt , toAddress ( to ) ) ; } } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.mail.send.OutgoingEmail.log.error ( ( "Error reading database for account: " + to ) , e ) ; } }

Target:
protected void add ( final com.google.gerrit.extensions.api.changes.RecipientType rt , final java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > list ) { for ( final com.google.gerrit.reviewdb.client.Account.Id id : list ) { add ( rt , id ) ; } }
Source:
protected void onOpenItem ( final java.lang.Object item ) { if ( item instanceof com.google.gerrit.client.patches.AbstractPatchContentTable.CommentList ) { for ( final com.google.gerrit.client.ui.ComplexDisclosurePanel p : ( ( com.google.gerrit.client.patches.AbstractPatchContentTable.CommentList ) ( item ) ) . panels ) { p.setOpen ( ( ! ( p.isOpen ( ) ) ) ) ; } } }

Target:
protected void onOpenRow ( final int row ) { final java.lang.Object item = getRowItem ( row ) ; if ( item instanceof com.google.gerrit.client.patches.AbstractPatchContentTable.CommentList ) { for ( final com.google.gerrit.client.ui.ComplexDisclosurePanel p : ( ( com.google.gerrit.client.patches.AbstractPatchContentTable.CommentList ) ( item ) ) . panels ) { p.setOpen ( ( ! ( p.isOpen ( ) ) ) ) ; } } }
Source:
com.google.common.util.concurrent.ListeningExecutorService getIndexExecutor ( @ com.google.gerrit.server.config.GerritServerConfig org.eclipse.jgit.lib.Config config , com.google.gerrit.server.git.WorkQueue workQueue ) { int threads = this . threads ; if ( threads <= 0 ) { threads = config.getInt ( "index" , null , "threads" , 0 ) ; } if ( threads <= 0 ) { return com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor ( ) ; } return com.google.common.util.concurrent.MoreExecutors.listeningDecorator ( workQueue.createQueue ( threads , "index" ) ) ; }

Target:
com.google.common.util.concurrent.ListeningExecutorService getBatchIndexExecutor ( @ com.google.gerrit.server.config.GerritServerConfig org.eclipse.jgit.lib.Config config , com.google.gerrit.server.git.WorkQueue workQueue ) { if ( ( batchExecutor ) != null ) { return batchExecutor ; } int threads = config.getInt ( "index" , null , "batchThreads" , 0 ) ; if ( threads <= 0 ) { threads = config.getInt ( "changeMerge" , null , "threadPoolSize" , 0 ) ; } if ( threads <= 0 ) { threads = java.lang.Runtime.getRuntime ( ) . availableProcessors ( ) ; } return com.google.common.util.concurrent.MoreExecutors.listeningDecorator ( workQueue.createQueue ( threads , "Index-Batch" ) ) ; }
Source:
protected void configure ( ) { install ( new com.google.gerrit.server.schema.SchemaVersion.Module ( ) ) ; bind ( org.eclipse.jgit.lib.PersonIdent.class ) . annotatedWith ( com.google.gerrit.server.GerritPersonIdent.class ) . toProvider ( com.google.gerrit.server.GerritPersonIdentProvider.class ) ; bind ( com.google.gerrit.server.git.GitRepositoryManager.class ) . to ( com.google.gerrit.server.git.LocalDiskRepositoryManager.class ) ; install ( new com.google.gerrit.lifecycle.LifecycleModule ( ) { @ java.lang.Override protected void configure ( ) { listener ( ) . to ( LocalDiskRepositoryManager.Lifecycle.class ) ; } } ) ; }

Target:
protected void configure ( ) { install ( new com.google.gerrit.server.schema.SchemaVersion.Module ( ) ) ; bind ( org.eclipse.jgit.lib.PersonIdent.class ) . annotatedWith ( com.google.gerrit.server.GerritPersonIdent.class ) . toProvider ( com.google.gerrit.server.GerritPersonIdentProvider.class ) ; bind ( com.google.gerrit.server.config.AllProjectsName.class ) . toProvider ( com.google.gerrit.server.config.AllProjectsNameProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; bind ( com.google.gerrit.server.git.GitRepositoryManager.class ) . to ( com.google.gerrit.server.git.LocalDiskRepositoryManager.class ) ; install ( new com.google.gerrit.lifecycle.LifecycleModule ( ) { @ java.lang.Override protected void configure ( ) { listener ( ) . to ( LocalDiskRepositoryManager.Lifecycle.class ) ; } } ) ; }
Source:
public boolean equals ( java.lang.Object other ) { return ( ( getClass ( ) ) == ( other.getClass ( ) ) ) && ( children.equals ( ( ( com.google.gerrit.server.query.RewritePredicate ) ( other ) ) . children ) ) ; }

Target:
public boolean equals ( java.lang.Object other ) { if ( other instanceof com.google.gerrit.server.query.RewritePredicate ) { com.google.gerrit.server.query.RewritePredicate that = ( ( com.google.gerrit.server.query.RewritePredicate < T > ) ( other ) ) ; if ( ( this . init ) && ( that.init ) ) { return ( ( ( this . getClass ( ) ) == ( that.getClass ( ) ) ) && ( this . name.equals ( that.name ) ) ) && ( this . children.equals ( that.children ) ) ; } } return ( this ) == other ; }
Source:
private int getInt ( com.google.gerrit.server.config.PluginConfig cfg , java.lang.String name , int defaultValue ) { try { return cfg.getInt ( name , defaultValue ) ; } catch ( java.lang.IllegalArgumentException e ) { com.ericsson.gerrit.plugins.highavailability.Configuration.log.error ( java.lang.String.format ( "invalid value for %s; using default value %d" , name , defaultValue ) ) ; return defaultValue ; } }

Target:
private int getInt ( com.google.gerrit.server.config.PluginConfig cfg , java.lang.String name , int defaultValue ) { try { return cfg.getInt ( name , defaultValue ) ; } catch ( java.lang.IllegalArgumentException e ) { com.ericsson.gerrit.plugins.highavailability.Configuration.log.error ( java.lang.String.format ( "invalid value for %s; using default value %d" , name , defaultValue ) ) ; com.ericsson.gerrit.plugins.highavailability.Configuration.log.debug ( ( "Failed retrieve integer value: " + ( e.getMessage ( ) ) ) , e ) ; return defaultValue ; } }
Source:
public void currentPatchSet ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( "\n" + "Patch-set: 1\n" ) + "Current: true" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( "\n" + "Patch-set: 1\n" ) + "Current: tRUe" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-set: 1\n" ) + "Current: false" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-set: 1\n" ) + "Current: blah" ) ) ) ; }

Target:
public void currentPatchSet ( ) throws java.lang.Exception { assertParseSucceeds ( "Update change\n\nPatch-set: 1\nCurrent: true" ) ; assertParseSucceeds ( "Update change\n\nPatch-set: 1\nCurrent: tRUe" ) ; assertParseFails ( "Update change\n\nPatch-set: 1\nCurrent: false" ) ; assertParseFails ( "Update change\n\nPatch-set: 1\nCurrent: blah" ) ; }