auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private java.lang.String getProjectFromProperties ( java.util.Collection < com.googlesource.gerrit.plugins.its.base.workflow.Property > properties ) { for ( com.googlesource.gerrit.plugins.its.base.workflow.Property property : properties ) { if ( "project" . equals ( property.getKey ( ) ) ) { return property.getValue ( ) ; } } return "" ; }

Target:
public java.util.Collection < com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest > actionRequestsFor ( java.lang.Iterable < com.googlesource.gerrit.plugins.its.base.workflow.Property > properties ) { java.util.Collection < com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest > ret = com.google.common.collect.Lists.newLinkedList ( ) ; for ( com.googlesource.gerrit.plugins.its.base.workflow.Rule rule : rules ) { ret.addAll ( rule.actionRequestsFor ( properties ) ) ; } return ret ; }
Source:
public void onEvent ( com.google.gerrit.server.events.Event e ) { if ( e instanceof com.google.gerrit.server.events.RefEvent ) { com.google.gerrit.server.events.RefEvent event = ( ( com.google.gerrit.server.events.RefEvent ) ( e ) ) ; java.lang.String key = com.google.gerrit.acceptance.EventRecorder.key ( event.getType ( ) , event.getProjectNameKey ( ) . get ( ) , event.getRefName ( ) ) ; recordedEvents.put ( key , event ) ; } }

Target:
public void onEvent ( com.google.gerrit.server.events.Event e ) { if ( e instanceof com.google.gerrit.server.events.ReviewerDeletedEvent ) { recordedEvents.put ( ReviewerDeletedEvent.TYPE , ( ( com.google.gerrit.server.events.ReviewerDeletedEvent ) ( e ) ) ) ; } else if ( e instanceof com.google.gerrit.server.events.RefEvent ) { com.google.gerrit.server.events.RefEvent event = ( ( com.google.gerrit.server.events.RefEvent ) ( e ) ) ; java.lang.String key = com.google.gerrit.acceptance.EventRecorder.refEventKey ( event.getType ( ) , event.getProjectNameKey ( ) . get ( ) , event.getRefName ( ) ) ; recordedEvents.put ( key , event ) ; } }
Source:
public void testNotAuthorized ( ) throws java.lang.Exception { java.lang.String expected = "unauthorized" ; com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.wireMockRule.givenThat ( com.github.tomakehurst.wiremock.client.WireMock.post ( com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.ENDPOINT ) ) . willReturn ( com.github.tomakehurst.wiremock.client.WireMock.aResponse ( ) . withStatus ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.UNAUTHORIZED ) . withBody ( expected ) ) ) ; com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult result = httpSession.post ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.ENDPOINT ) ; com.google.common.truth.Truth.assertThat ( result.isSuccessful ( ) ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( result.getMessage ( ) ) . isEqualTo ( expected ) ; }

Target:
public void testNotAuthorized ( ) throws java.lang.Exception { java.lang.String expected = "unauthorized" ; wireMockRule.givenThat ( com.github.tomakehurst.wiremock.client.WireMock.post ( com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.ENDPOINT ) ) . willReturn ( com.github.tomakehurst.wiremock.client.WireMock.aResponse ( ) . withStatus ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.UNAUTHORIZED ) . withBody ( expected ) ) ) ; com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult result = httpSession.post ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpSessionTest.ENDPOINT ) ; com.google.common.truth.Truth.assertThat ( result.isSuccessful ( ) ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( result.getMessage ( ) ) . isEqualTo ( expected ) ; }
Source:
private void insertNoneRow ( final int row ) { insertRow ( row ) ; table.setText ( row , 0 , Util.C.changeTableNone ( ) ) ; table.getFlexCellFormatter ( ) . setColSpan ( row , 0 , com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; setStyleName ( row , 0 , "gerrit-ChangeTable-EmptySectionRow" ) ; }

Target:
private void insertNoneRow ( final int row ) { insertRow ( row ) ; table.setText ( row , 0 , Util.C.changeTableNone ( ) ) ; final com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter fmt = table.getFlexCellFormatter ( ) ; fmt.setColSpan ( row , 0 , com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; fmt.setStyleName ( row , 0 , com.google.gerrit.client.changes.ChangeTable.S_EMPTY_SECTION ) ; }
Source:
protected void migrateData ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.schema.UpdateUI ui ) throws java.sql.SQLException { java.sql.Statement stmt = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . createStatement ( ) ; try { stmt.executeUpdate ( "UPDATE accounts set size_bar_in_change_table = 'Y'" ) ; } finally { stmt.close ( ) ; } }

Target:
protected void migrateData ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.schema.UpdateUI ui ) throws java.sql.SQLException { try ( java.sql.Statement stmt = newStatement ( db ) ) { stmt.executeUpdate ( "UPDATE accounts set size_bar_in_change_table = 'Y'" ) ; } }
Source:
protected void configure ( ) { cache ( com.google.gerrit.sshd.SshKeyCacheImpl.CACHE_NAME , java.lang.String.class , new com.google.inject.TypeLiteral < java.lang.Iterable < com.google.gerrit.sshd.SshKeyCacheEntry > > ( ) { } ) . loader ( com.google.gerrit.sshd.SshKeyCacheImpl.Loader.class ) ; bind ( com.google.gerrit.sshd.SshKeyCacheImpl.class ) ; bind ( com.google.gerrit.server.ssh.SshKeyCache.class ) . to ( com.google.gerrit.sshd.SshKeyCacheImpl.class ) ; }

Target:
protected void configure ( ) { cache ( com.google.gerrit.sshd.SshKeyCacheImpl.CACHE_NAME , java.lang.String.class , new com.google.inject.TypeLiteral < java.lang.Iterable < com.google.gerrit.sshd.SshKeyCacheEntry > > ( ) { } ) . loader ( com.google.gerrit.sshd.SshKeyCacheImpl.Loader.class ) ; bind ( com.google.gerrit.sshd.SshKeyCacheImpl.class ) ; bind ( com.google.gerrit.server.ssh.SshKeyCache.class ) . to ( com.google.gerrit.sshd.SshKeyCacheImpl.class ) ; bind ( com.google.gerrit.server.ssh.SshKeyCreator.class ) . to ( com.google.gerrit.sshd.SshKeyCreatorImpl.class ) ; }
Source:
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 ; }

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 ( ) ) ) ) ; r.assertOK ( ) ; com.google.gerrit.extensions.common.CommitInfo result = newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.extensions.common.CommitInfo.class ) ; r.consume ( ) ; return result ; }
Source:
public com.google.gerrit.extensions.restapi.Response < com.google.gerrit.extensions.api.projects.DashboardInfo > apply ( com.google.gerrit.server.project.ProjectResource resource , com.google.gerrit.extensions.common.SetDashboardInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.permissions.PermissionBackendException , java.io.IOException { com.google.gerrit.server.project.SetDefaultDashboard set = setDefault.get ( ) ; set.inherited = inherited ; return set.apply ( com.google.gerrit.server.project.DashboardResource.projectDefault ( resource.getControl ( ) ) , input ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < com.google.gerrit.extensions.api.projects.DashboardInfo > apply ( com.google.gerrit.server.project.ProjectResource resource , com.google.gerrit.extensions.common.SetDashboardInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.permissions.PermissionBackendException , java.io.IOException { com.google.gerrit.server.project.SetDefaultDashboard set = setDefault.get ( ) ; set.inherited = inherited ; return set.apply ( com.google.gerrit.server.project.DashboardResource.projectDefault ( resource.getProjectState ( ) , resource.getUser ( ) ) , input ) ; }
Source:
public void renameFile ( java.lang.String oldFilePath , java.lang.String newFilePath ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeEdits.Post.Input renameInput = new com.google.gerrit.server.change.ChangeEdits.Post.Input ( ) ; renameInput.oldPath = oldFilePath ; renameInput.newPath = newFilePath ; changeEditsPost.apply ( changeResource , renameInput ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot rename file of change edit" , e ) ; } }

Target:
public void renameFile ( java.lang.String oldFilePath , java.lang.String newFilePath ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.restapi.change.ChangeEdits.Post.Input renameInput = new com.google.gerrit.server.restapi.change.ChangeEdits.Post.Input ( ) ; renameInput.oldPath = oldFilePath ; renameInput.newPath = newFilePath ; changeEditsPost.apply ( changeResource , renameInput ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot rename file of change edit" , e ) ; } }
Source:
public void cannotUploadToAnyRef ( ) { com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/for/refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertCannotUpload ( u ) ; assertCannotCreateChange ( "refs/heads/master" , u ) ; }

Target:
public void usernamePatternCanUploadToAnyRef ( ) { com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/users/${username}/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , "a-registered-user" ) ; assertCanUpload ( u ) ; }
Source:
public void testProjectNotVisible ( ) throws java.lang.Exception { final com.google.gerrit.server.project.NoSuchProjectException err = new com.google.gerrit.server.project.NoSuchProjectException ( name ) ; validate ( ) . andThrow ( err ) ; doReplay ( ) ; try { new com.google.gerrit.httpd.rpc.project.ListBranches ( pcf , grm , name ) . call ( ) ; org.junit.Assert.fail ( "did not throw when expected not authorized" ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e2 ) { org.junit.Assert.assertSame ( err , e2 ) ; } doVerify ( ) ; }

Target:
public void testProjectNotVisible ( ) throws java.lang.Exception { final com.google.gerrit.server.project.NoSuchProjectException err = new com.google.gerrit.server.project.NoSuchProjectException ( name ) ; validate ( ) . andThrow ( err ) ; doReplay ( ) ; try { new com.google.gerrit.httpd.rpc.project.ListBranches ( pcf , com.google.gerrit.httpd.rpc.project.ListBranchesTest.createListBranchesProvider ( grm ) , name ) . call ( ) ; org.junit.Assert.fail ( "did not throw when expected not authorized" ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e2 ) { org.junit.Assert.assertSame ( err , e2 ) ; } doVerify ( ) ; }
Source:
public boolean allowsEdit ( final com.google.gerrit.reviewdb.Account.FieldName field ) { switch ( field ) { case FULL_NAME : if ( ( ldapSchema ) == null ) { return false ; } return ( ldapSchema.accountFullName ) == null ; case USER_NAME : if ( ( ldapSchema ) == null ) { return false ; } return ( ldapSchema.accountSshUserName ) == null ; default : return true ; } }

Target:
public boolean allowsEdit ( final com.google.gerrit.reviewdb.Account.FieldName field ) { return ! ( readOnlyAccountFields.contains ( field ) ) ; }
Source:
protected com.google.common.base.Optional < com.google.gitiles.FormatType > getFormat ( javax.servlet.http.HttpServletRequest req ) { com.google.common.base.Optional < com.google.gitiles.FormatType > format = com.google.gitiles.FormatType.getFormatType ( req ) ; if ( ( format.isPresent ( ) ) && ( ( format.get ( ) ) == ( com.google.gitiles.FormatType.DEFAULT ) ) ) { return com.google.common.base.Optional.of ( getDefaultFormat ( req ) ) ; } return format ; }

Target:
protected java.util.Optional < com.google.gitiles.FormatType > getFormat ( javax.servlet.http.HttpServletRequest req ) { java.util.Optional < com.google.gitiles.FormatType > format = com.google.gitiles.FormatType.getFormatType ( req ) ; if ( ( format.isPresent ( ) ) && ( ( format.get ( ) ) == ( com.google.gitiles.FormatType.DEFAULT ) ) ) { return java.util.Optional.of ( getDefaultFormat ( req ) ) ; } return format ; }
Source:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( com.google.inject.Stage.PRODUCTION , new com.google.gerrit.server.config.GerritServerModule ( ) , new com.google.gerrit.server.ssh.SshDaemonModule ( ) , new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; com.google.gerrit.client.rpc.Common.setGerritConfig ( injector.getInstance ( com.google.gerrit.client.data.GerritConfig.class ) ) ; injector.getInstance ( com.google.gerrit.server.ssh.Sshd.class ) . start ( ) ; return never ( ) ; }

Target:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( com.google.inject.Stage.PRODUCTION , new com.google.gerrit.server.config.GerritServerModule ( ) , new com.google.gerrit.server.ssh.SshDaemonModule ( ) , new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; com.google.gerrit.client.rpc.Common.setGerritConfig ( injector.getInstance ( com.google.gerrit.client.data.GerritConfig.class ) ) ; injector.getInstance ( com.google.gerrit.server.ssh.SshDaemon.class ) . start ( ) ; return never ( ) ; }
Source:
public com.google.gerrit.server.restapi.change.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { com.google.gerrit.reviewdb.client.Change change = rsrc.getChange ( ) ; return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Mark private" ) . setTitle ( "Mark change as private" ) . setVisible ( com.google.gerrit.extensions.conditions.BooleanCondition.and ( ( ! ( change.isPrivate ( ) ) ) , canSetPrivate ( rsrc ) ) ) ; }

Target:
public com.google.gerrit.server.restapi.change.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { com.google.gerrit.reviewdb.client.Change change = rsrc.getChange ( ) ; return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Mark private" ) . setTitle ( "Mark change as private" ) . setVisible ( com.google.gerrit.extensions.conditions.BooleanCondition.and ( ( ( ! ( disablePrivateChanges ) ) && ( ! ( change.isPrivate ( ) ) ) ) , canSetPrivate ( rsrc ) ) ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { if ( ( result.length ( ) ) > 0 ) { getTab ( ) . setTitle ( Resources.M.conflictingChanges ( result.length ( ) ) ) ; getTab ( ) . setChanges ( info.project ( ) , revision , convertChangeList ( result ) ) ; } }

Target:
public void onFailure ( java.lang.Throwable err ) { getTab ( ) . setTitle ( Resources.M.sameTopic ( Resources.C.notAvailable ( ) ) ) ; getTab ( ) . setError ( err.getMessage ( ) ) ; }
Source:
private < K , V > com.google.gerrit.server.cache.UnnamedCacheBinding < K , V > core ( final com.google.inject.Key < com.google.gerrit.server.cache.Cache < K , V > > key , final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < K , V > > type ) { final boolean disk = false ; final com.google.gerrit.server.cache.CacheProvider < K , V > b = new com.google.gerrit.server.cache.CacheProvider < K , V > ( disk , this , type ) ; bind ( key ) . toProvider ( b ) . in ( Scopes.SINGLETON ) ; return b ; }

Target:
private < K , V > com.google.gerrit.server.cache.UnnamedCacheBinding < K , V > cache ( final com.google.inject.Key < com.google.gerrit.server.cache.Cache < K , V > > key , final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < K , V > > type ) { final boolean disk = false ; final com.google.gerrit.server.cache.CacheProvider < K , V > b = new com.google.gerrit.server.cache.CacheProvider < K , V > ( this , type ) ; bind ( key ) . toProvider ( b ) . in ( Scopes.SINGLETON ) ; return b ; }
Source:
private com.google.gerrit.server.group.GroupResource createGroup ( ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.CreateGroup.Input input = new com.google.gerrit.server.group.CreateGroup.Input ( ) ; input.description = groupDescription ; input.visibleToAll = visibleToAll ; if ( ( ownerGroupId ) != null ) { input.ownerId = java.lang.String.valueOf ( ownerGroupId.get ( ) ) ; } com.google.gerrit.extensions.common.GroupInfo group = createGroupFactory.create ( groupName ) . apply ( TopLevelResource.INSTANCE , input ) ; return groups.parse ( TopLevelResource.INSTANCE , com.google.gerrit.extensions.restapi.IdString.fromUrl ( group.id ) ) ; }

Target:
private com.google.gerrit.server.group.GroupResource createGroup ( ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException { com.google.gerrit.extensions.api.groups.GroupInput input = new com.google.gerrit.extensions.api.groups.GroupInput ( ) ; input.description = groupDescription ; input.visibleToAll = visibleToAll ; if ( ( ownerGroupId ) != null ) { input.ownerId = java.lang.String.valueOf ( ownerGroupId.get ( ) ) ; } com.google.gerrit.extensions.common.GroupInfo group = createGroupFactory.create ( groupName ) . apply ( TopLevelResource.INSTANCE , input ) ; return groups.parse ( TopLevelResource.INSTANCE , com.google.gerrit.extensions.restapi.IdString.fromUrl ( group.id ) ) ; }
Source:
private static boolean isInternalGroup ( com.google.gerrit.common.data.GroupDescription.Basic group ) { return group instanceof com.google.gerrit.common.data.GroupDescription.Internal ; }

Target:
private static com.google.gerrit.extensions.common.GroupInfo createBasicGroupInfo ( com.google.gerrit.common.data.GroupDescription.Basic group ) { com.google.gerrit.extensions.common.GroupInfo info = new com.google.gerrit.extensions.common.GroupInfo ( ) ; info.id = com.google.gerrit.extensions.restapi.Url.encode ( group.getGroupUUID ( ) . get ( ) ) ; info.name = com.google.common.base.Strings.emptyToNull ( group.getName ( ) ) ; info.url = com.google.common.base.Strings.emptyToNull ( group.getUrl ( ) ) ; info.options = com.google.gerrit.server.group.GroupJson.createOptions ( group ) ; return info ; }
Source:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { final java.lang.String newOwner = ownerTxt.getText ( ) . trim ( ) ; if ( ( newOwner.length ( ) ) > 0 ) { Util.GROUP_SVC.changeGroupOwner ( getGroupId ( ) , newOwner , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.common.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.common.VoidResult result ) { saveOwner.setEnabled ( false ) ; } } ) ; } }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { final java.lang.String newOwner = ownerTxt.getText ( ) . trim ( ) ; if ( ( newOwner.length ( ) ) > 0 ) { com.google.gerrit.client.groups.GroupApi.setGroupOwner ( getGroupUUID ( ) , newOwner , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.common.com.google.gerrit.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.common.com.google.gerrit.client.VoidResult result ) { saveOwner.setEnabled ( false ) ; } } ) ; } }
Source:
public com.google.gerrit.server.IdentifiedUser get ( ) { final com.google.gerrit.server.CurrentUser user = session.get ( ) . getCurrentUser ( ) ; if ( user instanceof com.google.gerrit.server.IdentifiedUser ) { return ( ( com.google.gerrit.server.IdentifiedUser ) ( user ) ) ; } throw new com.google.inject.ProvisionException ( com.google.gerrit.common.errors.NotSignedInException.MESSAGE , new com.google.gerrit.common.errors.NotSignedInException ( ) ) ; }

Target:
public com.google.gerrit.server.IdentifiedUser get ( ) { final com.google.gerrit.server.CurrentUser user = session.get ( ) . getCurrentUser ( ) ; if ( user instanceof com.google.gerrit.server.IdentifiedUser ) { return factory.create ( user.getAccessPath ( ) , ( ( com.google.gerrit.server.IdentifiedUser ) ( user ) ) . getAccountId ( ) ) ; } throw new com.google.inject.ProvisionException ( com.google.gerrit.common.errors.NotSignedInException.MESSAGE , new com.google.gerrit.common.errors.NotSignedInException ( ) ) ; }
Source:
public com.googlesource.gerrit.plugins.serviceuser.GetMessages.MessagesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc ) { com.googlesource.gerrit.plugins.serviceuser.GetMessages.MessagesInfo info = new com.googlesource.gerrit.plugins.serviceuser.GetMessages.MessagesInfo ( ) ; info.onSuccess = com.google.common.base.Strings.emptyToNull ( cfg.getString ( "onSuccessMessage" ) ) ; return info ; }

Target:
public com.googlesource.gerrit.plugins.serviceuser.GetMessages.MessagesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc ) { com.googlesource.gerrit.plugins.serviceuser.GetMessages.MessagesInfo info = new com.googlesource.gerrit.plugins.serviceuser.GetMessages.MessagesInfo ( ) ; info.info = com.google.common.base.Strings.emptyToNull ( cfg.getString ( "infoMessage" ) ) ; info.onSuccess = com.google.common.base.Strings.emptyToNull ( cfg.getString ( "onSuccessMessage" ) ) ; return info ; }
Source:
private com.google.gerrit.server.git.BatchUpdate.ChangeContext newChangeContext ( com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChanges.get ( id ) ; if ( c == null ) { c = db.changes ( ) . get ( id ) ; } return new com.google.gerrit.server.git.BatchUpdate.ChangeContext ( changeControlFactory.controlFor ( c , user ) ) ; }

Target:
private com.google.gerrit.server.git.BatchUpdate.ChangeContext newChangeContext ( com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChanges.get ( id ) ; if ( c == null ) { c = com.google.gerrit.server.git.BatchUpdate.unwrap ( db ) . changes ( ) . get ( id ) ; } com.google.gerrit.server.notedb.ChangeNotes notes = changeNotesFactory.createForNew ( c ) ; com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx = new com.google.gerrit.server.git.BatchUpdate.ChangeContext ( changeControlFactory.controlFor ( notes , user ) , new com.google.gerrit.server.git.BatchUpdateReviewDb ( db ) ) ; return ctx ; }
Source:
public void rewriteAtStartOfLineIsRecognized ( ) throws java.lang.Exception { java.lang.String a = "abc1\n" ; java.lang.String b = "def1\n" ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.patch.IntraLineLoaderTest.intraline ( a , b ) ) . isEqualTo ( com.google.gerrit.server.patch.IntraLineLoaderTest.wordEdit ( 0 , 3 , 0 , 3 ) ) ; }

Target:
public void rewriteAtStartOfLineIsRecognized ( ) throws java.lang.Exception { java.lang.String a = "abc1\n" ; java.lang.String b = "def1\n" ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.patch.IntraLineLoaderTest.intraline ( a , b ) ) . isEqualTo ( com.google.gerrit.server.patch.IntraLineLoaderTest.ref ( ) . replace ( "abc" , "def" ) . common ( "1\n" ) . edits ) ; }
Source:
public void setFrom ( final com.google.gerrit.reviewdb.Account.Id id ) { super . setFrom ( id ) ; final com.google.gerrit.server.IdentifiedUser user = args.identifiedUserFactory.create ( id ) ; final java.util.Set < com.google.gerrit.reviewdb.AccountGroup.UUID > gids = user.getEffectiveGroups ( ) ; for ( final com.google.gerrit.reviewdb.AccountGroup.UUID gid : gids ) { if ( args.groupCache.get ( gid ) . isEmailOnlyAuthors ( ) ) { emailOnlyAuthors = true ; break ; } } }

Target:
public void setFrom ( final com.google.gerrit.reviewdb.Account.Id id ) { super . setFrom ( id ) ; final com.google.gerrit.server.IdentifiedUser user = args.identifiedUserFactory.create ( id ) ; final java.util.Set < com.google.gerrit.reviewdb.AccountGroup.UUID > gids = user.getEffectiveGroups ( ) ; for ( final com.google.gerrit.reviewdb.AccountGroup.UUID gid : gids ) { com.google.gerrit.reviewdb.AccountGroup group = args.groupCache.get ( gid ) ; if ( ( group != null ) && ( group.isEmailOnlyAuthors ( ) ) ) { emailOnlyAuthors = true ; break ; } } }
Source:
public void testInsertOneException ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchException ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , new java.sql.BatchUpdateException ( ) ) ; try { createClassUnderTest ( ) . insert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.client.OrmException e ) { } }

Target:
public void testUpsertOneException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement update = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.upsert ( 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 ( update ) ; }
Source:
public void onShowView ( ) { super . onShowView ( ) ; com.google.gwt.user.client.Window.enableScrolling ( false ) ; com.google.gerrit.client.JumpKeys.enable ( false ) ; if ( getPrefs ( ) . hideTopMenu ( ) ) { com.google.gerrit.client.Gerrit.setHeaderVisible ( false ) ; } resizeHandler = com.google.gwt.user.client.Window.addResizeHandler ( new com.google.gwt.event.logical.shared.ResizeHandler ( ) { @ java.lang.Override public void onResize ( com.google.gwt.event.logical.shared.ResizeEvent event ) { resizeCodeMirror ( ) ; } } ) ; }

Target:
public void onShowView ( ) { super . onShowView ( ) ; com.google.gwt.user.client.Window.enableScrolling ( false ) ; com.google.gerrit.client.JumpKeys.enable ( false ) ; if ( prefs.hideTopMenu ( ) ) { com.google.gerrit.client.Gerrit.setHeaderVisible ( false ) ; } resizeHandler = com.google.gwt.user.client.Window.addResizeHandler ( new com.google.gwt.event.logical.shared.ResizeHandler ( ) { @ java.lang.Override public void onResize ( com.google.gwt.event.logical.shared.ResizeEvent event ) { resizeCodeMirror ( ) ; } } ) ; }
Source:
public java.util.SortedSet < com.google.gerrit.reviewdb.client.Project.NameKey > list ( ) { namesUpdateLock.lock ( ) ; try { com.google.gerrit.server.git.LocalDiskRepositoryManager.ProjectVisitor visitor = new com.google.gerrit.server.git.LocalDiskRepositoryManager.ProjectVisitor ( ) ; try { java.nio.file.Files.walkFileTree ( basePath , java.util.EnumSet.of ( java.nio.file.FileVisitOption.FOLLOW_LINKS ) , java.lang.Integer.MAX_VALUE , visitor ) ; } catch ( java.io.IOException e ) { com.google.gerrit.server.git.LocalDiskRepositoryManager.log.error ( ( "Error walking repository tree " + ( basePath.toAbsolutePath ( ) ) ) , e ) ; } return java.util.Collections.unmodifiableSortedSet ( visitor.found ) ; } finally { namesUpdateLock.unlock ( ) ; } }

Target:
public java.util.SortedSet < com.google.gerrit.reviewdb.client.Project.NameKey > list ( ) { namesUpdateLock.lock ( ) ; try { com.google.gerrit.server.git.LocalDiskRepositoryManager.ProjectVisitor visitor = new com.google.gerrit.server.git.LocalDiskRepositoryManager.ProjectVisitor ( basePath ) ; scanProjects ( visitor ) ; return java.util.Collections.unmodifiableSortedSet ( visitor.found ) ; } finally { namesUpdateLock.unlock ( ) ; } }
Source:
HEAD ( com.google.gerrit.acceptance.ec436a Merge ) { }

Target:
public org.junit.runners.model.Statement apply ( final org.junit.runners.model.Statement base , final org.junit.runner.Description description ) { return new org.junit.runners.model.Statement ( ) { @ java.lang.Override public void evaluate ( ) throws java.lang.Throwable { beforeTest ( description ) ; try { base.evaluate ( ) ; } finally { afterTest ( ) ; } } } ; }
Source:
public java.util.Set < java.lang.String > getNames ( java.lang.String section , java.lang.String subsection ) { java.util.Set < java.lang.String > secureConfigNames = secureConfig.getNames ( section , subsection ) ; java.util.Set < java.lang.String > gerritConfigNames = gerritConfig.getNames ( section , subsection ) ; gerritConfigNames.addAll ( secureConfigNames ) ; return gerritConfigNames ; }

Target:
public java.util.Set < java.lang.String > getNames ( java.lang.String section , java.lang.String subsection ) { return new com.google.common.collect.ImmutableSet.Builder < java.lang.String > ( ) . addAll ( secureConfig.getNames ( section , subsection ) ) . addAll ( gerritConfig.getNames ( section , subsection ) ) . build ( ) ; }
Source:
public java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > filter ( java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > refs , org.eclipse.jgit.lib.Repository repo , com.google.gerrit.server.permissions.PermissionBackend.RefFilterOptions opts ) throws com.google.gerrit.server.permissions.PermissionBackendException { return refFilterFactory.create ( this ) . filter ( refs , repo , opts ) ; }

Target:
public java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > filter ( java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > refs , org.eclipse.jgit.lib.Repository repo , com.google.gerrit.server.permissions.PermissionBackend.RefFilterOptions opts ) throws com.google.gerrit.server.permissions.PermissionBackendException { if ( ( refFilter ) == null ) { refFilter = refFilterFactory.create ( this ) ; } return refFilter.filter ( refs , repo , opts ) ; }
Source:
private void renderOwner ( com.google.gerrit.client.changes.ChangeInfo info ) { ownerText.setInnerText ( ( ( info.owner ( ) . name ( ) ) != null ? info.owner ( ) . name ( ) : com.google.gerrit.client.Gerrit.getConfig ( ) . getAnonymousCowardName ( ) ) ) ; }

Target:
private void renderOwner ( com.google.gerrit.client.changes.ChangeInfo info ) { java.lang.String name = ( ( info.owner ( ) . name ( ) ) != null ) ? info.owner ( ) . name ( ) : com.google.gerrit.client.Gerrit.getConfig ( ) . getAnonymousCowardName ( ) ; ownerText.setInnerText ( name ) ; ownerText.setTitle ( name ) ; }
Source:
private boolean combineA ( final int i ) { final org.spearce.jgit.diff.Edit s = edits.get ( i ) ; final org.spearce.jgit.diff.Edit e = edits.get ( ( i - 1 ) ) ; return ( ( s.getBeginA ( ) ) - ( e.getEndA ( ) ) ) <= ( 2 * ( getContext ( ) ) ) ; }

Target:
public java.lang.Iterable < com.google.gerrit.client.data.EditList.Hunk > getHunks ( ) { return new com.google.gerrit.client.data.EditList ( edits , getContext ( ) , a.size ( ) , b.size ( ) ) . getHunks ( ) ; }
Source:
public void storeThenQueryVisible ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.MockEvent mockEvent = setUpMocks ( com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.PROJECT_VISIBLE_TO_USER ) ; store.storeEvent ( mockEvent ) ; java.util.List < java.lang.String > events = store.queryChangeEvents ( com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.GENERIC_QUERY ) ; java.lang.String json = new com.google.gson.Gson ( ) . toJson ( mockEvent ) ; com.google.common.truth.Truth.assertThat ( events ) . containsExactly ( json ) ; tearDown ( ) ; }

Target:
public void storeThenQueryVisible ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.MockEvent mockEvent = setUpMocks ( com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.PROJECT_VISIBLE_TO_USER ) ; store.storeEvent ( mockEvent ) ; java.util.List < java.lang.String > events = store.queryChangeEvents ( com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.GENERIC_QUERY ) ; java.lang.String json = new com.google.gson.Gson ( ) . toJson ( mockEvent ) ; com.google.common.truth.Truth.assertThat ( events ) . containsExactly ( json ) . inOrder ( ) ; tearDown ( ) ; }
Source:
public void testUSER_NoPreferredEmailUser ( ) { setFrom ( "USER" ) ; final java.lang.String name = "A U. Thor" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( name , null ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; com.google.common.truth.Truth.assertThat ( r ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( r.name ) . isEqualTo ( name ) ; com.google.common.truth.Truth.assertThat ( r.email ) . isEqualTo ( ident.getEmailAddress ( ) ) ; org.easymock.EasyMock.verify ( accountCache ) ; }

Target:
public void testUSERAllowDomain ( ) { setFrom ( "USER" ) ; setDomains ( java.util.Arrays.asList ( "*.example.com" ) ) ; final java.lang.String name = "A U. Thor" ; final java.lang.String email = "a.u.thor@test.example.com" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( name , email ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; com.google.common.truth.Truth.assertThat ( r ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( r.name ) . isEqualTo ( name ) ; com.google.common.truth.Truth.assertThat ( r.email ) . isEqualTo ( email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }
Source:
public void upsertProjectWatches ( com.google.gerrit.reviewdb.client.Account.Id accountId , java.util.Map < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey , java.util.Set < com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType > > newProjectWatches ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { try ( com.google.gerrit.server.account.WatchConfig watchConfig = open ( accountId ) ) { java.util.Map < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey , java.util.Set < com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType > > projectWatches = watchConfig.getProjectWatches ( ) ; projectWatches.putAll ( newProjectWatches ) ; commit ( watchConfig ) ; } }

Target:
public void upsertProjectWatches ( com.google.gerrit.reviewdb.client.Account.Id accountId , java.util.Map < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey , java.util.Set < com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType > > newProjectWatches ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.server.account.WatchConfig watchConfig = read ( accountId ) ; java.util.Map < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey , java.util.Set < com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType > > projectWatches = watchConfig.getProjectWatches ( ) ; projectWatches.putAll ( newProjectWatches ) ; commit ( watchConfig ) ; }
Source:
public void generatesExpectedMessage ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.submitter = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockChange.commitMessage = "This is a title\nAnd a the body." ; 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 merged\\n>>>" + ( "testproject (master): This is a title (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 { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.submitter = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockChange.number = 1234 ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockChange.commitMessage = "This is a title\nand a the body." ; 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 = "{\n" + ( ( ( ( ( ( ( ( ( ( ( " \"channel\": \"#testchannel\",\n" + " \"attachments\": [\n" ) + " {\n" ) + " \"fallback\": \"Unit Tester merged - testproject (master) - change 1234 - https://change/\",\n" ) + " \"pretext\": \"Unit Tester merged\",\n" ) + " \"title\": \"testproject (master) - change 1234\",\n" ) + " \"title_link\": \"https://change/\",\n" ) + " \"text\": \"This is a title\",\n" ) + " \"color\": \"good\"\n" ) + " }\n" ) + " ]\n" ) + "}\n" ) ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }
Source:
private void assertMembers ( java.util.List < com.google.gerrit.extensions.common.AccountInfo > members , java.lang.String ... names ) { java.lang.Iterable < java.lang.String > memberNames = com.google.common.collect.Iterables.transform ( members , new com.google.common.base.Function < com.google.gerrit.extensions.common.AccountInfo , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.common.AccountInfo info ) { return info.name ; } } ) ; com.google.common.truth.Truth.assertThat ( memberNames ) . containsExactlyElementsIn ( java.util.Arrays.asList ( names ) ) . inOrder ( ) ; }

Target:
private void assertMembers ( java.lang.Iterable < com.google.gerrit.extensions.common.AccountInfo > members , java.lang.String ... expectedNames ) { java.lang.Iterable < java.lang.String > memberNames = com.google.common.collect.Iterables.transform ( members , new com.google.common.base.Function < com.google.gerrit.extensions.common.AccountInfo , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.common.AccountInfo info ) { return info.name ; } } ) ; com.google.common.truth.Truth.assertThat ( memberNames ) . containsExactlyElementsIn ( java.util.Arrays.asList ( expectedNames ) ) . inOrder ( ) ; }
Source:
public void onResize ( com.google.gwt.event.logical.shared.ResizeEvent event ) { resizeCodeMirror ( ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.NativeMap < com.google.gwt.core.client.JsArray < com.google.gerrit.client.changes.CommentInfo > > result ) { com.google.gwt.core.client.JsArray < com.google.gerrit.client.changes.CommentInfo > in = result.get ( path ) ; if ( in != null ) { if ( toDrafts ) { if ( side == ( DisplaySide.A ) ) { draftsBase = in ; } else { draftsRevision = in ; } } else { if ( side == ( DisplaySide.A ) ) { publishedBase = in ; } else { publishedRevision = in ; } } } }
Source:
public int compareTo ( com.google.gerrit.server.notedb.rebuild.Event other ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( this . when , other.when ) . compareTrueFirst ( isPatchSet ( ) , isPatchSet ( ) ) . compareTrueFirst ( this . predatesChange , other.predatesChange ) . compare ( this . who , other.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( this . psId , other.psId , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) . nullsLast ( ) ) . result ( ) ; }

Target:
public int compareTo ( com.google.gerrit.server.notedb.rebuild.Event other ) { return com.google.common.collect.ComparisonChain.start ( ) . compareFalseFirst ( this . isFinalUpdates ( ) , other.isFinalUpdates ( ) ) . compare ( this . when , other.when ) . compareTrueFirst ( isPatchSet ( ) , isPatchSet ( ) ) . compareTrueFirst ( this . predatesChange , other.predatesChange ) . compare ( this . who , other.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( this . psId , other.psId , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) . nullsLast ( ) ) . result ( ) ; }
Source:
public static void setUp ( ) throws java.lang.Exception { org.easymock.EasyMockSupport easyMock = new org.easymock.EasyMockSupport ( ) ; com.ericsson.gerrit.plugins.eventslog.EventsLogConfig cfgMock = easyMock.createMock ( com.ericsson.gerrit.plugins.eventslog.EventsLogConfig.class ) ; org.easymock.EasyMock.expect ( cfgMock.getReturnLimit ( ) ) . andReturn ( 10 ) ; easyMock.replayAll ( ) ; com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.queryMaker = new com.ericsson.gerrit.plugins.eventslog.sql.SQLQueryMaker ( cfgMock ) ; com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.defaultQuery = com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.queryMaker.getDefaultQuery ( ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { org.mockito.Mockito.when ( cfgMock.getReturnLimit ( ) ) . thenReturn ( 10 ) ; queryMaker = new com.ericsson.gerrit.plugins.eventslog.sql.SQLQueryMaker ( cfgMock ) ; defaultQuery = queryMaker.getDefaultQuery ( ) ; }
Source:
static com.google.gerrit.server.query.change.QueryOptions convertOptions ( com.google.gerrit.server.query.change.QueryOptions opts ) { int backendLimit = opts.config ( ) . maxLimit ( ) ; int limit = com.google.common.primitives.Ints.saturatedCast ( ( ( ( long ) ( opts.limit ( ) ) ) + ( opts.start ( ) ) ) ) ; limit = java.lang.Math.min ( limit , backendLimit ) ; return com.google.gerrit.server.query.change.QueryOptions.create ( opts.config ( ) , 0 , limit , opts.fields ( ) ) ; }

Target:
static com.google.gerrit.server.index.QueryOptions convertOptions ( com.google.gerrit.server.index.QueryOptions opts ) { int backendLimit = opts.config ( ) . maxLimit ( ) ; int limit = com.google.common.primitives.Ints.saturatedCast ( ( ( ( long ) ( opts.limit ( ) ) ) + ( opts.start ( ) ) ) ) ; limit = java.lang.Math.min ( limit , backendLimit ) ; return com.google.gerrit.server.index.change.IndexedChangeQuery.createOptions ( opts.config ( ) , 0 , limit , opts.fields ( ) ) ; }
Source:
private java.lang.String toPath ( java.lang.String path ) { return com.google.gitiles.GitilesView.path ( ) . copyFrom ( view ) . setPathPart ( path ) . build ( ) . toUrl ( ) ; }

Target:
private java.lang.String toPath ( java.lang.String path ) { com.google.gitiles.GitilesView.Builder b ; if ( ( view.getType ( ) ) == ( GitilesView.Type.ROOTED_DOC ) ) { b = com.google.gitiles.GitilesView.rootedDoc ( ) ; } else { b = com.google.gitiles.GitilesView.path ( ) ; } return b.copyFrom ( view ) . setPathPart ( path ) . build ( ) . toUrl ( ) ; }
Source:
public void writeCommit ( com.google.gerrit.server.notedb.BatchMetaDataUpdate batch ) throws com.google.gwtorm.server.OrmException , java.io.IOException { org.eclipse.jgit.lib.CommitBuilder builder = new org.eclipse.jgit.lib.CommitBuilder ( ) ; if ( migration.writeChanges ( ) ) { org.eclipse.jgit.lib.ObjectId treeId = storeCommentsInNotes ( ) ; if ( treeId != null ) { builder.setTreeId ( treeId ) ; } } batch.write ( this , builder ) ; if ( ( draftUpdate ) != null ) { draftUpdate.commit ( ) ; } }

Target:
public void writeCommit ( com.google.gerrit.server.notedb.BatchMetaDataUpdate batch ) throws com.google.gwtorm.server.OrmException , java.io.IOException { org.eclipse.jgit.lib.CommitBuilder builder = new org.eclipse.jgit.lib.CommitBuilder ( ) ; if ( migration.writeChanges ( ) ) { org.eclipse.jgit.lib.ObjectId treeId = storeRevisionNotes ( ) ; if ( treeId != null ) { builder.setTreeId ( treeId ) ; } } batch.write ( this , builder ) ; if ( ( draftUpdate ) != null ) { draftUpdate.commit ( ) ; } }
Source:
public void stop ( ) { if ( ( scanner ) != null ) { scanner.end ( ) ; } synchronized ( this ) { boolean clean = ! ( running.isEmpty ( ) ) ; for ( com.google.gerrit.server.plugins.Plugin p : running.values ( ) ) { p.stop ( ) ; } running.clear ( ) ; broken.clear ( ) ; if ( clean ) { java.lang.System.gc ( ) ; processPendingCleanups ( ) ; } } }

Target:
public void stop ( ) { if ( ( scanner ) != null ) { scanner.end ( ) ; } srvInfoImpl.state = ServerInformation.State.SHUTDOWN ; synchronized ( this ) { boolean clean = ! ( running.isEmpty ( ) ) ; for ( com.google.gerrit.server.plugins.Plugin p : running.values ( ) ) { p.stop ( ) ; } running.clear ( ) ; broken.clear ( ) ; if ( clean ) { java.lang.System.gc ( ) ; processPendingCleanups ( ) ; } } }
Source:
com.ericsson.gerrit.plugins.eventslog.sql.SQLClient provideLocalSqlClient ( com.ericsson.gerrit.plugins.eventslog.EventsLogConfig cfg ) { java.lang.String path = cfg.getLocalStorePath ( ) . toString ( ) ; path = ( path.endsWith ( "/" ) ) ? path : path + "/" ; com.ericsson.gerrit.plugins.eventslog.sql.SQLClient sqlClient = new com.ericsson.gerrit.plugins.eventslog.sql.SQLClient ( cfg.getLocalStoreDriver ( ) , ( ( com.ericsson.gerrit.plugins.eventslog.sql.SQLModule.H2_DB_PREFIX ) + path ) , cfg.getUrlOptions ( ) ) ; sqlClient.setEvictIdleTime ( cfg.getEvictIdleTime ( ) ) ; return sqlClient ; }

Target:
com.ericsson.gerrit.plugins.eventslog.sql.SQLClient provideLocalSqlClient ( com.ericsson.gerrit.plugins.eventslog.EventsLogConfig cfg ) { java.lang.String path = cfg.getLocalStorePath ( ) . toString ( ) ; path = ( path.endsWith ( "/" ) ) ? path : path + "/" ; com.ericsson.gerrit.plugins.eventslog.sql.SQLClient sqlClient = new com.ericsson.gerrit.plugins.eventslog.sql.SQLClient ( cfg.getLocalStoreDriver ( ) , ( ( ( com.ericsson.gerrit.plugins.eventslog.sql.SQLModule.H2_DB_PREFIX ) + path ) + ( SQLTable.TABLE_NAME ) ) , cfg.getUrlOptions ( ) ) ; sqlClient.setEvictIdleTime ( cfg.getEvictIdleTime ( ) ) ; return sqlClient ; }
Source:
private org.eclipse.jetty.server.Connector [ ] connectors ( ) { org.eclipse.jetty.server.Connector c = new org.eclipse.jetty.server.nio.SelectChannelConnector ( ) ; c.setHost ( null ) ; c.setPort ( cfg.getInt ( "gitiles" , null , "port" , 8080 ) ) ; c.setStatsOn ( false ) ; return new org.eclipse.jetty.server.Connector [ ] { c } ; }

Target:
private org.eclipse.jetty.server.Connector [ ] connectors ( ) { org.eclipse.jetty.server.Connector c = new org.eclipse.jetty.server.bio.SocketConnector ( ) ; c.setHost ( null ) ; c.setPort ( cfg.getInt ( "gitiles" , null , "port" , 8080 ) ) ; c.setStatsOn ( false ) ; return new org.eclipse.jetty.server.Connector [ ] { c } ; }