auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gerrit.server.notedb.ChangeNotes create ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = db.changes ( ) . get ( changeId ) ; com.google.common.base.Preconditions.checkArgument ( change.getProject ( ) . equals ( project ) , ( "passed project %s when creating ChangeNotes for %s, but actual" + " project is %s" ) , project , changeId , change.getProject ( ) ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( repoManager , migration , allUsers , project , change ) . load ( ) ; }

Target:
public com.google.gerrit.server.notedb.ChangeNotes createFromIndexedChange ( com.google.gerrit.reviewdb.client.Change change ) { return new com.google.gerrit.server.notedb.ChangeNotes ( repoManager , migration , allUsers , changeNoteUtil , commentsUtil , change.getProject ( ) , change ) ; }
Source:
public void deleteTagByRestWithoutRefsTagsPrefix ( ) throws java.lang.Exception { grantDelete ( ) ; java.lang.String ref = TAG.substring ( org.eclipse.jgit.lib.Constants.R_TAGS.length ( ) ) ; com.google.gerrit.acceptance.RestResponse r = userRestSession.delete ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/tags/" ) + ref ) ) ; r.assertNoContent ( ) ; }

Target:
public void deleteTagByRestWithoutRefsTagsPrefix ( ) throws java.lang.Exception { grantDelete ( ) ; java.lang.String ref = com.google.gerrit.acceptance.rest.project.DeleteTagIT.TAG.substring ( org.eclipse.jgit.lib.Constants.R_TAGS.length ( ) ) ; com.google.gerrit.acceptance.RestResponse r = userRestSession.delete ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/tags/" ) + ref ) ) ; r.assertNoContent ( ) ; }
Source:
protected void configure ( ) { persist ( WebSessionManager.CACHE_NAME , java.lang.String.class , com.google.gerrit.httpd.WebSessionManager.Val.class ) . memoryLimit ( 1024 ) . maxAge ( com.google.gerrit.httpd.CacheBasedWebSession.MAX_AGE_MINUTES , java.util.concurrent.TimeUnit.MINUTES ) ; bind ( com.google.gerrit.httpd.WebSessionManager.class ) ; bind ( com.google.gerrit.httpd.WebSession.class ) . to ( com.google.gerrit.httpd.CacheBasedWebSession.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; }

Target:
protected void configure ( ) { final java.lang.String cacheName = WebSessionManager.CACHE_NAME ; final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.httpd.WebSessionManager.Key , com.google.gerrit.httpd.WebSessionManager.Val > > type = new com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.httpd.WebSessionManager.Key , com.google.gerrit.httpd.WebSessionManager.Val > > ( ) { } ; disk ( type , cacheName ) . memoryLimit ( 1024 ) . maxAge ( com.google.gerrit.httpd.CacheBasedWebSession.MAX_AGE_MINUTES , java.util.concurrent.TimeUnit.MINUTES ) . evictionPolicy ( EvictionPolicy.LRU ) ; bind ( com.google.gerrit.httpd.WebSessionManager.class ) ; bind ( com.google.gerrit.httpd.WebSession.class ) . to ( com.google.gerrit.httpd.CacheBasedWebSession.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; }
Source:
private static void clearSection ( org.eclipse.jgit.lib.Config cfg , java.lang.String section ) { for ( java.lang.String subsection : cfg.getSubsections ( section ) ) { cfg.unsetSection ( section , subsection ) ; } }

Target:
public java.lang.String toString ( ) { java.util.List < com.google.gerrit.server.account.WatchConfig.NotifyType > notifyTypes = new java.util.ArrayList < > ( notifyTypes ( ) ) ; java.lang.StringBuilder notifyValue = new java.lang.StringBuilder ( ) ; notifyValue.append ( com.google.common.base.MoreObjects.firstNonNull ( filter ( ) , com.google.gerrit.server.account.WatchConfig.FILTER_ALL ) ) . append ( " [" ) ; com.google.common.base.Joiner.on ( ", " ) . appendTo ( notifyValue , notifyTypes ) ; notifyValue.append ( "]" ) ; return notifyValue.toString ( ) ; }
Source:
protected boolean onKeyPress ( final char keyCode , final int modifiers ) { if ( super . onKeyPress ( keyCode , modifiers ) ) { return true ; } if ( modifiers == 0 ) { switch ( keyCode ) { case 's' : case 'c' : toggleCurrentRow ( ) ; return true ; } } return false ; }

Target:
protected boolean onKeyPress ( final com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( super . onKeyPress ( event ) ) { return true ; } if ( ! ( event.isAnyModifierKeyDown ( ) ) ) { switch ( event.getCharCode ( ) ) { case 's' : case 'c' : toggleCurrentRow ( ) ; return true ; } } return false ; }
Source:
protected void configure ( ) { bind ( com.codahale.metrics.MetricRegistry.class ) . in ( Scopes.SINGLETON ) ; bind ( com.google.gerrit.metrics.MetricMaker.class ) . to ( com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker.class ) ; }

Target:
protected void configure ( ) { bind ( com.codahale.metrics.MetricRegistry.class ) . in ( Scopes.SINGLETON ) ; bind ( com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker.class ) . in ( Scopes.SINGLETON ) ; bind ( com.google.gerrit.metrics.MetricMaker.class ) . to ( com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker.class ) ; com.google.gerrit.extensions.registration.DynamicMap.mapOf ( binder ( ) , com.google.gerrit.metrics.dropwizard.MetricResource.METRIC_KIND ) ; child ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "metrics" ) . to ( com.google.gerrit.metrics.dropwizard.MetricsCollection.class ) ; get ( com.google.gerrit.metrics.dropwizard.MetricResource.METRIC_KIND ) . to ( com.google.gerrit.metrics.dropwizard.GetMetric.class ) ; }
Source:
private org.eclipse.jgit.revwalk.RevCommit makeCommit ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.util.Map < java.io.File , byte [ ] > files = new java.util.HashMap < > ( ) ; java.lang.String content = "http://foo.bar.tld/?pw=myp4ssw0rdTefoobarstline2\n" ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foo.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "$Id$\n" + ( ( ( "$Header$\n" + "$Author$\n" ) + "processXFile($File::Find::name, $Config{$type});\n" ) + "$Id: foo bar$\n" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "bar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "Testline1\n" + ( ( "Testline2\n" + "Testline3\n" ) + "Testline4" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foobar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; return com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.makeCommit ( repo , "Commit foobar with test files." , files ) ; }

Target:
private org.eclipse.jgit.revwalk.RevCommit makeCommit ( org.eclipse.jgit.revwalk.RevWalk rw ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.util.Map < java.io.File , byte [ ] > files = new java.util.HashMap < > ( ) ; java.lang.String content = "http://foo.bar.tld/?pw=myp4ssw0rdTefoobarstline2\n" ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foo.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "$Id$\n" + ( ( ( "$Header$\n" + "$Author$\n" ) + "processXFile($File::Find::name, $Config{$type});\n" ) + "$Id: foo bar$\n" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "bar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "Testline1\n" + ( ( "Testline2\n" + "Testline3\n" ) + "Testline4" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foobar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; return com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.makeCommit ( rw , repo , "Commit foobar with test files." , files ) ; }
Source:
public com.google.gerrit.reviewdb.client.Change update ( com.google.gerrit.reviewdb.client.Change change ) { if ( ! ( java.util.Objects.equals ( oldNoteDbState , change.getNoteDbState ( ) ) ) ) { throw new com.google.gerrit.server.notedb.ChangeRebuilderImpl.AbortUpdateException ( ) ; } change.setNoteDbState ( newNoteDbState ) ; return change ; }

Target:
public com.google.gerrit.reviewdb.client.Change update ( com.google.gerrit.reviewdb.client.Change change ) { java.lang.String currNoteDbState = change.getNoteDbState ( ) ; if ( java.util.Objects.equals ( currNoteDbState , newNoteDbState ) ) { throw new com.google.gerrit.server.notedb.ChangeRebuilderImpl.AbortUpdateException ( ) ; } else if ( ! ( java.util.Objects.equals ( oldNoteDbState , currNoteDbState ) ) ) { throw new com.google.gerrit.server.notedb.ChangeRebuilderImpl.ConflictingUpdateException ( change , oldNoteDbState ) ; } change.setNoteDbState ( newNoteDbState ) ; return change ; }
Source:
protected void setUp ( ) throws java.lang.Exception { repo = new org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.DfsRepository > ( new org.eclipse.jgit.internal.storage.dfs.InMemoryRepository ( new org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription ( "test" ) ) ) ; servlet = new com.google.gitiles.RepositoryIndexServlet ( new com.google.gitiles.TestGitilesAccess ( repo.getRepository ( ) ) , new com.google.gitiles.DefaultRenderer ( ) , new com.google.gitiles.DateFormatterBuilder ( ) , new com.google.gitiles.TimeCache ( ) ) ; }

Target:
protected void setUp ( ) throws java.lang.Exception { repo = new org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.DfsRepository > ( new org.eclipse.jgit.internal.storage.dfs.InMemoryRepository ( new org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription ( "test" ) ) ) ; servlet = new com.google.gitiles.RepositoryIndexServlet ( new com.google.gitiles.TestGitilesAccess ( repo.getRepository ( ) ) , new com.google.gitiles.DefaultRenderer ( ) , new com.google.gitiles.DateFormatterBuilder ( com.google.common.base.Optional.< java.util.TimeZone > absent ( ) ) , new com.google.gitiles.TimeCache ( ) ) ; }
Source:
private void setUp ( ) { try { getEventsDb ( ) . createDBIfNotCreated ( ) ; } catch ( java.sql.SQLException e ) { com.ericsson.gerrit.plugins.eventslog.sql.SQLStore.log.warn ( ( "Cannot start the database. Events will be stored locally " + "until database connection can be established" ) , e ) ; setOnline ( false ) ; } if ( online ) { restoreEventsFromLocal ( ) ; } removeOldEvents ( ) ; }

Target:
private void setUp ( ) { try { getEventsDb ( ) . createDBIfNotCreated ( ) ; } catch ( java.sql.SQLException e ) { com.ericsson.gerrit.plugins.eventslog.sql.SQLStore.log.warn ( ( "Cannot start the database. Events will be stored locally " + "until database connection can be established" ) , e ) ; setOnline ( false ) ; } if ( online ) { restoreEventsFromLocal ( ) ; } getEventsDb ( ) . removeOldEvents ( maxAge ) ; }
Source:
public Account.Id apply ( com.google.gerrit.reviewdb.client.PatchSetApproval psa ) { return psa.getAccountId ( ) ; }

Target:
public void postUpdate ( com.google.gerrit.server.git.BatchUpdate.Context ctx ) throws java.lang.Exception { emailReviewers ( rsrc.getChange ( ) , added ) ; if ( ! ( added.isEmpty ( ) ) ) { for ( com.google.gerrit.reviewdb.client.PatchSetApproval psa : added ) { com.google.gerrit.reviewdb.client.Account account = accountCache.get ( psa.getAccountId ( ) ) . getAccount ( ) ; reviewerAdded.fire ( rsrc.getChange ( ) , patchSet , account , ctx.getAccount ( ) , ctx.getWhen ( ) ) ; } } }
Source:
private static java.util.Collection < com.google.gerrit.reviewdb.client.AccountProjectWatch > getWatches ( com.google.gerrit.server.query.change.ChangeQueryBuilder.Arguments args ) throws com.google.gerrit.server.query.QueryParseException { com.google.gerrit.server.CurrentUser user = args.getUser ( ) ; if ( user.isIdentifiedUser ( ) ) { return args.accountCache.get ( args.getUser ( ) . getAccountId ( ) ) . getProjectWatches ( ) ; } return java.util.Collections.< com.google.gerrit.reviewdb.client.AccountProjectWatch > emptySet ( ) ; }

Target:
private static java.util.Collection < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey > getWatches ( com.google.gerrit.server.query.change.ChangeQueryBuilder.Arguments args ) throws com.google.gerrit.server.query.QueryParseException { com.google.gerrit.server.CurrentUser user = args.getUser ( ) ; if ( user.isIdentifiedUser ( ) ) { return args.accountCache.get ( args.getUser ( ) . getAccountId ( ) ) . getProjectWatches ( ) . keySet ( ) ; } return java.util.Collections.< com.google.gerrit.server.account.WatchConfig.ProjectWatchKey > emptySet ( ) ; }
Source:
private boolean isVisibleTo ( com.google.gerrit.reviewdb.Change change , com.google.gerrit.server.IdentifiedUser user ) { final com.google.gerrit.server.project.ProjectState pe = projectCache.get ( change.getProject ( ) ) ; if ( pe == null ) { return false ; } final com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; return pc.controlFor ( change ) . isVisible ( ) ; }

Target:
private boolean isVisibleTo ( com.google.gerrit.reviewdb.Change change , com.google.gerrit.server.IdentifiedUser user ) { com.google.gerrit.server.project.ProjectState pe = com.google.gerrit.server.util.FutureUtil.getOrNull ( projectCache.get ( change.getProject ( ) ) ) ; if ( pe == null ) { return false ; } final com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; return pc.controlFor ( change ) . isVisible ( ) ; }
Source:
public void run ( ) { if ( ( cm.hasActiveLine ( ) ) && ( ( toLeft && ( cm == ( cmB ) ) ) || ( ( ! toLeft ) && ( cm == ( cmA ) ) ) ) ) { net.codemirror.lib.CodeMirror other = otherCm ( cm ) ; other.setCursor ( net.codemirror.lib.LineCharacter.create ( mapper.lineOnOther ( getSideFromCm ( cm ) , cm.getLineNumber ( cm.getActiveLine ( ) ) ) . getLine ( ) ) ) ; other.focus ( ) ; } }

Target:
public void run ( ) { if ( cm.hasVimSearchHighlight ( ) ) { net.codemirror.lib.CodeMirror.handleVimKey ( cm , "n" ) ; } else { diffChunkNav ( cm , false ) . run ( ) ; } }
Source:
public void addComments ( com.google.gerrit.server.events.ChangeAttribute ca , java.util.Collection < com.google.gerrit.reviewdb.ChangeMessage > messages ) { if ( ! ( messages.isEmpty ( ) ) ) { ca.comments = new java.util.ArrayList < com.google.gerrit.server.events.MessageAttribute > ( ) ; for ( com.google.gerrit.reviewdb.ChangeMessage message : messages ) { ca.comments.add ( asMessageAttribute ( message ) ) ; } } }

Target:
public void addComments ( com.google.gerrit.server.events.ChangeAttribute ca , java.util.Collection < com.google.gerrit.reviewdb.client.ChangeMessage > messages ) { if ( ! ( messages.isEmpty ( ) ) ) { ca.comments = new java.util.ArrayList < com.google.gerrit.server.events.MessageAttribute > ( ) ; for ( com.google.gerrit.reviewdb.client.ChangeMessage message : messages ) { ca.comments.add ( asMessageAttribute ( message ) ) ; } } }
Source:
private void assertMembers ( java.util.List < com.google.gerrit.acceptance.rest.group.AccountInfo > ai , com.google.gerrit.acceptance.TestAccount ... members ) { java.util.Map < java.lang.Integer , com.google.gerrit.acceptance.rest.group.AccountInfo > infoById = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.google.gerrit.acceptance.rest.group.AccountInfo i : ai ) { infoById.put ( i._account_id , i ) ; } for ( com.google.gerrit.acceptance.TestAccount a : members ) { com.google.gerrit.acceptance.rest.group.AccountInfo i = infoById.get ( a.id.get ( ) ) ; org.junit.Assert.assertNotNull ( i ) ; assertAccountInfo ( a , i ) ; } org.junit.Assert.assertEquals ( ai.size ( ) , members.length ) ; }

Target:
private void assertMembers ( java.util.List < com.google.gerrit.acceptance.rest.account.AccountInfo > ai , com.google.gerrit.acceptance.TestAccount ... members ) { java.util.Map < java.lang.Integer , com.google.gerrit.acceptance.rest.account.AccountInfo > infoById = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.google.gerrit.acceptance.rest.account.AccountInfo i : ai ) { infoById.put ( i._account_id , i ) ; } for ( com.google.gerrit.acceptance.TestAccount a : members ) { com.google.gerrit.acceptance.rest.account.AccountInfo i = infoById.get ( a.id.get ( ) ) ; org.junit.Assert.assertNotNull ( i ) ; com.google.gerrit.acceptance.rest.account.AccountAssert.assertAccountInfo ( a , i ) ; } org.junit.Assert.assertEquals ( ai.size ( ) , members.length ) ; }
Source:
public static < T > void itemOf ( com.google.inject.Binder binder , com.google.inject.TypeLiteral < T > member ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) com.google.inject.Key < com.google.gerrit.extensions.registration.DynamicItem < T > > key = ( ( com.google.inject.Key < com.google.gerrit.extensions.registration.DynamicItem < T > > ) ( com.google.inject.Key.get ( com.google.inject.util.Types.newParameterizedType ( com.google.gerrit.extensions.registration.DynamicItem.class , member.getType ( ) ) ) ) ) ; binder.bind ( key ) . toProvider ( new com.google.gerrit.extensions.registration.DynamicItemProvider ( member , key ) ) . in ( Scopes.SINGLETON ) ; }

Target:
public static < T > void itemOf ( com.google.inject.Binder binder , com.google.inject.TypeLiteral < T > member ) { com.google.inject.Key < com.google.gerrit.extensions.registration.DynamicItem < T > > key = com.google.gerrit.extensions.registration.DynamicItem.keyFor ( member ) ; binder.bind ( key ) . toProvider ( new com.google.gerrit.extensions.registration.DynamicItemProvider ( member , key ) ) . in ( Scopes.SINGLETON ) ; }
Source:
public void remove ( ) throws java.lang.Exception { com.google.gerrit.server.git.gpg.TestKey key1 = com.google.gerrit.server.git.gpg.TestKey.key1 ( ) ; store.add ( key1.getPublicKeyRing ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) , key1 ) ; store.remove ( key1.getPublicKey ( ) . getFingerprint ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FAST_FORWARD , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) ) ; }

Target:
public void remove ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key1 = com.google.gerrit.gpg.testutil.TestKey.key1 ( ) ; store.add ( key1.getPublicKeyRing ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) , key1 ) ; store.remove ( key1.getPublicKey ( ) . getFingerprint ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FAST_FORWARD , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) ) ; }
Source:
private org.eclipse.jgit.notes.NoteMap loadRejectCommitsMap ( ) throws java.io.IOException { java.lang.String rejectNotes = "refs/meta/reject-commits" ; try { org.eclipse.jgit.lib.Ref ref = repo.getRef ( rejectNotes ) ; if ( ref == null ) { return null ; } org.eclipse.jgit.revwalk.RevWalk rw = rp.getRevWalk ( ) ; org.eclipse.jgit.revwalk.RevCommit map = rw.parseCommit ( ref.getObjectId ( ) ) ; return org.eclipse.jgit.notes.NoteMap.read ( rw.getObjectReader ( ) , map ) ; } catch ( java.io.IOException badMap ) { throw new java.io.IOException ( ( "Cannot load " + rejectNotes ) , badMap ) ; } }

Target:
private org.eclipse.jgit.notes.NoteMap loadRejectCommitsMap ( ) throws java.io.IOException { try { org.eclipse.jgit.lib.Ref ref = repo.getRef ( GitRepositoryManager.REF_REJECT_COMMITS ) ; if ( ref == null ) { return org.eclipse.jgit.notes.NoteMap.newEmptyMap ( ) ; } org.eclipse.jgit.revwalk.RevWalk rw = rp.getRevWalk ( ) ; org.eclipse.jgit.revwalk.RevCommit map = rw.parseCommit ( ref.getObjectId ( ) ) ; return org.eclipse.jgit.notes.NoteMap.read ( rw.getObjectReader ( ) , map ) ; } catch ( java.io.IOException badMap ) { throw new java.io.IOException ( ( "Cannot load " + ( GitRepositoryManager.REF_REJECT_COMMITS ) ) , badMap ) ; } }
Source:
public static boolean branchExists ( final com.google.gerrit.server.git.GitRepositoryManager repoManager , final com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { final org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( branch.getParentKey ( ) ) ; try { boolean exists = ( repo.getRef ( branch.get ( ) ) ) != null ; if ( ! exists ) { exists = repo.getFullBranch ( ) . equals ( branch.get ( ) ) ; } return exists ; } finally { repo.close ( ) ; } }

Target:
public static boolean branchExists ( final com.google.gerrit.server.git.GitRepositoryManager repoManager , final com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( branch.getParentKey ( ) ) ) { boolean exists = ( repo.getRefDatabase ( ) . exactRef ( branch.get ( ) ) ) != null ; if ( ! exists ) { exists = repo.getFullBranch ( ) . equals ( branch.get ( ) ) ; } return exists ; } }
Source:
void resizeCodeMirror ( ) { int rest = ( ( ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + ( header.getOffsetHeight ( ) ) ) + ( diffTable.getHeaderHeight ( ) ) ) + 5 ; int h = ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - rest ; cmA.setHeight ( h ) ; cmB.setHeight ( h ) ; cmA.refresh ( ) ; cmB.refresh ( ) ; diffTable.sidePanel.adjustGutters ( cmB ) ; }

Target:
public void onShowView ( ) { super . onShowView ( ) ; com.google.gwt.user.client.Window.enableScrolling ( false ) ; final int height = getCodeMirrorHeight ( ) ; onShowView ( cmA , height ) ; onShowView ( cmB , height ) ; diffTable.sidePanel.adjustGutters ( cmB ) ; cmB.setCursor ( net.codemirror.lib.LineCharacter.create ( 0 ) ) ; cmB.focus ( ) ; prefetchNextFile ( ) ; }
Source:
private java.lang.Iterable < com.google.gerrit.server.query.change.ChangeData > flattenBatches ( java.util.Collection < com.google.gerrit.server.git.BranchBatch > batches ) { return com.google.common.collect.FluentIterable.from ( batches ) . transformAndConcat ( new com.google.common.base.Function < com.google.gerrit.server.git.BranchBatch , java.util.List < com.google.gerrit.server.query.change.ChangeData > > ( ) { @ java.lang.Override public java.util.List < com.google.gerrit.server.query.change.ChangeData > apply ( com.google.gerrit.server.git.BranchBatch batch ) { return batch.changes ( ) ; } } ) ; }

Target:
private java.lang.Iterable < com.google.gerrit.server.query.change.ChangeData > flattenBatches ( java.util.Collection < com.google.gerrit.server.git.MergeOp.BranchBatch > batches ) { return com.google.common.collect.FluentIterable.from ( batches ) . transformAndConcat ( new com.google.common.base.Function < com.google.gerrit.server.git.MergeOp.BranchBatch , java.util.List < com.google.gerrit.server.query.change.ChangeData > > ( ) { @ java.lang.Override public java.util.List < com.google.gerrit.server.query.change.ChangeData > apply ( com.google.gerrit.server.git.MergeOp.BranchBatch batch ) { return batch.changes ( ) ; } } ) ; }
Source:
public void onSend ( ) { Util.MANAGE_SVC.abandonChange ( patchSet.getId ( ) , getMessageText ( ) , createCallback ( ) ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; Util.MANAGE_SVC.deleteDraftChange ( patchSet.getId ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( com.google.gwtjsonrpc.client.VoidResult result ) { com.google.gerrit.client.Gerrit.display ( PageLinks.MINE ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; super . onFailure ( caught ) ; } } ) ; }
Source:
protected void configure ( ) { factory ( AbandonChange.Factory.class ) ; factory ( RestoreChange.Factory.class ) ; factory ( ChangeDetailFactory.Factory.class ) ; factory ( IncludedInDetailFactory.Factory.class ) ; factory ( PatchSetDetailFactory.Factory.class ) ; factory ( PatchSetPublishDetailFactory.Factory.class ) ; factory ( SubmitAction.Factory.class ) ; }

Target:
protected void configure ( ) { factory ( AbandonChange.Factory.class ) ; factory ( RestoreChange.Factory.class ) ; factory ( RevertChange.Factory.class ) ; factory ( ChangeDetailFactory.Factory.class ) ; factory ( IncludedInDetailFactory.Factory.class ) ; factory ( PatchSetDetailFactory.Factory.class ) ; factory ( PatchSetPublishDetailFactory.Factory.class ) ; factory ( SubmitAction.Factory.class ) ; }
Source:
public com.googlecode.prolog_cafe.builtin.Operation exec ( com.googlecode.prolog_cafe.builtin.Prolog engine ) { engine.setB0 ( ) ; com.googlecode.prolog_cafe.builtin.Term a1 ; a1 = arg1 ; a1 = a1.dereference ( ) ; if ( ! ( a1 instanceof com.googlecode.prolog_cafe.builtin.VariableTerm ) ) throw new com.googlecode.prolog_cafe.exceptions.IllegalTypeException ( this , 1 , "variable" , a1 ) ; if ( ! ( a1.unify ( new com.googlecode.prolog_cafe.builtin.JavaObjectTerm ( engine.getHashManager ( ) ) , engine.trail ) ) ) return engine.fail ( ) ; return cont ; }

Target:
public com.googlecode.prolog_cafe.lang.Operation exec ( com.googlecode.prolog_cafe.lang.Prolog engine ) { engine.setB0 ( ) ; com.googlecode.prolog_cafe.lang.Term a1 ; a1 = arg1 ; a1 = a1.dereference ( ) ; if ( ! ( a1 instanceof com.googlecode.prolog_cafe.lang.VariableTerm ) ) throw new com.googlecode.prolog_cafe.exceptions.IllegalTypeException ( this , 1 , "variable" , a1 ) ; if ( ! ( a1.unify ( new com.googlecode.prolog_cafe.lang.JavaObjectTerm ( engine.getHashManager ( ) ) , engine.trail ) ) ) return engine.fail ( ) ; return cont ; }
Source:
private static java.lang.Iterable < com.google.gerrit.reviewdb.client.Change > changesToUpdate ( com.google.gerrit.server.update.BatchUpdate.ChangeContextImpl ctx ) { com.google.gerrit.reviewdb.client.Change c = ctx.getChange ( ) ; if ( ( ctx.bumpLastUpdatedOn ) && ( c.getLastUpdatedOn ( ) . before ( ctx.getWhen ( ) ) ) ) { c.setLastUpdatedOn ( ctx.getWhen ( ) ) ; } return java.util.Collections.singleton ( c ) ; }

Target:
protected abstract com.google.gerrit.server.update.Context newContext ( ) ;
Source:
void onMatchBrackets ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.matchBrackets ( e.getValue ( ) ) ; if ( ( view ) != null ) { view.getEditor ( ) . setOption ( "matchBrackets" , prefs.matchBrackets ( ) ) ; } }

Target:
void onTopMenu ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.hideTopMenu ( ( ! ( e.getValue ( ) ) ) ) ; if ( ( view ) != null ) { com.google.gerrit.client.Gerrit.setHeaderVisible ( ( ! ( prefs.hideTopMenu ( ) ) ) ) ; view.adjustHeight ( ) ; } }
Source:
public static java.security.PublicKey parse ( com.google.gerrit.reviewdb.client.AccountSshKey key ) throws java.security.NoSuchAlgorithmException , java.security.NoSuchProviderException , java.security.spec.InvalidKeySpecException { try { final java.lang.String s = key.getEncodedKey ( ) ; if ( s == null ) { throw new java.security.spec.InvalidKeySpecException ( "No key string" ) ; } final byte [ ] bin = org.apache.commons.codec.binary.Base64.decodeBase64 ( org.eclipse.jgit.lib.Constants.encodeASCII ( s ) ) ; return new org.apache.sshd.common.util.buffer.ByteArrayBuffer ( bin ) . getRawPublicKey ( ) ; } catch ( java.lang.RuntimeException | org.apache.sshd.common.SshException e ) { throw new java.security.spec.InvalidKeySpecException ( "Cannot parse key" , e ) ; } }

Target:
public static java.security.PublicKey parse ( com.google.gerrit.server.account.AccountSshKey key ) throws java.security.NoSuchAlgorithmException , java.security.NoSuchProviderException , java.security.spec.InvalidKeySpecException { try { final java.lang.String s = key.getEncodedKey ( ) ; if ( s == null ) { throw new java.security.spec.InvalidKeySpecException ( "No key string" ) ; } final byte [ ] bin = org.apache.commons.codec.binary.Base64.decodeBase64 ( org.eclipse.jgit.lib.Constants.encodeASCII ( s ) ) ; return new org.apache.sshd.common.util.buffer.ByteArrayBuffer ( bin ) . getRawPublicKey ( ) ; } catch ( java.lang.RuntimeException | org.apache.sshd.common.SshException e ) { throw new java.security.spec.InvalidKeySpecException ( "Cannot parse key" , e ) ; } }
Source:
void addChange ( java.lang.String token ) { try { changes.addAll ( parseChangeId ( token ) ) ; } catch ( com.google.gerrit.sshd.commands.UnloggedFailure e ) { throw new java.lang.IllegalArgumentException ( e.getMessage ( ) , e ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.lang.IllegalArgumentException ( "database is down" , e ) ; } }

Target:
void addChange ( java.lang.String token ) { try { addChangeImpl ( token ) ; } catch ( com.google.gerrit.sshd.commands.UnloggedFailure e ) { throw new java.lang.IllegalArgumentException ( e.getMessage ( ) , e ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.lang.IllegalArgumentException ( "database is down" , e ) ; } }
Source:
public void deleteReviewerFromReviewableWipChange ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableWipChange ( ) ; removeReviewer ( sc , extraReviewer ) ; assertThat ( sender ) . sent ( "deleteReviewer" , sc ) . notTo ( sc.owner ) . to ( extraReviewer ) . to ( sc.reviewerByEmail ) . cc ( extraCcer , sc.reviewer , sc.ccer ) . cc ( sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; }

Target:
public void deleteReviewerWithApprovalFromWipChangeNotifyOwner ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( ) ; setApiUser ( extraReviewer ) ; gApi.changes ( ) . id ( sc.changeId ) . revision ( "current" ) . review ( com.google.gerrit.extensions.api.changes.ReviewInput.recommend ( ) ) ; sender.clear ( ) ; setApiUser ( sc.owner ) ; removeReviewer ( sc , extraReviewer , NotifyHandling.OWNER ) ; assertThat ( sender ) . sent ( "deleteReviewer" , sc ) . to ( extraReviewer ) ; }
Source:
public void trustCycle ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey kf = add ( com.google.gerrit.gpg.testutil.TestTrustKeys.keyF ( ) ) ; com.google.gerrit.gpg.testutil.TestKey kg = add ( com.google.gerrit.gpg.testutil.TestTrustKeys.keyG ( ) ) ; save ( ) ; com.google.gerrit.gpg.PublicKeyChecker checker = newChecker ( 10 , com.google.gerrit.gpg.testutil.TestTrustKeys.keyA ( ) ) ; assertProblems ( checker , kf , "No path to a trusted key" , com.google.gerrit.gpg.PublicKeyCheckerTest.notTrusted ( kg ) ) ; assertProblems ( checker , kg , "No path to a trusted key" , com.google.gerrit.gpg.PublicKeyCheckerTest.notTrusted ( kf ) ) ; }

Target:
public void trustCycle ( ) throws java.lang.Exception { com.google.gerrit.gpg.testing.TestKey kf = add ( com.google.gerrit.gpg.testing.TestTrustKeys.keyF ( ) ) ; com.google.gerrit.gpg.testing.TestKey kg = add ( com.google.gerrit.gpg.testing.TestTrustKeys.keyG ( ) ) ; save ( ) ; com.google.gerrit.gpg.PublicKeyChecker checker = newChecker ( 10 , com.google.gerrit.gpg.testing.TestTrustKeys.keyA ( ) ) ; assertProblems ( checker , kf , "No path to a trusted key" , com.google.gerrit.gpg.PublicKeyCheckerTest.notTrusted ( kg ) ) ; assertProblems ( checker , kg , "No path to a trusted key" , com.google.gerrit.gpg.PublicKeyCheckerTest.notTrusted ( kf ) ) ; }
Source:
private void assertProblems ( com.google.gerrit.server.notedb.ChangeNotes notes , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput fix , com.google.gerrit.extensions.common.ProblemInfo first , com.google.gerrit.extensions.common.ProblemInfo ... rest ) throws java.lang.Exception { java.util.List < com.google.gerrit.extensions.common.ProblemInfo > expected = new java.util.ArrayList ( ( 1 + ( rest.length ) ) ) ; expected.add ( first ) ; expected.addAll ( java.util.Arrays.asList ( rest ) ) ; com.google.common.truth.Truth.assertThat ( checker.check ( controlForNotes ( notes ) , fix ) . problems ( ) ) . containsExactlyElementsIn ( expected ) . inOrder ( ) ; }

Target:
private void assertNoProblems ( com.google.gerrit.server.notedb.ChangeNotes notes , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput fix ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( checker.check ( notes , fix ) . problems ( ) ) . isEmpty ( ) ; }
Source:
public void doProjectCreatedHook ( com.google.gerrit.reviewdb.client.Project.NameKey project , java.lang.String headName ) { com.google.gerrit.server.events.ProjectCreatedEvent event = new com.google.gerrit.server.events.ProjectCreatedEvent ( ) ; event.projectName = project.get ( ) ; event.headName = headName ; fireEvent ( project , event ) ; java.util.List < java.lang.String > args = new java.util.ArrayList < > ( ) ; addArg ( args , "--project" , project.get ( ) ) ; addArg ( args , "--head" , headName ) ; runHook ( project , projectCreatedHook , args ) ; }

Target:
public void doProjectCreatedHook ( com.google.gerrit.reviewdb.client.Project.NameKey project , java.lang.String headName ) { com.google.gerrit.server.events.ProjectCreatedEvent event = new com.google.gerrit.server.events.ProjectCreatedEvent ( ) ; event.projectName = project.get ( ) ; event.headName = headName ; fireEvent ( project , event ) ; if ( ! ( projectCreatedHook.isPresent ( ) ) ) { return ; } java.util.List < java.lang.String > args = new java.util.ArrayList < > ( ) ; addArg ( args , "--project" , project.get ( ) ) ; addArg ( args , "--head" , headName ) ; runHook ( project , projectCreatedHook , args ) ; }
Source:
public void doPost ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { try { doAuth ( req , rsp ) ; } catch ( java.lang.Exception e ) { getServletContext ( ) . log ( "Unexpected error during authentication" , e ) ; finishLogin ( req , rsp , null , null ) ; } }

Target:
public void doPost ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { try { doAuth ( req , rsp ) ; } catch ( java.lang.Exception e ) { getServletContext ( ) . log ( "Unexpected error during authentication" , e ) ; callback ( req , rsp , SignInResult.CANCEL ) ; } }
Source:
public void testCreate_NonEmpty ( ) throws java.io.IOException { final java.io.File root = com.google.gerrit.server.config.SitePathsTest.random ( ) ; final java.io.File txt = new java.io.File ( root , "test.txt" ) ; try { org.junit.Assert.assertTrue ( root.mkdir ( ) ) ; org.junit.Assert.assertTrue ( txt.createNewFile ( ) ) ; final com.google.gerrit.server.config.SitePaths site = new com.google.gerrit.server.config.SitePaths ( root ) ; org.junit.Assert.assertFalse ( site.isNew ) ; org.junit.Assert.assertEquals ( root , site.site_path ) ; } finally { txt.delete ( ) ; root.delete ( ) ; } }

Target:
public void testCreate_NonEmpty ( ) throws java.io.IOException { final java.nio.file.Path root = com.google.gerrit.server.config.SitePathsTest.random ( ) ; final java.nio.file.Path txt = root.resolve ( "test.txt" ) ; try { java.nio.file.Files.createDirectory ( root ) ; java.nio.file.Files.createFile ( txt ) ; final com.google.gerrit.server.config.SitePaths site = new com.google.gerrit.server.config.SitePaths ( root ) ; org.junit.Assert.assertFalse ( site.isNew ) ; org.junit.Assert.assertEquals ( root.toFile ( ) , site.site_path ) ; } finally { java.nio.file.Files.delete ( txt ) ; java.nio.file.Files.delete ( root ) ; } }
Source:
public void setHashtags ( com.google.gerrit.extensions.api.changes.HashtagsInput input ) throws com.google.gerrit.extensions.restapi.RestApiException { try { postHashtags.apply ( change , input ) ; } catch ( com.google.gerrit.extensions.restapi.RestApiException | com.google.gerrit.server.git.UpdateException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot post hashtags" , e ) ; } }

Target:
public void topic ( java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.change.PutTopic.Input in = new com.google.gerrit.server.change.PutTopic.Input ( ) ; in.topic = topic ; try { putTopic.apply ( change , in ) ; } catch ( com.google.gerrit.server.update.UpdateException | com.google.gerrit.server.permissions.PermissionBackendException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot set topic" , e ) ; } }
Source:
public static void putMessage ( com.google.gerrit.reviewdb.client.PatchSet.Id id , java.lang.String m , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > r ) { com.google.gerrit.client.changes.ChangeFileApi.putMessage ( id.getParentKey ( ) , m , r ) ; }

Target:
public static void getContentOrMessage ( com.google.gerrit.reviewdb.client.PatchSet.Id id , java.lang.String path , com.google.gwt.user.client.rpc.AsyncCallback < java.lang.String > cb ) { if ( Patch.COMMIT_MSG.equals ( path ) ) { com.google.gerrit.client.changes.ChangeFileApi.getMessage ( id , cb ) ; } else { com.google.gerrit.client.changes.ChangeFileApi.contentEditOrPs ( id , path ) . get ( com.google.gerrit.client.changes.ChangeFileApi.wrapper ( cb ) ) ; } }
Source:
private void startReplication ( ) { final com.google.gerrit.git.ReplicationQueue rq = injector.getInstance ( com.google.gerrit.git.ReplicationQueue.class ) ; if ( rq.isEnabled ( ) ) { final com.google.gerrit.server.GerritServer gs = injector.getInstance ( com.google.gerrit.server.GerritServer.class ) ; com.google.gerrit.git.WorkQueue.schedule ( new com.google.gerrit.git.PushAllProjectsOp ( gs , rq ) , 30 , java.util.concurrent.TimeUnit.SECONDS ) ; } }

Target:
private void startReplication ( ) { final com.google.gerrit.git.ReplicationQueue rq = injector.getInstance ( com.google.gerrit.git.ReplicationQueue.class ) ; if ( rq.isEnabled ( ) ) { final com.google.gwtorm.client.SchemaFactory < com.google.gerrit.client.reviewdb.ReviewDb > sf = injector.getInstance ( com.google.inject.Key.get ( new com.google.inject.TypeLiteral < com.google.gwtorm.client.SchemaFactory < com.google.gerrit.client.reviewdb.ReviewDb > > ( ) { } ) ) ; com.google.gerrit.git.WorkQueue.schedule ( new com.google.gerrit.git.PushAllProjectsOp ( sf , rq ) , 30 , java.util.concurrent.TimeUnit.SECONDS ) ; } }
Source:
public static java.util.List < java.lang.Object [ ] > getParam ( ) { java.util.List < java.lang.Object [ ] > params = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.acceptance.git.PushForReviewIT.Protocol p : com.google.gerrit.acceptance.git.PushForReviewIT.Protocol.values ( ) ) { params.add ( new java.lang.Object [ ] { p } ) ; } return params ; }

Target:
public void testPushForNonExistingBranch_HTTP ( ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { testPushForNonExistingBranch ( com.google.gerrit.acceptance.git.PushForReviewIT.Protocol.HTTP ) ; }
Source:
public java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > createEntry ( final java.lang.String username ) throws java.lang.Exception { final javax.naming.directory.DirContext ctx = helper.open ( ) ; try { return helper.queryForGroups ( ctx , username , null ) ; } finally { try { ctx.close ( ) ; } catch ( javax.naming.NamingException e ) { com.google.gerrit.server.auth.ldap.LdapRealm.log.warn ( "Cannot close LDAP query handle" , e ) ; } } }

Target:
public java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > load ( java.lang.String username ) throws java.lang.Exception { final javax.naming.directory.DirContext ctx = helper.open ( ) ; try { return helper.queryForGroups ( ctx , username , null ) ; } finally { try { ctx.close ( ) ; } catch ( javax.naming.NamingException e ) { com.google.gerrit.server.auth.ldap.LdapRealm.log.warn ( "Cannot close LDAP query handle" , e ) ; } } }
Source:
private com.google.gerrit.server.project.ChangeControl incrementPatchSet ( com.google.gerrit.server.project.ChangeControl ctl , org.eclipse.jgit.revwalk.RevCommit commit ) throws java.lang.Exception { com.google.gerrit.server.change.PatchSetInserter ins ; try ( com.google.gerrit.server.update.BatchUpdate bu = newUpdate ( ctl.getChange ( ) . getOwner ( ) ) ) { ins = patchSetInserterFactory.create ( ctl , nextPatchSetId ( ctl ) , commit ) . setValidate ( false ) . setFireRevisionCreated ( false ) . setNotify ( NotifyHandling.NONE ) ; bu.addOp ( ctl.getId ( ) , ins ) . execute ( ) ; } return reload ( ctl ) ; }

Target:
private com.google.gerrit.server.notedb.ChangeNotes reload ( com.google.gerrit.server.notedb.ChangeNotes notes ) throws java.lang.Exception { return changeNotesFactory.create ( db , notes.getChange ( ) . getProject ( ) , notes.getChangeId ( ) ) ; }
Source:
public void pruneSchema ( ) throws com.google.gwtorm.client.OrmException { try { pruneSequences ( ) ; pruneRelations ( ) ; for ( final com.google.gwtorm.schema.RelationModel rel : dbDef.getSchemaModel ( ) . getRelations ( ) ) { pruneColumns ( rel ) ; } } catch ( java.sql.SQLException e ) { throw new com.google.gwtorm.client.OrmException ( "Schema prune failure" , e ) ; } }

Target:
public void pruneSchema ( final com.google.gwtorm.client.StatementExecutor e ) throws com.google.gwtorm.client.OrmException { try { pruneSequences ( e ) ; pruneRelations ( e ) ; for ( final com.google.gwtorm.schema.RelationModel rel : dbDef.getSchemaModel ( ) . getRelations ( ) ) { pruneColumns ( e , rel ) ; } } catch ( java.sql.SQLException err ) { throw new com.google.gwtorm.client.OrmException ( "Schema prune failure" , err ) ; } }
Source:
public void remove ( com.google.gerrit.common.data.AccessSection section ) { if ( section != null ) { accessSections.remove ( section.getName ( ) ) ; } }

Target:
public void remove ( com.google.gerrit.common.data.AccessSection section , com.google.gerrit.common.data.Permission permission ) { if ( permission == null ) { remove ( section ) ; } else if ( section != null ) { com.google.gerrit.common.data.AccessSection a = accessSections.get ( section.getName ( ) ) ; a.remove ( permission ) ; if ( a.getPermissions ( ) . isEmpty ( ) ) { remove ( a ) ; } } }
Source:
private boolean validateAction ( java.lang.String actionName , java.lang.String actionValue ) throws com.j2bugzilla.base.BugzillaException { com.j2bugzilla.rpc.GetLegalValues.Fields field = getFields ( ) . get ( actionName ) ; return ( field != null ) && ( getLegalValues ( field ) . contains ( actionValue ) ) ; }

Target:
private void assertLegalValue ( com.j2bugzilla.rpc.GetLegalValues.Fields field , java.lang.String actionValue ) throws com.googlesource.gerrit.plugins.hooks.its.InvalidTransitionException , com.j2bugzilla.base.BugzillaException { if ( ! ( getLegalValues ( field ) . contains ( actionValue ) ) ) { throw new com.googlesource.gerrit.plugins.hooks.its.InvalidTransitionException ( ( ( ( ( "The value '" + actionValue ) + "' is not an allowed value for bugzilla's " ) + ( field.getInternalName ( ) ) ) + " field" ) ) ; } }
Source:
public void testInsertOneException ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchException ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , new java.sql.BatchUpdateException ( ) ) ; try { createClassUnderTest ( ) . insert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.client.OrmException e ) { } }

Target:
public void testUpsertOneNotExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( oneRow ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertExpectedIdsUsed ( insert , 1 ) ; }
Source:
public void testUpsertOneExisting ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; }

Target:
public void testUpsertOneException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement update = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.upsert ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; }
Source:
boolean isDraft ( ) { return draft ; }

Target:
void addHashtag ( java.lang.String token ) throws org.kohsuke.args4j.CmdLineException { if ( ! ( notesMigration.readChanges ( ) ) ) { throw clp.reject ( "cannot add hashtags; noteDb is disabled" ) ; } java.lang.String hashtag = com.google.gerrit.server.change.HashtagsUtil.cleanupHashtag ( token ) ; if ( ! ( hashtag.isEmpty ( ) ) ) { hashtags.add ( hashtag ) ; } }
Source:
protected void rpc ( final java.lang.String name , java.lang.Class < ? extends com.google.gwtjsonrpc.client.RemoteJsonService > clazz ) { final com.google.inject.Key < com.google.gerrit.server.http.GerritJsonServlet > srv = com.google.inject.Key.get ( com.google.gerrit.server.http.GerritJsonServlet.class , com.google.gerrit.server.http.ServletNameImpl.named ( name ) ) ; final com.google.gerrit.server.http.GerritJsonServletProvider provider = new com.google.gerrit.server.http.GerritJsonServletProvider ( clazz ) ; serve ( ( ( prefix ) + name ) ) . with ( srv ) ; bind ( srv ) . toProvider ( provider ) . in ( Scopes.SINGLETON ) ; }

Target:
protected void rpc ( final java.lang.String name , java.lang.Class < ? extends com.google.gwtjsonrpc.client.RemoteJsonService > clazz ) { final com.google.inject.Key < com.google.gerrit.server.http.GerritJsonServlet > srv = com.google.inject.Key.get ( com.google.gerrit.server.http.GerritJsonServlet.class , com.google.inject.internal.UniqueAnnotations.create ( ) ) ; final com.google.gerrit.server.http.GerritJsonServletProvider provider = new com.google.gerrit.server.http.GerritJsonServletProvider ( clazz ) ; serve ( ( ( prefix ) + name ) ) . with ( srv ) ; bind ( srv ) . toProvider ( provider ) . in ( Scopes.SINGLETON ) ; }
Source:
private void doClearPassword ( ) { if ( ( id ) != null ) { enableUI ( false ) ; Util.ACCOUNT_SEC.clearPassword ( id.getKey ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.reviewdb.client.AccountExternalId > ( ) { public void onSuccess ( final com.google.gerrit.reviewdb.client.AccountExternalId result ) { display ( result ) ; } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { enableUI ( true ) ; } } ) ; } }

Target:
public void onSuccess ( com.google.gerrit.client.VoidResult result ) { id.setPassword ( null ) ; display ( id ) ; }
Source:
private void addPriority ( java.util.Map < java.lang.String , java.lang.Object > have , com.google.gerrit.server.account.AccountResource rsrc ) { com.google.gerrit.server.git.QueueProvider.QueueType queue = rsrc.getUser ( ) . getCapabilities ( ) . getQueueType ( ) ; if ( ( queue != ( QueueProvider.QueueType.INTERACTIVE ) ) || ( ( ( query ) != null ) && ( query.contains ( com.google.gerrit.common.data.GlobalCapability.PRIORITY ) ) ) ) { have.put ( com.google.gerrit.common.data.GlobalCapability.PRIORITY , queue ) ; } }

Target:
private void addPriority ( java.util.Map < java.lang.String , java.lang.Object > have , com.google.gerrit.server.account.CapabilityControl cc ) { com.google.gerrit.server.git.QueueProvider.QueueType queue = cc.getQueueType ( ) ; if ( ( queue != ( QueueProvider.QueueType.INTERACTIVE ) ) || ( ( ( query ) != null ) && ( query.contains ( com.google.gerrit.common.data.GlobalCapability.PRIORITY ) ) ) ) { have.put ( com.google.gerrit.common.data.GlobalCapability.PRIORITY , queue ) ; } }