auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public java.util.Optional < java.lang.String > getOptionalString ( java.lang.String fieldName ) { return getOptional ( fieldName ) . map ( new java.util.function.Function < com.googlesource.gerrit.plugins.manager.gson.SmartJson , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( com.googlesource.gerrit.plugins.manager.gson.SmartJson elem ) { if ( ! ( elem.jsonElem.isJsonPrimitive ( ) ) ) { throw new java.lang.IllegalArgumentException ( ( ( "cannot convert " + ( elem.jsonElem ) ) + " into a String" ) ) ; } return elem.jsonElem.getAsString ( ) ; } } ) ; }

Target:
public com.google.common.base.Optional < java.lang.String > getOptionalString ( java.lang.String fieldName ) { return getOptional ( fieldName ) . transform ( new com.google.common.base.Function < com.googlesource.gerrit.plugins.manager.gson.SmartJson , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( com.googlesource.gerrit.plugins.manager.gson.SmartJson elem ) { if ( ! ( elem.jsonElem.isJsonPrimitive ( ) ) ) { throw new java.lang.IllegalArgumentException ( ( ( "cannot convert " + ( elem.jsonElem ) ) + " into a String" ) ) ; } return elem.jsonElem.getAsString ( ) ; } } ) ; }
Source:
private void logRetry ( java.lang.String cause ) { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpClientProvider.log.debug ( ( ( ( "Retrying request to '" + ( cfg.getUrl ( ) ) ) + "' Cause: " ) + cause ) ) ; }

Target:
private void logRetry ( java.lang.String cause , org.apache.http.protocol.HttpContext context ) { if ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpClientProvider.log.isDebugEnabled ( ) ) { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpClientProvider.log.debug ( ( ( ( ( "Retrying request caused by '" + cause ) + "', request: '" ) + ( context.getAttribute ( "http.request" ) ) ) + "'" ) ) ; } }
Source:
public void skipWhenUserBelongsToGroupUUID ( ) throws java.lang.Exception { java.lang.String config = "[plugin \"uploadvalidator\"]\n" + ( ( "skipValidation=testOp\n" + "skipGroup=testGroup\n" ) + "skipGroup=anotherGroup" ) ; com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig validatorConfig = new com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig ( new com.googlesource.gerrit.plugins.uploadvalidator.FakeConfigFactory ( projectName , config ) , new com.googlesource.gerrit.plugins.uploadvalidator.FakeGroupCacheUUIDByName ( ) ) ; com.google.common.truth.Truth.assertThat ( validatorConfig.isEnabledForRef ( new com.googlesource.gerrit.plugins.uploadvalidator.FakeUserProvider ( "testGroup" , "yetAnotherGroup" ) . get ( ) , projectName , "anyRef" , "testOp" ) ) . isFalse ( ) ; }

Target:
public void skipWhenUserBelongsToGroupUUID ( ) throws java.lang.Exception { java.lang.String config = "[plugin \"uploadvalidator\"]\n" + ( ( "skipValidation=testOp\n" + "skipGroup=testGroup\n" ) + "skipGroup=anotherGroup" ) ; com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig validatorConfig = new com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig ( new com.googlesource.gerrit.plugins.uploadvalidator.FakeConfigFactory ( projectName , config ) , new com.googlesource.gerrit.plugins.uploadvalidator.FakeGroupByNameFinder ( ) ) ; com.google.common.truth.Truth.assertThat ( validatorConfig.isEnabledForRef ( new com.googlesource.gerrit.plugins.uploadvalidator.FakeUserProvider ( "testGroup" , "yetAnotherGroup" ) . get ( ) , projectName , "anyRef" , "testOp" ) ) . isFalse ( ) ; }
Source:
public java.lang.String onSubmit ( java.lang.String newCommitMessage , org.eclipse.jgit.revwalk.RevCommit original , org.eclipse.jgit.revwalk.RevCommit mergeTip , com.google.gerrit.server.project.ChangeControl ctl ) { java.util.List < java.lang.String > custom = mergeTip.getFooterLines ( "Custom" ) ; if ( ! ( custom.isEmpty ( ) ) ) { newCommitMessage += ( "Custom-Parent: " + ( custom.get ( 0 ) ) ) + "\n" ; } return ( newCommitMessage + "Custom: " ) + ( ctl.getChange ( ) . getDest ( ) . get ( ) ) ; }

Target:
public java.lang.String onSubmit ( java.lang.String newCommitMessage , org.eclipse.jgit.revwalk.RevCommit original , org.eclipse.jgit.revwalk.RevCommit mergeTip , com.google.gerrit.reviewdb.client.Branch.NameKey destination ) { java.util.List < java.lang.String > custom = mergeTip.getFooterLines ( "Custom" ) ; if ( ! ( custom.isEmpty ( ) ) ) { newCommitMessage += ( "Custom-Parent: " + ( custom.get ( 0 ) ) ) + "\n" ; } return ( newCommitMessage + "Custom: " ) + ( destination.get ( ) ) ; }
Source:
public void listBranchesHeadHidden ( ) throws java.lang.Exception { blockRead ( "refs/heads/master" ) ; pushTo ( "refs/heads/master" ) ; java.lang.String dev = pushTo ( "refs/heads/dev" ) . getCommit ( ) . name ( ) ; setApiUser ( user ) ; com.google.gerrit.acceptance.rest.project.BranchAssert.assertBranches ( com.google.common.collect.ImmutableList.of ( com.google.gerrit.acceptance.rest.project.ListBranchesIT.branch ( "refs/heads/dev" , dev , false ) ) , list ( ) . get ( ) ) ; }

Target:
public void listBranchesHeadHidden ( ) throws java.lang.Exception { blockRead ( "refs/heads/master" ) ; pushTo ( "refs/heads/master" ) ; java.lang.String dev = pushTo ( "refs/heads/dev" ) . getCommit ( ) . name ( ) ; setApiUser ( user ) ; com.google.gerrit.acceptance.rest.project.RefAssert.assertRefs ( com.google.common.collect.ImmutableList.of ( com.google.gerrit.acceptance.rest.project.ListBranchesIT.branch ( "refs/heads/dev" , dev , false ) ) , list ( ) . get ( ) ) ; }
Source:
public void testParseInvalid ( ) { com.google.gerrit.server.mail.AddressTest.assertInvalid ( "" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a<" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "<a" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "<a>" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a<a>" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a <a>" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a<@" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "<a@" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "<a@>" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a<a@>" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a <a@>" ) ; com.google.gerrit.server.mail.AddressTest.assertInvalid ( "a <@a>" ) ; }

Target:
public void testParseInvalid ( ) { assertInvalid ( "" ) ; assertInvalid ( "a" ) ; assertInvalid ( "a<" ) ; assertInvalid ( "<a" ) ; assertInvalid ( "<a>" ) ; assertInvalid ( "a<a>" ) ; assertInvalid ( "a <a>" ) ; assertInvalid ( "a" ) ; assertInvalid ( "a<@" ) ; assertInvalid ( "<a@" ) ; assertInvalid ( "<a@>" ) ; assertInvalid ( "a<a@>" ) ; assertInvalid ( "a <a@>" ) ; assertInvalid ( "a <@a>" ) ; }
Source:
private javax.mail.Address computeFrom ( ) throws javax.mail.internet.AddressException { if ( ( fromId ) != null ) { return toAddress ( fromId ) ; } final org.spearce.jgit.lib.PersonIdent pi = server.newGerritPersonIdent ( ) ; try { return new javax.mail.internet.InternetAddress ( pi.getName ( ) , pi.getEmailAddress ( ) ) ; } catch ( java.io.UnsupportedEncodingException e ) { return new javax.mail.internet.InternetAddress ( pi.getEmailAddress ( ) ) ; } }

Target:
private com.google.gerrit.server.mail.Address computeFrom ( ) { if ( ( fromId ) != null ) { return toAddress ( fromId ) ; } final org.spearce.jgit.lib.PersonIdent pi = server.newGerritPersonIdent ( ) ; return new com.google.gerrit.server.mail.Address ( pi.getName ( ) , pi.getEmailAddress ( ) ) ; }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.AccountSshKey > getKeys ( ) { com.google.common.base.Preconditions.checkState ( ( ( keys ) != null ) , "SSH keys not loaded yet" ) ; java.util.List < com.google.gerrit.reviewdb.client.AccountSshKey > result = new java.util.ArrayList < > ( ) ; for ( com.google.common.base.Optional < com.google.gerrit.reviewdb.client.AccountSshKey > key : keys.values ( ) ) { if ( key.isPresent ( ) ) { result.add ( key.get ( ) ) ; } } return result ; }

Target:
public void load ( org.eclipse.jgit.lib.Repository git ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { com.google.common.base.Preconditions.checkState ( ( ( this . git ) == null ) ) ; this . git = git ; super . load ( git ) ; }
Source:
public static java.lang.String getDestBranchName ( java.lang.String refName ) { java.lang.String magicBranch = com.google.gerrit.server.util.MagicBranch.NEW_CHANGE ; if ( refName.startsWith ( com.google.gerrit.server.util.MagicBranch.NEW_DRAFT_CHANGE ) ) { magicBranch = com.google.gerrit.server.util.MagicBranch.NEW_DRAFT_CHANGE ; } return refName.substring ( magicBranch.length ( ) ) ; }

Target:
public static java.lang.String getDestBranchName ( java.lang.String refName ) { java.lang.String magicBranch = com.google.gerrit.server.util.MagicBranch.NEW_CHANGE ; if ( refName.startsWith ( com.google.gerrit.server.util.MagicBranch.NEW_DRAFT_CHANGE ) ) { magicBranch = com.google.gerrit.server.util.MagicBranch.NEW_DRAFT_CHANGE ; } else if ( refName.startsWith ( com.google.gerrit.server.util.MagicBranch.NEW_PUBLISH_CHANGE ) ) { magicBranch = com.google.gerrit.server.util.MagicBranch.NEW_PUBLISH_CHANGE ; } return refName.substring ( magicBranch.length ( ) ) ; }
Source:
public com.google.common.collect.ImmutableSetMultimap < com.google.gerrit.server.notedb.ReviewerState , com.google.gerrit.reviewdb.client.Account.Id > getReviewers ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes ) throws com.google.gwtorm.server.OrmException { if ( ! ( migration.readPatchSetApprovals ( ) ) ) { return com.google.gerrit.server.ApprovalsUtil.getReviewers ( db.patchSetApprovals ( ) . byChange ( notes.getChangeId ( ) ) ) ; } return notes.load ( ) . getReviewers ( ) ; }

Target:
public com.google.common.collect.ImmutableSetMultimap < com.google.gerrit.server.notedb.ReviewerState , com.google.gerrit.reviewdb.client.Account.Id > getReviewers ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes ) throws com.google.gwtorm.server.OrmException { if ( ! ( migration.readChanges ( ) ) ) { return com.google.gerrit.server.ApprovalsUtil.getReviewers ( db.patchSetApprovals ( ) . byChange ( notes.getChangeId ( ) ) ) ; } return notes.load ( ) . getReviewers ( ) ; }
Source:
private void appendLineNumber ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx , boolean isForSideA ) { m.openTd ( ) ; m.setStyleName ( Gerrit.RESOURCES.css ( ) . lineNumber ( ) ) ; if ( isForSideA ) { m.addStyleName ( Gerrit.RESOURCES.css ( ) . rightBorder ( ) ) ; } m.append ( com.google.gwtexpui.safehtml.client.SafeHtml.asis ( ( ( "<a href=\"javascript:void(0)\">" + ( idx + 1 ) ) + "</a>" ) ) ) ; m.closeTd ( ) ; }

Target:
private void appendLineNumberForSideA ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx ) { m.openTd ( ) ; m.setStyleName ( Gerrit.RESOURCES.css ( ) . lineNumber ( ) ) ; m.addStyleName ( Gerrit.RESOURCES.css ( ) . rightBorder ( ) ) ; m.append ( com.google.gwtexpui.safehtml.client.SafeHtml.asis ( ( ( "<a href=\"javascript:void(0)\">" + ( idx + 1 ) ) + "</a>" ) ) ) ; m.closeTd ( ) ; }
Source:
public void rescheduleOnRecoverableException ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.HEADERS , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.BODY ) ) . thenThrow ( java.io.IOException.class ) ; 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 rescheduleOnRecoverableException ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( remote ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenThrow ( java.io.IOException.class ) ; 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:
public boolean equals ( java.lang.Object other ) { if ( ( other == null ) || ( ( getClass ( ) ) != ( other.getClass ( ) ) ) ) { return false ; } com.google.gerrit.server.index.IndexedQuery < ? , ? > o = ( ( com.google.gerrit.server.index.IndexedQuery < ? , ? > ) ( other ) ) ; return ( pred.equals ( o.pred ) ) && ( opts.equals ( o.opts ) ) ; }

Target:
public boolean equals ( java.lang.Object other ) { if ( ( other == null ) || ( ( getClass ( ) ) != ( other.getClass ( ) ) ) ) { return false ; } com.google.gerrit.index.IndexedQuery < ? , ? > o = ( ( com.google.gerrit.index.IndexedQuery < ? , ? > ) ( other ) ) ; return ( pred.equals ( o.pred ) ) && ( opts.equals ( o.opts ) ) ; }
Source:
private void addAllNotes ( org.eclipse.jgit.notes.NoteMap notes ) throws java.io.IOException { for ( org.eclipse.jgit.notes.Note n : notes ) { if ( ours.contains ( n ) ) { org.eclipse.jgit.notes.NoteMerger noteMerger = new com.google.gerrit.server.git.ReviewNoteMerger ( ) ; org.eclipse.jgit.lib.ObjectId noteContent = noteMerger.merge ( null , n , ours.getNote ( n ) , reader , inserter ) . getData ( ) ; ours.set ( n , noteContent ) ; } else { ours.set ( n , n.getData ( ) ) ; } } }

Target:
private void addAllNotes ( org.eclipse.jgit.notes.NoteMap notes ) throws java.io.IOException { for ( org.eclipse.jgit.notes.Note n : notes ) { if ( ours.contains ( n ) ) { org.eclipse.jgit.lib.ObjectId noteContent = getNoteMerger ( ) . merge ( null , n , ours.getNote ( n ) , reader , inserter ) . getData ( ) ; ours.set ( n , noteContent ) ; } else { ours.set ( n , n.getData ( ) ) ; } } }
Source:
public void testDoPostRefReplicationDoneEvent ( ) throws java.lang.Exception { java.lang.String event = "{\"project\":\"gerrit/test-sync-index\",\"ref\":" + ( "\"refs/changes/76/669676/2\",\"nodesCount\":1,\"type\":" + "\"ref-replication-done\",\"eventCreatedOn\":1451415011}" ) ; org.mockito.Mockito.when ( req.getReader ( ) ) . thenReturn ( new java.io.BufferedReader ( new java.io.StringReader ( event ) ) ) ; dispatcher.postEvent ( org.mockito.ArgumentMatchers.any ( com.ericsson.gerrit.plugins.syncevents.SyncEventsRestApiServletTest.RefReplicationDoneEvent.class ) ) ; syncEventsRestApiServlet.doPost ( req , rsp ) ; org.mockito.Mockito.verify ( rsp ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; }

Target:
public void testDoPostRefReplicationDoneEvent ( ) throws java.lang.Exception { java.lang.String event = "{\"project\":\"gerrit/some-project\",\"ref\":" + ( "\"refs/changes/76/669676/2\",\"nodesCount\":1,\"type\":" + "\"ref-replication-done\",\"eventCreatedOn\":1451415011}" ) ; org.mockito.Mockito.when ( req.getReader ( ) ) . thenReturn ( new java.io.BufferedReader ( new java.io.StringReader ( event ) ) ) ; dispatcher.postEvent ( org.mockito.ArgumentMatchers.any ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.EventRestApiServletTest.RefReplicationDoneEvent.class ) ) ; eventRestApiServlet.doPost ( req , rsp ) ; org.mockito.Mockito.verify ( rsp ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; }
Source:
public void byOwnerIn ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo = createProject ( "repo" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( newChangeForUser ( repo , userId ) ) ; com.google.gerrit.reviewdb.client.Account.Id user2 = accountManager.authenticate ( com.google.gerrit.server.account.AuthRequest.forUser ( "anotheruser" ) ) . getAccountId ( ) ; com.google.gerrit.reviewdb.client.Change change2 = insert ( newChangeForUser ( repo , user2 ) ) ; assertQuery ( "ownerin:Administrators" , change1 ) ; assertQuery ( "ownerin:\"Registered Users\"" , change2 , change1 ) ; }

Target:
public void byOwnerIn ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo = createProject ( "repo" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( repo , newChange ( repo ) , userId ) ; com.google.gerrit.reviewdb.client.Account.Id user2 = accountManager.authenticate ( com.google.gerrit.server.account.AuthRequest.forUser ( "anotheruser" ) ) . getAccountId ( ) ; com.google.gerrit.reviewdb.client.Change change2 = insert ( repo , newChange ( repo ) , user2 ) ; assertQuery ( "ownerin:Administrators" , change1 ) ; assertQuery ( "ownerin:\"Registered Users\"" , change2 , change1 ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.changes.Changes.class ) . to ( com.google.gerrit.server.api.changes.ChangesImpl.class ) ; factory ( ChangeApiImpl.Factory.class ) ; factory ( CommentApiImpl.Factory.class ) ; factory ( DraftApiImpl.Factory.class ) ; factory ( RevisionApiImpl.Factory.class ) ; factory ( FileApiImpl.Factory.class ) ; factory ( ReviewerApiImpl.Factory.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.changes.Changes.class ) . to ( com.google.gerrit.server.api.changes.ChangesImpl.class ) ; factory ( ChangeApiImpl.Factory.class ) ; factory ( CommentApiImpl.Factory.class ) ; factory ( RobotCommentApiImpl.Factory.class ) ; factory ( DraftApiImpl.Factory.class ) ; factory ( RevisionApiImpl.Factory.class ) ; factory ( FileApiImpl.Factory.class ) ; factory ( ReviewerApiImpl.Factory.class ) ; }
Source:
public static com.google.gerrit.server.account.AuthRequest forUser ( final java.lang.String username ) { final com.google.gerrit.reviewdb.client.AccountExternalId.Key i = new com.google.gerrit.reviewdb.client.AccountExternalId.Key ( com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_GERRIT , username ) ; final com.google.gerrit.server.account.AuthRequest r = new com.google.gerrit.server.account.AuthRequest ( i.get ( ) ) ; r.setUserName ( username ) ; return r ; }

Target:
public static com.google.gerrit.server.account.AuthRequest forUser ( java.lang.String username ) { com.google.gerrit.server.account.AuthRequest r = new com.google.gerrit.server.account.AuthRequest ( ExternalId.Key.create ( com.google.gerrit.server.account.ExternalId.SCHEME_GERRIT , username ) ) ; r.setUserName ( username ) ; return r ; }
Source:
public java.util.Set < com.googlesource.gerrit.plugins.its.base.workflow.Property > extractFrom ( com.google.gerrit.server.data.RefUpdateAttribute refUpdateAttribute ) { java.util.Set < com.googlesource.gerrit.plugins.its.base.workflow.Property > properties = com.google.common.collect.Sets.newHashSet ( ) ; properties.add ( propertyFactory.create ( "revision" , refUpdateAttribute.newRev ) ) ; properties.add ( propertyFactory.create ( "revision-old" , refUpdateAttribute.oldRev ) ) ; properties.add ( propertyFactory.create ( "project" , refUpdateAttribute.project ) ) ; properties.add ( propertyFactory.create ( "ref" , refUpdateAttribute.refName ) ) ; return properties ; }

Target:
public java.util.Set < com.googlesource.gerrit.plugins.its.base.workflow.Property > extractFrom ( com.google.gerrit.server.data.RefUpdateAttribute refUpdateAttribute ) { java.util.Set < com.googlesource.gerrit.plugins.its.base.workflow.Property > properties = com.google.common.collect.Sets.newHashSet ( ) ; properties.add ( propertyFactory.create ( "revision" , refUpdateAttribute.newRev ) ) ; properties.add ( propertyFactory.create ( "revision-old" , refUpdateAttribute.oldRev ) ) ; properties.add ( propertyFactory.create ( "revisionOld" , refUpdateAttribute.oldRev ) ) ; properties.add ( propertyFactory.create ( "project" , refUpdateAttribute.project ) ) ; properties.add ( propertyFactory.create ( "ref" , refUpdateAttribute.refName ) ) ; return properties ; }
Source:
public void testInheritRead_OverrideWithDeny ( ) { grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/*" ) . setDeny ( ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local ) ; assertFalse ( "can't read" , u.isVisible ( ) ) ; }

Target:
public void testInheritRead_OverrideWithDeny ( ) { com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/*" ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.REGISTERED , "refs/*" ) . setDeny ( ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local ) ; assertFalse ( "can't read" , u.isVisible ( ) ) ; }
Source:
private java.lang.String testLineOwnerPath ( java.lang.String line , java.lang.String s1 ) { return testLineOwnerPath ( line , s1 , mockedTestDir ( ) ) ; }

Target:
public void emptyParserResult ( ) { com.googlesource.gerrit.plugins.findowners.Parser.Result result = new com.googlesource.gerrit.plugins.findowners.Parser.Result ( ) ; com.google.common.truth.Truth.assertThat ( result.stopLooking ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( result.warnings ) . isEmpty ( ) ; com.google.common.truth.Truth.assertThat ( result.errors ) . isEmpty ( ) ; com.google.common.truth.Truth.assertThat ( result.owner2paths ) . isEmpty ( ) ; }
Source:
public boolean isOwner ( ) { if ( ( isOwner ) == null ) { com.google.gerrit.reviewdb.AccountGroup g = groupCache.get ( group.getOwnerGroupId ( ) ) ; com.google.gerrit.reviewdb.AccountGroup.UUID ownerUUID = ( g != null ) ? g.getGroupUUID ( ) : null ; isOwner = ( getCurrentUser ( ) . getEffectiveGroups ( ) . contains ( ownerUUID ) ) || ( getCurrentUser ( ) . isAdministrator ( ) ) ; } return isOwner ; }

Target:
public boolean isOwner ( ) { if ( ( isOwner ) == null ) { com.google.gerrit.reviewdb.AccountGroup g = groupCache.get ( group.getOwnerGroupId ( ) ) ; com.google.gerrit.reviewdb.AccountGroup.UUID ownerUUID = ( g != null ) ? g.getGroupUUID ( ) : null ; isOwner = ( getCurrentUser ( ) . getEffectiveGroups ( ) . contains ( ownerUUID ) ) || ( getCurrentUser ( ) . getCapabilities ( ) . canAdministrateServer ( ) ) ; } return isOwner ; }
Source:
public java.util.List < com.google.gerrit.server.project.ChangeControl > findChanges ( com.google.gerrit.reviewdb.client.Change.Id id ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.InternalChangeQuery query = queryProvider.get ( ) . setRequestedFields ( com.google.common.collect.ImmutableSet.< java.lang.String > of ( ) ) ; return asChangeControls ( query.byLegacyChangeId ( id ) ) ; }

Target:
public java.util.List < com.google.gerrit.server.project.ChangeControl > findChanges ( com.google.gerrit.reviewdb.client.Change.Id id , com.google.gerrit.server.CurrentUser user ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.InternalChangeQuery query = queryProvider.get ( ) . setRequestedFields ( com.google.common.collect.ImmutableSet.< java.lang.String > of ( ) ) ; return asChangeControls ( query.byLegacyChangeId ( id ) , user ) ; }
Source:
public void writeNoChanges ( ) throws java.lang.Exception { org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , modifier.createEdit ( change , ps ) ) ; try { modifier.modifyFile ( editUtil.byChange ( change ) . get ( ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME , com.google.gerrit.acceptance.edit.ChangeEditIT.CONTENT_OLD ) ; org.junit.Assert.fail ( ) ; } catch ( com.google.gerrit.server.project.InvalidChangeOperationException e ) { org.junit.Assert.assertEquals ( "no changes were made" , e.getMessage ( ) ) ; } }

Target:
public void createEmptyEditRest ( ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( adminSession.post ( urlEdit ( ) ) . getStatusCode ( ) ) . isEqualTo ( org.apache.http.HttpStatus.SC_NO_CONTENT ) ; com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( change ) ; com.google.gerrit.acceptance.edit.ChangeEditIT.assertByteArray ( fileUtil.getContent ( edit.get ( ) . getChange ( ) . getProject ( ) , edit.get ( ) . getRevision ( ) . get ( ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME ) , com.google.gerrit.acceptance.edit.ChangeEditIT.CONTENT_OLD ) ; }
Source:
public void run ( ) { cmA.setOption ( "mode" , ( b ? getContentType ( diff.meta_a ( ) ) : null ) ) ; cmB.setOption ( "mode" , ( b ? getContentType ( diff.meta_b ( ) ) : null ) ) ; }

Target:
public void onSuccess ( java.lang.Void result ) { if ( prefs.syntaxHighlighting ( ) ) { cmA.setOption ( "mode" , getContentType ( diff.meta_a ( ) ) ) ; cmB.setOption ( "mode" , getContentType ( diff.meta_b ( ) ) ) ; } }
Source:
public com.google.gerrit.testutil.InMemoryDatabase create ( ) throws com.google.gwtorm.client.OrmException { if ( ! ( created ) ) { created = true ; final com.google.gerrit.reviewdb.ReviewDb c = open ( ) ; try { try { new com.google.gerrit.server.schema.SchemaCreator ( new java.io.File ( "." ) , schemaVersion , null , new org.eclipse.jgit.lib.PersonIdent ( "name" , "email@site" ) ) . create ( c ) ; } catch ( java.io.IOException e ) { throw new com.google.gwtorm.client.OrmException ( "Cannot create in-memory database" , e ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new com.google.gwtorm.client.OrmException ( "Cannot create in-memory database" , e ) ; } } finally { c.close ( ) ; } } return this ; }

Target:
public com.google.gerrit.testutil.InMemoryDatabase create ( ) throws com.google.gwtorm.client.OrmException { if ( ! ( created ) ) { created = true ; final com.google.gerrit.reviewdb.ReviewDb c = open ( ) ; try { try { new com.google.gerrit.server.schema.SchemaCreator ( new java.io.File ( "." ) , schemaVersion , null , new com.google.gerrit.server.config.AllProjectsName ( "Test-Projects" ) , new org.eclipse.jgit.lib.PersonIdent ( "name" , "email@site" ) ) . create ( c ) ; } catch ( java.io.IOException e ) { throw new com.google.gwtorm.client.OrmException ( "Cannot create in-memory database" , e ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new com.google.gwtorm.client.OrmException ( "Cannot create in-memory database" , e ) ; } } finally { c.close ( ) ; } } return this ; }
Source:
public void manualCertificationDoesNotMatchExternalId ( ) throws java.lang.Exception { addExternalId ( "foo" , "otherId" , null ) ; com.google.gerrit.gpg.GerritPublicKeyChecker checker = checkerFactory.create ( user ) ; assertProblems ( checker.check ( com.google.gerrit.gpg.testutil.TestKeys.validKeyWithSecondUserId ( ) . getPublicKey ( ) ) , Status.BAD , ( "Key must contain a valid certification for one of the following " + ( ( ( "identities:\n" + " foo:otherId\n" ) + " gerrit:user\n" ) + " username:user" ) ) ) ; }

Target:
public void manualCertificationDoesNotMatchExternalId ( ) throws java.lang.Exception { addExternalId ( "foo" , "otherId" , null ) ; com.google.gerrit.gpg.PublicKeyChecker checker = checkerFactory.create ( ) . setExpectedUser ( user ) . disableTrust ( ) ; assertProblems ( checker.check ( com.google.gerrit.gpg.testutil.TestKeys.validKeyWithSecondUserId ( ) . getPublicKey ( ) ) , Status.BAD , ( "Key must contain a valid certification for one of the following " + ( ( ( "identities:\n" + " foo:otherId\n" ) + " gerrit:user\n" ) + " username:user" ) ) ) ; }
Source:
private java.util.List < com.google.gerrit.server.query.change.ChangeData > queryChangesForSha1 ( java.lang.String pullRequestSha1 ) { com.google.gerrit.server.query.QueryResult < com.google.gerrit.server.query.change.ChangeData > results ; try { results = qp.query ( changeQuery.commit ( pullRequestSha1 ) ) ; return results.entities ( ) ; } catch ( com.google.gwtorm.server.OrmException | com.google.gerrit.server.query.QueryParseException e ) { com.googlesource.gerrit.plugins.github.git.PullRequestCreateChange.LOG.error ( ( ( "Invalid SHA1 " + pullRequestSha1 ) + ": cannot query changes for this pull request" ) , e ) ; return java.util.Collections.emptyList ( ) ; } }

Target:
private java.util.List < com.google.gerrit.server.query.change.ChangeData > queryChangesForSha1 ( java.lang.String pullRequestSha1 ) { com.google.gerrit.index.query.QueryResult < com.google.gerrit.server.query.change.ChangeData > results ; try { results = qp.query ( changeQuery.commit ( pullRequestSha1 ) ) ; return results.entities ( ) ; } catch ( com.google.gwtorm.server.OrmException | com.google.gerrit.index.query.QueryParseException e ) { com.googlesource.gerrit.plugins.github.git.PullRequestCreateChange.LOG.error ( ( ( "Invalid SHA1 " + pullRequestSha1 ) + ": cannot query changes for this pull request" ) , e ) ; return java.util.Collections.emptyList ( ) ; } }
Source:
void onValueChange ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > event ) { com.google.gerrit.client.rpc.RestApi api = com.google.gerrit.client.changes.ChangeApi.revision ( patchSetId ) . view ( "files" ) . id ( path ) . view ( "reviewed" ) ; if ( event.getValue ( ) ) { api.put ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } else { api.delete ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } }

Target:
private com.google.gerrit.client.rpc.RestApi reviewed ( ) { return com.google.gerrit.client.changes.ChangeApi.revision ( patchSetId ) . view ( "files" ) . id ( path ) . view ( "reviewed" ) ; }
Source:
private com.google.gerrit.reviewdb.client.Change.Id getOrRegisterAccount ( com.google.gerrit.reviewdb.server.ReviewDb db , java.lang.String login , java.lang.String name , java.lang.String email ) 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 , org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.reviewdb.client.AccountExternalId.Key userExtKey = new com.google.gerrit.reviewdb.client.AccountExternalId.Key ( com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_USERNAME , login ) ; 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 ( login , name , email ) ; } return userExtId.getAccountId ( ) ; }

Target:
private java.util.Optional < com.google.gerrit.server.account.externalids.ExternalId > externalIdByScheme ( java.lang.String scheme , java.lang.String id ) { try { return java.util.Optional.ofNullable ( externalIds.get ( ExternalId.Key.create ( scheme , id ) ) ) ; } catch ( java.io.IOException | org.eclipse.jgit.errors.ConfigInvalidException e ) { com.googlesource.gerrit.plugins.github.git.PullRequestImportJob.LOG.error ( ( ( ( "Unable to get external id for " + scheme ) + ":" ) + id ) , e ) ; return java.util.Optional.empty ( ) ; } }
Source:
protected org.eclipse.jgit.lib.CommitBuilder applyImpl ( org.eclipse.jgit.lib.ObjectInserter ins ) throws com.google.gwtorm.server.OrmException , java.io.IOException { org.eclipse.jgit.lib.CommitBuilder cb = new org.eclipse.jgit.lib.CommitBuilder ( ) ; cb.setMessage ( "Update draft comments" ) ; java.util.concurrent.atomic.AtomicBoolean removedAllComments = new java.util.concurrent.atomic.AtomicBoolean ( ) ; org.eclipse.jgit.lib.ObjectId treeId = storeCommentsInNotes ( ins , removedAllComments ) ; if ( removedAllComments.get ( ) ) { return null ; } cb.setTreeId ( com.google.common.base.Preconditions.checkNotNull ( treeId ) ) ; return cb ; }

Target:
protected org.eclipse.jgit.lib.CommitBuilder applyImpl ( org.eclipse.jgit.revwalk.RevWalk rw , org.eclipse.jgit.lib.ObjectInserter ins , org.eclipse.jgit.lib.ObjectId curr ) throws com.google.gwtorm.server.OrmException , java.io.IOException { org.eclipse.jgit.lib.CommitBuilder cb = new org.eclipse.jgit.lib.CommitBuilder ( ) ; cb.setMessage ( "Update draft comments" ) ; try { org.eclipse.jgit.lib.ObjectId treeId = storeCommentsInNotes ( rw , ins , curr ) ; if ( treeId == null ) { return null ; } cb.setTreeId ( com.google.common.base.Preconditions.checkNotNull ( treeId ) ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } return cb ; }
Source:
protected void run ( ) throws java.lang.Exception { com.google.gerrit.server.project.SetHead.Input input = new com.google.gerrit.server.project.SetHead.Input ( ) ; input.ref = newHead ; try { setHead.apply ( new com.google.gerrit.server.project.ProjectResource ( project ) , input ) ; } catch ( com.google.gerrit.extensions.restapi.UnprocessableEntityException e ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( ( "fatal: " + ( e.getMessage ( ) ) ) ) ; } }

Target:
protected void run ( ) throws java.lang.Exception { com.google.gerrit.server.project.SetHead.Input input = new com.google.gerrit.server.project.SetHead.Input ( ) ; input.ref = newHead ; try { setHead.apply ( new com.google.gerrit.server.project.ProjectResource ( project ) , input ) ; } catch ( com.google.gerrit.extensions.restapi.UnprocessableEntityException e ) { throw die ( e ) ; } }
Source:
private com.google.common.collect.ImmutableList < com.google.gerrit.server.events.ReviewerDeletedEvent > getReviewerDeletedEvents ( int expectedSize ) { java.lang.String key = com.google.gerrit.server.events.ReviewerDeletedEvent.TYPE ; if ( expectedSize == 0 ) { com.google.common.truth.Truth.assertThat ( recordedEvents ) . doesNotContainKey ( key ) ; return com.google.common.collect.ImmutableList.of ( ) ; } com.google.common.truth.Truth.assertThat ( recordedEvents ) . containsKey ( key ) ; com.google.common.collect.ImmutableList < com.google.gerrit.server.events.ReviewerDeletedEvent > events = com.google.common.collect.FluentIterable.from ( recordedEvents.get ( key ) ) . transform ( new com.google.gerrit.acceptance.EventRecorder.RefEventTransformer < com.google.gerrit.server.events.ReviewerDeletedEvent > ( ) ) . toList ( ) ; com.google.common.truth.Truth.assertThat ( events ) . hasSize ( expectedSize ) ; return events ; }

Target:
private com.google.common.collect.ImmutableList < com.google.gerrit.server.events.ReviewerDeletedEvent > getReviewerDeletedEvents ( int expectedSize ) { java.lang.String key = com.google.gerrit.server.events.ReviewerDeletedEvent.TYPE ; if ( expectedSize == 0 ) { com.google.common.truth.Truth.assertThat ( recordedEvents ) . doesNotContainKey ( key ) ; return com.google.common.collect.ImmutableList.of ( ) ; } com.google.common.truth.Truth.assertThat ( recordedEvents ) . containsKey ( key ) ; com.google.common.collect.ImmutableList < com.google.gerrit.server.events.ReviewerDeletedEvent > events = com.google.common.collect.FluentIterable.from ( recordedEvents.get ( key ) ) . transform ( com.google.gerrit.server.events.ReviewerDeletedEvent.class :: cast ) . toList ( ) ; com.google.common.truth.Truth.assertThat ( events ) . hasSize ( expectedSize ) ; return events ; }
Source:
public com.google.gerrit.server.account.GroupControl controlFor ( final com.google.gerrit.server.CurrentUser who , final com.google.gerrit.reviewdb.client.AccountGroup.UUID groupId ) throws com.google.gerrit.common.errors.NoSuchGroupException { final com.google.gerrit.common.data.GroupDescription.Basic group = groupBackend.get ( groupId ) ; if ( group == null ) { throw new com.google.gerrit.common.errors.NoSuchGroupException ( groupId ) ; } return new com.google.gerrit.server.account.GroupControl ( who , group , groupBackend ) ; }

Target:
public com.google.gerrit.server.account.GroupControl controlFor ( com.google.gerrit.server.CurrentUser who , com.google.gerrit.reviewdb.client.AccountGroup.UUID groupId ) throws com.google.gerrit.common.errors.NoSuchGroupException { com.google.gerrit.common.data.GroupDescription.Basic group = groupBackend.get ( groupId ) ; if ( group == null ) { throw new com.google.gerrit.common.errors.NoSuchGroupException ( groupId ) ; } return new com.google.gerrit.server.account.GroupControl ( who , group , permissionBackend , groupBackend ) ; }
Source:
protected void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; java.lang.Class.forName ( com.mysql.jdbc.Driver.class . getName ( ) ) ; final java.lang.String host = "localhost" ; final java.lang.String database = "gwtorm" ; final java.lang.String user = "gwtorm" ; final java.lang.String pass = "gwtorm" ; final java.lang.String url = ( ( "jdbc:mysql://" + host ) + "/" ) + database ; db = java.sql.DriverManager.getConnection ( url , user , pass ) ; dialect = new com.google.gwtorm.schema.sql.DialectMySQL ( ) . refine ( db ) ; final java.util.Properties p = new java.util.Properties ( ) ; p.setProperty ( "driver" , com.mysql.jdbc.Driver.class . getName ( ) ) ; p.setProperty ( "url" , db.getMetaData ( ) . getURL ( ) ) ; p.setProperty ( "user" , user ) ; p.setProperty ( "password" , pass ) ; phoneBook = new com.google.gwtorm.jdbc.Database < com.google.gwtorm.data.PhoneBookDb > ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb.class ) ; phoneBook2 = new com.google.gwtorm.jdbc.Database < com.google.gwtorm.data.PhoneBookDb2 > ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb2.class ) ; drop ( "TABLE address_id" ) ; drop ( "TABLE addresses" ) ; drop ( "TABLE cnt" ) ; drop ( "TABLE foo" ) ; drop ( "TABLE people" ) ; }

Target:
protected void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; java.lang.Class.forName ( com.mysql.jdbc.Driver.class . getName ( ) ) ; final java.lang.String host = "localhost" ; final java.lang.String database = "gwtorm" ; final java.lang.String user = "gwtorm" ; final java.lang.String pass = "gwtorm" ; final java.lang.String url = ( ( "jdbc:mysql://" + host ) + "/" ) + database ; db = java.sql.DriverManager.getConnection ( url , user , pass ) ; executor = new com.google.gwtorm.jdbc.JdbcExecutor ( db ) ; dialect = new com.google.gwtorm.schema.sql.DialectMySQL ( ) . refine ( db ) ; final java.util.Properties p = new java.util.Properties ( ) ; p.setProperty ( "driver" , com.mysql.jdbc.Driver.class . getName ( ) ) ; p.setProperty ( "url" , db.getMetaData ( ) . getURL ( ) ) ; p.setProperty ( "user" , user ) ; p.setProperty ( "password" , pass ) ; phoneBook = new com.google.gwtorm.jdbc.Database < com.google.gwtorm.data.PhoneBookDb > ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb.class ) ; phoneBook2 = new com.google.gwtorm.jdbc.Database < com.google.gwtorm.data.PhoneBookDb2 > ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb2.class ) ; drop ( "TABLE address_id" ) ; drop ( "TABLE addresses" ) ; drop ( "TABLE cnt" ) ; drop ( "TABLE foo" ) ; drop ( "TABLE people" ) ; }
Source:
protected void onLoad ( ) { super . onLoad ( ) ; Util.ACCOUNT_SVC.myProjectWatch ( new com.google.gerrit.client.rpc.ScreenLoadCallback < java.util.List < com.google.gerrit.common.data.AccountProjectWatchInfo > > ( this ) { public void preDisplay ( final java.util.List < com.google.gerrit.common.data.AccountProjectWatchInfo > result ) { watches.display ( result ) ; } } ) ; }

Target:
protected void onLoad ( ) { super . onLoad ( ) ; populateWatches ( ) ; }
Source:
private void applyAllSuccess ( ) { if ( ( ( ! ( failed ) ) && ( finalAdded ) ) && ( remaining.isEmpty ( ) ) ) { for ( com.google.gerrit.client.rpc.CallbackGroup.CallbackImpl < ? > cb : callbacks ) { cb.applySuccess ( ) ; } callbacks.clear ( ) ; } }

Target:
public void applySuccess ( ) { com.google.gerrit.client.rpc.HttpCallback < T > cb = delegate ; if ( cb != null ) { delegate = null ; cb.onSuccess ( result ) ; result = null ; } }
Source:
public void stop ( ) { com.google.gerrit.server.index.ChangeIndex read = searchIndex.get ( ) ; if ( read != null ) { read.close ( ) ; } for ( com.google.gerrit.server.index.ChangeIndex write : writeIndexes ) { if ( write != read ) { write.close ( ) ; } } }

Target:
public void stop ( ) { com.google.gerrit.server.index.change.ChangeIndex read = searchIndex.get ( ) ; if ( read != null ) { read.close ( ) ; } for ( com.google.gerrit.server.index.change.ChangeIndex write : writeIndexes ) { if ( write != read ) { write.close ( ) ; } } }
Source:
public void testReplaceInOrder1 ( ) { final com.google.gwtexpui.safehtml.client.RawFindReplace [ ] repl = new com.google.gwtexpui.safehtml.client.RawFindReplace [ ] { new com.google.gwtexpui.safehtml.client.RawFindReplace ( "(GWTEXPUI-(\\d+))" , "<a href=\"gwtexpui-bug?$2\">$1</a>" ) , new com.google.gwtexpui.safehtml.client.RawFindReplace ( "(issue\\s+(\\d+))" , "<a href=\"generic-bug?$2\">$1</a>" ) } ; final com.google.gwtexpui.safehtml.client.SafeHtml o = com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.html ( "A\nissue 42\nReally GWTEXPUI-9918 is better\nB" ) ; final com.google.gwtexpui.safehtml.client.SafeHtml n = o.replaceAll ( java.util.Arrays.asList ( repl ) ) ; assertNotSame ( o , n ) ; assertEquals ( ( "A\n" + ( ( "<a href=\"generic-bug?42\">issue 42</a>\n" + "Really <a href=\"gwtexpui-bug?9918\">GWTEXPUI-9918</a> is better\n" ) + "B" ) ) , n.asString ( ) ) ; }

Target:
public void testReplaceOverlappingAtFirstCharFirstMatch ( ) { com.google.gwtexpui.safehtml.client.SafeHtml o = com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.html ( "abcd" ) ; com.google.gwtexpui.safehtml.client.RegexFindReplace ab1 = new com.google.gwtexpui.safehtml.client.RegexFindReplace ( "ab" , "AB" ) ; com.google.gwtexpui.safehtml.client.RegexFindReplace ab2 = new com.google.gwtexpui.safehtml.client.RegexFindReplace ( "[^cd][^cd]" , "12" ) ; assertEquals ( "ABcd" , o.replaceAll ( com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.repls ( ab1 , ab2 ) ) . asString ( ) ) ; assertEquals ( "12cd" , o.replaceAll ( com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.repls ( ab2 , ab1 ) ) . asString ( ) ) ; }
Source:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc , com.google.gerrit.extensions.client.GeneralPreferencesInfo input ) throws com.google.gerrit.extensions.restapi.BadRequestException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { if ( ! ( com.google.gerrit.server.restapi.config.SetPreferences.hasSetFields ( input ) ) ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "unsupported option" ) ; } com.google.gerrit.server.account.PreferencesConfig.validateMy ( input.my ) ; try ( com.google.gerrit.server.git.MetaDataUpdate md = metaDataUpdateFactory.get ( ) . create ( allUsersName ) ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo updatedPrefs = com.google.gerrit.server.account.PreferencesConfig.updateDefaultGeneralPreferences ( md , input ) ; accountCache.evictAllNoReindex ( ) ; return updatedPrefs ; } }

Target:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc , com.google.gerrit.extensions.client.GeneralPreferencesInfo input ) throws com.google.gerrit.extensions.restapi.BadRequestException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { if ( ! ( com.google.gerrit.server.restapi.config.SetPreferences.hasSetFields ( input ) ) ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "unsupported option" ) ; } com.google.gerrit.server.account.Preferences.validateMy ( input.my ) ; try ( com.google.gerrit.server.git.MetaDataUpdate md = metaDataUpdateFactory.get ( ) . create ( allUsersName ) ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo updatedPrefs = com.google.gerrit.server.account.Preferences.updateDefaultGeneralPreferences ( md , input ) ; accountCache.evictAllNoReindex ( ) ; return updatedPrefs ; } }
Source:
public void testUpsertTwoSecondExistsing ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 0 , 1 ) ; java.sql.PreparedStatement insert = stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.TWO_ROWS ) ; verifyIds ( insert , 1 ) ; }

Target:
public void testUpsertOneExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT ) ; createClassUnderTest ( ) . upsert ( oneRow ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertNotUsed ( insert ) ; }
Source:
static void deleteSessionCookie ( ) { com.google.gerrit.client.Gerrit.myAccount = null ; com.google.gerrit.client.Gerrit.myAccountDiffPref = null ; com.google.gerrit.client.Gerrit.myPrefs = com.google.gerrit.client.info.AccountPreferencesInfo.createDefault ( ) ; com.google.gerrit.client.Gerrit.xGerritAuth = null ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; com.google.gwt.user.client.Cookies.removeCookie ( "GerritAccount" ) ; }

Target:
static void deleteSessionCookie ( ) { com.google.gerrit.client.Gerrit.myAccount = com.google.gerrit.client.info.AccountInfo.create ( 0 , null , null , null ) ; com.google.gerrit.client.Gerrit.myAccountDiffPref = null ; com.google.gerrit.client.Gerrit.myPrefs = com.google.gerrit.client.info.AccountPreferencesInfo.createDefault ( ) ; com.google.gerrit.client.Gerrit.xGerritAuth = null ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; com.google.gwt.user.client.Cookies.removeCookie ( "GerritAccount" ) ; }
Source:
private void mergeImpl ( final com.google.gerrit.client.reviewdb.Branch.NameKey branch ) { try { new com.google.gerrit.git.MergeOp ( server , schema , replication , branch ) . merge ( ) ; } catch ( java.lang.Throwable e ) { com.google.gerrit.git.ChangeMergeQueue.log.error ( ( ( "Merge attempt for " + branch ) + " failed" ) , e ) ; } }

Target:
private void mergeImpl ( final com.google.gerrit.client.reviewdb.Branch.NameKey branch ) { try { new com.google.gerrit.git.MergeOp ( server , schema , replication , emailSender , branch ) . merge ( ) ; } catch ( java.lang.Throwable e ) { com.google.gerrit.git.ChangeMergeQueue.log.error ( ( ( "Merge attempt for " + branch ) + " failed" ) , e ) ; } }
Source:
protected org.eclipse.jgit.revwalk.RevCommit getRemoteHead ( com.google.gerrit.reviewdb.client.Project ... projects ) throws java.io.IOException { com.google.common.truth.Truth.assertThat ( projects.length ) . isLessThan ( 2 ) ; com.google.gerrit.reviewdb.client.Project.NameKey project = this . project ; if ( ( projects.length ) > 0 ) { project = projects [ 0 ] ; } try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( project ) ) { return getHead ( repo , "refs/heads/master" ) ; } }

Target:
protected org.eclipse.jgit.revwalk.RevCommit getRemoteHead ( com.google.gerrit.reviewdb.client.Project.NameKey project , java.lang.String branch ) throws java.io.IOException { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( project ) ) { return getHead ( repo , ( "refs/heads/" + branch ) ) ; } }
Source:
protected void migrateData ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.schema.UpdateUI ui ) throws java.sql.SQLException { ui.message ( ( "Migrate user preference showUserInReview to " + "reviewCategoryStrategy" ) ) ; java.sql.Statement stmt = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . createStatement ( ) ; try { stmt.executeUpdate ( ( "UPDATE accounts SET " + ( "REVIEW_CATEGORY_STRATEGY='NAME' " + "WHERE (SHOW_USER_IN_REVIEW='Y')" ) ) ) ; } finally { stmt.close ( ) ; } }

Target:
protected void migrateData ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.schema.UpdateUI ui ) throws java.sql.SQLException { ui.message ( ( "Migrate user preference showUserInReview to " + "reviewCategoryStrategy" ) ) ; try ( java.sql.Statement stmt = newStatement ( db ) ) { stmt.executeUpdate ( ( "UPDATE accounts SET " + ( "REVIEW_CATEGORY_STRATEGY='NAME' " + "WHERE (SHOW_USER_IN_REVIEW='Y')" ) ) ) ; } }