auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static org.eclipse.jgit.lib.Config allEnabledConfig ( ) { org.eclipse.jgit.lib.Config cfg = new org.eclipse.jgit.lib.Config ( ) ; for ( com.google.gerrit.server.notedb.NoteDbTable t : com.google.gerrit.server.notedb.NoteDbTable.values ( ) ) { cfg.setBoolean ( com.google.gerrit.server.notedb.ConfigNotesMigration.NOTE_DB , t.key ( ) , com.google.gerrit.server.notedb.ConfigNotesMigration.WRITE , true ) ; cfg.setBoolean ( com.google.gerrit.server.notedb.ConfigNotesMigration.NOTE_DB , t.key ( ) , com.google.gerrit.server.notedb.ConfigNotesMigration.READ , true ) ; } return cfg ; }

Target:
public static org.eclipse.jgit.lib.Config allEnabledConfig ( ) { org.eclipse.jgit.lib.Config cfg = new org.eclipse.jgit.lib.Config ( ) ; cfg.setBoolean ( com.google.gerrit.server.notedb.ConfigNotesMigration.NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.CHANGES.key ( ) , com.google.gerrit.server.notedb.ConfigNotesMigration.WRITE , true ) ; cfg.setBoolean ( com.google.gerrit.server.notedb.ConfigNotesMigration.NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.CHANGES.key ( ) , com.google.gerrit.server.notedb.ConfigNotesMigration.READ , true ) ; return cfg ; }
Source:
public void onFailure ( java.lang.Throwable err ) { com.google.gerrit.client.change.DraftActions.setEnabled ( true , draftButtons ) ; if ( com.google.gerrit.client.change.SubmitFailureDialog.isConflict ( err ) ) { new com.google.gerrit.client.change.SubmitFailureDialog ( err.getMessage ( ) ) . center ( ) ; com.google.gerrit.client.Gerrit.display ( PageLinks.MINE ) ; } else { super . onFailure ( err ) ; } }

Target:
public void onFailure ( java.lang.Throwable err ) { com.google.gerrit.client.change.ChangeActions.setEnabled ( true , draftButtons ) ; if ( com.google.gerrit.client.change.SubmitFailureDialog.isConflict ( err ) ) { new com.google.gerrit.client.change.SubmitFailureDialog ( err.getMessage ( ) ) . center ( ) ; com.google.gerrit.client.Gerrit.display ( PageLinks.MINE ) ; } else { super . onFailure ( err ) ; } }
Source:
private void enableForm ( final boolean canModifyAgreements , final boolean canModifyDescription , final boolean canModifyMergeType ) { submitType.setEnabled ( canModifyMergeType ) ; descTxt.setEnabled ( canModifyDescription ) ; useContributorAgreements.setEnabled ( canModifyAgreements ) ; useSignedOffBy.setEnabled ( canModifyAgreements ) ; requireChangeID.setEnabled ( canModifyMergeType ) ; saveProject.setEnabled ( ( ( canModifyAgreements || canModifyDescription ) || canModifyMergeType ) ) ; }

Target:
private void enableForm ( final boolean canModifyAgreements , final boolean canModifyDescription , final boolean canModifyMergeType ) { submitType.setEnabled ( canModifyMergeType ) ; useContentMerge.setEnabled ( canModifyMergeType ) ; descTxt.setEnabled ( canModifyDescription ) ; useContributorAgreements.setEnabled ( canModifyAgreements ) ; useSignedOffBy.setEnabled ( canModifyAgreements ) ; requireChangeID.setEnabled ( canModifyMergeType ) ; }
Source:
private static int index ( com.google.gerrit.common.data.Permission a ) { if ( com.google.gerrit.common.data.Permission.isLabel ( a.getName ( ) ) ) { return com.google.gerrit.common.data.Permission.labelIndex ; } else if ( com.google.gerrit.common.data.Permission.isLabelAs ( a.getName ( ) ) ) { return com.google.gerrit.common.data.Permission.labelAsIndex ; } int index = com.google.gerrit.common.data.Permission.NAMES_LC.indexOf ( a.getName ( ) . toLowerCase ( ) ) ; return 0 <= index ? index : com.google.gerrit.common.data.Permission.NAMES_LC.size ( ) ; }

Target:
private static int index ( com.google.gerrit.common.data.Permission a ) { if ( com.google.gerrit.common.data.Permission.isLabel ( a.getName ( ) ) ) { return com.google.gerrit.common.data.Permission.LABEL_INDEX ; } else if ( com.google.gerrit.common.data.Permission.isLabelAs ( a.getName ( ) ) ) { return com.google.gerrit.common.data.Permission.LABEL_AS_INDEX ; } int index = com.google.gerrit.common.data.Permission.NAMES_LC.indexOf ( a.getName ( ) . toLowerCase ( ) ) ; return 0 <= index ? index : com.google.gerrit.common.data.Permission.NAMES_LC.size ( ) ; }
Source:
private com.google.inject.Injector getPluginInjector ( final java.io.File jarFile ) throws java.io.IOException { final java.lang.String pluginName = com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.plugins.JarPluginProvider.getJarPluginName ( jarFile ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( jarFile ) ) ; return initInjector.createChildInjector ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.PluginName.class ) . toInstance ( pluginName ) ; } } ) ; }

Target:
private com.google.inject.Injector getPluginInjector ( java.nio.file.Path jarPath ) throws java.io.IOException { final java.lang.String pluginName = com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.plugins.JarPluginProvider.getJarPluginName ( jarPath ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( jarPath ) ) ; return initInjector.createChildInjector ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.PluginName.class ) . toInstance ( pluginName ) ; } } ) ; }
Source:
private com.google.gerrit.server.plugins.ServerPlugin loadExternalPlugin ( java.lang.String name , java.io.File scriptFile , org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot ) { return externalPluginFactory.get ( name , scriptFile , pluginUserFactory.create ( name ) , snapshot ) ; }

Target:
private com.google.gerrit.server.plugins.ServerPlugin loadExternalPlugin ( java.io.File scriptFile , org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot ) throws com.google.gerrit.server.plugins.InvalidPluginException { java.lang.String name = externalPluginFactory.getPluginName ( scriptFile ) ; return externalPluginFactory.get ( scriptFile , snapshot , new com.google.gerrit.server.plugins.ServerPluginProvider.PluginDescription ( pluginUserFactory.create ( name ) , getPluginCanonicalWebUrl ( name ) , getPluginDataDir ( name ) ) ) ; }
Source:
public void postRun ( ) throws java.lang.Exception { org.eclipse.jgit.lib.Config cfg = allProjectsConfig.load ( ) . getConfig ( ) ; if ( installVerified ) { cfg.setString ( com.google.gerrit.pgm.init.InitLabels.KEY_LABEL , com.google.gerrit.pgm.init.InitLabels.LABEL_VERIFIED , com.google.gerrit.pgm.init.InitLabels.KEY_FUNCTION , "MaxWithBlock" ) ; cfg.setStringList ( com.google.gerrit.pgm.init.InitLabels.KEY_LABEL , com.google.gerrit.pgm.init.InitLabels.LABEL_VERIFIED , com.google.gerrit.pgm.init.InitLabels.KEY_VALUE , java.util.Arrays.asList ( new java.lang.String [ ] { "-1 Fails" , " 0 No score" , "+1 Verified" } ) ) ; cfg.setBoolean ( com.google.gerrit.pgm.init.InitLabels.KEY_LABEL , com.google.gerrit.pgm.init.InitLabels.LABEL_VERIFIED , com.google.gerrit.pgm.init.InitLabels.KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE , true ) ; allProjectsConfig.save ( "Configure 'Verified' label" ) ; } }

Target:
public void postRun ( ) throws java.lang.Exception { org.eclipse.jgit.lib.Config cfg = allProjectsConfig.load ( ) . getConfig ( ) ; if ( installVerified ) { cfg.setString ( com.google.gerrit.pgm.init.InitLabels.KEY_LABEL , com.google.gerrit.pgm.init.InitLabels.LABEL_VERIFIED , com.google.gerrit.pgm.init.InitLabels.KEY_FUNCTION , com.google.gerrit.common.data.LabelFunction.MAX_WITH_BLOCK.getFunctionName ( ) ) ; cfg.setStringList ( com.google.gerrit.pgm.init.InitLabels.KEY_LABEL , com.google.gerrit.pgm.init.InitLabels.LABEL_VERIFIED , com.google.gerrit.pgm.init.InitLabels.KEY_VALUE , java.util.Arrays.asList ( new java.lang.String [ ] { "-1 Fails" , " 0 No score" , "+1 Verified" } ) ) ; cfg.setBoolean ( com.google.gerrit.pgm.init.InitLabels.KEY_LABEL , com.google.gerrit.pgm.init.InitLabels.LABEL_VERIFIED , com.google.gerrit.pgm.init.InitLabels.KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE , true ) ; allProjectsConfig.save ( "Configure 'Verified' label" ) ; } }
Source:
public void onLoad ( com.google.gerrit.plugin.client.screen.Screen screen ) { java.lang.String projectName = com.google.gwt.http.client.URL.decode ( screen.getToken ( 1 ) ) ; java.lang.String path = com.google.gwt.http.client.URL.decode ( screen.getToken ( 2 ) ) ; screen.show ( new com.googlesource.gerrit.plugins.xdocs.client.XDocScreen ( projectName , "HEAD" , path ) ) ; screen.setWindowTitle ( com.googlesource.gerrit.plugins.xdocs.client.FileInfo.getFileName ( path ) ) ; }

Target:
public void onLoad ( com.google.gerrit.plugin.client.screen.Screen screen ) { java.lang.String projectName = com.google.gwt.http.client.URL.decodeQueryString ( screen.getToken ( 1 ) ) ; java.lang.String path = com.google.gwt.http.client.URL.decode ( screen.getToken ( 2 ) ) ; screen.show ( new com.googlesource.gerrit.plugins.xdocs.client.XDocScreen ( projectName , "HEAD" , path ) ) ; screen.setWindowTitle ( com.googlesource.gerrit.plugins.xdocs.client.FileInfo.getFileName ( path ) ) ; }
Source:
public void testUpsertTwoFirstExistsing ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 , 0 ) ; java.sql.PreparedStatement insert = stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.TWO_ROWS ) ; verifyIds ( insert , 2 ) ; }

Target:
public void testInsertOneDBException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement insert = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.insert ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; }
Source:
public void testPushForMasterAsDraft ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = pushTo ( "refs/drafts/master" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.DRAFT , null ) ; r = pushTo ( "refs/for/master%draft" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.DRAFT , null ) ; }

Target:
public void pushForMasterAsDraft ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = pushTo ( "refs/drafts/master" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.DRAFT , null ) ; r = pushTo ( "refs/for/master%draft" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.DRAFT , null ) ; }
Source:
public void repositoryIndex ( ) throws java.lang.Exception { com.google.gitiles.GitilesView view = getView ( "/repo" ) ; org.junit.Assert.assertEquals ( Type.REPOSITORY_INDEX , view.getType ( ) ) ; org.junit.Assert.assertEquals ( "repo" , view.getRepositoryName ( ) ) ; org.junit.Assert.assertEquals ( Revision.NULL , view.getRevision ( ) ) ; org.junit.Assert.assertEquals ( Revision.NULL , view.getOldRevision ( ) ) ; org.junit.Assert.assertNull ( view.getPathPart ( ) ) ; }

Target:
public void hostIndex ( ) throws java.lang.Exception { com.google.gitiles.GitilesView view = getView ( "/" ) ; com.google.common.truth.Truth.assertThat ( view.getType ( ) ) . isEqualTo ( Type.HOST_INDEX ) ; com.google.common.truth.Truth.assertThat ( view.getHostName ( ) ) . isEqualTo ( "test-host" ) ; com.google.common.truth.Truth.assertThat ( view.getRepositoryName ( ) ) . isNull ( ) ; com.google.common.truth.Truth.assertThat ( view.getRevision ( ) ) . isEqualTo ( Revision.NULL ) ; com.google.common.truth.Truth.assertThat ( view.getOldRevision ( ) ) . isEqualTo ( Revision.NULL ) ; com.google.common.truth.Truth.assertThat ( view.getPathPart ( ) ) . isNull ( ) ; }
Source:
public static void assertAccountInfo ( com.google.gerrit.acceptance.TestAccount a , com.google.gerrit.server.account.AccountInfo ai ) { org.junit.Assert.assertTrue ( ( ( a.id.get ( ) ) == ( ai._account_id ) ) ) ; org.junit.Assert.assertEquals ( a.fullName , ai.name ) ; org.junit.Assert.assertEquals ( a.email , ai.email ) ; }

Target:
public static void assertAccountInfo ( com.google.gerrit.acceptance.TestAccount a , com.google.gerrit.server.account.AccountInfo ai ) { org.junit.Assert.assertTrue ( ( ( a.id.get ( ) ) == ( ai._accountId ) ) ) ; org.junit.Assert.assertEquals ( a.fullName , ai.name ) ; org.junit.Assert.assertEquals ( a.email , ai.email ) ; }
Source:
public boolean evict ( java.lang.String cacheName , java.lang.Object key ) { try { java.lang.String json = com.ericsson.gerrit.plugins.highavailability.forwarder.rest.GsonParser.toJson ( cacheName , key ) ; return httpSession.post ( com.google.common.base.Joiner.on ( "/" ) . join ( pluginRelativePath , "cache" , cacheName ) , json ) . isSuccessful ( ) ; } catch ( java.io.IOException e ) { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.log.error ( ( "Error trying to evict for cache " + cacheName ) , e ) ; return false ; } }

Target:
com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult send ( ) throws java.io.IOException { java.lang.String json = com.ericsson.gerrit.plugins.highavailability.forwarder.rest.GsonParser.toJson ( cacheName , key ) ; return httpSession.post ( com.google.common.base.Joiner.on ( "/" ) . join ( pluginRelativePath , "cache" , cacheName ) , json ) ; }
Source:
protected void populate ( final int row , final com.google.gerrit.reviewdb.client.Project k ) { final com.google.gwt.user.client.ui.Anchor projectLink = new com.google.gwt.user.client.ui.Anchor ( k.getName ( ) ) ; projectLink.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { sugestParent.setText ( getRowItem ( row ) . getName ( ) ) ; } } ) ; table.setWidget ( row , 1 , projectLink ) ; table.setText ( row , 2 , k.getDescription ( ) ) ; setRowItem ( row , k ) ; }

Target:
protected void populate ( final int row , final com.google.gerrit.client.projects.ProjectInfo k ) { final com.google.gwt.user.client.ui.Anchor projectLink = new com.google.gwt.user.client.ui.Anchor ( k.name ( ) ) ; projectLink.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { sugestParent.setText ( getRowItem ( row ) . name ( ) ) ; } } ) ; table.setWidget ( row , 1 , projectLink ) ; table.setText ( row , 2 , k.description ( ) ) ; setRowItem ( row , k ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig.KEY_PROJECT ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Projects" , null , com.google.gerrit.extensions.api.projects.ProjectConfigEntryType.ARRAY , null , false , "Only projects that match this regex will be validated." ) ) ; bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig.KEY_REF ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Refs" , null , com.google.gerrit.extensions.api.projects.ProjectConfigEntryType.ARRAY , null , false , "Only refs that match this regex will be validated." ) ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig.KEY_PROJECT ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Projects" , null , com.google.gerrit.extensions.api.projects.ProjectConfigEntryType.ARRAY , null , false , "Only projects that match this regex will be validated." ) ) ; bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig.KEY_REF ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Refs" , null , com.google.gerrit.extensions.api.projects.ProjectConfigEntryType.ARRAY , null , false , "Only refs that match this regex will be validated." ) ) ; bind ( com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig.GroupByNameFinder.class ) . to ( com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig.GroupByNameFromIndexFinder.class ) ; }
Source:
public void onSuccess ( com.googlesource.gerrit.plugins.serviceuser.client.GroupInfo result ) { updateValue ( ( result != null ? result.name ( ) : "" ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . refresh ( ) ; }

Target:
public void onSuccess ( com.googlesource.gerrit.plugins.serviceuser.client.GroupInfo result ) { updateValue ( ( result != null ? result.name ( ) : "" ) ) ; updateHref ( ( result != null ? result.url ( ) : "" ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . refresh ( ) ; }
Source:
private java.lang.String canCreateCommit ( org.eclipse.jgit.lib.Repository repo , org.eclipse.jgit.revwalk.RevCommit commit , com.google.gerrit.server.project.ProjectState projectState , com.google.gerrit.server.IdentifiedUser user , com.google.gerrit.server.permissions.PermissionBackend.ForRef forRef ) throws com.google.gerrit.server.permissions.PermissionBackendException { if ( projectState.controlFor ( user ) . isReachableFromHeadsOrTags ( repo , commit ) ) { return null ; } else if ( testAuditLogged ( forRef , RefPermission.UPDATE ) ) { return null ; } return ( ( ( user.getAccountId ( ) ) + " lacks permission " ) + ( com.google.gerrit.common.data.Permission.PUSH ) ) + " for creating new commit object" ; }

Target:
private void checkCreateCommit ( org.eclipse.jgit.lib.Repository repo , org.eclipse.jgit.revwalk.RevCommit commit , com.google.gerrit.server.project.ProjectState projectState , com.google.gerrit.server.permissions.PermissionBackend.ForRef forRef ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.server.permissions.PermissionBackendException { try { forRef.check ( RefPermission.UPDATE ) ; return ; } catch ( com.google.gerrit.extensions.restapi.AuthException denied ) { } if ( projectState.controlFor ( user.get ( ) ) . isReachableFromHeadsOrTags ( repo , commit ) ) { return ; } throw new com.google.gerrit.extensions.restapi.AuthException ( java.lang.String.format ( "%s for creating new commit object not permitted" , RefPermission.UPDATE.describeForException ( ) ) ) ; }
Source:
public void set ( final boolean s ) { if ( ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) && ( s != ( get ( ) ) ) ) { final com.google.gerrit.common.data.ToggleStarRequest req = new com.google.gerrit.common.data.ToggleStarRequest ( ) ; req.toggle ( cache.getChangeId ( ) , s ) ; com.google.gerrit.client.changes.Util.LIST_SVC.toggleStars ( req , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { setStarred ( s ) ; fireEvent ( new com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > ( s ) { } ) ; } } ) ; } }

Target:
public void set ( final boolean s ) { if ( ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) && ( s != ( get ( ) ) ) ) { final com.google.gerrit.common.data.ToggleStarRequest req = new com.google.gerrit.common.data.ToggleStarRequest ( ) ; req.toggle ( cache.getChangeId ( ) , s ) ; Util.LIST_SVC.toggleStars ( req , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { setStarred ( s ) ; fireEvent ( new com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > ( s ) { } ) ; } } ) ; } }
Source:
public void patchScript ( final com.google.gerrit.reviewdb.Patch.Key patchKey , final com.google.gerrit.reviewdb.PatchSet.Id psa , final com.google.gerrit.reviewdb.PatchSet.Id psb , final com.google.gerrit.common.data.PatchScriptSettings s , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.PatchScript > callback ) { if ( psb == null ) { callback.onFailure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; return ; } patchScriptFactoryFactory.create ( patchKey , psa , psb , s ) . to ( callback ) ; }

Target:
public void patchScript ( final com.google.gerrit.reviewdb.Patch.Key patchKey , final com.google.gerrit.reviewdb.PatchSet.Id psa , final com.google.gerrit.reviewdb.PatchSet.Id psb , final com.google.gerrit.reviewdb.AccountDiffPreference dp , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.PatchScript > callback ) { if ( psb == null ) { callback.onFailure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; return ; } patchScriptFactoryFactory.create ( patchKey , psa , psb , dp ) . to ( callback ) ; }
Source:
public void testCreateProjectHttpWithInvalidRefName_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.branches = java.util.Collections.singletonList ( name ( "invalid ref name" ) ) ; adminSession.put ( ( "/projects/" + ( name ( "newProject" ) ) ) , in ) . assertBadRequest ( ) ; }

Target:
public void testCreateProjectHttpWithInvalidRefName_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.branches = java.util.Collections.singletonList ( name ( "invalid ref name" ) ) ; adminRestSession.put ( ( "/projects/" + ( name ( "newProject" ) ) ) , in ) . assertBadRequest ( ) ; }
Source:
public void testUnblockVisibilityByREGISTEREDUsers ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.REGISTERED ) ; org.junit.Assert.assertTrue ( "u can read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }

Target:
public void testUnblockVisibilityByREGISTEREDUsers ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; org.junit.Assert.assertTrue ( "u can read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }
Source:
private void assertNotFound ( org.eclipse.jgit.lib.ObjectId id ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = userSession.get ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/commits/" ) + ( id.name ( ) ) ) ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_NOT_FOUND , r.getStatusCode ( ) ) ; }

Target:
private com.google.gerrit.extensions.common.CommitInfo getCommit ( org.eclipse.jgit.lib.ObjectId id ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = userSession.get ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/commits/" ) + ( id.name ( ) ) ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; com.google.gerrit.extensions.common.CommitInfo result = newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.extensions.common.CommitInfo.class ) ; r.consume ( ) ; return result ; }
Source:
public void testInheritRead_SingleBranchDoesNotOverrideInherited ( ) { inherited.add ( grant ( com.google.gerrit.reviewdb.ApprovalCategory.READ , registered , "refs/*" , 1 , 2 ) ) ; local.add ( grant ( com.google.gerrit.reviewdb.ApprovalCategory.READ , registered , "refs/heads/foobar" , 1 , 1 ) ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertTrue ( "can upload" , u.canUploadToAtLeastOneRef ( ) ) ; assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; assertTrue ( "can upload refs/heads/foobar" , u.controlForRef ( "refs/heads/foobar" ) . canUpload ( ) ) ; }

Target:
public void testInheritRead_SingleBranchDoesNotOverrideInherited ( ) { inherited.add ( grant ( com.google.gerrit.reviewdb.ApprovalCategory.READ , registered , "refs/*" , 1 , 2 ) ) ; local.add ( grant ( com.google.gerrit.reviewdb.ApprovalCategory.READ , registered , "refs/heads/foobar" , 1 , 1 ) ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertTrue ( "can upload" , u.canPushToAtLeastOneRef ( ) ) ; assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; assertTrue ( "can upload refs/heads/foobar" , u.controlForRef ( "refs/heads/foobar" ) . canUpload ( ) ) ; }
Source:
private java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > suggestReviewers ( com.google.gerrit.server.api.changes.SuggestedReviewersRequest r ) throws com.google.gerrit.extensions.restapi.RestApiException { try { suggestReviewers.setQuery ( r.getQuery ( ) ) ; suggestReviewers.setLimit ( r.getLimit ( ) ) ; return suggestReviewers.apply ( change ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot retrieve suggested reviewers" , e ) ; } }

Target:
private java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > suggestReviewers ( com.google.gerrit.server.api.changes.SuggestedReviewersRequest r ) throws com.google.gerrit.extensions.restapi.RestApiException { try { suggestReviewers.setQuery ( r.getQuery ( ) ) ; suggestReviewers.setLimit ( r.getLimit ( ) ) ; return suggestReviewers.apply ( change ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot retrieve suggested reviewers" , e ) ; } }
Source:
public boolean rollback ( ) { 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.GitCloneStep.log.error ( ( "Cannot clean-up output Git directory " + gitDirectory ) ) ; return false ; } }

Target:
public boolean rollback ( ) { 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.GitCloneStep.LOG.error ( ( "Cannot clean-up output Git directory " + gitDirectory ) ) ; return false ; } }
Source:
public static void setReady ( com.google.gerrit.server.config.SitePaths sitePaths , int version , boolean ready ) throws java.io.IOException { try { org.eclipse.jgit.storage.file.FileBasedConfig cfg = com.google.gerrit.lucene.LuceneVersionManager.loadGerritIndexConfig ( sitePaths ) ; com.google.gerrit.lucene.LuceneVersionManager.setReady ( cfg , version , ready ) ; cfg.save ( ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new java.io.IOException ( e ) ; } }

Target:
public static void setReady ( com.google.gerrit.server.config.SitePaths sitePaths , java.lang.String name , int version , boolean ready ) throws java.io.IOException { try { com.google.gerrit.lucene.GerritIndexStatus cfg = new com.google.gerrit.lucene.GerritIndexStatus ( sitePaths ) ; cfg.setReady ( name , version , ready ) ; cfg.save ( ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new java.io.IOException ( e ) ; } }
Source:
void setEdit ( boolean edit ) { if ( edit ) { removeStyleName ( draftStyle.view ( ) ) ; addStyleName ( draftStyle.edit ( ) ) ; editArea.setText ( contentPanelMessage.getText ( ) ) ; editArea.setFocus ( true ) ; } else { removeStyleName ( draftStyle.edit ( ) ) ; addStyleName ( draftStyle.view ( ) ) ; } resizePaddingWidget ( ) ; }

Target:
void setEdit ( boolean edit ) { if ( edit ) { setOpen ( true ) ; removeStyleName ( draftStyle.view ( ) ) ; addStyleName ( draftStyle.edit ( ) ) ; editArea.setText ( contentPanelMessage.getText ( ) ) ; editArea.setFocus ( true ) ; } else { removeStyleName ( draftStyle.edit ( ) ) ; addStyleName ( draftStyle.view ( ) ) ; } resizePaddingWidget ( ) ; }
Source:
private void parseUpdate ( final org.eclipse.jgit.transport.ReceiveCommand cmd ) { com.google.gerrit.server.project.RefControl ctl = projectControl.controlForRef ( cmd.getRefName ( ) ) ; if ( ctl.canUpdate ( ) ) { } else { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd ) ; } }

Target:
private void parseUpdate ( final org.eclipse.jgit.transport.ReceiveCommand cmd ) { com.google.gerrit.server.project.RefControl ctl = projectControl.controlForRef ( cmd.getRefName ( ) ) ; if ( ctl.canUpdate ( ) ) { validateNewCommits ( ctl , cmd ) ; } else { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd ) ; } }
Source:
protected void configure ( ) { factory ( RenameGroupOp.Factory.class ) ; factory ( MetaDataUpdate.InternalFactory.class ) ; bind ( MetaDataUpdate.Server.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , org.eclipse.jgit.transport.PostUploadHook.class ) . to ( com.google.gerrit.server.git.UploadPackMetricsHook.class ) ; }

Target:
protected void configure ( ) { factory ( RenameGroupOp.Factory.class ) ; factory ( MetaDataUpdate.InternalFactory.class ) ; bind ( MetaDataUpdate.Server.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , org.eclipse.jgit.transport.PostUploadHook.class ) . to ( com.google.gerrit.server.git.UploadPackMetricsHook.class ) ; com.google.gerrit.extensions.registration.DynamicItem.itemOf ( binder ( ) , com.google.gerrit.server.git.ChangeReportFormatter.class ) ; com.google.gerrit.extensions.registration.DynamicItem.bind ( binder ( ) , com.google.gerrit.server.git.ChangeReportFormatter.class ) . to ( com.google.gerrit.server.git.DefaultChangeReportFormatter.class ) ; }
Source:
protected void configure ( ) { get ( com.google.gerrit.server.change.RevisionResource.REVISION_KIND , "verifications" ) . to ( com.googlesource.gerrit.plugins.verifystatus.server.GetVerifications.class ) ; post ( com.google.gerrit.server.change.RevisionResource.REVISION_KIND , "verifications" ) . to ( com.googlesource.gerrit.plugins.verifystatus.server.PostVerification.class ) ; }

Target:
protected void configure ( ) { get ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "config" ) . to ( com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.class ) ; put ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "config" ) . to ( com.googlesource.gerrit.plugins.verifystatus.server.PutConfig.class ) ; get ( com.google.gerrit.server.change.RevisionResource.REVISION_KIND , "verifications" ) . to ( com.googlesource.gerrit.plugins.verifystatus.server.GetVerifications.class ) ; post ( com.google.gerrit.server.change.RevisionResource.REVISION_KIND , "verifications" ) . to ( com.googlesource.gerrit.plugins.verifystatus.server.PostVerification.class ) ; }
Source:
private synchronized void runHook ( java.io.File hook , java.util.List < java.lang.String > args ) { if ( hook.exists ( ) ) { hookQueue.execute ( new com.google.gerrit.common.ChangeHookRunner.AsyncHookTask ( null , hook , args ) ) ; } }

Target:
private synchronized void runHook ( com.google.gerrit.reviewdb.client.Project.NameKey project , java.nio.file.Path hook , java.util.List < java.lang.String > args ) { if ( ( project != null ) && ( java.nio.file.Files.exists ( hook ) ) ) { hookQueue.execute ( new com.google.gerrit.common.ChangeHookRunner.AsyncHookTask ( project , hook , args ) ) ; } }
Source:
private < T extends java.lang.Enum < ? > > void set ( org.eclipse.jgit.lib.Config cfg , java.lang.String section , java.lang.String name , T value , T def ) { if ( ( value != null ) && ( value != def ) ) { cfg.setString ( section , null , name , value.toString ( ) ) ; } else { cfg.unset ( section , null , name ) ; } }

Target:
private static java.net.URI toURI ( java.lang.String url ) throws java.net.URISyntaxException { final java.net.URI u = new java.net.URI ( url ) ; if ( com.google.gerrit.pgm.Init.isAnyAddress ( u ) ) { final int s = url.indexOf ( '*' ) ; url = ( ( url.substring ( 0 , s ) ) + ( com.google.gerrit.pgm.Init.hostname ( ) ) ) + ( url.substring ( ( s + 1 ) ) ) ; } return new java.net.URI ( url ) ; }
Source:
public void parseOptionMap ( java.util.Map < java.lang.String , java.lang.String [ ] > parameters ) throws org.kohsuke.args4j.CmdLineException { parseOptionMap ( parameters , java.util.Collections.< java.lang.String > emptySet ( ) ) ; }

Target:
public void parseOptionMap ( java.util.Map < java.lang.String , java.lang.String [ ] > parameters ) throws org.kohsuke.args4j.CmdLineException { com.google.common.collect.Multimap < java.lang.String , java.lang.String > map = com.google.common.collect.LinkedHashMultimap.create ( ) ; for ( java.util.Map.Entry < java.lang.String , java.lang.String [ ] > ent : parameters.entrySet ( ) ) { for ( java.lang.String val : ent.getValue ( ) ) { map.put ( ent.getKey ( ) , val ) ; } } parseOptionMap ( map ) ; }
Source:
public void testIsEnabledRefNoParentMatchingBranchMiddleDisabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/foo.*" , "^refs/heads/test.*" , "^refs/heads/baz.*" } ; setupIsEnabled ( "false" , null , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectNK = new com.google.gerrit.reviewdb.client.Project.NameKey ( "testProject" ) ; assertFalse ( itsConfig.isEnabled ( projectNK , "refs/heads/testBranch" ) ) ; }

Target:
public void BROKEN_testIsEnabledRefNoParentMatchingBranchMiddleDisabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/foo.*" , "^refs/heads/test.*" , "^refs/heads/baz.*" } ; setupIsEnabled ( "false" , null , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectNK = new com.google.gerrit.reviewdb.client.Project.NameKey ( "testProject" ) ; assertFalse ( itsConfig.isEnabled ( projectNK , "refs/heads/testBranch" ) ) ; }
Source:
com.google.gerrit.client.reviewdb.ContactInformation toContactInformation ( ) { final com.google.gerrit.client.reviewdb.ContactInformation info ; if ( com.google.gerrit.client.rpc.Common.getGerritConfig ( ) . isUseContactInfo ( ) ) { info = new com.google.gerrit.client.reviewdb.ContactInformation ( ) ; info.setAddress ( addressTxt.getText ( ) ) ; info.setCountry ( countryTxt.getText ( ) ) ; info.setPhoneNumber ( phoneTxt.getText ( ) ) ; info.setFaxNumber ( faxTxt.getText ( ) ) ; } else { info = null ; } return info ; }

Target:
com.google.gerrit.client.reviewdb.ContactInformation toContactInformation ( ) { final com.google.gerrit.client.reviewdb.ContactInformation info ; if ( com.google.gerrit.client.Gerrit.getConfig ( ) . isUseContactInfo ( ) ) { info = new com.google.gerrit.client.reviewdb.ContactInformation ( ) ; info.setAddress ( addressTxt.getText ( ) ) ; info.setCountry ( countryTxt.getText ( ) ) ; info.setPhoneNumber ( phoneTxt.getText ( ) ) ; info.setFaxNumber ( faxTxt.getText ( ) ) ; } else { info = null ; } return info ; }
Source:
public com.google.gerrit.extensions.common.ChangeInfo apply ( com.google.gerrit.server.change.ChangeResource req , com.google.gerrit.extensions.api.changes.AbandonInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; if ( ! ( control.canAbandon ( dbProvider.get ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "abandon not permitted" ) ; } com.google.gerrit.reviewdb.client.Change change = abandon ( control , input.message , input.notify , notifyUtil.resolveAccounts ( input.notifyDetails ) ) ; return json.create ( ChangeJson.NO_OPTIONS ) . format ( change ) ; }

Target:
public com.google.gerrit.extensions.common.ChangeInfo apply ( com.google.gerrit.server.change.ChangeResource req , com.google.gerrit.extensions.api.changes.AbandonInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; if ( ! ( control.canAbandon ( dbProvider.get ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "abandon not permitted" ) ; } com.google.gerrit.reviewdb.client.Change change = abandon ( control , input.message , input.notify , notifyUtil.resolveAccounts ( input.notifyDetails ) ) ; return json.noOptions ( ) . format ( change ) ; }
Source:
java.util.Map < java.lang.String , com.google.gerrit.extensions.common.FileInfo > toFileInfoMap ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.RevId revision , @ com.google.gerrit.common.Nullable com.google.gerrit.reviewdb.client.PatchSet base ) throws com.google.gerrit.server.patch.PatchListNotAvailableException { org.eclipse.jgit.lib.ObjectId a = ( base == null ) ? null : org.eclipse.jgit.lib.ObjectId.fromString ( base.getRevision ( ) . get ( ) ) ; org.eclipse.jgit.lib.ObjectId b = org.eclipse.jgit.lib.ObjectId.fromString ( revision.get ( ) ) ; return toFileInfoMap ( change , new com.google.gerrit.server.patch.PatchListKey ( a , b , com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_NONE ) ) ; }

Target:
java.util.Map < java.lang.String , com.google.gerrit.extensions.common.FileInfo > toFileInfoMap ( com.google.gerrit.reviewdb.client.Change change , org.eclipse.jgit.lib.ObjectId objectId , @ com.google.gerrit.common.Nullable com.google.gerrit.reviewdb.client.PatchSet base ) throws com.google.gerrit.server.patch.PatchListNotAvailableException { org.eclipse.jgit.lib.ObjectId a = ( base == null ) ? null : org.eclipse.jgit.lib.ObjectId.fromString ( base.getRevision ( ) . get ( ) ) ; return toFileInfoMap ( change , new com.google.gerrit.server.patch.PatchListKey ( a , objectId , com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_NONE ) ) ; }
Source:
void stop ( ) throws java.lang.Exception { try { if ( com.google.gerrit.testutil.NoteDbMode.get ( ) . equals ( NoteDbMode.CHECK ) ) { testInjector.getInstance ( com.google.gerrit.testutil.NoteDbChecker.class ) . checkAllChanges ( ) ; } } finally { daemon.getLifecycleManager ( ) . stop ( ) ; if ( ( daemonService ) != null ) { java.lang.System.out.println ( "Gerrit Server Shutdown" ) ; daemonService.shutdownNow ( ) ; daemonService.awaitTermination ( java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; } org.eclipse.jgit.lib.RepositoryCache.clear ( ) ; } }

Target:
void stop ( ) throws java.lang.Exception { try { if ( com.google.gerrit.testutil.NoteDbMode.get ( ) . equals ( NoteDbMode.CHECK ) ) { testInjector.getInstance ( com.google.gerrit.testutil.NoteDbChecker.class ) . rebuildAndCheckAllChanges ( ) ; } } finally { daemon.getLifecycleManager ( ) . stop ( ) ; if ( ( daemonService ) != null ) { java.lang.System.out.println ( "Gerrit Server Shutdown" ) ; daemonService.shutdownNow ( ) ; daemonService.awaitTermination ( java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; } org.eclipse.jgit.lib.RepositoryCache.clear ( ) ; } }
Source:
protected void bccStarredBy ( ) { if ( ! ( NotifyHandling.ALL.equals ( notify ) ) ) { return ; } try { for ( com.google.gerrit.reviewdb.client.Account.Id accountId : args.starredChangesUtil.byChange ( change.getId ( ) ) ) { super . add ( RecipientType.BCC , accountId ) ; } } catch ( com.google.gwtorm.server.OrmException err ) { com.google.gerrit.server.mail.ChangeEmail.log.warn ( "Cannot BCC users that starred updated change" , err ) ; } }

Target:
protected void bccStarredBy ( ) { if ( ! ( NotifyHandling.ALL.equals ( notify ) ) ) { return ; } try { for ( com.google.gerrit.reviewdb.client.Account.Id accountId : args.starredChangesUtil.byChangeFromIndex ( change.getId ( ) ) ) { super . add ( RecipientType.BCC , accountId ) ; } } catch ( com.google.gwtorm.server.OrmException | com.google.gerrit.server.project.NoSuchChangeException err ) { com.google.gerrit.server.mail.ChangeEmail.log.warn ( "Cannot BCC users that starred updated change" , err ) ; } }
Source:
protected void configure ( ) { if ( recheckMergeable ) { install ( new com.google.gerrit.pgm.Reindex.MergeabilityModule ( ) ) ; } }

Target:
private com.google.inject.Injector createSysInjector ( ) { java.util.List < com.google.inject.Module > modules = com.google.common.collect.Lists.newArrayList ( ) ; com.google.inject.Module changeIndexModule ; switch ( com.google.gerrit.server.index.IndexModule.getIndexType ( dbInjector ) ) { case LUCENE : changeIndexModule = new com.google.gerrit.lucene.LuceneIndexModule ( version , threads , outputBase ) ; break ; case SOLR : changeIndexModule = new com.google.gerrit.solr.SolrIndexModule ( false , threads , outputBase ) ; break ; default : throw new java.lang.IllegalStateException ( "unsupported index.type" ) ; } modules.add ( changeIndexModule ) ; modules.add ( dbInjector.getInstance ( com.google.gerrit.pgm.util.BatchProgramModule.class ) ) ; return dbInjector.createChildInjector ( modules ) ; }
Source:
protected void run ( java.lang.String [ ] args ) throws com.google.gerrit.server.ssh.Failure { final com.google.gerrit.client.data.GroupCache gc = com.google.gerrit.client.rpc.Common.getGroupCache ( ) ; if ( gc.isAdministrator ( getAccountId ( ) ) ) { gc.flush ( ) ; com.google.gerrit.client.rpc.Common.getProjectCache ( ) . 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 = com.google.gerrit.client.rpc.Common.getGroupCache ( ) ; if ( gc.isAdministrator ( getAccountId ( ) ) ) { gc.flush ( ) ; com.google.gerrit.client.rpc.Common.getProjectCache ( ) . flush ( ) ; com.google.gerrit.client.rpc.Common.getAccountCache ( ) . flush ( ) ; } else { throw new com.google.gerrit.server.ssh.Failure ( 1 , "fatal: Not a Gerrit administrator" ) ; } }
Source:
public com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Project.NameKey > getProjectSubscriptionGraph ( ) { com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Project.NameKey > graph = com.google.common.collect.HashMultimap.create ( ) ; for ( com.google.gerrit.reviewdb.client.Branch.NameKey b : targets.keySet ( ) ) { java.util.Collection < com.google.gerrit.reviewdb.client.SubmoduleSubscription > ss = targets.get ( b ) ; for ( com.google.gerrit.reviewdb.client.SubmoduleSubscription s : ss ) { graph.put ( b.getParentKey ( ) , s.getSubmodule ( ) . getParentKey ( ) ) ; } } return graph ; }

Target:
private < T > java.lang.String printCircularPath ( java.util.LinkedHashSet < T > p , T target ) { java.lang.StringBuilder sb = new java.lang.StringBuilder ( ) ; sb.append ( target ) ; java.util.ArrayList < T > reverseP = new java.util.ArrayList < > ( p ) ; java.util.Collections.reverse ( reverseP ) ; for ( T t : reverseP ) { sb.append ( "->" ) ; sb.append ( t ) ; if ( t.equals ( target ) ) { break ; } } return sb.toString ( ) ; }
Source:
void onValueChange ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > event ) { com.google.gerrit.client.rpc.RestApi api = com.google.gerrit.client.changes.ChangeApi.revision ( patchSetId ) . view ( "files" ) . id ( path ) . view ( "reviewed" ) ; if ( event.getValue ( ) ) { api.put ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } else { api.delete ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } }

Target:
public void run ( ) { ( hasNext ? next : up ) . go ( ) ; }
Source:
public void ambiguousRelativeToNonBranchOrTagSoy ( ) throws java.lang.Exception { repo.branch ( "refs/foo" ) . commit ( ) . create ( ) ; repo.branch ( "refs/heads/foo" ) . commit ( ) . create ( ) ; repo.branch ( "refs/tags/foo" ) . commit ( ) . create ( ) ; org.junit.Assert.assertEquals ( com.google.common.collect.ImmutableList.of ( ref ( "/b/test/+/refs/heads/foo" , "foo" ) ) , buildBranchesSoyData ( ) ) ; org.junit.Assert.assertEquals ( com.google.common.collect.ImmutableList.of ( ref ( "/b/test/+/refs/tags/foo" , "foo" ) ) , buildTagsSoyData ( ) ) ; }

Target:
public void ambiguousRelativeToNonBranchOrTagSoy ( ) throws java.lang.Exception { repo.branch ( "refs/foo" ) . commit ( ) . create ( ) ; repo.branch ( "refs/heads/foo" ) . commit ( ) . create ( ) ; repo.branch ( "refs/tags/foo" ) . commit ( ) . create ( ) ; com.google.common.truth.Truth.assertThat ( buildBranchesSoyData ( ) ) . containsExactly ( ref ( "/b/test/+/refs/heads/foo" , "foo" ) ) . inOrder ( ) ; com.google.common.truth.Truth.assertThat ( buildTagsSoyData ( ) ) . containsExactly ( ref ( "/b/test/+/refs/tags/foo" , "foo" ) ) . inOrder ( ) ; }
Source:
private com.google.gerrit.server.plugins.Plugin loadPlugin ( java.lang.String name , java.nio.file.Path srcPlugin , org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot ) throws com.google.gerrit.server.plugins.InvalidPluginException { java.lang.String pluginName = srcPlugin.getFileName ( ) . toString ( ) ; if ( com.google.gerrit.server.plugins.PluginLoader.isJsPlugin ( pluginName ) ) { return loadJsPlugin ( name , srcPlugin , snapshot ) ; } else if ( serverPluginFactory.handles ( srcPlugin ) ) { return loadServerPlugin ( srcPlugin , snapshot ) ; } else { throw new com.google.gerrit.server.plugins.InvalidPluginException ( java.lang.String.format ( "Unsupported plugin type: %s" , srcPlugin.getFileName ( ) ) ) ; } }

Target:
private com.google.gerrit.server.plugins.Plugin loadPlugin ( java.lang.String name , java.nio.file.Path srcPlugin , org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot ) throws com.google.gerrit.server.plugins.InvalidPluginException { java.lang.String pluginName = srcPlugin.getFileName ( ) . toString ( ) ; if ( com.google.gerrit.server.plugins.PluginLoader.isUiPlugin ( pluginName ) ) { return loadJsPlugin ( name , srcPlugin , snapshot ) ; } else if ( serverPluginFactory.handles ( srcPlugin ) ) { return loadServerPlugin ( srcPlugin , snapshot ) ; } else { throw new com.google.gerrit.server.plugins.InvalidPluginException ( java.lang.String.format ( "Unsupported plugin type: %s" , srcPlugin.getFileName ( ) ) ) ; } }