auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setUp ( ) throws java.lang.Exception { index = new com.google.gerrit.server.index.change.FakeChangeIndex ( FakeChangeIndex.V2 ) ; indexes = new com.google.gerrit.server.index.IndexCollection ( ) ; indexes.setSearchIndex ( index ) ; queryBuilder = new com.google.gerrit.server.index.change.FakeQueryBuilder ( indexes ) ; rewrite = new com.google.gerrit.server.index.change.IndexRewriter ( indexes , com.google.gerrit.server.index.IndexConfig.create ( 0 , 0 , 3 ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { index = new com.google.gerrit.server.index.change.FakeChangeIndex ( FakeChangeIndex.V2 ) ; indexes = new com.google.gerrit.server.index.change.ChangeIndexCollection ( ) ; indexes.setSearchIndex ( index ) ; queryBuilder = new com.google.gerrit.server.index.change.FakeQueryBuilder ( indexes ) ; rewrite = new com.google.gerrit.server.index.change.IndexRewriter ( indexes , com.google.gerrit.server.index.IndexConfig.create ( 0 , 0 , 3 ) ) ; }
Source:
public void submitWithRebaseWithoutAddPatchSetPermission ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.testing.Util.block ( cfg , Permission.ADD_PATCH_SET , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( cfg , Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( cfg , com.google.gerrit.common.data.Permission.forLabel ( com.google.gerrit.server.project.testing.Util.codeReview ( ) . getName ( ) ) , ( - 2 ) , 2 , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; saveProjectConfig ( project , cfg ) ; submitWithRebase ( user ) ; }

Target:
public void submitWithRebaseWithoutAddPatchSetPermission ( ) throws java.lang.Exception { com.google.gerrit.server.project.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.testing.Util.block ( cfg , Permission.ADD_PATCH_SET , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( cfg , Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( cfg , com.google.gerrit.common.data.Permission.forLabel ( com.google.gerrit.server.project.testing.Util.codeReview ( ) . getName ( ) ) , ( - 2 ) , 2 , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; saveProjectConfig ( project , cfg ) ; submitWithRebase ( user ) ; }
Source:
public boolean verifyAuthInfo ( java.lang.String authToken , java.lang.String operation , org.eclipse.jgit.lfs.lib.AnyLongObjectId id ) { com.google.common.base.Optional < com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken > token = processor.deserialize ( authToken ) ; if ( ! ( token.isPresent ( ) ) ) { return false ; } return new com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.Verifier ( token.get ( ) , operation , id ) . verify ( ) ; }

Target:
public boolean verifyAuthInfo ( java.lang.String authToken , java.lang.String operation , org.eclipse.jgit.lfs.lib.AnyLongObjectId id ) { java.util.Optional < com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken > token = processor.deserialize ( authToken ) ; if ( ! ( token.isPresent ( ) ) ) { return false ; } return new com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.Verifier ( token.get ( ) , operation , id ) . verify ( ) ; }
Source:
public void login ( final com.google.gerrit.server.account.AuthResult res , final boolean rememberMe ) { final com.google.gerrit.reviewdb.client.Account.Id id = res.getAccountId ( ) ; final com.google.gerrit.reviewdb.client.AccountExternalId.Key identity = res.getExternalId ( ) ; if ( ( val ) != null ) { manager.destroy ( key ) ; } key = manager.createKey ( id ) ; val = manager.createVal ( key , id , rememberMe , identity , null , null ) ; saveCookie ( ) ; }

Target:
public void login ( final com.google.gerrit.server.account.AuthResult res , final boolean rememberMe ) { final com.google.gerrit.reviewdb.client.Account.Id id = res.getAccountId ( ) ; final com.google.gerrit.reviewdb.client.AccountExternalId.Key identity = res.getExternalId ( ) ; if ( ( val ) != null ) { manager.destroy ( key ) ; } key = manager.createKey ( id ) ; val = manager.createVal ( key , id , rememberMe , identity , null , null ) ; saveCookie ( ) ; user = identified.create ( val.getAccountId ( ) ) ; }
Source:
public static void scheduleUpdate ( final com.google.gerrit.client.reviewdb.Project.NameKey project , final java.lang.String ref ) { for ( final org.spearce.jgit.transport.RemoteConfig cfg : com.google.gerrit.git.PushQueue.allConfigs ( ) ) { if ( com.google.gerrit.git.PushQueue.wouldPushRef ( cfg , ref ) ) { for ( final org.spearce.jgit.transport.URIish uri : cfg.getURIs ( ) ) { com.google.gerrit.git.PushQueue.scheduleImp ( project , ref , cfg , com.google.gerrit.git.PushQueue.expandURI ( uri , project ) ) ; } } } }

Target:
public static void scheduleUpdate ( final com.google.gerrit.client.reviewdb.Project.NameKey project , final java.lang.String ref ) { for ( final com.google.gerrit.git.PushQueue.ReplicationConfig cfg : com.google.gerrit.git.PushQueue.allConfigs ( ) ) { if ( cfg.wouldPushRef ( ref ) ) { for ( final org.spearce.jgit.transport.URIish uri : cfg.getURIs ( project ) ) { com.google.gerrit.git.PushQueue.scheduleImp ( project , ref , cfg , uri ) ; } } } }
Source:
private static com.google.common.base.Optional < com.google.gerrit.common.data.SubmitRecord > findOkRecord ( java.util.Collection < com.google.gerrit.common.data.SubmitRecord > in ) { return com.google.common.collect.Iterables.tryFind ( in , new com.google.common.base.Predicate < com.google.gerrit.common.data.SubmitRecord > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.common.data.SubmitRecord input ) { return ( input.status ) == ( SubmitRecord.Status.OK ) ; } } ) ; }

Target:
private static com.google.common.base.Optional < com.google.gerrit.common.data.SubmitRecord > findOkRecord ( java.util.Collection < com.google.gerrit.common.data.SubmitRecord > in ) { if ( in == null ) { return com.google.common.base.Optional.absent ( ) ; } return com.google.common.collect.Iterables.tryFind ( in , new com.google.common.base.Predicate < com.google.gerrit.common.data.SubmitRecord > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.common.data.SubmitRecord input ) { return ( input.status ) == ( SubmitRecord.Status.OK ) ; } } ) ; }
Source:
private void initFileSystemFactory ( ) { setFileSystemFactory ( new org.apache.sshd.common.file.FileSystemFactory ( ) { @ java.lang.Override public org.apache.sshd.common.file.FileSystemView createFileSystemView ( org.apache.sshd.common.Session session ) throws java.io.IOException { return new org.apache.sshd.common.file.FileSystemView ( ) { @ java.lang.Override public org.apache.sshd.common.file.SshFile getFile ( org.apache.sshd.common.file.SshFile baseDir , java.lang.String file ) { return null ; } @ java.lang.Override public org.apache.sshd.common.file.SshFile getFile ( java.lang.String file ) { return null ; } @ java.lang.Override public org.apache.sshd.common.file.FileSystemView getNormalizedView ( ) { return this ; } } ; } } ) ; }

Target:
private void initForwarding ( ) { setTcpipForwardingFilter ( new org.apache.sshd.server.forward.ForwardingFilter ( ) { @ java.lang.Override public boolean canForwardAgent ( org.apache.sshd.common.session.Session session ) { return false ; } @ java.lang.Override public boolean canForwardX11 ( org.apache.sshd.common.session.Session session ) { return false ; } @ java.lang.Override public boolean canListen ( org.apache.sshd.common.util.net.SshdSocketAddress address , org.apache.sshd.common.session.Session session ) { return false ; } @ java.lang.Override public boolean canConnect ( com.google.gerrit.sshd.Type type , org.apache.sshd.common.util.net.SshdSocketAddress address , org.apache.sshd.common.session.Session session ) { return false ; } } ) ; setTcpipForwarderFactory ( new org.apache.sshd.common.forward.DefaultTcpipForwarderFactory ( ) ) ; }
Source:
public void testSortWithRegex ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "^refs/heads/.*" ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "^refs/heads/.*-QA-.*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can read" , u.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; org.junit.Assert.assertTrue ( "d can read" , d.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; }

Target:
public void testSortWithRegex ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "^refs/heads/.*" ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "^refs/heads/.*-QA-.*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can read" , u.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; org.junit.Assert.assertTrue ( "d can read" , d.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; }
Source:
public com.google.gerrit.server.project.ConfigInfo apply ( com.google.gerrit.server.project.ProjectResource rsrc , com.google.gerrit.server.project.PutConfig.Input input ) throws com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gerrit.extensions.restapi.ResourceNotFoundException { if ( ! ( rsrc.getControl ( ) . isOwner ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( rsrc.getName ( ) ) ; } return apply ( rsrc.getControl ( ) , input ) ; }

Target:
public com.google.gerrit.server.project.ConfigInfo apply ( com.google.gerrit.server.project.ProjectResource rsrc , com.google.gerrit.extensions.api.projects.ConfigInput input ) throws com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gerrit.extensions.restapi.ResourceNotFoundException { if ( ! ( rsrc.getControl ( ) . isOwner ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( rsrc.getName ( ) ) ; } return apply ( rsrc.getControl ( ) , input ) ; }
Source:
protected void assertCherryPick ( org.eclipse.jgit.api.Git localGit , boolean contentMerge ) throws java.io.IOException { assertRebase ( localGit , contentMerge ) ; org.eclipse.jgit.revwalk.RevCommit remoteHead = getRemoteHead ( ) ; com.google.common.truth.Truth.assertThat ( remoteHead.getFooterLines ( "Reviewed-On" ) ) . isNotEmpty ( ) ; com.google.common.truth.Truth.assertThat ( remoteHead.getFooterLines ( "Reviewed-By" ) ) . isNotEmpty ( ) ; }

Target:
protected void assertCherryPick ( org.eclipse.jgit.junit.TestRepository < ? > testRepo , boolean contentMerge ) throws java.io.IOException { assertRebase ( testRepo , contentMerge ) ; org.eclipse.jgit.revwalk.RevCommit remoteHead = getRemoteHead ( ) ; com.google.common.truth.Truth.assertThat ( remoteHead.getFooterLines ( "Reviewed-On" ) ) . isNotEmpty ( ) ; com.google.common.truth.Truth.assertThat ( remoteHead.getFooterLines ( "Reviewed-By" ) ) . isNotEmpty ( ) ; }
Source:
public void changeAssigneeOnReviewableChange ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; com.google.gerrit.acceptance.TestAccount other = accounts.create ( "other" , "other@example.com" , "other" ) ; assign ( sc , sc.owner , other ) ; sender.clear ( ) ; assign ( sc , sc.owner , assignee ) ; assertThat ( sender ) . sent ( "setassignee" , sc ) . notTo ( sc.owner , sc.reviewer , sc.ccer , sc.starrer , other ) . to ( sc.reviewerByEmail ) . cc ( sc.ccerByEmail ) . to ( assignee ) ; }

Target:
public void changeAssigneeToSelfOnReviewableChangeInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; assign ( sc , sc.owner , sc.assignee ) ; sender.clear ( ) ; assign ( sc , sc.owner , sc.owner ) ; assertThat ( sender ) . sent ( "setassignee" , sc ) . notTo ( sc.owner , sc.reviewer , sc.ccer , sc.starrer , sc.assignee ) . to ( sc.reviewerByEmail ) . cc ( sc.ccerByEmail ) ; }
Source:
void stop ( ) throws java.lang.Exception { com.google.gerrit.lifecycle.LifecycleManager manager = com.google.gerrit.acceptance.GerritServer.get ( daemon , "manager" ) ; java.lang.System.out.println ( "Gerrit Server Shutdown" ) ; manager.stop ( ) ; daemonService.shutdownNow ( ) ; daemonService.awaitTermination ( java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; com.google.gerrit.acceptance.TempFileUtil.recursivelyDelete ( sitePath ) ; org.eclipse.jgit.lib.RepositoryCache.clear ( ) ; }

Target:
void stop ( ) throws java.lang.Exception { daemon.getLifecycleManager ( ) . stop ( ) ; if ( ( daemonService ) != null ) { java.lang.System.out.println ( "Gerrit Server Shutdown" ) ; daemonService.shutdownNow ( ) ; daemonService.awaitTermination ( java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; } if ( ( sitePath ) != null ) { com.google.gerrit.acceptance.TempFileUtil.recursivelyDelete ( sitePath ) ; } org.eclipse.jgit.lib.RepositoryCache.clear ( ) ; }
Source:
public boolean match ( com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { java.util.List < java.lang.String > files = object.currentFilePaths ( ) ; if ( files != null ) { return ( java.util.Collections.binarySearch ( files , value ) ) >= 0 ; } else { return true ; } }

Target:
static com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > create ( com.google.gerrit.server.query.change.ChangeQueryBuilder.Arguments args , java.lang.String value ) { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > eqPath = new com.google.gerrit.server.query.change.EqualsPathPredicate ( ChangeQueryBuilder.FIELD_FILE , value ) ; if ( ! ( args.indexes.getSearchIndex ( ) . getSchema ( ) . getFields ( ) . containsKey ( ChangeField.FILE_PART.getName ( ) ) ) ) { return eqPath ; } return com.google.gerrit.server.query.Predicate.or ( eqPath , new com.google.gerrit.server.query.change.EqualsFilePredicate ( value ) ) ; }
Source:
public void inheritSubmit_AllowInChildDoesntAffectUnblockInParent ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertNotBlocked ( com.google.gerrit.common.data.Permission.SUBMIT , "refs/heads/master" , u ) ; }

Target:
public void inheritSubmit_AllowInChildDoesntAffectUnblockInParent ( ) { com.google.gerrit.server.project.testing.Util.block ( parent , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.SUBMIT , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertNotBlocked ( com.google.gerrit.common.data.Permission.SUBMIT , "refs/heads/master" , u ) ; }
Source:
public void setUsername ( java.lang.String username ) { this . username = username ; resetSession ( ) ; }

Target:
public com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing conduitPing ( ) throws com.googlesource.gerrit.plugins.its.phabricator.conduit.ConduitException { java.util.Map < java.lang.String , java.lang.Object > params = new java.util.HashMap < > ( ) ; com.google.gson.JsonElement callResult = conduitConnection.call ( "conduit.ping" , params , token ) ; com.google.gson.JsonObject callResultWrapper = new com.google.gson.JsonObject ( ) ; callResultWrapper.add ( "hostname" , callResult ) ; com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing result = gson.fromJson ( callResultWrapper , com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing.class ) ; return result ; }
Source:
private void load ( ) throws java.io.IOException { if ( ( migration.write ( ) ) && ( ( getRevision ( ) ) == null ) ) { org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( getProjectName ( ) ) ; try { load ( repo ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new java.io.IOException ( e ) ; } finally { repo.close ( ) ; } } }

Target:
private void load ( ) throws java.io.IOException { if ( ( migration.write ( ) ) && ( ( getRevision ( ) ) == null ) ) { org.eclipse.jgit.lib.Repository repo = repoManager.openMetadataRepository ( getProjectName ( ) ) ; try { load ( repo ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new java.io.IOException ( e ) ; } finally { repo.close ( ) ; } } }
Source:
public void newPatchSetOnReviewableWipChangeInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%wip" , sc.owner ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . notTo ( sc.owner ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . to ( sc.reviewer , sc.ccer ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; }

Target:
public void newPatchSetOnWipChangeSettingReadyInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%ready" , sc.owner ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . notTo ( sc.owner ) . to ( sc.reviewer , sc.ccer ) . to ( sc.reviewerByEmail ) . cc ( sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; assertThat ( sender ) . notSent ( ) ; }
Source:
public void confirmAlreadyInUse_UnprocessableEntity ( ) throws java.lang.Exception { com.google.gerrit.server.config.ConfirmEmail.Input in = new com.google.gerrit.server.config.ConfirmEmail.Input ( ) ; in.token = emailTokenVerifier.encode ( admin.getId ( ) , user.email ) ; com.google.gerrit.acceptance.rest.config.RestResponse r = adminSession.put ( "/config/server/email.confirm" , in ) ; assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_UNPROCESSABLE_ENTITY ) ; }

Target:
public void confirmAlreadyInUse_UnprocessableEntity ( ) throws java.lang.Exception { com.google.gerrit.server.config.ConfirmEmail.Input in = new com.google.gerrit.server.config.ConfirmEmail.Input ( ) ; in.token = emailTokenVerifier.encode ( admin.getId ( ) , user.email ) ; adminRestSession.put ( "/config/server/email.confirm" , in ) . assertUnprocessableEntity ( ) ; }
Source:
private com.google.gerrit.reviewdb.client.ChangeMessage message ( final com.google.gerrit.reviewdb.client.Change c , final java.lang.String body ) { final java.lang.String uuid ; try { uuid = com.google.gerrit.server.ChangeUtil.messageUUID ( db ) ; } catch ( com.google.gwtorm.server.OrmException e ) { return null ; } final com.google.gerrit.reviewdb.client.ChangeMessage m = new com.google.gerrit.reviewdb.client.ChangeMessage ( new com.google.gerrit.reviewdb.client.ChangeMessage.Key ( c.getId ( ) , uuid ) , null , c.currentPatchSetId ( ) ) ; m.setMessage ( body ) ; return m ; }

Target:
private com.google.gerrit.reviewdb.client.ChangeMessage message ( com.google.gerrit.reviewdb.client.Change c , java.lang.String body ) { java.lang.String uuid ; try { uuid = com.google.gerrit.server.ChangeUtil.messageUUID ( db ) ; } catch ( com.google.gwtorm.server.OrmException e ) { return null ; } com.google.gerrit.reviewdb.client.ChangeMessage m = new com.google.gerrit.reviewdb.client.ChangeMessage ( new com.google.gerrit.reviewdb.client.ChangeMessage.Key ( c.getId ( ) , uuid ) , null , com.google.gerrit.common.TimeUtil.nowTs ( ) , c.currentPatchSetId ( ) ) ; m.setMessage ( body ) ; return m ; }
Source:
public boolean exists ( final java.lang.String externalId ) throws com.google.gerrit.server.account.AccountException { try { final com.google.gerrit.client.reviewdb.ReviewDb db = schema.open ( ) ; try { return ( db.accountExternalIds ( ) . get ( new com.google.gerrit.client.reviewdb.AccountExternalId.Key ( externalId ) ) ) != null ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { throw new com.google.gerrit.server.account.AccountException ( ( "Cannot lookup account " + externalId ) , e ) ; } }

Target:
public Account.Id lookup ( final java.lang.String externalId ) throws com.google.gerrit.server.account.AccountException { try { final com.google.gerrit.client.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.client.reviewdb.AccountExternalId ext = db.accountExternalIds ( ) . get ( new com.google.gerrit.client.reviewdb.AccountExternalId.Key ( externalId ) ) ; return ext != null ? ext.getAccountId ( ) : null ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { throw new com.google.gerrit.server.account.AccountException ( ( "Cannot lookup account " + externalId ) , e ) ; } }
Source:
public boolean canFastForward ( com.google.gerrit.server.git.MergeSorter mergeSorter , com.google.gerrit.server.git.CodeReviewCommit mergeTip , com.google.gerrit.server.git.CodeReviewCommit.CodeReviewRevWalk rw , com.google.gerrit.server.git.CodeReviewCommit toMerge ) throws com.google.gerrit.server.git.MergeException { if ( hasMissingDependencies ( mergeSorter , toMerge ) ) { return false ; } try { return ( mergeTip == null ) || ( rw.isMergedInto ( mergeTip , toMerge ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.MergeException ( "Cannot fast-forward test during merge" , e ) ; } }

Target:
public boolean canFastForward ( com.google.gerrit.server.git.MergeSorter mergeSorter , com.google.gerrit.server.git.CodeReviewCommit mergeTip , com.google.gerrit.server.git.CodeReviewCommit.CodeReviewRevWalk rw , com.google.gerrit.server.git.CodeReviewCommit toMerge ) throws com.google.gerrit.server.git.IntegrationException { if ( hasMissingDependencies ( mergeSorter , toMerge ) ) { return false ; } try { return ( mergeTip == null ) || ( rw.isMergedInto ( mergeTip , toMerge ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.IntegrationException ( "Cannot fast-forward test during merge" , e ) ; } }
Source:
public void evictDefault ( ) throws java.io.IOException , javax.servlet.ServletException { configureMocksFor ( Constants.DEFAULT ) ; servlet.doPost ( request , response ) ; verifyAll ( ) ; }

Target:
public void badRequest ( ) throws java.lang.Exception { org.mockito.Mockito.when ( request.getPathInfo ( ) ) . thenReturn ( "/someCache" ) ; java.lang.String errorMessage = "someError" ; org.mockito.Mockito.doThrow ( new java.io.IOException ( errorMessage ) ) . when ( request ) . getReader ( ) ; servlet.doPost ( request , response ) ; org.mockito.Mockito.verify ( response ) . sendError ( javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST , errorMessage ) ; }
Source:
public void createdOnIsPopulatedForGroupsCreatedAfterAudit ( ) throws java.lang.Exception { java.sql.Timestamp testStartTime = com.google.gerrit.common.TimeUtil.nowTs ( ) ; com.google.gerrit.reviewdb.client.AccountGroup.Id groupId = createGroup ( "Group for schema migration" ) ; setCreatedOnToVeryOldTimestamp ( groupId ) ; schema151.migrateData ( db , new com.google.gerrit.testutil.TestUpdateUI ( ) ) ; com.google.gerrit.reviewdb.client.AccountGroup group = db.accountGroups ( ) . get ( groupId ) ; com.google.common.truth.Truth.assertThat ( group.getCreatedOn ( ) ) . isAtLeast ( testStartTime ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { testEnv.getInjector ( ) . injectMembers ( this ) ; db = testEnv.getDb ( ) ; com.google.common.truth.TruthJUnit.assume ( ) . that ( ( ( db ) instanceof com.google.gwtorm.jdbc.JdbcSchema ) ) . isTrue ( ) ; connection = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) ; createdOnRetrieval = connection.prepareStatement ( "SELECT created_on FROM account_groups WHERE group_id = ?" ) ; createdOnUpdate = connection.prepareStatement ( "UPDATE account_groups SET created_on = ? WHERE group_id = ?" ) ; auditEntryDeletion = connection.prepareStatement ( "DELETE FROM account_group_members_audit WHERE group_id = ?" ) ; }
Source:
protected void configure ( ) { com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.common.ChangeListener.class ) . to ( com.googlesource.gerrit.plugins.reviewersbyblame.ChangeUpdatedListener.class ) ; factory ( ReviewersByBlame.Factory.class ) ; bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( "maxReviewers" ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Max Reviewers" , 3 , true , ( "The maximum number of reviewers that should be automatically added" + " to a change based on the git blame computation on the changed files." ) ) ) ; }

Target:
protected void configure ( ) { com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.common.EventListener.class ) . to ( com.googlesource.gerrit.plugins.reviewersbyblame.ChangeUpdatedListener.class ) ; factory ( ReviewersByBlame.Factory.class ) ; bind ( com.google.gerrit.server.config.ProjectConfigEntry.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.Exports.named ( "maxReviewers" ) ) . toInstance ( new com.google.gerrit.server.config.ProjectConfigEntry ( "Max Reviewers" , 3 , true , ( "The maximum number of reviewers that should be automatically added" + " to a change based on the git blame computation on the changed files." ) ) ) ; }
Source:
private void initDescription ( ) { final com.google.gwt.user.client.ui.VerticalPanel vp = new com.google.gwt.user.client.ui.VerticalPanel ( ) ; vp.add ( new com.google.gerrit.client.ui.SmallHeading ( Util.C.headingDescription ( ) ) ) ; descTxt = new com.google.gwtexpui.globalkey.client.NpTextArea ( ) ; descTxt.setVisibleLines ( 6 ) ; descTxt.setCharacterWidth ( 60 ) ; vp.add ( descTxt ) ; add ( vp ) ; saveEnabler = new com.google.gerrit.client.ui.OnEditEnabler ( saveProject ) ; saveEnabler.listenTo ( descTxt ) ; }

Target:
private void initDescription ( ) { final com.google.gwt.user.client.ui.VerticalPanel vp = new com.google.gwt.user.client.ui.VerticalPanel ( ) ; vp.add ( new com.google.gerrit.client.ui.SmallHeading ( AdminConstants.I.headingDescription ( ) ) ) ; descTxt = new com.google.gwtexpui.globalkey.client.NpTextArea ( ) ; descTxt.setVisibleLines ( 6 ) ; descTxt.setCharacterWidth ( 60 ) ; vp.add ( descTxt ) ; add ( vp ) ; saveEnabler = new com.google.gerrit.client.ui.OnEditEnabler ( saveProject ) ; saveEnabler.listenTo ( descTxt ) ; }
Source:
protected void configureServlets ( ) { java.lang.Class < ? extends javax.servlet.Filter > authFilter ; if ( authConfig.isTrustContainerAuth ( ) ) { authFilter = com.google.gerrit.httpd.ContainerAuthFilter.class ; } else { authFilter = com.google.gerrit.httpd.ProjectDigestFilter.class ; } java.lang.String git = GitOverHttpServlet.URL_REGEX ; filterRegex ( git ) . through ( authFilter ) ; serveRegex ( git ) . with ( com.google.gerrit.httpd.GitOverHttpServlet.class ) ; }

Target:
protected void configureServlets ( ) { java.lang.Class < ? extends javax.servlet.Filter > authFilter ; if ( authConfig.isTrustContainerAuth ( ) ) { authFilter = com.google.gerrit.httpd.ContainerAuthFilter.class ; } else { authFilter = com.google.gerrit.httpd.ProjectDigestFilter.class ; } java.lang.String git = GitOverHttpServlet.URL_REGEX ; filterRegex ( git ) . through ( authFilter ) ; serveRegex ( git ) . with ( com.google.gerrit.httpd.GitOverHttpServlet.class ) ; filter ( "/a/*" ) . through ( authFilter ) ; }
Source:
public void setAuthorNameText ( final com.google.gerrit.client.account.AccountInfo author , final java.lang.String nameText ) { header.setWidget ( 0 , 0 , new com.google.gerrit.client.AvatarImage ( author , 26 ) ) ; header.setText ( 0 , 1 , nameText ) ; }

Target:
public void setAuthorNameText ( final com.google.gerrit.client.account.AccountInfo author , final java.lang.String nameText ) { header.setWidget ( 0 , 0 , new com.google.gerrit.client.AvatarImage ( author , 26 ) ) ; header.setText ( 0 , 1 , nameText ) ; body.getElement ( ) . setAttribute ( "email" , author.email ( ) ) ; body.getElement ( ) . setAttribute ( "name" , author.name ( ) ) ; }
Source:
private static long initialDelay ( java.lang.String startTime , java.lang.String interval ) { return com.google.gerrit.server.config.ScheduleConfig.builder ( com.google.gerrit.server.config.ScheduleConfigTest.config ( startTime , interval ) , "section" , "subsection" ) . setNow ( com.google.gerrit.server.config.ScheduleConfigTest.NOW ) . build ( ) . schedule ( ) . initialDelay ( ) ; }

Target:
private static long initialDelay ( java.lang.String startTime , java.lang.String interval ) { java.util.Optional < com.google.gerrit.server.config.ScheduleConfig.Schedule > schedule = com.google.gerrit.server.config.ScheduleConfig.builder ( com.google.gerrit.server.config.ScheduleConfigTest.config ( startTime , interval ) , "section" ) . setSubsection ( "subsection" ) . setNow ( com.google.gerrit.server.config.ScheduleConfigTest.NOW ) . build ( ) . schedule ( ) ; com.google.common.truth.Truth.assertThat ( schedule ) . isPresent ( ) ; return schedule.get ( ) . initialDelay ( ) ; }
Source:
protected void configure ( ) { com.google.gerrit.extensions.registration.DynamicMap.mapOf ( binder ( ) , com.google.gerrit.server.config.CacheResource.CACHE_KIND ) ; child ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "caches" ) . to ( com.google.gerrit.server.config.CachesCollection.class ) ; get ( com.google.gerrit.server.config.CacheResource.CACHE_KIND ) . to ( com.google.gerrit.server.config.GetCache.class ) ; post ( com.google.gerrit.server.config.CacheResource.CACHE_KIND , "flush" ) . to ( com.google.gerrit.server.config.FlushCache.class ) ; }

Target:
protected void configure ( ) { com.google.gerrit.extensions.registration.DynamicMap.mapOf ( binder ( ) , com.google.gerrit.server.config.CacheResource.CACHE_KIND ) ; child ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "caches" ) . to ( com.google.gerrit.server.config.CachesCollection.class ) ; get ( com.google.gerrit.server.config.CacheResource.CACHE_KIND ) . to ( com.google.gerrit.server.config.GetCache.class ) ; post ( com.google.gerrit.server.config.CacheResource.CACHE_KIND , "flush" ) . to ( com.google.gerrit.server.config.FlushCache.class ) ; get ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "summary" ) . to ( com.google.gerrit.server.config.GetSummary.class ) ; }
Source:
public void evaluate ( ) throws java.lang.Throwable { boolean mem = ( description.getAnnotation ( com.google.gerrit.acceptance.UseLocalDisk.class ) ) == null ; beforeTest ( config ( description ) , mem ) ; base.evaluate ( ) ; afterTest ( ) ; }

Target:
public void evaluate ( ) throws java.lang.Throwable { boolean mem = ( description.getAnnotation ( com.google.gerrit.acceptance.UseLocalDisk.class ) ) == null ; boolean enableHttpd = ( ( description.getAnnotation ( com.google.gerrit.acceptance.NoHttpd.class ) ) == null ) && ( ( description.getTestClass ( ) . getAnnotation ( com.google.gerrit.acceptance.NoHttpd.class ) ) == null ) ; beforeTest ( config ( description ) , mem , enableHttpd ) ; base.evaluate ( ) ; afterTest ( ) ; }
Source:
private java.lang.String readCookie ( ) { final javax.servlet.http.Cookie [ ] all = request.getCookies ( ) ; if ( all != null ) { for ( final javax.servlet.http.Cookie c : all ) { if ( com.google.gerrit.httpd.CacheBasedWebSession.ACCOUNT_COOKIE.equals ( c.getName ( ) ) ) { final java.lang.String v = c.getValue ( ) ; return ( v != null ) && ( ! ( "" . equals ( v ) ) ) ? v : null ; } } } return null ; }

Target:
private static java.lang.String readCookie ( javax.servlet.http.HttpServletRequest request ) { javax.servlet.http.Cookie [ ] all = request.getCookies ( ) ; if ( all != null ) { for ( javax.servlet.http.Cookie c : all ) { if ( com.google.gerrit.httpd.CacheBasedWebSession.ACCOUNT_COOKIE.equals ( c.getName ( ) ) ) { return com.google.common.base.Strings.emptyToNull ( c.getValue ( ) ) ; } } } return null ; }
Source:
protected void onUnload ( ) { if ( ( updateCheck ) != null ) { updateCheck.cancel ( ) ; updateCheck = null ; } for ( com.google.gwt.event.shared.HandlerRegistration h : handlers ) { h.removeHandler ( ) ; } handlers.clear ( ) ; super . onUnload ( ) ; }

Target:
protected void onUnload ( ) { if ( ( replyAction ) != null ) { replyAction.hide ( ) ; } if ( ( updateCheck ) != null ) { updateCheck.cancel ( ) ; updateCheck = null ; } for ( com.google.gwt.event.shared.HandlerRegistration h : handlers ) { h.removeHandler ( ) ; } handlers.clear ( ) ; super . onUnload ( ) ; }
Source:
public void testUpsertOneNotExisting ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; 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:
private void send ( ) throws javax.mail.MessagingException { if ( rcptTo.isEmpty ( ) ) { return ; } if ( ( ( rcptTo.size ( ) ) == 1 ) && ( rcptTo.contains ( fromId ) ) ) { return ; } msg.setText ( body.toString ( ) , "UTF-8" ) ; javax.mail.Transport.send ( msg ) ; }

Target:
private boolean haveRcptTo ( ) { if ( rcptTo.isEmpty ( ) ) { return false ; } if ( ( ( rcptTo.size ( ) ) == 1 ) && ( rcptTo.contains ( fromId ) ) ) { return false ; } return true ; }
Source:
void setText ( final java.lang.String query ) { if ( ( query == null ) || ( query.equals ( "" ) ) ) { searchBox.setText ( Gerrit.C.searchHint ( ) ) ; searchBox.addStyleName ( Gerrit.RESOURCES.css ( ) . inputFieldTypeHint ( ) ) ; } else { searchBox.setText ( query ) ; searchBox.removeStyleName ( Gerrit.RESOURCES.css ( ) . inputFieldTypeHint ( ) ) ; } }

Target:
private void doSearch ( ) { final java.lang.String query = searchBox.getText ( ) . trim ( ) ; if ( "" . equals ( query ) ) { return ; } searchBox.setFocus ( false ) ; if ( query.matches ( "^[1-9][0-9]*$" ) ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( Change.Id.parse ( query ) ) ) ; } else { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChangeQuery ( query ) , com.google.gerrit.client.changes.QueryScreen.forQuery ( query ) ) ; } }
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 ( background , cb ) ; try { if ( ! ( background ) ) { 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 send ( com.google.gwt.http.client.RequestBuilder.Method method , com.google.gerrit.client.rpc.HttpCallback < T > cb ) { com.google.gerrit.client.rpc.RestApi.HttpImpl < T > httpCallback = new com.google.gerrit.client.rpc.RestApi.HttpImpl ( background , cb ) ; try { if ( ! ( background ) ) { RpcStatus.INSTANCE.onRpcStart ( ) ; } request ( method ) . sendRequest ( null , httpCallback ) ; } catch ( com.google.gwt.http.client.RequestException e ) { httpCallback.onError ( null , e ) ; } }
Source:
protected static java.lang.String getInstanceAndProjectName ( java.lang.String instanceName , java.lang.String projectName ) { if ( ( instanceName == null ) || ( instanceName.isEmpty ( ) ) ) { return com.google.gerrit.server.mail.send.NotificationEmail.getShortProjectName ( projectName ) ; } return ( instanceName + "/" ) + ( projectName.substring ( ( ( projectName.lastIndexOf ( "/" ) ) + 1 ) ) ) ; }

Target:
protected static java.lang.String getInstanceAndProjectName ( java.lang.String instanceName , java.lang.String projectName ) { if ( ( instanceName == null ) || ( instanceName.isEmpty ( ) ) ) { return com.google.gerrit.server.mail.send.NotificationEmail.getShortProjectName ( projectName ) ; } return ( instanceName + "/" ) + ( projectName.substring ( ( ( projectName.lastIndexOf ( '/' ) ) + 1 ) ) ) ; }
Source:
public void listOneIncludeMember ( ) throws java.lang.Exception { group ( "gx" , "Administrators" ) ; group ( "gy" , "Administrators" ) ; PUT ( "/groups/Administrators/groups/gx" ) ; PUT ( "/groups/Administrators/groups/gy" ) ; com.google.common.truth.Truth.assertThat ( GET_ONE ( "/groups/Administrators/groups/gx" ) . name ) . isEqualTo ( "gx" ) ; }

Target:
public void listNonEmptyGroupIncludes ( ) throws java.lang.Exception { java.lang.String gx = group ( "gx" , "Administrators" ) ; java.lang.String gy = group ( "gy" , "Administrators" ) ; java.lang.String gz = group ( "gz" , "Administrators" ) ; PUT ( ( ( ( "/groups/" + gx ) + "/groups/" ) + gy ) ) ; PUT ( ( ( ( "/groups/" + gx ) + "/groups/" ) + gz ) ) ; assertIncludes ( GET ( ( ( "/groups/" + gx ) + "/groups/" ) ) , gy , gz ) ; }
Source:
public void commentOnReviewableWipChangeByBot ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; com.google.gerrit.acceptance.TestAccount bot = sc.testAccount ( "bot" ) ; review ( bot , sc.changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED , null , "tag" ) ; assertThat ( sender ) . sent ( "comment" , sc ) . to ( sc.owner ) . notTo ( sc.reviewer , sc.ccer ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( sc.starrer ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; }

Target:
public void commentOnReviewableWipChangeByOwner ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableWipChange ( ) ; review ( sc.owner , sc.changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ) ; assertThat ( sender ) . sent ( "comment" , sc ) . cc ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) . noOneElse ( ) ; }
Source:
public boolean evict ( final java.lang.String cacheName , final java.lang.Object key ) { return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.Request ( ( ( ( ( "evict for cache " + cacheName ) + "[" ) + key ) + "]" ) ) { @ java.lang.Override com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult send ( ) throws java.io.IOException { java.lang.String json = com.ericsson.gerrit.plugins.highavailability.forwarder.rest.GsonParser.toJson ( cacheName , key ) ; return httpSession.post ( com.google.common.base.Joiner.on ( "/" ) . join ( pluginRelativePath , "cache" , cacheName ) , json ) ; } } . execute ( ) ; }

Target:
public boolean evict ( final java.lang.String cacheName , final java.lang.Object key ) { return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.Request ( ( ( ( ( "invalidate cache " + cacheName ) + "[" ) + key ) + "]" ) ) { @ java.lang.Override com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult send ( ) throws java.io.IOException { java.lang.String json = com.ericsson.gerrit.plugins.highavailability.forwarder.rest.GsonParser.toJson ( cacheName , key ) ; return httpSession.post ( com.google.common.base.Joiner.on ( "/" ) . join ( pluginRelativePath , "cache" , cacheName ) , json ) ; } } . execute ( ) ; }
Source:
public com.google.gerrit.server.notedb.ChangeNotes createFromIdOnlyWhenNotedbDisabled ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( ( ! ( migration.readChanges ( ) ) ) , ( "do not call" + " createFromIdOnlyWhenNotedbDisabled when notedb is enabled" ) ) ; com.google.gerrit.reviewdb.client.Change change = db.changes ( ) . get ( changeId ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( repoManager , migration , allUsers , change.getProject ( ) , change ) . load ( ) ; }

Target:
public com.google.gerrit.server.notedb.ChangeNotes createFromIdOnlyWhenNotedbDisabled ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( ( ! ( migration.readChanges ( ) ) ) , ( "do not call" + " createFromIdOnlyWhenNotedbDisabled when notedb is enabled" ) ) ; com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.server.notedb.ChangeNotes.Factory.unwrap ( db ) . changes ( ) . get ( changeId ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( repoManager , migration , allUsers , changeNoteUtil , commentsUtil , change.getProject ( ) , change ) . load ( ) ; }
Source:
public static com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > getLatestRelease ( ) { com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > latest = null ; for ( com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > schema : com.google.gerrit.server.index.ChangeSchemas.ALL.values ( ) ) { if ( schema.isRelease ( ) ) { latest = schema ; } } com.google.common.base.Preconditions.checkState ( ( latest != null ) , "No released schema versions found" ) ; return latest ; }

Target:
public static com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > getLatest ( ) { return com.google.common.collect.Iterables.getLast ( com.google.gerrit.server.index.ChangeSchemas.ALL.values ( ) ) ; }
Source:
public void testTokenOnTime ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestToken token = new com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestToken ( 1 ) ; com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestTokenVerifier verifier = new com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestTokenVerifier ( token ) ; com.google.common.truth.Truth.assertThat ( verifier.verify ( ) ) . isTrue ( ) ; }

Target:
public void testTokenOnTime ( ) throws java.lang.Exception { java.time.Instant when = java.time.Instant.now ( ) ; com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestToken token = new com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestToken ( when , 1L ) ; com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestTokenVerifier verifier = new com.googlesource.gerrit.plugins.lfs.LfsAuthTokenTest.TestTokenVerifier ( token ) ; com.google.common.truth.Truth.assertThat ( verifier.onTime ( when.plusMillis ( 999 ) ) ) . isTrue ( ) ; }
Source:
public void defaultMessage ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.lang.String changeId = createChange ( ) ; com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.MESSAGES ) ; org.junit.Assert.assertNotNull ( c.messages ) ; org.junit.Assert.assertEquals ( 1 , c.messages.size ( ) ) ; org.junit.Assert.assertEquals ( "Uploaded patch set 1." , c.messages.iterator ( ) . next ( ) . message ) ; }

Target:
public void defaultMessage ( ) throws com.google.gerrit.extensions.restapi.RestApiException , java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.lang.String changeId = createChange ( ) ; com.google.gerrit.extensions.common.ChangeInfo c = getChange ( ( "p~master~" + changeId ) , java.util.EnumSet.of ( com.google.gerrit.extensions.common.ListChangesOption.MESSAGES ) ) ; org.junit.Assert.assertNotNull ( c.messages ) ; org.junit.Assert.assertEquals ( 1 , c.messages.size ( ) ) ; org.junit.Assert.assertEquals ( "Uploaded patch set 1." , c.messages.iterator ( ) . next ( ) . message ) ; }
Source:
private boolean canAddPatchSet ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { if ( ( ! ( refControl.asForRef ( ) . testOrFalse ( RefPermission.CREATE_CHANGE ) ) ) || ( isPatchSetLocked ( db ) ) ) { return false ; } if ( isOwner ( ) ) { return true ; } return refControl.canAddPatchSet ( ) ; }

Target:
private boolean canAddPatchSet ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { if ( ( ! ( ( refControl.asForRef ( ) . testOrFalse ( RefPermission.CREATE_CHANGE ) ) && ( getProjectControl ( ) . getProjectState ( ) . statePermitsWrite ( ) ) ) ) || ( isPatchSetLocked ( db ) ) ) { return false ; } if ( isOwner ( ) ) { return true ; } return refControl.canAddPatchSet ( ) ; }
Source:
public void preDisplay ( final com.google.gerrit.common.data.ProjectDetail result ) { enableForm ( result.canModifyAgreements , result.canModifyDescription , result.canModifyMergeType , result.canModifyState , result.canModifyMaxObjectSizeLimit ) ; saveProject.setVisible ( ( ( ( ( result.canModifyAgreements ) || ( result.canModifyDescription ) ) || ( result.canModifyMergeType ) ) || ( result.canModifyState ) ) ) ; display ( result ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.access.ProjectAccessInfo result ) { isOwner = result.isOwner ( ) ; enableForm ( ) ; saveProject.setVisible ( isOwner ) ; }