auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int compare ( final com.google.gerrit.reviewdb.client.AccountGroupInclude o1 , final com.google.gerrit.reviewdb.client.AccountGroupInclude o2 ) { final com.google.gerrit.reviewdb.client.AccountGroup a = gic.get ( o1.getIncludeId ( ) ) ; final com.google.gerrit.reviewdb.client.AccountGroup b = gic.get ( o2.getIncludeId ( ) ) ; return n ( a ) . compareTo ( n ( b ) ) ; }

Target:
public int compare ( final com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid o1 , final com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid o2 ) { final com.google.gerrit.reviewdb.client.AccountGroup a = gic.get ( o1.getIncludeUUID ( ) ) ; final com.google.gerrit.reviewdb.client.AccountGroup b = gic.get ( o2.getIncludeUUID ( ) ) ; return n ( a ) . compareTo ( n ( b ) ) ; }
Source:
private void verifyComment ( com.google.gerrit.reviewdb.client.Comment c ) { com.google.common.base.Preconditions.checkArgument ( ( ( c.revId ) != null ) , "RevId required for comment: %s" , c ) ; com.google.common.base.Preconditions.checkArgument ( c.author.getId ( ) . equals ( getAccountId ( ) ) , ( "The author for the following comment does not match the author of" + " this ChangeDraftUpdate (%s): %s" ) , getAccountId ( ) , c ) ; }

Target:
private void verifyComment ( com.google.gerrit.reviewdb.client.Comment c ) { com.google.common.base.Preconditions.checkArgument ( ( ( c.revId ) != null ) , "RevId required for comment: %s" , c ) ; com.google.common.base.Preconditions.checkArgument ( c.author.getId ( ) . equals ( getAccountId ( ) ) , ( "The author for the following comment does not match the author of" + " this ChangeUpdate (%s): %s" ) , getAccountId ( ) , c ) ; }
Source:
public static java.lang.String refsUsers ( com.google.gerrit.reviewdb.client.Account.Id accountId ) { java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( com.google.gerrit.reviewdb.client.RefNames.REFS_USER ) ; int account = accountId.get ( ) ; int m = account % 100 ; if ( m < 10 ) { r.append ( '0' ) ; } r.append ( m ) ; r.append ( '/' ) ; r.append ( account ) ; return r.toString ( ) ; }

Target:
public static java.lang.String refsUsers ( com.google.gerrit.reviewdb.client.Account.Id accountId ) { java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( com.google.gerrit.reviewdb.client.RefNames.REFS_USERS ) ; int account = accountId.get ( ) ; int m = account % 100 ; if ( m < 10 ) { r.append ( '0' ) ; } r.append ( m ) ; r.append ( '/' ) ; r.append ( account ) ; return r.toString ( ) ; }
Source:
private com.google.gerrit.server.project.ProjectControl user ( com.google.gerrit.reviewdb.AccountGroup ... memberOf ) { return new com.google.gerrit.server.project.ProjectControl ( java.util.Collections.< com.google.gerrit.reviewdb.AccountGroup.Id > emptySet ( ) , java.util.Collections.< com.google.gerrit.reviewdb.AccountGroup.Id > emptySet ( ) , new com.google.gerrit.server.project.RefControlTest.MockUser ( memberOf ) , newProjectState ( ) ) ; }

Target:
public com.google.gerrit.server.project.RefControl create ( final com.google.gerrit.server.project.ProjectControl projectControl , final java.lang.String ref ) { return new com.google.gerrit.server.project.RefControl ( systemConfig , projectControl , ref ) ; }
Source:
public Account.Id apply ( com.google.gerrit.acceptance.TestAccount a ) { return a.id ; }

Target:
private void assertReviewers ( com.google.gerrit.reviewdb.client.Change c , com.google.gerrit.acceptance.TestAccount ... expectedReviewers ) throws com.google.gwtorm.server.OrmException { java.lang.Iterable < com.google.gerrit.reviewdb.client.Account.Id > actualIds = approvalsUtil.getReviewers ( db , notesFactory.create ( c ) ) . values ( ) ; com.google.common.truth.Truth.assertThat ( actualIds ) . containsExactlyElementsIn ( com.google.common.collect.Sets.newHashSet ( com.google.gerrit.acceptance.TestAccount.ids ( expectedReviewers ) ) ) ; }
Source:
public < T > T execute ( com.google.gerrit.server.update.RetryHelper.ActionType actionType , com.google.gerrit.server.update.RetryHelper.Action < T > action ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { return execute ( actionType , action , ( t ) -> t instanceof com.google.gerrit.server.git.LockFailureException ) ; }

Target:
public < T > T execute ( com.google.gerrit.server.update.RetryHelper.ActionType actionType , com.google.gerrit.server.update.RetryHelper.Action < T > action , com.google.gerrit.server.update.RetryHelper.Options opts , com.google.common.base.Predicate < java.lang.Throwable > exceptionPredicate ) throws java.lang.Exception { try { return executeWithAttemptAndTimeoutCount ( actionType , action , opts , exceptionPredicate ) ; } catch ( java.lang.Throwable t ) { com.google.common.base.Throwables.throwIfUnchecked ( t ) ; com.google.common.base.Throwables.throwIfInstanceOf ( t , java.lang.Exception.class ) ; throw new java.lang.IllegalStateException ( t ) ; } }
Source:
protected static java.util.Set < com.google.gerrit.reviewdb.client.Branch.NameKey > toSet ( java.util.List < com.google.gerrit.server.git.Row > destRows ) { java.util.Set < com.google.gerrit.reviewdb.client.Branch.NameKey > dests = com.google.common.collect.Sets.newHashSetWithExpectedSize ( destRows.size ( ) ) ; for ( com.google.gerrit.server.git.Row row : destRows ) { dests.add ( new com.google.gerrit.reviewdb.client.Branch.NameKey ( new com.google.gerrit.reviewdb.client.Project.NameKey ( row.right ) , row.left ) ) ; } return dests ; }

Target:
private static java.util.Set < com.google.gerrit.reviewdb.client.Branch.NameKey > toSet ( java.util.List < com.google.gerrit.server.account.Row > destRows ) { java.util.Set < com.google.gerrit.reviewdb.client.Branch.NameKey > dests = com.google.common.collect.Sets.newHashSetWithExpectedSize ( destRows.size ( ) ) ; for ( com.google.gerrit.server.account.Row row : destRows ) { dests.add ( new com.google.gerrit.reviewdb.client.Branch.NameKey ( new com.google.gerrit.reviewdb.client.Project.NameKey ( row.right ) , row.left ) ) ; } return dests ; }
Source:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString msg ) { b.setEnabled ( true ) ; if ( ( msg != null ) && ( ! ( msg.asString ( ) . isEmpty ( ) ) ) ) { com.google.gwt.user.client.Window.alert ( msg.asString ( ) ) ; } }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString msg ) { b.setEnabled ( true ) ; if ( ( msg != null ) && ( ! ( msg.asString ( ) . isEmpty ( ) ) ) ) { com.google.gwt.user.client.Window.alert ( msg.asString ( ) ) ; } com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( patchSet.getId ( ) ) ) ; }
Source:
public com.google.gerrit.extensions.auth.oauth.OAuthUserInfo getUserInfo ( com.google.gerrit.extensions.auth.oauth.OAuthToken token ) throws java.io.IOException { com.googlesource.gerrit.plugins.cfoauth.AccessToken accessToken = uaaClient.toAccessToken ( token.getToken ( ) ) ; com.googlesource.gerrit.plugins.cfoauth.UserInfo userInfo = accessToken.getUserInfo ( ) ; userInfo.setDisplayName ( uaaClient.getDisplayName ( token.getToken ( ) ) ) ; return com.googlesource.gerrit.plugins.cfoauth.CFOAuthService.getAsOAuthUserInfo ( userInfo ) ; }

Target:
public com.google.gerrit.extensions.auth.oauth.OAuthUserInfo getUserInfo ( com.google.gerrit.extensions.auth.oauth.OAuthToken token ) throws java.io.IOException { if ( token == null ) { throw new com.googlesource.gerrit.plugins.cfoauth.UAAClientException ( "Must provide an access token" ) ; } com.googlesource.gerrit.plugins.cfoauth.AccessToken accessToken = uaaClient.toAccessToken ( token.getToken ( ) ) ; com.googlesource.gerrit.plugins.cfoauth.UserInfo userInfo = accessToken.getUserInfo ( ) ; userInfo.setDisplayName ( uaaClient.getDisplayName ( token.getToken ( ) ) ) ; return com.googlesource.gerrit.plugins.cfoauth.CFOAuthService.getAsOAuthUserInfo ( userInfo ) ; }
Source:
public void testBlockRule_ParentBlocksChild ( ) { com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/tags/*" ) ; com.google.gerrit.server.project.Util.block ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/tags/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't update tag" , u.controlForRef ( "refs/tags/V10" ) . canUpdate ( ) ) ; }

Target:
public void testBlockRule_ParentBlocksChild ( ) { com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/tags/*" ) ; com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/tags/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't update tag" , u.controlForRef ( "refs/tags/V10" ) . canUpdate ( ) ) ; }
Source:
public org.eclipse.jgit.transport.ReceivePack create ( javax.servlet.http.HttpServletRequest req , org.eclipse.jgit.lib.Repository db ) throws org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException { final com.google.gerrit.server.project.ProjectControl pc = ( ( com.google.gerrit.server.project.ProjectControl ) ( req.getAttribute ( com.google.gerrit.httpd.GitOverHttpServlet.ATT_CONTROL ) ) ) ; if ( ! ( pc.getUser ( ) . isIdentifiedUser ( ) ) ) { throw new org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException ( ) ; } com.google.gerrit.server.git.receive.AsyncReceiveCommits arc = factory.create ( pc , db ) ; arc.init ( ) ; org.eclipse.jgit.transport.ReceivePack rp = arc.getReceivePack ( ) ; req.setAttribute ( com.google.gerrit.httpd.GitOverHttpServlet.ATT_ARC , arc ) ; return rp ; }

Target:
public org.eclipse.jgit.transport.ReceivePack create ( javax.servlet.http.HttpServletRequest req , org.eclipse.jgit.lib.Repository db ) throws org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException { final com.google.gerrit.server.project.ProjectControl pc = ( ( com.google.gerrit.server.project.ProjectControl ) ( req.getAttribute ( com.google.gerrit.httpd.GitOverHttpServlet.ATT_CONTROL ) ) ) ; if ( ! ( pc.getUser ( ) . isIdentifiedUser ( ) ) ) { throw new org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException ( ) ; } com.google.gerrit.server.git.receive.AsyncReceiveCommits arc = factory.create ( pc , db , com.google.common.collect.ImmutableSetMultimap.of ( ) ) ; org.eclipse.jgit.transport.ReceivePack rp = arc.getReceivePack ( ) ; req.setAttribute ( com.google.gerrit.httpd.GitOverHttpServlet.ATT_ARC , arc ) ; return rp ; }
Source:
private org.eclipse.jgit.treewalk.TreeWalk find ( final org.eclipse.jgit.lib.ObjectId within ) throws java.io.IOException , org.eclipse.jgit.errors.CorruptObjectException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { if ( ( path ) == null ) { return null ; } final org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( db ) ; final org.eclipse.jgit.revwalk.RevTree tree = rw.parseTree ( within ) ; return org.eclipse.jgit.treewalk.TreeWalk.forPath ( db , path , tree ) ; }

Target:
com.google.gerrit.common.data.PatchScript toPatchScript ( final com.google.gerrit.server.patch.PatchListEntry content , final boolean intralineDifference , final com.google.gerrit.common.data.CommentDetail comments , final java.util.List < com.google.gerrit.reviewdb.Patch > history ) throws java.io.IOException { reader = db.newObjectReader ( ) ; try { return build ( content , intralineDifference , comments , history ) ; } finally { reader.release ( ) ; } }
Source:
public com.google.gwtjsonrpc.client.VoidResult run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gerrit.httpd.rpc.account.Failure , com.google.gwtorm.server.OrmException { final com.google.gerrit.reviewdb.client.Account.Id me = getAccountId ( ) ; for ( final com.google.gerrit.reviewdb.client.AccountProjectWatch.Key keyId : keys ) { if ( ! ( me.equals ( keyId.getParentKey ( ) ) ) ) throw new com.google.gerrit.httpd.rpc.account.Failure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; } db.accountProjectWatches ( ) . deleteKeys ( keys ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; }

Target:
public com.google.gwtjsonrpc.common.VoidResult run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gerrit.httpd.rpc.account.Failure , com.google.gwtorm.server.OrmException { final com.google.gerrit.reviewdb.client.Account.Id me = getAccountId ( ) ; for ( final com.google.gerrit.reviewdb.client.AccountProjectWatch.Key keyId : keys ) { if ( ! ( me.equals ( keyId.getParentKey ( ) ) ) ) throw new com.google.gerrit.httpd.rpc.account.Failure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; } db.accountProjectWatches ( ) . deleteKeys ( keys ) ; return com.google.gwtjsonrpc.common.VoidResult.INSTANCE ; }
Source:
public void defaultIncludingTimeZone ( ) throws java.lang.Exception { com.google.gitiles.DateFormatterBuilder dfb = new com.google.gitiles.DateFormatterBuilder ( ) ; org.eclipse.jgit.lib.PersonIdent ident = newIdent ( "Mon Jan 2 15:04:05 2006" , "-0700" ) ; org.junit.Assert.assertEquals ( "Mon Jan 02 15:04:05 2006 -0700" , dfb.create ( Format.DEFAULT ) . format ( ident ) ) ; }

Target:
public void defaultIncludingTimeZone ( ) throws java.lang.Exception { com.google.gitiles.DateFormatterBuilder dfb = new com.google.gitiles.DateFormatterBuilder ( com.google.common.base.Optional.< java.util.TimeZone > absent ( ) ) ; org.eclipse.jgit.lib.PersonIdent ident = newIdent ( "Mon Jan 2 15:04:05 2006" , "-0700" ) ; org.junit.Assert.assertEquals ( "Mon Jan 02 15:04:05 2006 -0700" , dfb.create ( Format.DEFAULT ) . format ( ident ) ) ; }
Source:
public com.google.gerrit.extensions.registration.ReloadableRegistrationHandle < T > add ( com.google.inject.Key < T > key , T item ) { java.util.concurrent.atomic.AtomicReference < T > ref = new java.util.concurrent.atomic.AtomicReference < T > ( item ) ; items.add ( ref ) ; return new ReloadableHandle ( ref , key , item ) ; }

Target:
public void remove ( ) { if ( ref.compareAndSet ( item , null ) ) { items.remove ( ref ) ; } }
Source:
public void groupDetail ( com.google.gerrit.reviewdb.client.AccountGroup.Id groupId , com.google.gerrit.reviewdb.client.AccountGroup.UUID groupUUID , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.GroupDetail > callback ) { if ( ( groupId == null ) && ( groupUUID != null ) ) { com.google.gerrit.reviewdb.client.AccountGroup g = groupCache.get ( groupUUID ) ; if ( g != null ) { groupId = g.getId ( ) ; } } groupDetailFactory.create ( groupId ) . to ( callback ) ; }

Target:
public void groupDetail ( com.google.gerrit.reviewdb.client.AccountGroup.Id groupId , com.google.gerrit.reviewdb.client.AccountGroup.UUID groupUUID , com.google.gwtjsonrpc.common.AsyncCallback < com.google.gerrit.common.data.GroupDetail > callback ) { if ( ( groupId == null ) && ( groupUUID != null ) ) { com.google.gerrit.reviewdb.client.AccountGroup g = groupCache.get ( groupUUID ) ; if ( g != null ) { groupId = g.getId ( ) ; } } groupDetailFactory.create ( groupId ) . to ( callback ) ; }
Source:
public void insert ( final java.lang.Iterable < T > instances ) throws com.google.gwtorm.server.OrmException { try { if ( schema.getDialect ( ) . canDetermineTotalBatchUpdateCount ( ) ) { insertAsBatch ( instances ) ; } else { insertIndividually ( instances ) ; } } catch ( java.sql.SQLException e ) { throw convertError ( "insert" , e ) ; } }

Target:
public void insert ( final java.lang.Iterable < T > instances ) throws com.google.gwtorm.server.OrmException { try { if ( schema.getDialect ( ) . canDetermineTotalBatchUpdateCount ( ) ) { insertAsBatch ( instances ) ; } else { insertIndividually ( instances ) ; } } catch ( java.sql.SQLException e ) { throwOrDefer ( convertError ( "insert" , e ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throwOrDefer ( e ) ; } }
Source:
public void blockOwnerProject ( ) { com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.project.Util.ADMIN , "refs/*" ) ; com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.project.Util.DEVS , "refs/*" ) ; assertAdminsAreOwnersAndDevsAreNot ( ) ; }

Target:
public void branchDelegation1 ( ) { com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.project.testing.Util.ADMIN , "refs/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/x/*" ) ; com.google.gerrit.server.project.ProjectControl uDev = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertNotOwner ( uDev ) ; assertOwner ( "refs/heads/x/*" , uDev ) ; assertOwner ( "refs/heads/x/y" , uDev ) ; assertOwner ( "refs/heads/x/y/*" , uDev ) ; assertNotOwner ( "refs/*" , uDev ) ; assertNotOwner ( "refs/heads/master" , uDev ) ; }
Source:
public void changeProjectAccess ( com.google.gerrit.reviewdb.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ProjectAccess > cb ) { org.eclipse.jgit.lib.ObjectId base = org.eclipse.jgit.lib.ObjectId.fromString ( baseRevision ) ; changeProjectAccessFactory.create ( projectName , base , sections , msg ) . to ( cb ) ; }

Target:
public void changeProjectAccess ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwtjsonrpc.common.AsyncCallback < com.google.gerrit.common.data.ProjectAccess > cb ) { org.eclipse.jgit.lib.ObjectId base ; if ( ( baseRevision != null ) && ( ! ( baseRevision.isEmpty ( ) ) ) ) { base = org.eclipse.jgit.lib.ObjectId.fromString ( baseRevision ) ; } else { base = null ; } changeProjectAccessFactory.create ( projectName , base , sections , msg ) . to ( cb ) ; }
Source:
public void onLoad ( ) { super . onLoad ( ) ; table.setSavePointerId ( com.google.gwt.user.client.History.getToken ( ) ) ; Util.LIST_SVC.myStarredChanges ( new com.google.gwt.user.client.rpc.AsyncCallback < java.util.List < com.google.gerrit.client.data.ChangeInfo > > ( ) { public void onSuccess ( final java.util.List < com.google.gerrit.client.data.ChangeInfo > result ) { starred.display ( result ) ; table.finishDisplay ( ) ; } public void onFailure ( final java.lang.Throwable caught ) { com.google.gwt.core.client.GWT.log ( "Fail" , caught ) ; } } ) ; }

Target:
public void onLoad ( ) { super . onLoad ( ) ; table.setSavePointerId ( com.google.gwt.user.client.History.getToken ( ) ) ; Util.LIST_SVC.myStarredChanges ( new com.google.gerrit.client.rpc.GerritCallback < java.util.List < com.google.gerrit.client.data.ChangeInfo > > ( ) { public void onSuccess ( final java.util.List < com.google.gerrit.client.data.ChangeInfo > result ) { starred.display ( result ) ; table.finishDisplay ( ) ; } } ) ; }
Source:
private void loadCommit ( final com.google.gerrit.client.changes.ChangeInfo.RevisionInfo rev , com.google.gerrit.client.rpc.CallbackGroup group ) { com.google.gerrit.client.changes.ChangeApi.revision ( changeId.get ( ) , rev.name ( ) ) . view ( "commit" ) . get ( group.add ( new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.ChangeInfo.CommitInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo.CommitInfo info ) { rev.set_commit ( info ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ) ; }

Target:
private void loadCommit ( final com.google.gerrit.client.changes.ChangeInfo.RevisionInfo rev , com.google.gerrit.client.rpc.CallbackGroup group ) { if ( rev.is_edit ( ) ) { return ; } com.google.gerrit.client.changes.ChangeApi.commitWithLinks ( changeId.get ( ) , rev.name ( ) , group.add ( new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.ChangeInfo.CommitInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo.CommitInfo info ) { rev.set_commit ( info ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ) ; }
Source:
public static void applyUserPreferences ( ) { if ( ( com.google.gerrit.client.Gerrit.myAccount ) != null ) { final com.google.gerrit.reviewdb.client.AccountGeneralPreferences p = com.google.gerrit.client.Gerrit.myAccount.getGeneralPreferences ( ) ; com.google.gwtexpui.clippy.client.CopyableLabel.setFlashEnabled ( p.isUseFlashClipboard ( ) ) ; if ( ( com.google.gerrit.client.Gerrit.siteHeader ) != null ) { com.google.gerrit.client.Gerrit.siteHeader.setVisible ( p.isShowSiteHeader ( ) ) ; } if ( ( com.google.gerrit.client.Gerrit.siteFooter ) != null ) { com.google.gerrit.client.Gerrit.siteFooter.setVisible ( p.isShowSiteHeader ( ) ) ; } com.google.gerrit.client.FormatUtil.setPreferences ( com.google.gerrit.client.Gerrit.myAccount.getGeneralPreferences ( ) ) ; } }

Target:
private static void applyUserPreferences ( ) { com.google.gwtexpui.clippy.client.CopyableLabel.setFlashEnabled ( com.google.gerrit.client.Gerrit.myPrefs.useFlashClipboard ( ) ) ; if ( ( com.google.gerrit.client.Gerrit.siteHeader ) != null ) { com.google.gerrit.client.Gerrit.siteHeader.setVisible ( com.google.gerrit.client.Gerrit.myPrefs.showSiteHeader ( ) ) ; } if ( ( com.google.gerrit.client.Gerrit.siteFooter ) != null ) { com.google.gerrit.client.Gerrit.siteFooter.setVisible ( com.google.gerrit.client.Gerrit.myPrefs.showSiteHeader ( ) ) ; } com.google.gerrit.client.FormatUtil.setPreferences ( com.google.gerrit.client.Gerrit.myPrefs ) ; com.google.gerrit.client.Gerrit.urlAliasMatcher.updateUserAliases ( com.google.gerrit.client.Gerrit.myPrefs.urlAliases ( ) ) ; }
Source:
public void cleanUp ( ) { for ( java.nio.file.Path path : listFiles ( ) ) ; com.google.gerrit.httpd.WebSessionManager.Val val = readFile ( path ) ; java.time.Instant expires = java.time.Instant.ofEpochMilli ( val.getExpiresAt ( ) ) ; HEAD ( e448b8 ) ; com.ericsson.gerrit.plugins.highavailability.websession.file.Update bazlets ; com.ericsson.gerrit.plugins.highavailability.websession.file.latest master ; }

Target:
public void cleanUp ( ) { for ( java.nio.file.Path path : listFiles ( ) ) { com.google.gerrit.httpd.WebSessionManager.Val val = readFile ( path ) ; if ( val != null ) { java.time.Instant expires = java.time.Instant.ofEpochMilli ( val.getExpiresAt ( ) ) ; if ( expires.isBefore ( com.ericsson.gerrit.plugins.highavailability.websession.file.FileBasedWebsessionCache.TimeMachine.now ( ) ) ) { deleteFile ( path ) ; } } } }
Source:
public com.google.gerrit.server.change.ChangeJson.ChangeInfo format ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.server.query.change.ChangeData > tmp = com.google.common.collect.ImmutableList.of ( cd ) ; return formatList2 ( com.google.common.collect.ImmutableList.of ( tmp ) ) . get ( 0 ) . get ( 0 ) ; }

Target:
private com.google.gerrit.server.change.ChangeJson.ChangeInfo format ( com.google.gerrit.server.query.change.ChangeData cd , com.google.common.base.Optional < com.google.gerrit.reviewdb.client.PatchSet.Id > limitToPsId ) throws com.google.gwtorm.server.OrmException { accountLoader = accountLoaderFactory.create ( has ( com.google.gerrit.common.changes.ListChangesOption.DETAILED_ACCOUNTS ) ) ; com.google.gerrit.server.change.ChangeJson.ChangeInfo res = toChangeInfo ( cd , limitToPsId ) ; accountLoader.fill ( ) ; return res ; }
Source:
public void unblockInLocal_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , 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 , fixers , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl f = user ( local , fixers ) ; assertCannotUpdate ( "refs/heads/master" , f ) ; }

Target:
public void unblockInParentBlockInLocal ( ) { com.google.gerrit.server.project.testing.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl d = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCannotUpdate ( "refs/heads/master" , d ) ; }
Source:
public void offlineUponStart ( ) throws java.lang.Exception { setUpClientMock ( ) ; eventsDb.createDBIfNotCreated ( ) ; org.easymock.EasyMock.expectLastCall ( ) . andThrow ( new java.sql.SQLException ( new java.net.ConnectException ( ) ) ) . once ( ) ; easyMock.replayAll ( ) ; store = new com.ericsson.gerrit.plugins.eventslog.SQLStore ( pcFactoryMock , userProviderMock , cfgMock , eventsDb , localEventsDb ) ; store.start ( ) ; easyMock.verifyAll ( ) ; }

Target:
public void offlineUponStart ( ) throws java.lang.Exception { setUpClientMock ( ) ; eventsDb.createDBIfNotCreated ( ) ; org.easymock.EasyMock.expectLastCall ( ) . andThrow ( new java.sql.SQLException ( new java.net.ConnectException ( ) ) ) . once ( ) ; eventsDb.queryOne ( ) ; org.easymock.EasyMock.expectLastCall ( ) . andThrow ( new java.sql.SQLException ( ) ) ; easyMock.replayAll ( ) ; store = new com.ericsson.gerrit.plugins.eventslog.SQLStore ( pcFactoryMock , userProviderMock , cfgMock , eventsDb , localEventsDb , poolMock ) ; store.start ( ) ; easyMock.verifyAll ( ) ; }
Source:
public void insert ( byte [ ] key , byte [ ] data ) throws com.google.gwtorm.client.OrmException { db.lock.lock ( ) ; try { if ( db.table.containsKey ( key ) ) { throw new com.google.gwtorm.client.OrmDuplicateKeyException ( "Duplicate key" ) ; } else { db.table.put ( key , data ) ; } } finally { db.lock.unlock ( ) ; } }

Target:
public void atomicUpdate ( byte [ ] key , com.google.gwtorm.client.AtomicUpdate < byte [ ] > update ) throws com.google.gwtorm.client.OrmException { db.lock.lock ( ) ; try { final byte [ ] oldData = fetchRow ( key ) ; final byte [ ] newData = update.update ( oldData ) ; if ( newData != null ) { upsert ( key , newData ) ; } else if ( oldData != null ) { delete ( key ) ; } } finally { db.lock.unlock ( ) ; } }
Source:
private static java.lang.String apply ( com.google.gerrit.server.ParamertizedString p , com.google.gerrit.server.ldap.LdapQuery.Result m ) { if ( p == null ) { return null ; } java.lang.String r = p.replace ( m.map ( ) ) ; return r.isEmpty ( ) ? null : r ; }

Target:
private static java.lang.String apply ( com.google.gerrit.server.ParamertizedString p , com.google.gerrit.server.ldap.LdapQuery.Result m ) throws javax.naming.NamingException { if ( p == null ) { return null ; } final java.util.Map < java.lang.String , java.lang.String > values = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; for ( final java.lang.String name : m.attributes ( ) ) { values.put ( name , m.get ( name ) ) ; } java.lang.String r = p.replace ( values ) ; return r.isEmpty ( ) ? null : r ; }
Source:
private void configureHttp ( ) { ui.header ( "Http section" ) ; promptAndSetString ( "User" , com.ericsson.gerrit.plugins.highavailability.HTTP_SECTION , com.ericsson.gerrit.plugins.highavailability.USER_KEY , null ) ; promptAndSetString ( "Password" , com.ericsson.gerrit.plugins.highavailability.HTTP_SECTION , com.ericsson.gerrit.plugins.highavailability.PASSWORD_KEY , null ) ; promptAndSetString ( "Max number of tries to forward to remote peer" , com.ericsson.gerrit.plugins.highavailability.HTTP_SECTION , com.ericsson.gerrit.plugins.highavailability.MAX_TRIES_KEY , com.ericsson.gerrit.plugins.highavailability.Setup.str ( com.ericsson.gerrit.plugins.highavailability.DEFAULT_MAX_TRIES ) ) ; promptAndSetString ( "Retry interval [ms]" , com.ericsson.gerrit.plugins.highavailability.HTTP_SECTION , com.ericsson.gerrit.plugins.highavailability.RETRY_INTERVAL_KEY , com.ericsson.gerrit.plugins.highavailability.Setup.str ( com.ericsson.gerrit.plugins.highavailability.DEFAULT_RETRY_INTERVAL ) ) ; promptAndSetString ( "Connection timeout [ms]" , com.ericsson.gerrit.plugins.highavailability.HTTP_SECTION , com.ericsson.gerrit.plugins.highavailability.CONNECTION_TIMEOUT_KEY , com.ericsson.gerrit.plugins.highavailability.Setup.str ( com.ericsson.gerrit.plugins.highavailability.DEFAULT_TIMEOUT_MS ) ) ; promptAndSetString ( "Socket timeout [ms]" , com.ericsson.gerrit.plugins.highavailability.HTTP_SECTION , com.ericsson.gerrit.plugins.highavailability.SOCKET_TIMEOUT_KEY , com.ericsson.gerrit.plugins.highavailability.Setup.str ( com.ericsson.gerrit.plugins.highavailability.DEFAULT_TIMEOUT_MS ) ) ; }

Target:
private void configureMainSection ( ) { ui.header ( "Main section" ) ; java.lang.String sharedDirDefault = ( ui.isBatch ( ) ) ? com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_SHARED_DIRECTORY : null ; java.lang.String shared = promptAndSetString ( "Shared directory" , com.ericsson.gerrit.plugins.highavailability.Configuration.MAIN_SECTION , com.ericsson.gerrit.plugins.highavailability.Configuration.SHARED_DIRECTORY_KEY , sharedDirDefault ) ; if ( ! ( com.google.common.base.Strings.isNullOrEmpty ( shared ) ) ) { java.nio.file.Path resolved = site.site_path.resolve ( java.nio.file.Paths.get ( shared ) ) ; com.google.gerrit.common.FileUtil.mkdirsOrDie ( resolved , ( "cannot create " + resolved ) ) ; } }
Source:
private com.google.gerrit.reviewdb.client.Change.Id getOrRegisterAccount ( com.google.gerrit.reviewdb.server.ReviewDb db , org.kohsuke.github.GHUser user ) throws com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gerrit.extensions.restapi.UnprocessableEntityException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.reviewdb.client.AccountExternalId.Key userExtKey = new com.google.gerrit.reviewdb.client.AccountExternalId.Key ( com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_USERNAME , user.getLogin ( ) ) ; com.google.gerrit.reviewdb.server.AccountExternalIdAccess gerritExtIds = db.accountExternalIds ( ) ; com.google.gerrit.reviewdb.client.AccountExternalId userExtId = gerritExtIds.get ( userExtKey ) ; if ( userExtId == null ) { return accountImporter.importAccount ( user ) ; } else { return userExtId.getAccountId ( ) ; } }

Target:
private com.google.gerrit.reviewdb.client.Change.Id getOrRegisterAccount ( com.google.gerrit.reviewdb.server.ReviewDb db , org.kohsuke.github.GHUser user ) throws com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gerrit.extensions.restapi.UnprocessableEntityException , com.google.gwtorm.server.OrmException , java.io.IOException { return getOrRegisterAccount ( db , user.getLogin ( ) , user.getName ( ) , user.getEmail ( ) ) ; }
Source:
private void deleteAllFiles ( java.io.File dir ) { for ( java.io.File f : dir.listFiles ( ) ) { if ( f.isDirectory ( ) ) { deleteAllFiles ( f ) ; } else { f.delete ( ) ; } } dir.delete ( ) ; }

Target:
private static java.io.File [ ] listFiles ( java.io.File dir ) throws java.io.IOException { java.io.File [ ] files = dir.listFiles ( ) ; if ( files == null ) { throw new java.io.IOException ( ( "Failed to list directory: " + dir ) ) ; } return files ; }
Source:
protected void onLoad ( ) { super . onLoad ( ) ; Util.ACCOUNT_SEC.myGroups ( new com.google.gerrit.client.rpc.ScreenLoadCallback < java.util.List < com.google.gerrit.reviewdb.client.AccountGroup > > ( this ) { @ java.lang.Override public void preDisplay ( final java.util.List < com.google.gerrit.reviewdb.client.AccountGroup > result ) { groups.display ( result ) ; } } ) ; }

Target:
protected void onLoad ( ) { super . onLoad ( ) ; com.google.gerrit.client.groups.GroupMap.my ( new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.groups.GroupMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.groups.GroupMap result ) { groups.display ( result ) ; groups.finishDisplay ( ) ; } } ) ; }
Source:
public static java.lang.String sortKey ( long lastUpdated , int id ) { final long lastUpdatedOn = ( lastUpdated / 1000L ) - 1222819200L ; final java.lang.StringBuilder r = new java.lang.StringBuilder ( 16 ) ; r.setLength ( 16 ) ; com.google.gerrit.server.ChangeUtil.formatHexInt ( r , 0 , ( ( int ) ( lastUpdatedOn / 60 ) ) ) ; com.google.gerrit.server.ChangeUtil.formatHexInt ( r , 8 , id ) ; return r.toString ( ) ; }

Target:
public static java.lang.String sortKey ( long lastUpdated , int id ) { final long lastUpdatedOn = ( lastUpdated / 1000L ) - ( com.google.gerrit.server.ChangeUtil.SORT_KEY_EPOCH ) ; final java.lang.StringBuilder r = new java.lang.StringBuilder ( 16 ) ; r.setLength ( 16 ) ; com.google.gerrit.server.ChangeUtil.formatHexInt ( r , 0 , ( ( int ) ( lastUpdatedOn / 60 ) ) ) ; com.google.gerrit.server.ChangeUtil.formatHexInt ( r , 8 , id ) ; return r.toString ( ) ; }
Source:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Move Change" ) . setTitle ( "Move change to a different branch" ) . setVisible ( permissionBackend.user ( rsrc.getUser ( ) ) . project ( rsrc.getProject ( ) ) . testOrFalse ( ProjectPermission.CREATE_CHANGE ) ) ; }

Target:
public UiAction.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 ( "Move Change" ) . setTitle ( "Move change to a different branch" ) . setVisible ( ( ( ( change.getStatus ( ) . isOpen ( ) ) && ( permissionBackend.user ( rsrc.getUser ( ) ) . ref ( change.getDest ( ) ) . testOrFalse ( com.google.gerrit.server.permissions.RefPermission.CREATE_CHANGE ) ) ) && ( rsrc.permissions ( ) . database ( dbProvider ) . testOrFalse ( com.google.gerrit.server.permissions.ChangePermission.ABANDON ) ) ) ) ; }
Source:
public void rescheduleOnError ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.ERR_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verify ( executor , org.mockito.Mockito.times ( 1 ) ) . schedule ( task , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.RETRY_INTERVAL , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }

Target:
public void rescheduleOnError ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( remote ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.ERR_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verify ( executor , org.mockito.Mockito.times ( 1 ) ) . schedule ( task , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.RETRY_INTERVAL , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }
Source:
protected void configure ( ) { factory ( AddBranch.Factory.class ) ; factory ( AddProjectRight.Factory.class ) ; factory ( ChangeProjectSettings.Factory.class ) ; factory ( DeleteBranches.Factory.class ) ; factory ( DeleteProjectRights.Factory.class ) ; factory ( ListBranches.Factory.class ) ; factory ( OwnedProjects.Factory.class ) ; factory ( ProjectDetailFactory.Factory.class ) ; }

Target:
protected void configure ( ) { factory ( AddBranch.Factory.class ) ; factory ( AddRefRight.Factory.class ) ; factory ( ChangeProjectSettings.Factory.class ) ; factory ( DeleteBranches.Factory.class ) ; factory ( DeleteRefRights.Factory.class ) ; factory ( ListBranches.Factory.class ) ; factory ( OwnedProjects.Factory.class ) ; factory ( ProjectDetailFactory.Factory.class ) ; }
Source:
public void unsupportedIndexOperator ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "status:merged file:a" ) ; com.google.common.truth.Truth.assertThat ( rewrite ( in ) ) . isEqualTo ( query ( in ) ) ; indexes.setSearchIndex ( new com.google.gerrit.server.index.change.FakeChangeIndex ( FakeChangeIndex.V1 ) ) ; exception.expect ( com.google.gerrit.server.query.QueryParseException.class ) ; exception.expectMessage ( "Unsupported index predicate: file:a" ) ; rewrite ( in ) ; }

Target:
public void unsupportedIndexOperator ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "status:merged file:a" ) ; com.google.common.truth.Truth.assertThat ( rewrite ( in ) ) . isEqualTo ( query ( in ) ) ; indexes.setSearchIndex ( new com.google.gerrit.server.index.change.FakeChangeIndex ( FakeChangeIndex.V1 ) ) ; exception.expect ( com.google.gerrit.index.query.QueryParseException.class ) ; exception.expectMessage ( "Unsupported index predicate: file:a" ) ; rewrite ( in ) ; }
Source:
public void verificationOneTest ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.verifystatus.common.VerifyInput in = new com.googlesource.gerrit.plugins.verifystatus.common.VerifyInput ( ) ; in.verifications = new java.util.HashMap < > ( ) ; com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo i = new com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo ( ) ; i.name = "job42" ; i.value = 1 ; i.reporter = "zuul@openstack.org" ; i.comment = "Test CI" ; i.url = "url" ; i.category = "bar" ; i.duration = "1h 30min" ; in.verifications.put ( "foo" , i ) ; com.google.gerrit.acceptance.PushOneCommit.Result c = createChange ( ) ; java.lang.String endPoint = url ( c ) ; com.google.gerrit.acceptance.RestResponse r = adminRestSession.post ( endPoint , in ) ; r.assertNoContent ( ) ; java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo > infos = getVerifications ( c ) ; com.google.common.truth.Truth.assertThat ( infos ) . hasSize ( 1 ) ; com.googlesource.gerrit.plugins.verifystatus.VerifyStatusIT.assertVerification ( com.google.common.collect.Iterables.getOnlyElement ( infos.values ( ) ) , i ) ; }

Target:
public void verificationOneTest ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.verifystatus.common.VerifyInput in = new com.googlesource.gerrit.plugins.verifystatus.common.VerifyInput ( ) ; in.verifications = new java.util.HashMap < > ( ) ; com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo i = new com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo ( ) ; i.name = "job42" ; i.value = 1 ; i.reporter = "zuul@openstack.org" ; i.rerun = true ; i.comment = "Test CI" ; i.url = "url" ; i.category = "bar" ; i.duration = "1h 30min" ; in.verifications.put ( "foo" , i ) ; com.google.gerrit.acceptance.PushOneCommit.Result c = createChange ( ) ; java.lang.String endPoint = url ( c ) ; com.google.gerrit.acceptance.RestResponse r = adminRestSession.post ( endPoint , in ) ; r.assertNoContent ( ) ; java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo > infos = getVerifications ( c ) ; com.google.common.truth.Truth.assertThat ( infos ) . hasSize ( 1 ) ; com.googlesource.gerrit.plugins.verifystatus.VerifyStatusIT.assertVerification ( com.google.common.collect.Iterables.getOnlyElement ( infos.values ( ) ) , i ) ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.ProjectDetail result ) { display ( result ) ; }

Target:
void onEdit ( com.google.gwt.event.dom.client.ClickEvent event ) { resetEditors ( ) ; edit.setEnabled ( false ) ; cancel1.setVisible ( true ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( commitTools , true ) ; commit.setVisible ( ( ! ( access.getOwnerOf ( ) . isEmpty ( ) ) ) ) ; review.setVisible ( access.canUpload ( ) ) ; accessEditor.setEditing ( true ) ; driver.edit ( access ) ; }
Source:
private java.util.Map < com.google.gerrit.reviewdb.client.Account.Id , com.google.gerrit.reviewdb.client.AccountGroupMember > getMembers ( final com.google.gerrit.reviewdb.client.AccountGroup.Id groupId ) throws com.google.gwtorm.server.OrmException { final java.util.Map < com.google.gerrit.reviewdb.client.Account.Id , com.google.gerrit.reviewdb.client.AccountGroupMember > members = com.google.common.collect.Maps.newHashMap ( ) ; for ( final com.google.gerrit.reviewdb.client.AccountGroupMember m : db.get ( ) . accountGroupMembers ( ) . byGroup ( groupId ) ) { members.put ( m.getAccountId ( ) , m ) ; } return members ; }

Target:
private java.util.Map < com.google.gerrit.reviewdb.client.Account.Id , com.google.gerrit.reviewdb.client.AccountGroupMember > getMembers ( final com.google.gerrit.reviewdb.client.AccountGroup.Id groupId ) throws com.google.gwtorm.server.OrmException { final java.util.Map < com.google.gerrit.reviewdb.client.Account.Id , com.google.gerrit.reviewdb.client.AccountGroupMember > members = new java.util.HashMap < > ( ) ; for ( final com.google.gerrit.reviewdb.client.AccountGroupMember m : db.get ( ) . accountGroupMembers ( ) . byGroup ( groupId ) ) { members.put ( m.getAccountId ( ) , m ) ; } return members ; }
Source:
public void testSortWithRegex ( ) { grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "^refs/heads/.*" ) ; grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "^refs/heads/.*-QA-.*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertTrue ( "u can read" , u.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; assertTrue ( "d can read" , d.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; }

Target:
public void testSortWithRegex ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "^refs/heads/.*" ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "^refs/heads/.*-QA-.*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertTrue ( "u can read" , u.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; assertTrue ( "d can read" , d.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; }
Source:
public void operationComplete ( org.apache.mina.core.future.IoFuture future ) { final com.google.gerrit.sshd.SshScope.Context ctx = new com.google.gerrit.sshd.SshScope.Context ( sd , null ) ; final com.google.gerrit.sshd.SshScope.Context old = sshScope.set ( ctx ) ; try { sshLog.onLogout ( ) ; } finally { sshScope.set ( old ) ; } }

Target:
public void operationComplete ( org.apache.mina.core.future.IoFuture future ) { final com.google.gerrit.sshd.SshScope.Context ctx = sshScope.newContext ( sd , null ) ; final com.google.gerrit.sshd.SshScope.Context old = sshScope.set ( ctx ) ; try { sshLog.onLogout ( ) ; } finally { sshScope.set ( old ) ; } }
Source:
public void testPatternNullMatchWCommentLink ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "ItsTestName" , null , "commentlink" ) ) . andReturn ( "foo" ) . atLeastOnce ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "commentlink" , "foo" , "match" ) ) . andReturn ( null ) . atLeastOnce ( ) ; replayMocks ( ) ; assertNull ( "Pattern for null match is not null" , itsConfig.getIssuePattern ( ) ) ; }

Target:
public void testGetIssuePatternNullMatchWCommentLink ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "ItsTestName" , null , "commentlink" ) ) . andReturn ( "foo" ) . atLeastOnce ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "commentlink" , "foo" , "match" ) ) . andReturn ( null ) . atLeastOnce ( ) ; replayMocks ( ) ; assertNull ( "Pattern for null match is not null" , itsConfig.getIssuePattern ( ) ) ; }
Source:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { char c = event.getCharCode ( ) ; if ( ( c < '0' ) || ( '9' < c ) ) { final int nativeCode = event.getNativeEvent ( ) . getKeyCode ( ) ; switch ( nativeCode ) { case com.google.gwt.event.dom.client.KeyCodes.KEY_BACKSPACE : case com.google.gwt.event.dom.client.KeyCodes.KEY_LEFT : case com.google.gwt.event.dom.client.KeyCodes.KEY_RIGHT : case com.google.gwt.event.dom.client.KeyCodes.KEY_HOME : case com.google.gwt.event.dom.client.KeyCodes.KEY_END : case com.google.gwt.event.dom.client.KeyCodes.KEY_TAB : break ; default : if ( ! ( event.isAnyModifierKeyDown ( ) ) ) { event.preventDefault ( ) ; } break ; } } }

Target:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { char c = event.getCharCode ( ) ; if ( ( c < '0' ) || ( '9' < c ) ) { final int nativeCode = event.getNativeEvent ( ) . getKeyCode ( ) ; switch ( nativeCode ) { case com.google.gwt.event.dom.client.KeyCodes.KEY_BACKSPACE : case com.google.gwt.event.dom.client.KeyCodes.KEY_LEFT : case com.google.gwt.event.dom.client.KeyCodes.KEY_RIGHT : case com.google.gwt.event.dom.client.KeyCodes.KEY_HOME : case com.google.gwt.event.dom.client.KeyCodes.KEY_END : case com.google.gwt.event.dom.client.KeyCodes.KEY_TAB : case com.google.gwt.event.dom.client.KeyCodes.KEY_DELETE : break ; default : if ( ! ( event.isAnyModifierKeyDown ( ) ) ) { event.preventDefault ( ) ; } break ; } } }
Source:
public void absolutePath ( ) { com.google.gitiles.doc.MarkdownToHtml md = new com.google.gitiles.doc.MarkdownToHtml ( view , config ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/" ) ) . isEqualTo ( "/g/repo/+/HEAD/" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/index.md" ) ) . isEqualTo ( "/g/repo/+/HEAD/index.md" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/doc/index.md" ) ) . isEqualTo ( "/g/repo/+/HEAD/doc/index.md" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/doc/" ) ) . isEqualTo ( "/g/repo/+/HEAD/doc" ) ; }

Target:
public void absolutePath ( ) { com.google.gitiles.doc.MarkdownToHtml md = new com.google.gitiles.doc.MarkdownToHtml ( view , config , "index.md" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/" ) ) . isEqualTo ( "/g/repo/+/HEAD/" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/index.md" ) ) . isEqualTo ( "/g/repo/+/HEAD/index.md" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/doc/index.md" ) ) . isEqualTo ( "/g/repo/+/HEAD/doc/index.md" ) ; com.google.common.truth.Truth.assertThat ( md.href ( "/doc/" ) ) . isEqualTo ( "/g/repo/+/HEAD/doc" ) ; }