auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gerrit.server.data.PatchSetCommentAttribute asPatchSetLineAttribute ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { com.google.gerrit.server.data.PatchSetCommentAttribute a = new com.google.gerrit.server.data.PatchSetCommentAttribute ( ) ; a.reviewer = asAccountAttribute ( c.getAuthor ( ) ) ; a.file = c.getKey ( ) . getParentKey ( ) . get ( ) ; a.line = c.getLine ( ) ; a.message = c.getMessage ( ) ; return a ; }

Target:
public com.google.gerrit.server.data.PatchSetCommentAttribute asPatchSetLineAttribute ( com.google.gerrit.reviewdb.client.Comment c ) { com.google.gerrit.server.data.PatchSetCommentAttribute a = new com.google.gerrit.server.data.PatchSetCommentAttribute ( ) ; a.reviewer = asAccountAttribute ( c.author.getId ( ) ) ; a.file = c.key.filename ; a.line = c.lineNbr ; a.message = c.message ; return a ; }
Source:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString result ) { if ( isSubmittable ) { if ( status == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) { statusText.setInnerText ( ( changeInfo.mergeable ( ) ? Util.C.readyToSubmit ( ) : Util.C.mergeConflict ( ) ) ) ; } } setVisible ( notMergeable , ( ! ( changeInfo.mergeable ( ) ) ) ) ; renderSubmitType ( result.asString ( ) ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString result ) { if ( canSubmit ) { if ( status == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) { statusText.setInnerText ( ( changeInfo.mergeable ( ) ? Util.C.readyToSubmit ( ) : Util.C.mergeConflict ( ) ) ) ; } } setVisible ( notMergeable , ( ! ( changeInfo.mergeable ( ) ) ) ) ; renderSubmitType ( result.asString ( ) ) ; }
Source:
public void remoteUrlUndefinedEventsNotPosted ( ) { eventHandler.onEvent ( com.googlesource.gerrit.plugins.webhooks.EventHandlerTest.PROJECT_CREATED ) ; org.mockito.Mockito.verifyZeroInteractions ( postTask ) ; }

Target:
public void remoteUrlUndefinedTaskNotScheduled ( ) { org.mockito.Mockito.when ( config.getSubsections ( org.mockito.ArgumentMatchers.eq ( com.googlesource.gerrit.plugins.webhooks.EventHandlerTest.REMOTE ) ) ) . thenReturn ( com.google.common.collect.ImmutableSet.of ( com.googlesource.gerrit.plugins.webhooks.EventHandlerTest.FOO ) ) ; eventHandler.onEvent ( projectCreated ) ; org.mockito.Mockito.verifyZeroInteractions ( taskFactory ) ; org.mockito.Mockito.verifyZeroInteractions ( postTask ) ; }
Source:
com.google.gerrit.client.changes.CommentInfo createReply ( com.google.gerrit.client.changes.CommentInfo replyTo ) { if ( ! ( replyTo.has_line ( ) ) ) { return com.google.gerrit.client.changes.CommentInfo.createFile ( path , replyTo.side ( ) , replyTo.id ( ) , null ) ; } else { return com.google.gerrit.client.changes.CommentInfo.createRange ( path , replyTo.side ( ) , replyTo.line ( ) , replyTo.id ( ) , null , null ) ; } }

Target:
com.google.gerrit.client.changes.CommentInfo createReply ( com.google.gerrit.client.changes.CommentInfo replyTo ) { if ( ( ! ( replyTo.has_line ( ) ) ) && ( ( replyTo.range ( ) ) == null ) ) { return com.google.gerrit.client.changes.CommentInfo.createFile ( path , replyTo.side ( ) , replyTo.id ( ) , null ) ; } else { return com.google.gerrit.client.changes.CommentInfo.createRange ( path , replyTo.side ( ) , replyTo.line ( ) , replyTo.id ( ) , null , replyTo.range ( ) ) ; } }
Source:
private java.util.List < com.google.gerrit.reviewdb.client.AccountGroupById > loadIncludes ( ) throws com.google.gwtorm.server.OrmException { if ( ! ( control.canSeeGroup ( ) ) ) { return com.google.common.collect.ImmutableList.of ( ) ; } java.util.List < com.google.gerrit.reviewdb.client.AccountGroupById > groups = new java.util.ArrayList < > ( ) ; for ( com.google.gerrit.reviewdb.client.AccountGroupById m : db.accountGroupById ( ) . byGroup ( groupId ) ) { groups.add ( m ) ; } return groups ; }

Target:
private com.google.common.collect.ImmutableSet < com.google.gerrit.reviewdb.client.AccountGroup.UUID > loadIncludes ( ) throws com.google.gwtorm.server.OrmException { if ( ! ( control.canSeeGroup ( ) ) ) { return com.google.common.collect.ImmutableSet.of ( ) ; } return groups.getIncludes ( db , groupId ) . collect ( com.google.common.collect.ImmutableSet.toImmutableSet ( ) ) ; }
Source:
public void unblockForceWithAllowNoForce_NotPossible ( ) { 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/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCannotForceUpdate ( "refs/heads/master" , u ) ; }

Target:
public void unblockForceWithAllowNoForce_NotPossible ( ) { 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/*" ) ; com.google.gerrit.server.permissions.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCannotForceUpdate ( "refs/heads/master" , u ) ; }
Source:
public java.lang.Iterable < com.google.gerrit.extensions.common.WebLinkInfo > getProjectLinks ( java.lang.String project ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.extensions.webui.ProjectWebLink webLink : projectLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getProjectUrl ( project ) ) ) ; } return links ; }

Target:
public java.lang.Iterable < com.google.gerrit.extensions.common.WebLinkInfo > getProjectLinks ( java.lang.String project ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.extensions.webui.ProjectWebLink webLink : projectLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getProjectUrl ( project ) , webLink.getTarget ( ) ) ) ; } return links ; }
Source:
public void setList ( java.lang.String section , java.lang.String subsection , java.lang.String name , java.util.List < java.lang.String > values ) { if ( values != null ) { sec.setStringList ( section , subsection , name , values.stream ( ) . map ( codec :: encode ) . collect ( java.util.stream.Collectors.toList ( ) ) ) ; } else { sec.unset ( section , subsection , name ) ; } save ( ) ; }

Target:
public void setList ( java.lang.String section , java.lang.String subsection , java.lang.String name , java.util.List < java.lang.String > values ) { if ( values != null ) { sec.setStringList ( section , subsection , name , com.google.common.collect.FluentIterable.from ( values ) . transform ( codec.encodeFun ) . toList ( ) ) ; } else { sec.unset ( section , subsection , name ) ; } save ( ) ; }
Source:
protected void assertApproved ( java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.extensions.common.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.DETAILED_LABELS ) ; com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; com.google.common.truth.Truth.assertThat ( cr.all ) . hasSize ( 1 ) ; com.google.common.truth.Truth.assertThat ( cr.all.get ( 0 ) . value.intValue ( ) ) . isEqualTo ( 2 ) ; com.google.common.truth.Truth.assertThat ( new com.google.gerrit.reviewdb.client.Account.Id ( cr.all.get ( 0 ) . _accountId ) ) . isEqualTo ( admin.getId ( ) ) ; }

Target:
protected void assertApproved ( java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.extensions.common.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS ) ; com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; com.google.common.truth.Truth.assertThat ( cr.all ) . hasSize ( 1 ) ; com.google.common.truth.Truth.assertThat ( cr.all.get ( 0 ) . value.intValue ( ) ) . isEqualTo ( 2 ) ; com.google.common.truth.Truth.assertThat ( new com.google.gerrit.reviewdb.client.Account.Id ( cr.all.get ( 0 ) . _accountId ) ) . isEqualTo ( admin.getId ( ) ) ; }
Source:
private void showText ( java.lang.Object data , int depth ) { for ( java.lang.reflect.Field f : fieldsOf ( data.getClass ( ) ) ) { java.lang.Object val ; try { val = f.get ( data ) ; } catch ( java.lang.IllegalArgumentException err ) { continue ; } catch ( java.lang.IllegalAccessException err ) { continue ; } if ( val == null ) { continue ; } showField ( f.getName ( ) , val , depth ) ; } }

Target:
private int getEffectiveLimit ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) { java.util.List < java.lang.Integer > possibleLimits = new java.util.ArrayList < > ( 3 ) ; possibleLimits.add ( permittedLimit ) ; if ( ( limitFromCaller ) > 0 ) { possibleLimits.add ( limitFromCaller ) ; } java.lang.Integer limitFromPredicate = com.google.gerrit.server.query.change.LimitPredicate.getLimit ( p ) ; if ( limitFromPredicate != null ) { possibleLimits.add ( limitFromPredicate ) ; } return com.google.common.collect.Ordering.natural ( ) . min ( possibleLimits ) ; }
Source:
public void onScreenLoad ( com.google.gerrit.client.ui.ScreenLoadEvent event ) { com.google.gerrit.client.ui.Screen screen = event.getScreen ( ) ; if ( screen instanceof com.google.gerrit.client.admin.ProjectScreen ) { com.google.gerrit.reviewdb.client.Project.NameKey projectKey = ( ( com.google.gerrit.client.admin.ProjectScreen ) ( screen ) ) . getProjectKey ( ) ; setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( projectKey , panel ) ) ; setVisible ( true ) ; } else { setVisible ( false ) ; } super . onScreenLoad ( event ) ; }

Target:
public void onScreenLoad ( com.google.gerrit.client.ui.ScreenLoadEvent event ) { com.google.gerrit.client.ui.Screen screen = event.getScreen ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectKey ; if ( screen instanceof com.google.gerrit.client.admin.ProjectScreen ) { projectKey = ( ( com.google.gerrit.client.admin.ProjectScreen ) ( screen ) ) . getProjectKey ( ) ; } else { projectKey = com.google.gerrit.client.admin.ProjectScreen.getSavedKey ( ) ; } if ( projectKey != null ) { setVisible ( true ) ; setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( projectKey , panel ) ) ; } else { setVisible ( false ) ; } super . onScreenLoad ( event ) ; }
Source:
static java.lang.String getTitle ( org.pegdown.ast.Node node ) { if ( node instanceof org.pegdown.ast.HeaderNode ) { if ( ( ( ( org.pegdown.ast.HeaderNode ) ( node ) ) . getLevel ( ) ) == 1 ) { return com.google.gitiles.doc.MarkdownUtil.getInnerText ( node ) ; } return null ; } for ( org.pegdown.ast.Node child : node.getChildren ( ) ) { java.lang.String title = com.google.gitiles.doc.MarkdownUtil.getTitle ( child ) ; if ( title != null ) { return title ; } } return null ; }

Target:
static java.lang.String getTitle ( org.commonmark.node.Node node ) { if ( node instanceof org.commonmark.node.Heading ) { if ( ( ( ( org.commonmark.node.Heading ) ( node ) ) . getLevel ( ) ) == 1 ) { return com.google.gitiles.doc.MarkdownUtil.getInnerText ( node ) ; } return null ; } for ( org.commonmark.node.Node c = node.getFirstChild ( ) ; c != null ; c = c.getNext ( ) ) { java.lang.String title = com.google.gitiles.doc.MarkdownUtil.getTitle ( c ) ; if ( title != null ) { return title ; } } return null ; }
Source:
public void addComment ( final java.lang.String bugId , final java.lang.String comment ) throws java.io.IOException { int task_id = java.lang.Integer.parseInt ( bugId ) ; try { conduit.maniphestUpdate ( task_id , comment ) ; } catch ( com.googlesource.gerrit.plugins.its.phabricator.conduit.ConduitException e ) { throw new java.io.IOException ( ( "Could not update message for task " + task_id ) , e ) ; } com.googlesource.gerrit.plugins.its.phabricator.PhabricatorItsFacade.log.debug ( ( ( ( "Added comment " + comment ) + " to bug " ) + task_id ) ) ; }

Target:
public void addComment ( final java.lang.String bugId , final java.lang.String comment ) throws java.io.IOException { int task_id = java.lang.Integer.parseInt ( bugId ) ; try { conduit.maniphestEdit ( task_id , comment ) ; } catch ( com.googlesource.gerrit.plugins.its.phabricator.conduit.ConduitException e ) { throw new java.io.IOException ( ( "Could not update message for task " + task_id ) , e ) ; } com.googlesource.gerrit.plugins.its.phabricator.PhabricatorItsFacade.log.debug ( ( ( ( "Added comment " + comment ) + " to bug " ) + task_id ) ) ; }
Source:
public void merge ( java.lang.String submissionId , java.lang.Iterable < com.google.gerrit.common.data.SubmitRecord > submitRecords ) { this . status = Change.Status.MERGED ; this . submissionId = submissionId ; this . submitRecords = com.google.common.collect.ImmutableList.copyOf ( submitRecords ) ; com.google.common.base.Preconditions.checkArgument ( ( ! ( this . submitRecords.isEmpty ( ) ) ) , "no submit records specified at submit time" ) ; }

Target:
public void merge ( com.google.gerrit.server.util.RequestId submissionId , java.lang.Iterable < com.google.gerrit.common.data.SubmitRecord > submitRecords ) { this . status = Change.Status.MERGED ; this . submissionId = submissionId.toStringForStorage ( ) ; this . submitRecords = com.google.common.collect.ImmutableList.copyOf ( submitRecords ) ; com.google.common.base.Preconditions.checkArgument ( ( ! ( this . submitRecords.isEmpty ( ) ) ) , "no submit records specified at submit time" ) ; }
Source:
private boolean canPerformOnAllRefs ( com.google.gerrit.reviewdb.ApprovalCategory.Id actionId , short requireValue ) { boolean canPerform = false ; final java.util.Set < java.lang.String > patterns = allRefPatterns ( actionId ) ; if ( patterns.contains ( RefRight.ALL ) ) { for ( final java.lang.String pattern : patterns ) { if ( controlForRef ( pattern ) . canPerform ( actionId , requireValue ) ) { canPerform = true ; } else { return false ; } } } return canPerform ; }

Target:
private boolean canPerformOnAllRefs ( java.lang.String permission ) { boolean canPerform = false ; java.util.Set < java.lang.String > patterns = allRefPatterns ( permission ) ; if ( patterns.contains ( AccessSection.ALL ) ) { for ( final java.lang.String pattern : patterns ) { if ( controlForRef ( pattern ) . canPerform ( permission ) ) { canPerform = true ; } else { return false ; } } } return canPerform ; }
Source:
protected void setUpEnvironment ( com.google.gerrit.rules.PrologEnvironment env ) throws java.lang.Exception { com.google.gerrit.common.data.LabelTypes labelTypes = new com.google.gerrit.common.data.LabelTypes ( java.util.Arrays.asList ( com.google.gerrit.server.project.Util.codeReview ( ) , com.google.gerrit.server.project.Util.verified ( ) ) ) ; com.google.gerrit.server.query.change.ChangeData cd = org.easymock.EasyMock.createMock ( com.google.gerrit.server.query.change.ChangeData.class ) ; org.easymock.EasyMock.expect ( cd.getLabelTypes ( ) ) . andStubReturn ( labelTypes ) ; org.easymock.EasyMock.replay ( cd ) ; env.set ( StoredValues.CHANGE_DATA , cd ) ; }

Target:
protected void setUpEnvironment ( com.google.gerrit.rules.PrologEnvironment env ) throws java.lang.Exception { com.google.gerrit.common.data.LabelTypes labelTypes = new com.google.gerrit.common.data.LabelTypes ( java.util.Arrays.asList ( com.google.gerrit.server.project.testing.Util.codeReview ( ) , com.google.gerrit.server.project.testing.Util.verified ( ) ) ) ; com.google.gerrit.server.query.change.ChangeData cd = org.easymock.EasyMock.createMock ( com.google.gerrit.server.query.change.ChangeData.class ) ; org.easymock.EasyMock.expect ( cd.getLabelTypes ( ) ) . andStubReturn ( labelTypes ) ; org.easymock.EasyMock.replay ( cd ) ; env.set ( StoredValues.CHANGE_DATA , cd ) ; }
Source:
public com.google.gwtorm.server.OrmException apply ( java.lang.Exception input ) { if ( input instanceof com.google.gwtorm.server.OrmException ) { return ( ( com.google.gwtorm.server.OrmException ) ( input ) ) ; } return new com.google.gwtorm.server.OrmException ( "Error updating database" , input ) ; }

Target:
public com.google.gerrit.server.git.InsertException apply ( java.lang.Exception input ) { if ( input instanceof com.google.gwtorm.server.OrmException ) { return new com.google.gerrit.server.git.InsertException ( "ORM error" , input ) ; } if ( input instanceof java.io.IOException ) { return new com.google.gerrit.server.git.InsertException ( "IO error" , input ) ; } return new com.google.gerrit.server.git.InsertException ( "Error inserting change/patchset" , input ) ; }
Source:
public void clearPublicKeyStore ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.Ref ref = repo.getRef ( RefNames.REFS_GPG_KEYS ) ; if ( ref != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( RefNames.REFS_GPG_KEYS ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assertThat ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }

Target:
public void clearPublicKeyStore ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.Ref ref = repo.getRef ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) ; if ( ref != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assertThat ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }
Source:
com.google.common.collect.ImmutableListMultimap < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.ChangeMessage > buildMessages ( ) { for ( java.util.Collection < com.google.gerrit.reviewdb.client.ChangeMessage > v : changeMessages.asMap ( ) . values ( ) ) { java.util.Collections.sort ( ( ( java.util.List < com.google.gerrit.reviewdb.client.ChangeMessage > ) ( v ) ) , ChangeNotes.MESSAGE_BY_TIME ) ; } return com.google.common.collect.ImmutableListMultimap.copyOf ( changeMessages ) ; }

Target:
com.google.common.collect.ImmutableListMultimap < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.ChangeMessage > buildMessages ( ) { for ( java.util.Collection < com.google.gerrit.reviewdb.client.ChangeMessage > v : changeMessages.asMap ( ) . values ( ) ) { java.util.Collections.reverse ( ( ( java.util.List < com.google.gerrit.reviewdb.client.ChangeMessage > ) ( v ) ) ) ; } return com.google.common.collect.ImmutableListMultimap.copyOf ( changeMessages ) ; }
Source:
private void matchChange ( java.util.Set < com.google.gerrit.reviewdb.client.Change.Id > matched , com.google.gerrit.reviewdb.client.Change change ) { try { if ( ( ( change != null ) && ( inProject ( change ) ) ) && ( changeControlFactory.controlFor ( change ) . isVisible ( db ) ) ) { matched.add ( change.getId ( ) ) ; } } catch ( com.google.gerrit.server.project.NoSuchChangeException e ) { } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.sshd.commands.SetReviewersCommand.log.warn ( ( "Error reading change " + ( change.getId ( ) ) ) , e ) ; } }

Target:
private void matchChange ( java.util.Set < com.google.gerrit.reviewdb.client.Change.Id > matched , com.google.gerrit.reviewdb.client.Change change ) { try { if ( ( ( change != null ) && ( inProject ( change ) ) ) && ( changeControlFactory.controlFor ( change , userProvider.get ( ) ) . isVisible ( db ) ) ) { matched.add ( change.getId ( ) ) ; } } catch ( com.google.gerrit.server.project.NoSuchChangeException e ) { } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.sshd.commands.SetReviewersCommand.log.warn ( ( "Error reading change " + ( change.getId ( ) ) ) , e ) ; } }
Source:
public void byPathRegex ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.InMemoryRepository > repo = createProject ( "repo" ) ; org.eclipse.jgit.revwalk.RevCommit commit = repo.parseBody ( repo.commit ( ) . message ( "one" ) . add ( "dir/file1" , "contents1" ) . add ( "dir/file2" , "contents2" ) . create ( ) ) ; com.google.gerrit.reviewdb.client.Change change = newChange ( repo , commit , null , null , null ) . insert ( ) ; com.google.common.truth.Truth.assertThat ( query ( "path:.*file.*" ) ) . isEmpty ( ) ; assertResultEquals ( change , queryOne ( "path:^dir.file.*" ) ) ; }

Target:
public void filterOutAllResults ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.InMemoryRepository > repo = createProject ( "repo" ) ; int user2 = accountManager.authenticate ( com.google.gerrit.server.account.AuthRequest.forUser ( "anotheruser" ) ) . getAccountId ( ) . get ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { newChange ( repo , null , null , user2 , null ) . insert ( ) ; } assertQuery ( "status:new ownerin:Administrators" ) ; assertQuery ( "status:new ownerin:Administrators limit:2" ) ; }
Source:
private static boolean acceptsGzip ( javax.servlet.http.HttpServletRequest req ) { return ( req != null ) && ( com.google.gwtjsonrpc.server.RPCServletUtils.acceptsGzipEncoding ( req ) ) ; }

Target:
private static boolean acceptsGzip ( javax.servlet.http.HttpServletRequest req ) { if ( req != null ) { java.lang.String accepts = req.getHeader ( com.google.common.net.HttpHeaders.ACCEPT_ENCODING ) ; return ( accepts != null ) && ( ( accepts.indexOf ( "gzip" ) ) != ( - 1 ) ) ; } return false ; }
Source:
protected Project.NameKey createProject ( java.lang.String nameSuffix , com.google.gerrit.reviewdb.client.Project.NameKey parent , boolean createEmptyCommit ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = name ( nameSuffix ) ; in.parent = ( parent != null ) ? parent.get ( ) : null ; in.createEmptyCommit = createEmptyCommit ; return createProject ( in ) ; }

Target:
protected Project.NameKey createProject ( java.lang.String nameSuffix , com.google.gerrit.reviewdb.client.Project.NameKey parent , boolean createEmptyCommit , com.google.gerrit.extensions.client.SubmitType submitType ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = name ( nameSuffix ) ; in.parent = ( parent != null ) ? parent.get ( ) : null ; in.createEmptyCommit = createEmptyCommit ; in.submitType = submitType ; return createProject ( in ) ; }
Source:
private com.google.inject.Injector getPluginInjector ( java.nio.file.Path jarPath ) throws java.io.IOException { final java.lang.String pluginName = com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.plugins.JarPluginProvider.getJarPluginName ( jarPath ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( jarPath ) ) ; return initInjector.createChildInjector ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.PluginName.class ) . toInstance ( pluginName ) ; } } ) ; }

Target:
private com.google.inject.Injector getPluginInjector ( java.nio.file.Path jarPath ) throws java.io.IOException { final java.lang.String pluginName = com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.plugins.JarPluginProvider.getJarPluginName ( jarPath ) , com.google.gerrit.server.plugins.PluginUtil.nameOf ( jarPath ) ) ; return initInjector.createChildInjector ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.PluginName.class ) . toInstance ( pluginName ) ; } } ) ; }
Source:
private static java.lang.String getReviewCategoryDisplayInfo ( com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy reviewCategoryStrategy , com.google.gerrit.client.account.AccountInfo accountInfo ) { switch ( reviewCategoryStrategy ) { case NAME : return accountInfo.name ( ) ; case EMAIL : return accountInfo.email ( ) ; case USERNAME : return accountInfo.username ( ) ; case ABBREV : return com.google.gerrit.client.changes.ChangeTable.getAbbreviation ( accountInfo.name ( ) , " " ) ; default : return null ; } }

Target:
private static java.lang.String getReviewCategoryDisplayInfo ( com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy reviewCategoryStrategy , com.google.gerrit.client.info.AccountInfo accountInfo ) { switch ( reviewCategoryStrategy ) { case NAME : return accountInfo.name ( ) ; case EMAIL : return accountInfo.email ( ) ; case USERNAME : return accountInfo.username ( ) ; case ABBREV : return com.google.gerrit.client.changes.ChangeTable.getAbbreviation ( accountInfo.name ( ) , " " ) ; default : return null ; } }
Source:
private com.google.gerrit.server.account.AccountState missing ( final com.google.gerrit.client.reviewdb.Account.Id accountId ) { final com.google.gerrit.client.reviewdb.Account account = new com.google.gerrit.client.reviewdb.Account ( accountId ) ; final java.util.Set < java.lang.String > emails = java.util.Collections.emptySet ( ) ; return new com.google.gerrit.server.account.AccountState ( account , anonymous , anonymous , emails ) ; }

Target:
private com.google.gerrit.server.account.AccountState missingAccount ( final com.google.gerrit.client.reviewdb.Account.Id accountId ) { final com.google.gerrit.client.reviewdb.Account account = new com.google.gerrit.client.reviewdb.Account ( accountId ) ; final java.util.Set < java.lang.String > emails = java.util.Collections.emptySet ( ) ; return new com.google.gerrit.server.account.AccountState ( account , anonymous , anonymous , emails ) ; }
Source:
private void fireEvent ( com.google.gerrit.reviewdb.client.Branch.NameKey branchName , com.google.gerrit.common.Event event ) { for ( com.google.gerrit.common.ChangeHookRunner.EventListenerHolder holder : listeners.values ( ) ) { if ( isVisibleTo ( branchName , holder.user ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }

Target:
private void fireEvent ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.server.events.ChangeEvent event , com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.common.ChangeHookRunner.EventListenerHolder holder : listeners.values ( ) ) { if ( isVisibleTo ( change , holder.user , db ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }
Source:
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 ) ; }

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.permissions.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCanForceUpdate ( "refs/heads/master" , u ) ; }
Source:
private void addComment ( com.google.gerrit.acceptance.PushOneCommit.Result r , java.lang.String message , boolean omitDuplicateComments ) throws java.lang.Exception { com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput c = new com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput ( ) ; c.line = 1 ; c.message = message ; c.path = com.google.gerrit.acceptance.PushOneCommit.FILE_NAME ; com.google.gerrit.extensions.api.changes.ReviewInput in = newInput ( c ) ; in.omitDuplicateComments = omitDuplicateComments ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . revision ( r.getCommit ( ) . name ( ) ) . review ( in ) ; }

Target:
private void addComment ( com.google.gerrit.acceptance.PushOneCommit.Result r , java.lang.String message , boolean omitDuplicateComments , java.lang.Boolean unresolved ) throws java.lang.Exception { com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput c = new com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput ( ) ; c.line = 1 ; c.message = message ; c.path = com.google.gerrit.acceptance.PushOneCommit.FILE_NAME ; c.unresolved = unresolved ; com.google.gerrit.extensions.api.changes.ReviewInput in = newInput ( c ) ; in.omitDuplicateComments = omitDuplicateComments ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . revision ( r.getCommit ( ) . name ( ) ) . review ( in ) ; }
Source:
private void setUpMocks ( boolean rightEvent ) { java.util.concurrent.ScheduledThreadPoolExecutor pool = new com.ericsson.gerrit.plugins.syncevents.EventHandlerTest.PoolMock ( 1 ) ; if ( rightEvent ) { event = org.mockito.Mockito.mock ( com.google.gerrit.server.events.RefEvent.class ) ; } else { event = org.mockito.Mockito.mock ( com.google.gerrit.server.events.Event.class ) ; } eventHandler = new com.ericsson.gerrit.plugins.syncevents.EventHandler ( restSession , pool , com.ericsson.gerrit.plugins.syncevents.EventHandlerTest.PLUGIN_NAME ) ; }

Target:
private void setUpMocks ( boolean rightEvent ) { java.util.concurrent.ScheduledThreadPoolExecutor pool = new com.ericsson.gerrit.plugins.highavailability.event.EventHandlerTest.PoolMock ( 1 ) ; if ( rightEvent ) { event = org.mockito.Mockito.mock ( com.google.gerrit.server.events.RefEvent.class ) ; } else { event = org.mockito.Mockito.mock ( com.google.gerrit.server.events.Event.class ) ; } eventHandler = new com.ericsson.gerrit.plugins.highavailability.event.EventHandler ( eventForwarder , pool , com.ericsson.gerrit.plugins.highavailability.event.EventHandlerTest.PLUGIN_NAME ) ; }
Source:
public int getCost ( ) { return that.getCost ( ) ; }

Target:
public boolean match ( final T object ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( that.isMatchable ( ) , ( "match invoked, but child predicate %s " + "doesn't implement %s" ) , that , com.google.gerrit.server.query.Matchable.class . getName ( ) ) ; return ! ( that.asMatchable ( ) . match ( object ) ) ; }
Source:
private static int split ( java.lang.String line ) { int sp = line.indexOf ( ' ' ) ; int tab = line.indexOf ( '\t' ) ; if ( ( sp < 0 ) && ( tab < 0 ) ) { return - 1 ; } if ( ( sp < 0 ) && ( 0 <= tab ) ) { return tab ; } if ( ( 0 <= sp ) && ( tab < 0 ) ) { return sp ; } return java.lang.Math.min ( sp , tab ) ; }

Target:
public static com.google.gerrit.server.git.ProjectConfig read ( com.google.gerrit.server.git.MetaDataUpdate update , org.eclipse.jgit.lib.ObjectId id ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.server.git.ProjectConfig r = new com.google.gerrit.server.git.ProjectConfig ( update.getProjectName ( ) ) ; r.load ( update , id ) ; return r ; }
Source:
public void rendersTemplate ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.message.MessageTemplate template ; template = new com.cisco.gerrit.plugins.slack.message.MessageTemplate ( ) ; template.setChannel ( "general" ) ; template.setName ( "Mr. Developer" ) ; template.setAction ( "proposed" ) ; template.setNumber ( 1234 ) ; template.setProject ( "project" ) ; template.setBranch ( "master" ) ; template.setUrl ( "https://gerrit-review.googlesource.com/#/admin/projects/plugins/slack-integration" ) ; template.setMessage ( "This is a really great commit." ) ; java.lang.System.out.println ( template.render ( ) ) ; }

Target:
public void rendersTemplate ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.message.MessageTemplate template ; template = new com.cisco.gerrit.plugins.slack.message.MessageTemplate ( ) ; template.setChannel ( "testchannel" ) ; template.setName ( "Unit Tester" ) ; template.setAction ( "proposed" ) ; template.setProject ( "project" ) ; template.setBranch ( "master" ) ; template.setUrl ( "https://change/" ) ; template.setNumber ( 1234 ) ; template.setMessage ( "This is a really great commit." ) ; }
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.server.notedb.ChangeNotes.Factory.unwrap ( db ) . changes ( ) . get ( 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 , project , change ) . load ( ) ; }

Target:
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.server.notedb.ChangeNotes.Factory.unwrap ( db ) . changes ( ) . get ( changeId ) ; com.google.common.base.Preconditions.checkArgument ( ( change != null ) , "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 , project , change ) . load ( ) ; }
Source:
com.google.common.util.concurrent.ListeningExecutorService getIndexExecutor ( @ com.google.gerrit.server.config.GerritServerConfig org.eclipse.jgit.lib.Config config , com.google.gerrit.server.git.WorkQueue workQueue ) { int threads = this . threads ; if ( threads <= 0 ) { threads = config.getInt ( "index" , null , "threads" , 0 ) ; } if ( threads <= 0 ) { return com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor ( ) ; } return com.google.common.util.concurrent.MoreExecutors.listeningDecorator ( workQueue.createQueue ( threads , "index" ) ) ; }

Target:
com.google.common.util.concurrent.ListeningExecutorService getInteractiveIndexExecutor ( @ com.google.gerrit.server.config.GerritServerConfig org.eclipse.jgit.lib.Config config , com.google.gerrit.server.git.WorkQueue workQueue ) { if ( ( interactiveExecutor ) != null ) { return interactiveExecutor ; } int threads = this . threads ; if ( threads <= 0 ) { threads = config.getInt ( "index" , null , "threads" , 0 ) ; } if ( threads <= 0 ) { threads = ( ( java.lang.Runtime.getRuntime ( ) . availableProcessors ( ) ) / 2 ) + 1 ; } return com.google.common.util.concurrent.MoreExecutors.listeningDecorator ( workQueue.createQueue ( threads , "Index-Interactive" ) ) ; }
Source:
public void shouldCreateSharedDirectoryIfItDoesNotExist ( ) throws java.lang.Exception { java.io.File configuredDirectory = tempFolder.newFolder ( ) ; com.google.common.truth.Truth.assertThat ( configuredDirectory.delete ( ) ) . isTrue ( ) ; org.mockito.Mockito.when ( configMock.main ( ) . sharedDirectory ( ) ) . thenReturn ( configuredDirectory.getAbsolutePath ( ) ) ; java.nio.file.Path sharedDirectory = module.getSharedDirectory ( configMock ) ; com.google.common.truth.Truth.assertThat ( sharedDirectory.toFile ( ) . exists ( ) ) . isTrue ( ) ; }

Target:
public void setUp ( ) { module = new com.ericsson.gerrit.plugins.highavailability.Module ( configMock ) ; }
Source:
protected void setApiHeaders ( javax.servlet.http.HttpServletResponse res , com.google.gitiles.FormatType type ) { res.setContentType ( type.getMimeType ( ) ) ; res.setCharacterEncoding ( com.google.common.base.Charsets.UTF_8.name ( ) ) ; res.setHeader ( com.google.common.net.HttpHeaders.CONTENT_DISPOSITION , "attachment" ) ; res.setHeader ( com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN , "*" ) ; setCacheHeaders ( res ) ; }

Target:
protected void setApiHeaders ( javax.servlet.http.HttpServletResponse res , java.lang.String contentType ) { if ( ! ( com.google.common.base.Strings.isNullOrEmpty ( contentType ) ) ) { res.setContentType ( contentType ) ; } res.setCharacterEncoding ( com.google.common.base.Charsets.UTF_8.name ( ) ) ; res.setHeader ( com.google.common.net.HttpHeaders.CONTENT_DISPOSITION , "attachment" ) ; res.setHeader ( com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN , "*" ) ; setCacheHeaders ( res ) ; }
Source:
void audit ( com.google.gerrit.sshd.SshScope.Context ctx , java.lang.Object result , java.lang.String cmd ) { final java.lang.String sid = extractSessionId ( ctx ) ; final long created = extractCreated ( ctx ) ; auditService.dispatch ( new com.google.gerrit.audit.SshAuditEvent ( sid , extractCurrentUser ( ctx ) , cmd , created , null , result ) ) ; }

Target:
void audit ( com.google.gerrit.sshd.SshScope.Context ctx , java.lang.Object result , com.google.gerrit.sshd.DispatchCommand cmd ) { audit ( ctx , result , extractWhat ( cmd ) , extractParameters ( cmd ) ) ; }
Source:
public void insertComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) throws com.google.gwtorm.server.OrmException { verifyComment ( c ) ; com.google.common.base.Preconditions.checkArgument ( ( ( c.getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.PatchLineComment.Status.DRAFT ) ) , "Cannot insert a published comment into a ChangeDraftUpdate" ) ; if ( migration.readChanges ( ) ) { com.google.common.base.Preconditions.checkArgument ( ( ! ( changeNotes.containsComment ( c ) ) ) , ( "A comment already exists with the same key," + " so the following comment cannot be inserted: %s" ) , c ) ; } upsertComments.add ( c ) ; }

Target:
public void insertComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) throws com.google.gwtorm.server.OrmException { verifyComment ( c ) ; com.google.common.base.Preconditions.checkArgument ( ( ( c.getStatus ( ) ) == ( PatchLineComment.Status.DRAFT ) ) , "Cannot insert a published comment into a ChangeDraftUpdate" ) ; if ( migration.readChanges ( ) ) { com.google.common.base.Preconditions.checkArgument ( ( ! ( changeNotes.containsComment ( c ) ) ) , ( "A comment already exists with the same key," + " so the following comment cannot be inserted: %s" ) , c ) ; } upsertComments.add ( c ) ; }
Source:
public static java.lang.String shortestExample ( java.lang.String refPattern ) { if ( com.google.gerrit.server.project.RefPattern.isRE ( refPattern ) ) { try { return com.google.gerrit.server.project.RefPattern.exampleCache.get ( refPattern ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.common.base.Throwables.throwIfUnchecked ( e.getCause ( ) ) ; throw new java.lang.RuntimeException ( e ) ; } } else if ( refPattern.endsWith ( "/*" ) ) { return ( refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return refPattern ; } }

Target:
public static java.lang.String shortestExample ( java.lang.String refPattern ) { if ( com.google.gerrit.server.project.RefPattern.isRE ( refPattern ) ) { try { return com.google.gerrit.server.project.RefPattern.exampleCache.get ( refPattern ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.common.base.Throwables.propagateIfPossible ( e.getCause ( ) ) ; throw new java.lang.RuntimeException ( e ) ; } } else if ( refPattern.endsWith ( "/*" ) ) { return ( refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return refPattern ; } }
Source:
public void searchExternalGroups ( final java.lang.String searchFilter , final com.google.gwt.user.client.rpc.AsyncCallback < java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > > callback ) { final java.util.ArrayList < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > matches = new java.util.ArrayList < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > ( accountRealm.lookupGroups ( searchFilter ) ) ; java.util.Collections.sort ( matches , new java.util.Comparator < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > ( ) { @ java.lang.Override public int compare ( com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey a , com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey b ) { return a.get ( ) . compareTo ( b.get ( ) ) ; } } ) ; callback.onSuccess ( matches ) ; }

Target:
public void searchExternalGroups ( final java.lang.String searchFilter , final com.google.gwtjsonrpc.common.AsyncCallback < java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > > callback ) { final java.util.ArrayList < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > matches = new java.util.ArrayList < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > ( accountRealm.lookupGroups ( searchFilter ) ) ; java.util.Collections.sort ( matches , new java.util.Comparator < com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey > ( ) { @ java.lang.Override public int compare ( com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey a , com.google.gerrit.reviewdb.client.AccountGroup.ExternalNameKey b ) { return a.get ( ) . compareTo ( b.get ( ) ) ; } } ) ; callback.onSuccess ( matches ) ; }
Source:
void display ( final com.google.gerrit.client.plugins.PluginMap plugins ) { while ( 1 < ( table.getRowCount ( ) ) ) { table.removeRow ( ( ( table.getRowCount ( ) ) - 1 ) ) ; } for ( final com.google.gerrit.client.plugins.PluginInfo p : plugins.values ( ) . asList ( ) ) { final int row = table.getRowCount ( ) ; table.insertRow ( row ) ; applyDataRowStyle ( row ) ; populate ( row , p ) ; } }

Target:
void display ( final com.google.gerrit.client.plugins.PluginMap plugins ) { while ( 1 < ( table.getRowCount ( ) ) ) { table.removeRow ( ( ( table.getRowCount ( ) ) - 1 ) ) ; } for ( final com.google.gerrit.client.plugins.PluginInfo p : com.google.gerrit.client.rpc.Natives.asList ( plugins.values ( ) ) ) { final int row = table.getRowCount ( ) ; table.insertRow ( row ) ; applyDataRowStyle ( row ) ; populate ( row , p ) ; } }
Source:
private java.lang.String getPublicKeyPart ( int index , java.lang.String defaultValue ) { java.lang.String s = getSshPublicKey ( ) ; if ( ( s != null ) && ( ( s.length ( ) ) > 0 ) ) { java.lang.String [ ] parts = s.split ( " " ) ; if ( ( parts.length ) > index ) { return parts [ index ] ; } } return defaultValue ; }

Target:
private java.lang.String publicKeyPart ( int index , java.lang.String defaultValue ) { java.lang.String s = sshPublicKey ( ) ; if ( ( s != null ) && ( ( s.length ( ) ) > 0 ) ) { java.util.List < java.lang.String > parts = com.google.common.base.Splitter.on ( ' ' ) . splitToList ( s ) ; if ( ( parts.size ( ) ) > index ) { return parts.get ( index ) ; } } return defaultValue ; }
Source:
public void onKeyUp ( com.google.gwt.event.dom.client.KeyUpEvent event ) { subname = filterTxt.getValue ( ) ; refresh ( ( ( event.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) ) ; }

Target:
public void onKeyUp ( com.google.gwt.event.dom.client.KeyUpEvent event ) { boolean enterPressed = ( event.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ; if ( enterPressed || ( ! ( filterTxt.getValue ( ) . equals ( subname ) ) ) ) { subname = filterTxt.getValue ( ) ; refresh ( enterPressed ) ; } }
Source:
private boolean isPolyGerritCookie ( javax.servlet.http.HttpServletRequest req ) { com.google.gerrit.httpd.GerritOptions.UiPreference pref = options.defaultUi ( ) ; javax.servlet.http.Cookie [ ] all = req.getCookies ( ) ; if ( all != null ) { for ( javax.servlet.http.Cookie c : all ) { if ( com.google.gerrit.httpd.raw.StaticModule.GERRIT_UI_COOKIE.equals ( c.getName ( ) ) ) { java.lang.String v = c.getValue ( ) . toUpperCase ( ) ; pref = com.google.common.base.Enums.getIfPresent ( com.google.gerrit.httpd.GerritOptions.UiPreference.class , v ) . or ( pref ) ; break ; } } } return pref == ( com.google.gerrit.httpd.GerritOptions.UiPreference.POLYGERRIT ) ; }

Target:
private boolean isPolyGerritCookie ( javax.servlet.http.HttpServletRequest req ) { com.google.gerrit.extensions.client.UiType type = options.defaultUi ( ) ; javax.servlet.http.Cookie [ ] all = req.getCookies ( ) ; if ( all != null ) { for ( javax.servlet.http.Cookie c : all ) { if ( com.google.gerrit.httpd.raw.StaticModule.GERRIT_UI_COOKIE.equals ( c.getName ( ) ) ) { com.google.gerrit.extensions.client.UiType t = com.google.gerrit.extensions.client.UiType.parse ( c.getValue ( ) ) ; if ( t != null ) { type = t ; break ; } } } } return type == ( com.google.gerrit.extensions.client.UiType.POLYGERRIT ) ; }
Source:
private com.google.gerrit.reviewdb.client.PatchSet insertPatchSet ( com.google.gerrit.reviewdb.client.Change c ) throws java.lang.Exception { db.changes ( ) . upsert ( java.util.Collections.singleton ( c ) ) ; org.eclipse.jgit.revwalk.RevCommit commit = repo.branch ( c.currentPatchSetId ( ) . toRefName ( ) ) . commit ( ) . parent ( tip ) . create ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , commit , userId ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( ps ) ) ; return ps ; }

Target:
private com.google.gerrit.reviewdb.client.PatchSet insertPatchSet ( com.google.gerrit.reviewdb.client.Change c ) throws java.lang.Exception { db.changes ( ) . upsert ( java.util.Collections.singleton ( c ) ) ; org.eclipse.jgit.revwalk.RevCommit commit = repo.branch ( c.currentPatchSetId ( ) . toRefName ( ) ) . commit ( ) . parent ( tip ) . create ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , commit , userId ) ; updatePatchSetRef ( ps ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( ps ) ) ; return ps ; }
Source:
private < T extends com.google.gwt.core.client.JavaScriptObject > void send ( com.google.gwt.http.client.RequestBuilder.Method method , com.google.gwt.user.client.rpc.AsyncCallback < T > cb ) { com.google.gerrit.client.rpc.RestApi.HttpCallback < T > httpCallback = new com.google.gerrit.client.rpc.RestApi.HttpCallback < T > ( cb ) ; try { RpcStatus.INSTANCE.onRpcStart ( ) ; request ( method ) . sendRequest ( null , httpCallback ) ; } catch ( com.google.gwt.http.client.RequestException e ) { httpCallback.onError ( null , e ) ; } }

Target:
private < T extends com.google.gwt.core.client.JavaScriptObject > void sendRaw ( com.google.gwt.http.client.RequestBuilder.Method method , java.lang.String body , com.google.gwt.user.client.rpc.AsyncCallback < T > cb ) { com.google.gerrit.client.rpc.RestApi.HttpCallback < T > httpCallback = new com.google.gerrit.client.rpc.RestApi.HttpCallback < T > ( background , cb ) ; try { if ( ! ( background ) ) { RpcStatus.INSTANCE.onRpcStart ( ) ; } com.google.gwt.http.client.RequestBuilder req = request ( method ) ; req.setHeader ( "Content-Type" , com.google.gerrit.client.rpc.RestApi.TEXT_TYPE ) ; req.sendRequest ( body , httpCallback ) ; } catch ( com.google.gwt.http.client.RequestException e ) { httpCallback.onError ( null , e ) ; } }