auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void populate ( final int row , final com.google.gerrit.reviewdb.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:
private void refresh ( ) { setToken ( ( ( ( subname ) == null ) || ( "" . equals ( subname ) ) ? com.google.gerrit.common.PageLinks.ADMIN_PROJECTS : ( ( com.google.gerrit.common.PageLinks.ADMIN_PROJECTS ) + "?filter=" ) + ( com.google.gwt.http.client.URL.encodeQueryString ( subname ) ) ) ) ; com.google.gerrit.client.projects.ProjectMap.match ( subname , new com.google.gerrit.client.ui.IgnoreOutdatedFilterResultsCallbackWrapper < com.google.gerrit.client.projects.ProjectMap > ( this , new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.projects.ProjectMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.projects.ProjectMap result ) { projects.display ( result ) ; } } ) ) ; }

Target:
private void refresh ( ) { setToken ( ( ( ( subname ) == null ) || ( "" . equals ( subname ) ) ? com.google.gerrit.common.PageLinks.ADMIN_PROJECTS : ( ( com.google.gerrit.common.PageLinks.ADMIN_PROJECTS ) + "?filter=" ) + ( com.google.gwt.http.client.URL.encodeQueryString ( subname ) ) ) ) ; com.google.gerrit.client.projects.ProjectMap.match ( subname , new com.google.gerrit.client.ui.IgnoreOutdatedFilterResultsCallbackWrapper < com.google.gerrit.client.projects.ProjectMap > ( this , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.projects.ProjectMap > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.projects.ProjectMap result ) { projects.display ( result ) ; } } ) ) ; }
Source:
public java.lang.Iterable < com.google.gerrit.extensions.common.WebLinkInfo > getPatchSetLinks ( java.lang.String project , java.lang.String commit ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.extensions.webui.PatchSetWebLink webLink : patchSetLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getPatchSetUrl ( project , commit ) , webLink.getTarget ( ) ) ) ; } return links ; }

Target:
public java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > getPatchSetLinks ( java.lang.String project , java.lang.String commit ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = new java.util.ArrayList < > ( 4 ) ; for ( com.google.gerrit.extensions.webui.PatchSetWebLink webLink : patchSetLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getPatchSetUrl ( project , commit ) , webLink.getTarget ( ) ) ) ; } return links ; }
Source:
private void openRepos ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.git.IntegrationException { for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { try { openRepo ( project ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException noProject ) { logWarn ( ( ( ( "Project " + ( noProject.project ( ) ) ) + " no longer exists, " ) + "abandoning open changes" ) ) ; abandonAllOpenChanges ( noProject.project ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.IntegrationException ( ( "Error opening project " + project ) , e ) ; } } }

Target:
private void openRepos ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.git.IntegrationException { for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { try { openRepo ( project ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException noProject ) { logWarn ( ( ( ( "Project " + ( noProject.project ( ) ) ) + " no longer exists, " ) + "abandoning open changes" ) ) ; abandonAllOpenChangeForDeletedProject ( noProject.project ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.IntegrationException ( ( "Error opening project " + project ) , e ) ; } } }
Source:
public void unblockNoForce ( ) { com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "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/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertCanUpdate ( "refs/heads/master" , u ) ; }

Target:
public void unblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.testing.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; r.setForce ( true ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCanForceUpdate ( "refs/heads/master" , u ) ; }
Source:
public void testUpdateNothing ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { createClassUnderTest ( ) . update ( com.google.gwtorm.jdbc.TestJdbcAccess.NO_DATA ) ; }

Target:
public void testUpsertTwoUpdateCountsAreNull ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , null ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 , 1 ) ; createClassUnderTest ( ) . upsert ( twoRows ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertExpectedIdsUsed ( insert , 1 , 2 ) ; }
Source:
private void responseLfsNotConfigured ( javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { com.google.gwtexpui.server.CacheHeaders.setNotCacheable ( res ) ; res.setContentType ( com.google.gerrit.httpd.plugins.LfsPluginServlet.CONTENTTYPE_VND_GIT_LFS_JSON ) ; res.setStatus ( javax.servlet.http.HttpServletResponse.SC_NOT_IMPLEMENTED ) ; java.io.Writer w = new java.io.BufferedWriter ( new java.io.OutputStreamWriter ( res.getOutputStream ( ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; w.write ( com.google.gerrit.httpd.plugins.LfsPluginServlet.MESSAGE_LFS_NOT_CONFIGURED ) ; w.flush ( ) ; }

Target:
private void responseLfsNotConfigured ( javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { com.google.gwtexpui.server.CacheHeaders.setNotCacheable ( res ) ; res.setContentType ( com.google.gerrit.extensions.api.lfs.LfsDefinitions.CONTENTTYPE_VND_GIT_LFS_JSON ) ; res.setStatus ( javax.servlet.http.HttpServletResponse.SC_NOT_IMPLEMENTED ) ; java.io.Writer w = new java.io.BufferedWriter ( new java.io.OutputStreamWriter ( res.getOutputStream ( ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; w.write ( com.google.gerrit.httpd.plugins.LfsPluginServlet.MESSAGE_LFS_NOT_CONFIGURED ) ; w.flush ( ) ; }
Source:
public com.google.gerrit.reviewdb.client.PatchSet update ( com.google.gerrit.reviewdb.client.PatchSet patchset ) { patchset.setDraft ( false ) ; return patchset ; }

Target:
private void sendCreateChange ( com.google.gerrit.server.git.BatchUpdate.Context ctx ) throws com.google.gerrit.common.errors.EmailException { com.google.gerrit.server.mail.CreateChangeSender cm = createChangeSenderFactory.create ( change.getId ( ) ) ; cm.setFrom ( ctx.getUser ( ) . getAccountId ( ) ) ; cm.setPatchSet ( patchSet , patchSetInfo ) ; cm.addReviewers ( recipients.getReviewers ( ) ) ; cm.addExtraCC ( recipients.getCcOnly ( ) ) ; cm.send ( ) ; }
Source:
private com.google.gerrit.reviewdb.Account findByEmail ( final java.lang.String email ) { final java.util.Set < com.google.gerrit.reviewdb.Account.Id > candidates = byEmail.get ( email ) ; if ( 1 == ( candidates.size ( ) ) ) { return byId.get ( candidates.iterator ( ) . next ( ) ) . getAccount ( ) ; } return null ; }

Target:
public com.google.gerrit.reviewdb.Account find ( final java.lang.String nameOrEmail ) throws com.google.gwtorm.client.OrmException { java.util.Set < com.google.gerrit.reviewdb.Account.Id > r = findAll ( nameOrEmail ) ; return ( r.size ( ) ) == 1 ? byId.get ( r.iterator ( ) . next ( ) ) . getAccount ( ) : null ; }
Source:
protected void doDelete ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse rsp ) { if ( ! ( currentUserProvider.get ( ) . getCapabilities ( ) . canAdministrateServer ( ) ) ) { sendError ( rsp , javax.servlet.http.HttpServletResponse.SC_FORBIDDEN ) ; return ; } this . healthy = false ; rsp.setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; }

Target:
protected void doPost ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse rsp ) { if ( ! ( permissionBackend.user ( currentUserProvider.get ( ) ) . testOrFalse ( com.google.gerrit.server.permissions.GlobalPermission.ADMINISTRATE_SERVER ) ) ) { sendError ( rsp , javax.servlet.http.HttpServletResponse.SC_FORBIDDEN ) ; return ; } this . healthy = true ; rsp.setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; }
Source:
private void displayView ( android.app.Fragment fragment , int position ) { displayView ( fragment ) ; com.google.reviewit.MainActivity.Item item = items.get ( position ) ; com.google.common.base.Preconditions.checkNotNull ( item ) ; list.setItemChecked ( position , true ) ; list.setSelection ( position ) ; setTitle ( getString ( item.titleId ) ) ; drawer.closeDrawer ( list ) ; }

Target:
private void displayView ( android.support.v4.app.Fragment fragment , int position ) { displayView ( fragment ) ; com.google.reviewit.MainActivity.Item item = items.get ( position ) ; com.google.common.base.Preconditions.checkNotNull ( item ) ; list.setItemChecked ( position , true ) ; list.setSelection ( position ) ; setTitle ( getString ( item.titleId ) ) ; drawer.closeDrawer ( list ) ; }
Source:
public void onSuccess ( com.google.gwt.core.client.JsArrayString result ) { hashtagTextBox.setEnabled ( true ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( error , false ) ; error.setInnerText ( "" ) ; hashtagTextBox.setText ( "" ) ; if ( ( result != null ) && ( ( result.length ( ) ) > 0 ) ) { updateHashtagList ( result ) ; } }

Target:
void set ( com.google.gerrit.client.info.ChangeInfo info , java.lang.String revision ) { psId = new com.google.gerrit.reviewdb.client.PatchSet.Id ( info.legacyId ( ) , info.revisions ( ) . get ( revision ) . _number ( ) ) ; canEdit = ( info.hasActions ( ) ) && ( info.actions ( ) . containsKey ( "hashtags" ) ) ; this . changeId = info.legacyId ( ) ; display ( info ) ; addHashtagIcon.setVisible ( canEdit ) ; }
Source:
private void initRights ( ) { final com.google.gwt.user.client.ui.Label rightsHdr = new com.google.gwt.user.client.ui.Label ( Util.C.headingAccessRights ( ) ) ; rightsHdr.setStyleName ( "gerrit-SmallHeading" ) ; rights = new com.google.gerrit.client.admin.ProjectAdminScreen.RightsTable ( ) ; delRight = new com.google.gwt.user.client.ui.Button ( Util.C.buttonDeleteGroupMembers ( ) ) ; delRight.addClickListener ( new com.google.gwt.user.client.ui.ClickListener ( ) { public void onClick ( final com.google.gwt.user.client.ui.Widget sender ) { rights.deleteChecked ( ) ; } } ) ; add ( rightsHdr ) ; add ( rights ) ; add ( delRight ) ; }

Target:
public void onClick ( final com.google.gwt.user.client.ui.Widget sender ) { doAddNewRight ( ) ; }
Source:
private boolean exists ( java.lang.String groupDn ) { try { javax.naming.directory.DirContext ctx = helper.open ( ) ; try { javax.naming.Name compositeGroupName = new javax.naming.CompositeName ( ) . add ( groupDn ) ; ctx.getAttributes ( compositeGroupName ) ; return true ; } finally { try { ctx.close ( ) ; } catch ( javax.naming.NamingException e ) { com.google.gerrit.server.auth.ldap.LdapGroupBackend.log.warn ( "Cannot close LDAP query handle" , e ) ; } } } catch ( javax.naming.NamingException e ) { com.google.gerrit.server.auth.ldap.LdapGroupBackend.log.warn ( "Cannot query LDAP for group" , e ) ; } return false ; }

Target:
public com.google.gerrit.server.account.GroupMembership membershipsOf ( com.google.gerrit.server.IdentifiedUser user ) { java.lang.String id = com.google.gerrit.server.auth.ldap.LdapGroupBackend.findId ( user.state ( ) . getExternalIds ( ) ) ; if ( id == null ) { return com.google.gerrit.server.account.GroupMembership.EMPTY ; } try { return new com.google.gerrit.server.account.ListGroupMembership ( membershipCache.get ( id ) ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.gerrit.server.auth.ldap.LdapGroupBackend.log.warn ( java.lang.String.format ( "Cannot lookup membershipsOf %s in LDAP" , id ) , e ) ; return com.google.gerrit.server.account.GroupMembership.EMPTY ; } }
Source:
public static java.lang.String asString ( byte [ ] content , java.lang.String encoding ) throws java.io.UnsupportedEncodingException { if ( encoding == null ) { org.mozilla.universalchardet.UniversalDetector d = new org.mozilla.universalchardet.UniversalDetector ( null ) ; d.handleData ( content , 0 , content.length ) ; d.dataEnd ( ) ; encoding = d.getDetectedCharset ( ) ; } if ( encoding == null ) { encoding = "ISO-8859-1" ; } return new java.lang.String ( content , encoding ) ; }

Target:
private static java.nio.charset.Charset charset ( byte [ ] content , java.lang.String encoding ) { if ( encoding == null ) { org.mozilla.universalchardet.UniversalDetector d = new org.mozilla.universalchardet.UniversalDetector ( null ) ; d.handleData ( content , 0 , content.length ) ; d.dataEnd ( ) ; encoding = d.getDetectedCharset ( ) ; } if ( encoding == null ) { encoding = "ISO-8859-1" ; } return java.nio.charset.Charset.forName ( encoding ) ; }
Source:
private boolean isValidPath ( javax.servlet.http.HttpServletRequest req ) throws java.io.IOException { java.nio.file.Path p = resolvePath ( req ) ; if ( ! ( java.nio.file.Files.isRegularFile ( p ) ) ) { return false ; } return ( isParent ( sitePaths.etc_dir , p ) ) || ( isParent ( sitePaths.static_dir , p ) ) ; }

Target:
private boolean isAllowedPath ( javax.servlet.http.HttpServletRequest req ) throws java.io.IOException { java.nio.file.Path p = resolvePath ( req ) ; if ( ! ( java.nio.file.Files.isRegularFile ( p ) ) ) { return false ; } return ( isParent ( sitePaths.etc_dir , p ) ) || ( isParent ( sitePaths.static_dir , p ) ) ; }
Source:
public boolean updateChange ( com.google.gerrit.server.update.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.ResourceConflictException { com.google.gerrit.reviewdb.client.Change change = ctx.getChange ( ) ; if ( ( change.getStatus ( ) ) == ( Change.Status.MERGED ) ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( "change is merged" ) ; } com.google.gerrit.server.notedb.ChangeUpdate update = ctx.getUpdate ( change.currentPatchSetId ( ) ) ; change.setPrivate ( isPrivate ) ; change.setLastUpdatedOn ( ctx.getWhen ( ) ) ; update.setPrivate ( isPrivate ) ; return true ; }

Target:
public boolean updateChange ( com.google.gerrit.server.update.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = ctx.getChange ( ) ; if ( ( change.getStatus ( ) ) == ( Change.Status.MERGED ) ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( "change is merged" ) ; } com.google.gerrit.server.notedb.ChangeUpdate update = ctx.getUpdate ( change.currentPatchSetId ( ) ) ; change.setPrivate ( isPrivate ) ; change.setLastUpdatedOn ( ctx.getWhen ( ) ) ; update.setPrivate ( isPrivate ) ; addMessage ( ctx , update ) ; return true ; }
Source:
boolean wouldPushProject ( final com.google.gerrit.reviewdb.client.Project.NameKey project ) { if ( ! ( isVisible ( project ) ) ) { return false ; } java.lang.String [ ] projects = config.getProjects ( ) ; if ( ( projects.length ) < 1 ) { return true ; } return new com.googlesource.gerrit.plugins.replication.ReplicationFilter ( java.util.Arrays.asList ( projects ) ) . matches ( project ) ; }

Target:
boolean wouldPushProject ( com.google.gerrit.reviewdb.client.Project.NameKey project ) { if ( ! ( shouldReplicate ( project ) ) ) { return false ; } java.util.List < java.lang.String > projects = config.getProjects ( ) ; if ( projects.isEmpty ( ) ) { return true ; } return new com.googlesource.gerrit.plugins.replication.ReplicationFilter ( projects ) . matches ( project ) ; }
Source:
public void onSuccess ( com.googlesource.gerrit.plugins.serviceuser.client.ConfigInfo configInfo ) { display ( serviceUserInfo , configInfo.getAllowEmail ( ) ) ; }

Target:
public void onSuccess ( final com.googlesource.gerrit.plugins.serviceuser.client.ConfigInfo configInfo ) { com.googlesource.gerrit.plugins.serviceuser.client.AccountCapabilities.all ( new com.google.gwt.user.client.rpc.AsyncCallback < com.googlesource.gerrit.plugins.serviceuser.client.AccountCapabilities > ( ) { @ java.lang.Override public void onSuccess ( com.googlesource.gerrit.plugins.serviceuser.client.AccountCapabilities ac ) { display ( serviceUserInfo , ( ( configInfo.getAllowEmail ( ) ) || ( ac.canPerform ( "administrateServer" ) ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } , "administrateServer" ) ; }
Source:
public com.google.gerrit.server.notedb.ChangeNotes create ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( changeId ) ; com.google.common.base.Preconditions.checkNotNull ( change , "change %s not found in ReviewDb" , changeId ) ; com.google.common.base.Preconditions.checkArgument ( change.getProject ( ) . equals ( project ) , ( "passed project %s when creating ChangeNotes for %s, but actual" + " project is %s" ) , project , changeId , change.getProject ( ) ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( args , change ) . load ( ) ; }

Target:
private com.google.gerrit.reviewdb.client.Change loadChangeFromDb ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( changeId ) ; com.google.common.base.Preconditions.checkNotNull ( change , "change %s not found in ReviewDb" , changeId ) ; com.google.common.base.Preconditions.checkArgument ( change.getProject ( ) . equals ( project ) , ( "passed project %s when creating ChangeNotes for %s, but actual" + " project is %s" ) , project , changeId , change.getProject ( ) ) ; return change ; }
Source:
public void description ( java.lang.String description ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.change.PutDescription.Input in = new com.google.gerrit.server.change.PutDescription.Input ( ) ; in.description = description ; try { putDescription.apply ( revision , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot set description" , e ) ; } }

Target:
public void description ( java.lang.String description ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.extensions.common.DescriptionInput in = new com.google.gerrit.extensions.common.DescriptionInput ( ) ; in.description = description ; try { putDescription.apply ( revision , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot set description" , e ) ; } }
Source:
public void handle ( final net.codemirror.lib.CodeMirror instance , final net.codemirror.lib.CodeMirror.LineHandle handle , com.google.gwt.dom.client.Element element ) { if ( lineActiveBoxMap.containsKey ( handle ) ) { lineActiveBoxMap.get ( handle ) . resizePaddingWidget ( ) ; } if ( linePaddingOnOtherSideMap.containsKey ( handle ) ) { com.google.gwt.core.client.Scheduler.get ( ) . scheduleDeferred ( new com.google.gwt.core.client.Scheduler.ScheduledCommand ( ) { @ java.lang.Override public void execute ( ) { resizePaddingOnOtherSide ( side , instance.getLineNumber ( handle ) ) ; } } ) ; } }

Target:
public void handle ( final net.codemirror.lib.CodeMirror instance , final net.codemirror.lib.CodeMirror.LineHandle handle , com.google.gwt.dom.client.Element element ) { if ( lineActiveBoxMap.containsKey ( handle ) ) { lineActiveBoxMap.get ( handle ) . resizePaddingWidget ( ) ; } if ( linePaddingOnOtherSideMap.containsKey ( handle ) ) { defer ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { resizePaddingOnOtherSide ( side , instance.getLineNumber ( handle ) ) ; } } ) ; } }
Source:
public void testGc ( ) throws java.lang.Exception { java.lang.String response = adminSshSession.exec ( ( ( ( ( "gerrit gc \"" + ( project.get ( ) ) ) + "\" \"" ) + ( project2.get ( ) ) ) + "\"" ) ) ; com.google.common.truth.Truth.assert_ ( ) . withFailureMessage ( adminSshSession.getError ( ) ) . that ( adminSshSession.hasError ( ) ) . isFalse ( ) ; assertNoError ( response ) ; gcAssert.assertHasPackFile ( project , project2 ) ; gcAssert.assertHasNoPackFile ( allProjects , project3 ) ; }

Target:
public void testGc ( ) throws java.lang.Exception { java.lang.String response = adminSshSession.exec ( ( ( ( ( "gerrit gc \"" + ( project.get ( ) ) ) + "\" \"" ) + ( project2.get ( ) ) ) + "\"" ) ) ; com.google.common.truth.Truth.assert_ ( ) . withMessage ( adminSshSession.getError ( ) ) . that ( adminSshSession.hasError ( ) ) . isFalse ( ) ; assertNoError ( response ) ; gcAssert.assertHasPackFile ( project , project2 ) ; gcAssert.assertHasNoPackFile ( allProjects , project3 ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.changes.Changes.class ) . to ( com.google.gerrit.server.api.changes.ChangesImpl.class ) ; factory ( ChangeApiImpl.Factory.class ) ; factory ( RevisionApiImpl.Factory.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.changes.Changes.class ) . to ( com.google.gerrit.server.api.changes.ChangesImpl.class ) ; factory ( ChangeApiImpl.Factory.class ) ; factory ( CommentApiImpl.Factory.class ) ; factory ( DraftApiImpl.Factory.class ) ; factory ( RevisionApiImpl.Factory.class ) ; factory ( FileApiImpl.Factory.class ) ; factory ( ReviewerApiImpl.Factory.class ) ; }
Source:
private void rebase ( com.google.gerrit.acceptance.PushOneCommit.Result r ) throws java.lang.Exception { revision ( r ) . rebase ( ) ; }

Target:
private void assertApproval ( com.google.gerrit.acceptance.PushOneCommit.Result r , int expected ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo c = get ( r.getChangeId ( ) ) ; com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; org.junit.Assert.assertEquals ( 1 , cr.all.size ( ) ) ; org.junit.Assert.assertEquals ( "Administrator" , cr.all.get ( 0 ) . name ) ; org.junit.Assert.assertEquals ( expected , cr.all.get ( 0 ) . value.intValue ( ) ) ; }
Source:
public void run ( ) throws java.lang.Exception { if ( ( ( impl.getUser ( ) ) != null ) && ( ! ( impl.getProjects ( ) . isEmpty ( ) ) ) ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( 1 , "fatal: --user and --project options are not compatible." ) ; } impl.display ( stdout ) ; }

Target:
public void run ( ) throws java.lang.Exception { if ( ( ( impl.getUser ( ) ) != null ) && ( ! ( impl.getProjects ( ) . isEmpty ( ) ) ) ) { throw die ( "--user and --project options are not compatible." ) ; } impl.display ( stdout ) ; }
Source:
public Change.Id cherryPick ( com.google.gerrit.server.update.BatchUpdate.Factory batchUpdateFactory , com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.PatchSet patch , com.google.gerrit.extensions.api.changes.CherryPickInput input , com.google.gerrit.server.project.RefControl refControl ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.IntegrationException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gerrit.server.update.UpdateException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { return cherryPick ( batchUpdateFactory , change , patch.getId ( ) , change.getProject ( ) , org.eclipse.jgit.lib.ObjectId.fromString ( patch.getRevision ( ) . get ( ) ) , input , refControl ) ; }

Target:
public Change.Id cherryPick ( com.google.gerrit.server.update.BatchUpdate.Factory batchUpdateFactory , com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.PatchSet patch , com.google.gerrit.extensions.api.changes.CherryPickInput input , com.google.gerrit.reviewdb.client.Branch.NameKey dest ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.IntegrationException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gerrit.server.project.NoSuchProjectException , com.google.gerrit.server.update.UpdateException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { return cherryPick ( batchUpdateFactory , change , patch.getId ( ) , change.getProject ( ) , org.eclipse.jgit.lib.ObjectId.fromString ( patch.getRevision ( ) . get ( ) ) , input , dest ) ; }
Source:
public com.google.gerrit.server.project.ChangeControl validateFor ( com.google.gerrit.reviewdb.client.Change.Id changeId , com.google.gerrit.server.CurrentUser user ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.server.project.ChangeControl > ctls = changeFinder.find ( changeId , user ) ; if ( ( ctls.size ( ) ) != 1 ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } return validateFor ( ctls.get ( 0 ) . getChange ( ) , user ) ; }

Target:
public com.google.gerrit.server.project.ChangeControl validateFor ( com.google.gerrit.reviewdb.client.Change.Id changeId , com.google.gerrit.server.CurrentUser user ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl ctl = changeFinder.findOne ( changeId , user ) ; return validateFor ( ctl.getChange ( ) , user ) ; }
Source:
public void run ( ) { java.lang.String t = prefs.theme ( ) . name ( ) . toLowerCase ( ) ; view.getCmFromSide ( DisplaySide.A ) . setOption ( "theme" , t ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "theme" , t ) ; }

Target:
public void run ( ) { if ( ( ( getSelectedTheme ( ) ) == newTheme ) && ( isAttached ( ) ) ) { java.lang.String t = newTheme.name ( ) . toLowerCase ( ) ; view.getCmFromSide ( DisplaySide.A ) . setOption ( "theme" , t ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "theme" , t ) ; view.setThemeStyles ( newTheme.isDark ( ) ) ; } }
Source:
public void execute ( ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException { try { executeRefUpdates ( ) ; executeChangeOps ( ) ; reindexChanges ( ) ; if ( ( batchRefUpdate ) != null ) { gitRefUpdated.fire ( project , batchRefUpdate ) ; } executePostOps ( ) ; } catch ( com.google.gerrit.server.git.UpdateException | com.google.gerrit.extensions.restapi.RestApiException e ) { throw e ; } catch ( java.lang.Exception e ) { com.google.common.base.Throwables.propagateIfPossible ( e ) ; throw new com.google.gerrit.server.git.UpdateException ( e ) ; } }

Target:
private void initRepository ( ) throws java.io.IOException { if ( ( repo ) == null ) { this . repo = repoManager.openRepository ( project ) ; closeRepo = true ; inserter = repo.newObjectInserter ( ) ; revWalk = new org.eclipse.jgit.revwalk.RevWalk ( inserter.newReader ( ) ) ; commands = new com.google.gerrit.server.git.ChainedReceiveCommands ( repo ) ; } }
Source:
public java.io.File get ( ) { if ( ! ( ready ) ) { synchronized ( dataDir ) { if ( ! ( ready ) ) { if ( ( ! ( dataDir.exists ( ) ) ) && ( ! ( dataDir.mkdirs ( ) ) ) ) { throw new com.google.inject.ProvisionException ( java.lang.String.format ( "Cannot create %s for plugin %s" , dataDir.getAbsolutePath ( ) , getName ( ) ) ) ; } ready = true ; } } } return dataDir ; }

Target:
public java.nio.file.Path get ( ) { if ( ! ( ready ) ) { synchronized ( dataDir ) { if ( ! ( ready ) ) { try { java.nio.file.Files.createDirectories ( dataDir ) ; } catch ( java.io.IOException e ) { throw new com.google.inject.ProvisionException ( java.lang.String.format ( "Cannot create %s for plugin %s" , dataDir.toAbsolutePath ( ) , getName ( ) ) , e ) ; } ready = true ; } } } return dataDir ; }
Source:
public void onClick ( com.google.gwt.user.client.ui.Widget sender ) { final java.lang.String txt = descTxt.getText ( ) . trim ( ) ; Util.ADMIN_SVC.changeGroupDescription ( groupId , txt , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { saveDesc.setEnabled ( false ) ; } } ) ; }

Target:
public void onClick ( com.google.gwt.user.client.ui.Widget sender ) { final java.lang.String txt = descTxt.getText ( ) . trim ( ) ; Util.GROUP_SVC.changeGroupDescription ( groupId , txt , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { saveDesc.setEnabled ( false ) ; } } ) ; }
Source:
public void changeEditRef ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Account.Id accountId = new com.google.gerrit.reviewdb.client.Account.Id ( 1000042 ) ; com.google.gerrit.reviewdb.client.Change.Id changeId = new com.google.gerrit.reviewdb.client.Change.Id ( 56414 ) ; java.lang.String refName = com.google.gerrit.server.edit.ChangeEditUtil.editRefName ( accountId , changeId ) ; org.junit.Assert.assertEquals ( "refs/users/42/1000042/edit-56414" , refName ) ; }

Target:
public void changeEditRef ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Account.Id accountId = new com.google.gerrit.reviewdb.client.Account.Id ( 1000042 ) ; com.google.gerrit.reviewdb.client.Change.Id changeId = new com.google.gerrit.reviewdb.client.Change.Id ( 56414 ) ; com.google.gerrit.reviewdb.client.PatchSet.Id psId = new com.google.gerrit.reviewdb.client.PatchSet.Id ( changeId , 50 ) ; java.lang.String refName = com.google.gerrit.server.edit.ChangeEditUtil.editRefName ( accountId , changeId , psId ) ; org.junit.Assert.assertEquals ( "refs/users/42/1000042/edit-56414/50" , refName ) ; }
Source:
private static java.util.List < com.google.gerrit.server.plugins.StartPluginListener > getListeners ( com.google.inject.Injector src ) { java.util.List < com.google.inject.Binding < com.google.gerrit.server.plugins.StartPluginListener > > bindings = src.findBindingsByType ( new com.google.inject.TypeLiteral < com.google.gerrit.server.plugins.StartPluginListener > ( ) { } ) ; java.util.List < com.google.gerrit.server.plugins.StartPluginListener > found = com.google.common.collect.Lists.newArrayListWithCapacity ( bindings.size ( ) ) ; for ( com.google.inject.Binding < com.google.gerrit.server.plugins.StartPluginListener > b : bindings ) { found.add ( b.getProvider ( ) . get ( ) ) ; } return found ; }

Target:
private static < T > java.util.List < T > listeners ( com.google.inject.Injector src , java.lang.Class < T > type ) { java.util.List < com.google.inject.Binding < T > > bindings = src.findBindingsByType ( com.google.inject.TypeLiteral.get ( type ) ) ; java.util.List < T > found = com.google.common.collect.Lists.newArrayListWithCapacity ( bindings.size ( ) ) ; for ( com.google.inject.Binding < T > b : bindings ) { found.add ( b.getProvider ( ) . get ( ) ) ; } return found ; }
Source:
public static void setTimeForTesting ( ) { final long clockStepMs = java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 1 , java.util.concurrent.TimeUnit.SECONDS ) ; final java.util.concurrent.atomic.AtomicLong clockMs = new java.util.concurrent.atomic.AtomicLong ( new org.joda.time.DateTime ( 2009 , 9 , 30 , 17 , 0 , 0 ) . getMillis ( ) ) ; org.joda.time.DateTimeUtils.setCurrentMillisProvider ( new org.joda.time.DateTimeUtils.MillisProvider ( ) { @ java.lang.Override public long getMillis ( ) { return clockMs.getAndAdd ( clockStepMs ) ; } } ) ; }

Target:
public static void setTimeForTesting ( ) { com.google.gerrit.testutil.TestTimeUtil.resetWithClockStep ( 1 , java.util.concurrent.TimeUnit.SECONDS ) ; }
Source:
public final java.lang.String getCommand ( com.google.gerrit.extensions.config.DownloadScheme scheme , java.lang.String project , java.lang.String ref ) { if ( ( commandAllowed ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isRecognizedScheme ( scheme ) ) ) { java.lang.String url = scheme.getUrl ( project ) ; if ( ( url != null ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isValidUrl ( url ) ) ) { return getCommand ( url , ref ) ; } } return null ; }

Target:
public final java.lang.String getCommand ( com.google.gerrit.extensions.config.DownloadScheme scheme , java.lang.String project , java.lang.String ref ) { if ( ( commandAllowed ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isRecognizedScheme ( scheme ) ) ) { java.lang.String url = scheme.getUrl ( project ) ; if ( ( url != null ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isValidUrl ( url ) ) ) { if ( checkForHiddenChangeRefs ) { ref = resolveRef ( project , ref ) ; } if ( ref != null ) { return getCommand ( url , ref ) ; } } } return null ; }
Source:
public com.google.gerrit.client.admin.ProjectDetail run ( com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gerrit.server.Failure , com.google.gwtorm.client.OrmException { assertAmProjectOwner ( db , projectId ) ; final com.google.gerrit.client.reviewdb.Project proj = db.projects ( ) . get ( projectId ) ; if ( proj == null ) { throw new com.google.gerrit.server.Failure ( new com.google.gerrit.client.rpc.NoSuchEntityException ( ) ) ; } final com.google.gerrit.client.admin.ProjectDetail d = new com.google.gerrit.client.admin.ProjectDetail ( ) ; d.load ( db , proj ) ; return d ; }

Target:
public com.google.gerrit.client.admin.ProjectDetail run ( com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gerrit.server.Failure , com.google.gwtorm.client.OrmException { assertAmProjectOwner ( db , projectId ) ; final com.google.gerrit.client.data.ProjectCache.Entry p = com.google.gerrit.client.rpc.Common.getProjectCache ( ) . get ( projectId ) ; if ( p == null ) { throw new com.google.gerrit.server.Failure ( new com.google.gerrit.client.rpc.NoSuchEntityException ( ) ) ; } final com.google.gerrit.client.admin.ProjectDetail d = new com.google.gerrit.client.admin.ProjectDetail ( ) ; d.load ( db , p ) ; return d ; }
Source:
public void initConfig ( com.google.gerrit.pgm.init.api.Section databaseSection ) { final java.lang.String defPort = "1521" ; databaseSection.string ( "Server hostname" , "hostname" , "localhost" ) ; databaseSection.string ( "Server port" , "port" , defPort , false ) ; databaseSection.string ( "Instance name" , "instance" , "xe" ) ; databaseSection.string ( "Database username" , "username" , com.google.gerrit.pgm.init.InitUtil.username ( ) ) ; databaseSection.password ( "username" , "password" ) ; }

Target:
public void initConfig ( com.google.gerrit.pgm.init.api.Section databaseSection ) { final java.lang.String defPort = "1521" ; databaseSection.string ( "Server hostname" , "hostname" , "localhost" ) ; databaseSection.string ( "Server port" , "port" , defPort , false ) ; databaseSection.string ( "Instance name" , "instance" , "xe" ) ; databaseSection.string ( "Database username" , "username" , com.google.gerrit.pgm.init.api.InitUtil.username ( ) ) ; databaseSection.password ( "username" , "password" ) ; }
Source:
public void testParsePaddedEnds ( ) throws java.lang.Exception { com.google.gerrit.server.git.QueryList ql = com.google.gerrit.server.git.QueryList.parse ( com.google.gerrit.server.git.QueryListTest.F_PAD_E , null ) ; com.google.common.truth.Truth.assertThat ( ql.getQuery ( com.google.gerrit.server.git.QueryListTest.N_FOO ) ) . isEqualTo ( com.google.gerrit.server.git.QueryListTest.Q_P ) ; com.google.common.truth.Truth.assertThat ( ql.getQuery ( com.google.gerrit.server.git.QueryListTest.N_BAR ) ) . isEqualTo ( com.google.gerrit.server.git.QueryListTest.Q_B ) ; }

Target:
public void testParsePaddedEnds ( ) throws java.lang.Exception { com.google.gerrit.server.account.QueryList ql = com.google.gerrit.server.account.QueryList.parse ( com.google.gerrit.server.account.QueryListTest.F_PAD_E , null ) ; com.google.common.truth.Truth.assertThat ( ql.getQuery ( com.google.gerrit.server.account.QueryListTest.N_FOO ) ) . isEqualTo ( com.google.gerrit.server.account.QueryListTest.Q_P ) ; com.google.common.truth.Truth.assertThat ( ql.getQuery ( com.google.gerrit.server.account.QueryListTest.N_BAR ) ) . isEqualTo ( com.google.gerrit.server.account.QueryListTest.Q_B ) ; }
Source:
void setNoDiff ( com.google.gerrit.client.diff.DiffInfo diff ) { com.google.gwt.core.client.JsArray < com.google.gerrit.client.diff.DiffInfo.Region > regions = diff.content ( ) ; boolean b = ( ( regions.length ( ) ) == 0 ) || ( ( ( regions.length ( ) ) == 1 ) && ( ( regions.get ( 0 ) . ab ( ) ) != null ) ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( noDiff , b ) ; }

Target:
void setNoDiff ( com.google.gerrit.client.diff.DiffInfo diff ) { if ( diff.binary ( ) ) { com.google.gwt.user.client.ui.UIObject.setVisible ( noDiff , false ) ; } else { com.google.gwt.core.client.JsArray < com.google.gerrit.client.diff.DiffInfo.Region > regions = diff.content ( ) ; boolean b = ( ( regions.length ( ) ) == 0 ) || ( ( ( regions.length ( ) ) == 1 ) && ( ( regions.get ( 0 ) . ab ( ) ) != null ) ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( noDiff , b ) ; } }
Source:
private static void createIndexes ( ) { com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping openChangesMapping = new com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping ( ChangeSchemaDefinitions.INSTANCE.getLatest ( ) ) ; com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping closedChangesMapping = new com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping ( ChangeSchemaDefinitions.INSTANCE.getLatest ( ) ) ; openChangesMapping.closedChanges = null ; closedChangesMapping.openChanges = null ; com.google.gerrit.elasticsearch.ElasticQueryChangesTest.node.client ( ) . admin ( ) . indices ( ) . prepareCreate ( com.google.gerrit.elasticsearch.ElasticQueryChangesTest.INDEX_NAME ) . addMapping ( com.google.gerrit.elasticsearch.ElasticChangeIndex.OPEN_CHANGES , com.google.gerrit.elasticsearch.ElasticQueryChangesTest.gson.toJson ( openChangesMapping ) ) . addMapping ( com.google.gerrit.elasticsearch.ElasticChangeIndex.CLOSED_CHANGES , com.google.gerrit.elasticsearch.ElasticQueryChangesTest.gson.toJson ( closedChangesMapping ) ) . execute ( ) . actionGet ( ) ; }

Target:
private static void createIndexes ( ) { com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping openChangesMapping = new com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping ( ChangeSchemaDefinitions.INSTANCE.getLatest ( ) ) ; com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping closedChangesMapping = new com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping ( ChangeSchemaDefinitions.INSTANCE.getLatest ( ) ) ; openChangesMapping.closedChanges = null ; closedChangesMapping.openChanges = null ; com.google.gerrit.elasticsearch.ElasticQueryChangesTest.nodeInfo.node.client ( ) . admin ( ) . indices ( ) . prepareCreate ( com.google.gerrit.elasticsearch.ElasticQueryChangesTest.INDEX_NAME ) . addMapping ( com.google.gerrit.elasticsearch.ElasticChangeIndex.OPEN_CHANGES , ElasticTestUtils.gson.toJson ( openChangesMapping ) ) . addMapping ( com.google.gerrit.elasticsearch.ElasticChangeIndex.CLOSED_CHANGES , ElasticTestUtils.gson.toJson ( closedChangesMapping ) ) . execute ( ) . actionGet ( ) ; }
Source:
public void testItsAssociationPolicyOptional ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "ItsTestName" , null , "commentlink" ) ) . andReturn ( null ) . atLeastOnce ( ) ; org.easymock.EasyMock.expect ( serverConfig.getEnum ( "commentlink" , "ItsTestName" , "association" , ItsAssociationPolicy.OPTIONAL ) ) . andReturn ( ItsAssociationPolicy.OPTIONAL ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated associated policy do not match" , ItsAssociationPolicy.OPTIONAL , itsConfig.getItsAssociationPolicy ( ) ) ; }

Target:
public void testGetItsAssociationPolicyOptional ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "ItsTestName" , null , "commentlink" ) ) . andReturn ( null ) . atLeastOnce ( ) ; org.easymock.EasyMock.expect ( serverConfig.getEnum ( "commentlink" , "ItsTestName" , "association" , ItsAssociationPolicy.OPTIONAL ) ) . andReturn ( ItsAssociationPolicy.OPTIONAL ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated associated policy do not match" , ItsAssociationPolicy.OPTIONAL , itsConfig.getItsAssociationPolicy ( ) ) ; }
Source:
private boolean isTrusted ( final com.google.gerrit.reviewdb.AccountExternalId id ) { if ( id.isScheme ( AccountExternalId.LEGACY_GAE ) ) { return isAllowGoogleAccountUpgrade ( ) ; } if ( id.isScheme ( AccountExternalId.SCHEME_MAILTO ) ) { return true ; } for ( final java.lang.String p : trusted ) { if ( matches ( p , id ) ) { return true ; } } return false ; }

Target:
private boolean isTrusted ( final com.google.gerrit.reviewdb.AccountExternalId id ) { if ( id.isScheme ( AccountExternalId.LEGACY_GAE ) ) { return isAllowGoogleAccountUpgrade ( ) ; } if ( id.isScheme ( AccountExternalId.SCHEME_MAILTO ) ) { return true ; } if ( id.isScheme ( AccountExternalId.SCHEME_UUID ) ) { return true ; } for ( final java.lang.String p : trusted ) { if ( matches ( p , id ) ) { return true ; } } return false ; }
Source:
static java.lang.String getHTTPBase64Content ( java.lang.String url ) { java.lang.String data = com.googlesource.gerrit.plugins.findowners.Util.getHTTP ( url , true ) ; return null == data ? "" : new java.lang.String ( java.util.Base64.getDecoder ( ) . decode ( data ) ) ; }

Target:
static void addToMap ( java.util.Map < java.lang.String , java.util.Set < java.lang.String > > map , java.lang.String key , java.lang.String value ) { if ( ( map.get ( key ) ) == null ) { map.put ( key , new java.util.HashSet < > ( ) ) ; } map.get ( key ) . add ( value ) ; }
Source:
public com.google.gerrit.acceptance.RestResponse delete ( java.lang.String endPoint ) throws java.io.IOException { return execute ( org.apache.http.client.fluent.Request.Delete ( ( ( ( url ) + "/a" ) + endPoint ) ) ) ; }

Target:
public com.google.gerrit.acceptance.RestResponse postWithHeader ( java.lang.String endPoint , java.lang.Object content , org.apache.http.Header header ) throws java.io.IOException { org.apache.http.client.fluent.Request post = org.apache.http.client.fluent.Request.Post ( getUrl ( endPoint ) ) ; if ( header != null ) { post.addHeader ( header ) ; } if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.body ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; } return execute ( post ) ; }
Source:
public java.util.List < com.google.gerrit.common.data.AccountInfo > run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { return suggestAccount ( db , query , active , limit ) ; }

Target:
public java.util.List < com.google.gerrit.common.data.AccountInfo > run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { return suggestAccount ( db , query , active , limit , new com.google.gerrit.httpd.rpc.SuggestServiceImpl.VisibilityControl ( ) { @ java.lang.Override public boolean isVisible ( com.google.gerrit.reviewdb.client.Account account ) throws com.google.gwtorm.server.OrmException { return accountControlFactory.get ( ) . canSee ( account ) ; } } ) ; }
Source:
private void initListId ( final java.lang.String messageClass ) throws javax.mail.MessagingException { final java.lang.StringBuilder listid = new java.lang.StringBuilder ( ) ; listid.append ( "gerrit-" ) ; listid.append ( messageClass ) ; listid.append ( "-" ) ; listid.append ( projectName.replace ( '/' , '-' ) ) ; listid.append ( "@" ) ; listid.append ( gerritHost ( ) ) ; final java.lang.String listidStr = listid.toString ( ) ; msg.setHeader ( "Mailing-List" , ( "list " + listidStr ) ) ; msg.setHeader ( "List-Id" , ( ( "<" + ( listidStr.replace ( '@' , '.' ) ) ) + ">" ) ) ; if ( ( settingsUrl ( ) ) != null ) { msg.setHeader ( "List-Unsubscribe" , ( ( "<" + ( settingsUrl ( ) ) ) + ">" ) ) ; } }

Target:
private void initMessageType ( final java.lang.String messageClass ) throws javax.mail.MessagingException { msg.setHeader ( "X-Gerrit-MessageType" , messageClass ) ; }
Source:
public org.eclipse.jgit.revwalk.RevCommit commit ( ) throws java.io.IOException { com.google.gerrit.server.notedb.BatchMetaDataUpdate batch = openUpdate ( ) ; try { writeCommit ( batch ) ; if ( ( draftUpdate ) != null ) { draftUpdate.commit ( ) ; } org.eclipse.jgit.revwalk.RevCommit c = batch.commit ( ) ; return c ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.io.IOException ( e ) ; } finally { batch.close ( ) ; } }

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 = storeCommentsInNotes ( ) ; if ( treeId != null ) { builder.setTreeId ( treeId ) ; } } batch.write ( this , builder ) ; if ( ( draftUpdate ) != null ) { draftUpdate.commit ( ) ; } }