auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void set ( ) throws java.lang.Exception { com.google.gerrit.server.account.PutUsername.Input in = new com.google.gerrit.server.account.PutUsername.Input ( ) ; in.username = "myUsername" ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/accounts/" + ( createUser ( ) . get ( ) ) ) + "/username" ) , in ) ; r.assertOK ( ) ; com.google.common.truth.Truth.assertThat ( newGson ( ) . fromJson ( r.getReader ( ) , java.lang.String.class ) ) . isEqualTo ( in.username ) ; }

Target:
public void set ( ) throws java.lang.Exception { com.google.gerrit.server.account.PutUsername.Input in = new com.google.gerrit.server.account.PutUsername.Input ( ) ; in.username = "myUsername" ; com.google.gerrit.acceptance.RestResponse r = adminRestSession.put ( ( ( "/accounts/" + ( createUser ( ) . get ( ) ) ) + "/username" ) , in ) ; r.assertOK ( ) ; com.google.common.truth.Truth.assertThat ( newGson ( ) . fromJson ( r.getReader ( ) , java.lang.String.class ) ) . isEqualTo ( in.username ) ; }
Source:
public T load ( ) throws com.google.gwtorm.server.OrmException { if ( ! ( loaded ) ) { org.eclipse.jgit.lib.Repository repo ; try { repo = repoManager.openRepository ( getProjectName ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } try { load ( repo ) ; loaded = true ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException | java.io.IOException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } finally { repo.close ( ) ; } } return self ( ) ; }

Target:
public T load ( ) throws com.google.gwtorm.server.OrmException { if ( ! ( loaded ) ) { org.eclipse.jgit.lib.Repository repo ; try { repo = repoManager.openMetadataRepository ( getProjectName ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } try { load ( repo ) ; loaded = true ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException | java.io.IOException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } finally { repo.close ( ) ; } } return self ( ) ; }
Source:
private AccountGroup.Id owner ( com.google.gerrit.server.group.CreateGroup.Input input ) throws com.google.gerrit.extensions.restapi.BadRequestException { if ( ( input.ownerId ) != null ) { try { com.google.gerrit.common.data.GroupDescription.Basic d = groups.parse ( com.google.gerrit.extensions.restapi.Url.decode ( input.ownerId ) ) ; com.google.gerrit.reviewdb.client.AccountGroup owner = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( d ) ; if ( owner == null ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "ownerId must be internal group" ) ; } return owner.getId ( ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException e ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "ownerId cannot be resolved" ) ; } } return null ; }

Target:
private AccountGroup.Id owner ( com.google.gerrit.server.group.CreateGroup.Input input ) throws com.google.gerrit.extensions.restapi.UnprocessableEntityException { if ( ( input.ownerId ) != null ) { com.google.gerrit.common.data.GroupDescription.Basic d = groups.parseInternal ( com.google.gerrit.extensions.restapi.Url.decode ( input.ownerId ) ) ; return com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( d ) . getId ( ) ; } return null ; }
Source:
private void fireEvent ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.server.events.ProjectEvent event ) { for ( com.google.gerrit.common.ChangeHookRunner.EventListenerHolder holder : listeners.values ( ) ) { if ( isVisibleTo ( project , holder.user ) ) { holder.listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }

Target:
private void fireEvent ( com.google.gerrit.common.Event event , com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.common.UserScopedEventListener listener : listeners ) { if ( isVisibleTo ( event , listener.getUser ( ) , db ) ) { listener.onEvent ( event ) ; } } fireEventForUnrestrictedListeners ( event ) ; }
Source:
public void messagesNotReturnedByDefault ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; postMessage ( changeId , "Some nits need to be fixed." ) ; com.google.gerrit.extensions.common.ChangeInfo c = info ( changeId ) ; org.junit.Assert.assertNull ( c.messages ) ; }

Target:
public void messagesNotReturnedByDefault ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; postMessage ( changeId , "Some nits need to be fixed." ) ; com.google.gerrit.extensions.common.ChangeInfo c = info ( changeId ) ; com.google.common.truth.Truth.assertThat ( ( ( java.lang.Iterable < ? > ) ( c.messages ) ) ) . isNull ( ) ; }
Source:
public void createBranch_Forbidden ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = userSession.put ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/branches/" ) + ( branch.getShortName ( ) ) ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_FORBIDDEN ) ; }

Target:
public void createBranch_Forbidden ( ) throws java.lang.Exception { setApiUser ( user ) ; assertCreateFails ( com.google.gerrit.extensions.restapi.AuthException.class ) ; }
Source:
static com.google.gson.JsonArray getHTTPJsonArray ( java.lang.String url ) { java.lang.String data = com.googlesource.gerrit.plugins.findowners.Util.getHTTP ( url , false ) ; return null == data ? new com.google.gson.JsonArray ( ) : new com.google.gson.JsonParser ( ) . parse ( data ) . getAsJsonArray ( ) ; }

Target:
static void addToMap ( java.util.Map < java.lang.String , java.util.Set < java.lang.String > > map , java.lang.String key , java.lang.String value ) { if ( ( map.get ( key ) ) == null ) { map.put ( key , new java.util.HashSet < > ( ) ) ; } map.get ( key ) . add ( value ) ; }
Source:
public void onSuccess ( com.google.gwt.core.client.JavaScriptObject msg ) { if ( com.google.gerrit.client.rpc.NativeString.is ( msg ) ) { com.google.gerrit.client.rpc.NativeString str = ( ( com.google.gerrit.client.rpc.NativeString ) ( msg ) ) ; if ( ! ( str.asString ( ) . isEmpty ( ) ) ) { com.google.gwt.user.client.Window.alert ( str.asString ( ) ) ; } } com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toProject ( project ) ) ; }

Target:
static void invoke ( com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.client.actions.ActionInfo action , com.google.gerrit.client.rpc.RestApi api ) { com.google.gerrit.client.api.DefaultActions.invoke ( action , api , com.google.gerrit.client.api.DefaultActions.callback ( com.google.gerrit.common.PageLinks.toProject ( project ) ) ) ; }
Source:
public static void suggest ( java.lang.String prefix , int limit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.ProjectMap > cb ) { com.google.gerrit.client.projects.ProjectMap.projects ( ) . addParameter ( "p" , prefix ) . addParameter ( "n" , limit ) . addParameterRaw ( "type" , "ALL" ) . addParameterTrue ( "d" ) . background ( ) . get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( cb ) ) ; }

Target:
public static void suggest ( java.lang.String prefix , int limit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.ProjectMap > cb ) { new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . addParameter ( "p" , prefix ) . addParameter ( "n" , limit ) . addParameterRaw ( "type" , "ALL" ) . addParameterTrue ( "d" ) . background ( ) . get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( cb ) ) ; }
Source:
public void inheritRead_SingleBranchDeniesUpload ( ) { com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/for/refs/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/foobar" ) ; com.google.gerrit.server.project.Util.doNotInherit ( local , com.google.gerrit.common.data.Permission.READ , "refs/heads/foobar" ) ; com.google.gerrit.server.project.Util.doNotInherit ( local , com.google.gerrit.common.data.Permission.PUSH , "refs/for/refs/heads/foobar" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertCanUpload ( u ) ; assertCreateChange ( "refs/heads/master" , u ) ; assertCannotCreateChange ( "refs/heads/foobar" , u ) ; }

Target:
public void blockPushDrafts ( ) { com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/for/refs/*" ) ; com.google.gerrit.server.project.testing.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertCreateChange ( "refs/heads/master" , u ) ; assertBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , u ) ; }
Source:
public static void doSignOut ( ) { com.google.gwt.user.client.Cookies.removeCookie ( com.google.gerrit.client.Gerrit.ACCOUNT_COOKIE ) ; com.google.gwt.user.client.Cookies.removeCookie ( com.google.gerrit.client.Gerrit.OPENIDUSER_COOKIE ) ; for ( final com.google.gerrit.client.SignedInListener l : com.google.gerrit.client.Gerrit.signedInListeners ) { l.onSignOut ( ) ; } com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; if ( ( ( com.google.gerrit.client.Gerrit.currentScreen ) != null ) && ( com.google.gerrit.client.Gerrit.currentScreen.isRequiresSignIn ( ) ) ) { com.google.gwt.user.client.History.newItem ( Link.ALL ) ; } }

Target:
public static void doSignOut ( ) { com.google.gerrit.client.Gerrit.myAccount = null ; com.google.gwt.user.client.Cookies.removeCookie ( com.google.gerrit.client.Gerrit.ACCOUNT_COOKIE ) ; com.google.gwt.user.client.Cookies.removeCookie ( com.google.gerrit.client.Gerrit.OPENIDUSER_COOKIE ) ; for ( final com.google.gerrit.client.SignedInListener l : com.google.gerrit.client.Gerrit.signedInListeners ) { l.onSignOut ( ) ; } com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; if ( ( ( com.google.gerrit.client.Gerrit.currentScreen ) != null ) && ( com.google.gerrit.client.Gerrit.currentScreen.isRequiresSignIn ( ) ) ) { com.google.gwt.user.client.History.newItem ( Link.ALL ) ; } }
Source:
public void writeCommentsToNoteMap ( org.eclipse.jgit.notes.NoteMap noteMap , java.util.List < com.google.gerrit.reviewdb.client.PatchLineComment > allComments , org.eclipse.jgit.lib.ObjectInserter inserter ) throws java.io.IOException { com.google.common.base.Preconditions.checkArgument ( ( ! ( allComments.isEmpty ( ) ) ) , "No comments to write; to delete, use removeNoteFromNoteMap()." ) ; org.eclipse.jgit.lib.ObjectId commit = org.eclipse.jgit.lib.ObjectId.fromString ( allComments.get ( 0 ) . getRevId ( ) . get ( ) ) ; java.util.Collections.sort ( allComments , ChangeNotes.PatchLineCommentComparator ) ; noteMap.set ( commit , inserter.insert ( org.eclipse.jgit.lib.Constants.OBJ_BLOB , buildNote ( allComments ) ) ) ; }

Target:
public void writeCommentsToNoteMap ( org.eclipse.jgit.notes.NoteMap noteMap , java.util.List < com.google.gerrit.reviewdb.client.PatchLineComment > allComments , org.eclipse.jgit.lib.ObjectInserter inserter ) throws java.io.IOException { com.google.common.base.Preconditions.checkArgument ( ( ! ( allComments.isEmpty ( ) ) ) , "No comments to write; to delete, use removeNoteFromNoteMap()." ) ; org.eclipse.jgit.lib.ObjectId commit = org.eclipse.jgit.lib.ObjectId.fromString ( allComments.get ( 0 ) . getRevId ( ) . get ( ) ) ; java.util.Collections.sort ( allComments , ChangeNotes.PLC_ORDER ) ; noteMap.set ( commit , inserter.insert ( org.eclipse.jgit.lib.Constants.OBJ_BLOB , buildNote ( allComments ) ) ) ; }
Source:
public static void get ( java.util.Set < com.google.gerrit.reviewdb.client.Project.NameKey > projects , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.access.AccessMap > callback ) { com.google.gerrit.client.rpc.RestApi api = new com.google.gerrit.client.rpc.RestApi ( "/access/" ) ; for ( com.google.gerrit.reviewdb.client.Project.NameKey p : projects ) { api.addParameter ( "project" , p.get ( ) ) ; } api.get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( callback ) ) ; }

Target:
public static void get ( java.util.Set < com.google.gerrit.reviewdb.client.Project.NameKey > projects , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.access.AccessMap > callback ) { com.google.gerrit.client.rpc.RestApi api = new com.google.gerrit.client.rpc.RestApi ( "access" ) ; for ( com.google.gerrit.reviewdb.client.Project.NameKey p : projects ) { api.addParameter ( "project" , p.get ( ) ) ; } api.get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( callback ) ) ; }
Source:
public void delete ( com.google.gerrit.server.query.change.ChangeData cd ) throws java.io.IOException { org.apache.lucene.index.Term id = com.google.gerrit.lucene.QueryBuilder.idTerm ( cd ) ; try { com.google.common.util.concurrent.Futures.allAsList ( openIndex.delete ( id ) , closedIndex.delete ( id ) ) . get ( ) ; } catch ( java.util.concurrent.ExecutionException | java.lang.InterruptedException e ) { throw new java.io.IOException ( e ) ; } }

Target:
private void decodePatchSets ( com.google.common.collect.Multimap < java.lang.String , org.apache.lucene.index.IndexableField > doc , com.google.gerrit.server.query.change.ChangeData cd ) { java.util.List < com.google.gerrit.reviewdb.client.PatchSet > patchSets = com.google.gerrit.lucene.LuceneChangeIndex.decodeProtos ( doc , com.google.gerrit.lucene.LuceneChangeIndex.PATCH_SET_FIELD , PatchSetProtoField.CODEC ) ; if ( ! ( patchSets.isEmpty ( ) ) ) { cd.setPatchSets ( patchSets ) ; } }
Source:
protected void onInitUI ( ) { super . onInitUI ( ) ; saveProject = new com.google.gwt.user.client.ui.Button ( Util.C.buttonSaveChanges ( ) ) ; saveProject.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { doSave ( ) ; } } ) ; add ( new com.google.gerrit.client.admin.ProjectInfoScreen.ProjectDownloadPanel ( projectName , true ) ) ; initDescription ( ) ; initProjectOptions ( ) ; initAgreements ( ) ; add ( saveProject ) ; }

Target:
protected void onInitUI ( ) { super . onInitUI ( ) ; saveProject = new com.google.gwt.user.client.ui.Button ( Util.C.buttonSaveChanges ( ) ) ; saveProject.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { doSave ( ) ; } } ) ; add ( new com.google.gerrit.client.admin.ProjectInfoScreen.ProjectDownloadPanel ( projectName , true ) ) ; initDescription ( ) ; grid = new com.google.gerrit.client.admin.ProjectInfoScreen.LabeledWidgetsGrid ( ) ; initProjectOptions ( ) ; initAgreements ( ) ; add ( grid ) ; add ( saveProject ) ; }
Source:
public void testUnblockLargerScope_Fails ( ) { grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/master" ) . setBlock ( ) ; grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockMoreSpecificRef_Fails ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/master" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }
Source:
private void createGroup ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure , com.google.gwtorm.client.OrmException { final com.google.gerrit.server.account.PerformCreateGroup performCreateGroup = performCreateGroupFactory.create ( ) ; try { performCreateGroup.createGroup ( groupName , groupDescription , ownerGroupId , initialMembers.toArray ( new com.google.gerrit.reviewdb.Account.Id [ initialMembers.size ( ) ] ) ) ; } catch ( com.google.gerrit.common.errors.NameAlreadyUsedException e ) { throw die ( e ) ; } }

Target:
private void createGroup ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure , com.google.gwtorm.client.OrmException { final com.google.gerrit.server.account.PerformCreateGroup performCreateGroup = performCreateGroupFactory.create ( ) ; try { performCreateGroup.createGroup ( groupName , groupDescription , visibleToAll , ownerGroupId , initialMembers.toArray ( new com.google.gerrit.reviewdb.Account.Id [ initialMembers.size ( ) ] ) ) ; } catch ( com.google.gerrit.common.errors.NameAlreadyUsedException e ) { throw die ( e ) ; } }
Source:
public java.lang.String apply ( java.lang.String s ) { try { return java.net.URLEncoder.encode ( s , com.google.common.base.Charsets.UTF_8.name ( ) ) . replace ( "%2F" , "/" ) . replace ( "%2f" , "/" ) . replace ( "+" , "%20" ) . replace ( "%2B" , "+" ) . replace ( "%2b" , "+" ) ; } catch ( java.io.UnsupportedEncodingException e ) { throw new java.lang.IllegalStateException ( e ) ; } }

Target:
public java.lang.String apply ( java.lang.String s ) { try { return java.net.URLEncoder.encode ( s , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) . replace ( "%2F" , "/" ) . replace ( "%2f" , "/" ) . replace ( "+" , "%20" ) . replace ( "%2B" , "+" ) . replace ( "%2b" , "+" ) ; } catch ( java.io.UnsupportedEncodingException e ) { throw new java.lang.IllegalStateException ( e ) ; } }
Source:
public static com.google.gerrit.common.data.Capable checkMagicBranchRefs ( org.eclipse.jgit.lib.Repository repo , com.google.gerrit.reviewdb.client.Project project ) { com.google.gerrit.common.data.Capable result = com.google.gerrit.server.util.MagicBranch.checkMagicBranchRef ( com.google.gerrit.server.util.MagicBranch.NEW_CHANGE , repo , project ) ; if ( result != ( com.google.gerrit.common.data.Capable.OK ) ) { return result ; } result = com.google.gerrit.server.util.MagicBranch.checkMagicBranchRef ( com.google.gerrit.server.util.MagicBranch.NEW_DRAFT_CHANGE , repo , project ) ; if ( result != ( com.google.gerrit.common.data.Capable.OK ) ) { return result ; } return com.google.gerrit.common.data.Capable.OK ; }

Target:
public static com.google.gerrit.common.data.Capable checkMagicBranchRefs ( org.eclipse.jgit.lib.Repository repo , com.google.gerrit.reviewdb.client.Project project ) { com.google.gerrit.common.data.Capable result = com.google.gerrit.server.util.MagicBranch.checkMagicBranchRef ( com.google.gerrit.server.util.MagicBranch.NEW_CHANGE , repo , project ) ; if ( result != ( com.google.gerrit.common.data.Capable.OK ) ) { return result ; } result = com.google.gerrit.server.util.MagicBranch.checkMagicBranchRef ( com.google.gerrit.server.util.MagicBranch.NEW_DRAFT_CHANGE , repo , project ) ; if ( result != ( com.google.gerrit.common.data.Capable.OK ) ) { return result ; } result = com.google.gerrit.server.util.MagicBranch.checkMagicBranchRef ( com.google.gerrit.server.util.MagicBranch.NEW_PUBLISH_CHANGE , repo , project ) ; if ( result != ( com.google.gerrit.common.data.Capable.OK ) ) { return result ; } return com.google.gerrit.common.data.Capable.OK ; }
Source:
public java.util.List < com.google.gerrit.extensions.api.changes.ProblemInfo > check ( com.google.gerrit.reviewdb.client.Change c ) { reset ( ) ; change = c ; try { checkImpl ( ) ; return problems ; } finally { if ( ( rw ) != null ) { rw.release ( ) ; } if ( ( repo ) != null ) { repo.close ( ) ; } } }

Target:
public com.google.gerrit.server.change.ConsistencyChecker.Result check ( com.google.gerrit.server.query.change.ChangeData cd ) { reset ( ) ; try { return check ( cd.change ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { error ( "Error looking up change" , e ) ; return com.google.gerrit.server.change.ConsistencyChecker.Result.create ( cd.getId ( ) , problems ) ; } }
Source:
private void decodePatchSets ( org.apache.lucene.document.Document doc , com.google.gerrit.server.query.change.ChangeData cd ) { java.util.List < com.google.gerrit.reviewdb.client.PatchSet > patchSets = com.google.gerrit.lucene.LuceneChangeIndex.decodeProtos ( doc , com.google.gerrit.lucene.LuceneChangeIndex.PATCH_SET_FIELD , PatchSetProtoField.CODEC ) ; if ( ! ( patchSets.isEmpty ( ) ) ) { cd.setPatchSets ( patchSets ) ; } }

Target:
private void decodePatchSets ( com.google.common.collect.Multimap < java.lang.String , org.apache.lucene.index.IndexableField > doc , com.google.gerrit.server.query.change.ChangeData cd ) { java.util.List < com.google.gerrit.reviewdb.client.PatchSet > patchSets = com.google.gerrit.lucene.LuceneChangeIndex.decodeProtos ( doc , com.google.gerrit.lucene.LuceneChangeIndex.PATCH_SET_FIELD , PatchSetProtoField.CODEC ) ; if ( ! ( patchSets.isEmpty ( ) ) ) { cd.setPatchSets ( patchSets ) ; } }
Source:
public void byAuthor ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo = createProject ( "repo" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( newChangeForUser ( repo , userId ) ) ; assertQuery ( "author:jauthor@example.com" , change1 ) ; assertQuery ( "author:jauthor" , change1 ) ; assertQuery ( "author:example" , change1 ) ; assertQuery ( "author:example.com" , change1 ) ; assertQuery ( "author:Author" , change1 ) ; assertQuery ( "author:jAuThOr" , change1 ) ; assertQuery ( "author:ExAmPlE" , change1 ) ; assertQuery ( "author:jcommitter@example.com" ) ; assertQuery ( "author:somewhere.com" ) ; assertQuery ( "author:jcommitter" ) ; assertQuery ( "author:Committer" ) ; }

Target:
public void byAuthor ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo = createProject ( "repo" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( repo , newChange ( repo ) , userId ) ; assertQuery ( "author:jauthor@example.com" , change1 ) ; assertQuery ( "author:jauthor" , change1 ) ; assertQuery ( "author:example" , change1 ) ; assertQuery ( "author:example.com" , change1 ) ; assertQuery ( "author:Author" , change1 ) ; assertQuery ( "author:jAuThOr" , change1 ) ; assertQuery ( "author:ExAmPlE" , change1 ) ; assertQuery ( "author:jcommitter@example.com" ) ; assertQuery ( "author:somewhere.com" ) ; assertQuery ( "author:jcommitter" ) ; assertQuery ( "author:Committer" ) ; }
Source:
private void parseRequest ( final com.google.gwtjsonrpc.server.ActiveCall call , final java.io.Reader in ) { final com.google.gson.GsonBuilder gb = createGsonBuilder ( ) ; gb.registerTypeAdapter ( com.google.gwtjsonrpc.server.ActiveCall.class , new com.google.gwtjsonrpc.server.CallDeserializer ( call , this ) ) ; gb.create ( ) . fromJson ( in , com.google.gwtjsonrpc.server.ActiveCall.class ) ; }

Target:
private void parsePostRequest ( final com.google.gwtjsonrpc.server.ActiveCall call , final java.io.Reader in ) { final com.google.gson.GsonBuilder gb = createGsonBuilder ( ) ; gb.registerTypeAdapter ( com.google.gwtjsonrpc.server.ActiveCall.class , new com.google.gwtjsonrpc.server.CallDeserializer ( call , this ) ) ; gb.create ( ) . fromJson ( in , com.google.gwtjsonrpc.server.ActiveCall.class ) ; }
Source:
private static java.lang.Object toImgSrc ( com.google.gitiles.doc.ImageLoader img , java.lang.String url ) { if ( com.google.gitiles.doc.html.HtmlBuilder.isValidHttpUri ( url ) ) { return url ; } if ( com.google.gitiles.doc.html.HtmlBuilder.isImageDataUri ( url ) ) { return com.google.template.soy.shared.restricted.Sanitizers.filterImageDataUri ( url ) ; } if ( img != null ) { return com.google.template.soy.shared.restricted.Sanitizers.filterImageDataUri ( img.loadImage ( url ) ) ; } return FilterImageDataUri.INSTANCE.getInnocuousOutput ( ) ; }

Target:
private java.lang.Object logo ( ) { if ( ( logoUrl ) == null ) { return null ; } java.lang.String url = fmt.image ( logoUrl ) ; if ( com.google.gitiles.doc.html.HtmlBuilder.isValidHttpUri ( url ) ) { return url ; } else if ( com.google.gitiles.doc.html.HtmlBuilder.isImageDataUri ( url ) ) { return com.google.template.soy.shared.restricted.Sanitizers.filterImageDataUri ( url ) ; } else { return FilterImageDataUri.INSTANCE.getInnocuousOutput ( ) ; } }
Source:
protected void configure ( ) { bind ( new com.google.inject.TypeLiteral < com.google.gwtorm.client.SchemaFactory < com.google.gerrit.reviewdb.ReviewDb > > ( ) { } ) . toInstance ( db ) ; bind ( com.google.gerrit.server.config.SitePaths.class ) . toInstance ( paths ) ; install ( new com.google.gerrit.server.schema.SchemaVersion.Module ( ) ) ; }

Target:
protected void configure ( ) { bind ( new com.google.inject.TypeLiteral < com.google.gwtorm.client.SchemaFactory < com.google.gerrit.reviewdb.ReviewDb > > ( ) { } ) . toInstance ( db ) ; bind ( com.google.gerrit.server.config.SitePaths.class ) . toInstance ( paths ) ; install ( new com.google.gerrit.server.schema.SchemaVersion.Module ( ) ) ; org.eclipse.jgit.lib.Config cfg = new org.eclipse.jgit.lib.Config ( ) ; cfg.setString ( "gerrit" , null , "basePath" , "git" ) ; cfg.setString ( "user" , null , "name" , "Gerrit Code Review" ) ; cfg.setString ( "user" , null , "email" , "gerrit@localhost" ) ; bind ( org.eclipse.jgit.lib.Config.class ) . annotatedWith ( com.google.gerrit.server.config.GerritServerConfig.class ) . toInstance ( cfg ) ; bind ( org.eclipse.jgit.lib.PersonIdent.class ) . annotatedWith ( com.google.gerrit.server.GerritPersonIdent.class ) . toProvider ( com.google.gerrit.server.GerritPersonIdentProvider.class ) ; bind ( com.google.gerrit.server.git.GitRepositoryManager.class ) . to ( com.google.gerrit.server.git.LocalDiskRepositoryManager.class ) ; }
Source:
public com.google.gerrit.extensions.api.changes.ChangeApi cherryPick ( com.google.gerrit.extensions.api.changes.CherryPickInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return changes.id ( cherryPick.apply ( revision , in ) . _number ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException | com.google.gerrit.server.update.UpdateException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot cherry pick" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.changes.ChangeApi cherryPick ( com.google.gerrit.extensions.api.changes.CherryPickInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return changes.id ( cherryPick.apply ( revision , in ) . _number ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot cherry pick" , e ) ; } }
Source:
private java.lang.String getPublicKeyPart ( int index , java.lang.String defaultValue ) { java.lang.String s = getSshPublicKey ( ) ; if ( ( s != null ) && ( ( s.length ( ) ) > 0 ) ) { java.lang.String [ ] parts = s.split ( " " ) ; if ( ( parts.length ) > index ) { return parts [ index ] ; } } return defaultValue ; }

Target:
public java.lang.String comment ( ) { return publicKeyPart ( 2 , "" ) ; }
Source:
public void parseStatus ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Status: NEW\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Status: new\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Status: OOPS\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Status: NEW\n" ) + "Status: NEW\n" ) ) ) ; }

Target:
public void parseSubject ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Subject: Some subject of a change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Subject: Some subject of a change\n" ) + "Subject: Some other subject\n" ) ) ) ; }
Source:
public boolean isIdentityTrustable ( final java.util.Collection < com.google.gerrit.reviewdb.client.AccountExternalId > ids ) { switch ( getAuthType ( ) ) { case DEVELOPMENT_BECOME_ANY_ACCOUNT : case HTTP : case HTTP_LDAP : case LDAP : case LDAP_BIND : case CLIENT_SSL_CERT_LDAP : case CUSTOM_EXTENSION : return true ; case OPENID : for ( final com.google.gerrit.reviewdb.client.AccountExternalId e : ids ) { if ( ! ( isTrusted ( e ) ) ) { return false ; } } return true ; default : return false ; } }

Target:
public boolean isIdentityTrustable ( final java.util.Collection < com.google.gerrit.reviewdb.client.AccountExternalId > ids ) { switch ( getAuthType ( ) ) { case DEVELOPMENT_BECOME_ANY_ACCOUNT : case HTTP : case HTTP_LDAP : case LDAP : case LDAP_BIND : case CLIENT_SSL_CERT_LDAP : case CUSTOM_EXTENSION : return true ; case OPENID_SSO : return true ; case OPENID : for ( final com.google.gerrit.reviewdb.client.AccountExternalId e : ids ) { if ( ! ( isTrusted ( e ) ) ) { return false ; } } return true ; default : return false ; } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.httpd.GerritOptions.class ) . toInstance ( new com.google.gerrit.httpd.GerritOptions ( headless , slave ) ) ; if ( test ) { bind ( com.google.gerrit.server.securestore.SecureStore.class ) . toProvider ( com.google.gerrit.server.securestore.SecureStoreProvider.class ) ; } }

Target:
protected void configure ( ) { bind ( com.google.gerrit.httpd.GerritOptions.class ) . toInstance ( new com.google.gerrit.httpd.GerritOptions ( config , headless , slave , polyGerritDev ) ) ; if ( test ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.server.securestore.SecureStoreClassName.class ) . toInstance ( com.google.gerrit.server.securestore.DefaultSecureStore.class . getName ( ) ) ; bind ( com.google.gerrit.server.securestore.SecureStore.class ) . toProvider ( com.google.gerrit.server.securestore.SecureStoreProvider.class ) ; } }
Source:
public boolean isIdentityTrustable ( final java.util.Collection < com.google.gerrit.client.reviewdb.AccountExternalId > ids ) { switch ( getLoginType ( ) ) { case DEVELOPMENT_BECOME_ANY_ACCOUNT : case HTTP : case HTTP_LDAP : return true ; case OPENID : for ( final com.google.gerrit.client.reviewdb.AccountExternalId e : ids ) { if ( ! ( isTrusted ( e ) ) ) { return false ; } } return true ; default : return false ; } }

Target:
public boolean isIdentityTrustable ( final java.util.Collection < com.google.gerrit.client.reviewdb.AccountExternalId > ids ) { switch ( getAuthType ( ) ) { case DEVELOPMENT_BECOME_ANY_ACCOUNT : case HTTP : case HTTP_LDAP : return true ; case OPENID : for ( final com.google.gerrit.client.reviewdb.AccountExternalId e : ids ) { if ( ! ( isTrusted ( e ) ) ) { return false ; } } return true ; default : return false ; } }
Source:
public int compare ( com.google.gerrit.server.group.MembersCollection.MemberInfo a , com.google.gerrit.server.group.MembersCollection.MemberInfo b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.fullName , b.fullName , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a.preferredEmail , b.preferredEmail , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a.id , b.id , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . result ( ) ; }

Target:
public int compare ( com.google.gerrit.server.account.AccountInfo a , com.google.gerrit.server.account.AccountInfo b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.name , b.name , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a.email , b.email , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a._account_id , b._account_id , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . result ( ) ; }
Source:
protected void configure ( ) { factory ( ReviewerResource.Factory.class ) ; factory ( AccountInfo.Loader.Factory.class ) ; factory ( EmailReviewComments.Factory.class ) ; factory ( ChangeInserter.Factory.class ) ; factory ( PatchSetInserter.Factory.class ) ; }

Target:
protected void configure ( ) { factory ( ReviewerResource.Factory.class ) ; factory ( AccountInfo.Loader.Factory.class ) ; factory ( EmailReviewComments.Factory.class ) ; factory ( ChangeInserter.Factory.class ) ; factory ( PatchSetInserter.Factory.class ) ; factory ( ChangeEdits.Create.Factory.class ) ; }
Source:
private com.google.common.base.Optional < com.googlesource.gerrit.plugins.manager.gson.SmartJson > findArtifact ( com.google.gson.JsonArray artifacts , java.lang.String string ) { for ( int i = 0 ; i < ( artifacts.size ( ) ) ; i ++ ) { com.googlesource.gerrit.plugins.manager.gson.SmartJson artifact = com.googlesource.gerrit.plugins.manager.gson.SmartJson.of ( artifacts.get ( i ) ) ; if ( artifact.getString ( "relativePath" ) . endsWith ( string ) ) { return com.google.common.base.Optional.of ( artifact ) ; } } return com.google.common.base.Optional.absent ( ) ; }

Target:
private java.util.Optional < com.googlesource.gerrit.plugins.manager.gson.SmartJson > findArtifact ( com.google.gson.JsonArray artifacts , java.lang.String string ) { for ( int i = 0 ; i < ( artifacts.size ( ) ) ; i ++ ) { com.googlesource.gerrit.plugins.manager.gson.SmartJson artifact = com.googlesource.gerrit.plugins.manager.gson.SmartJson.of ( artifacts.get ( i ) ) ; if ( artifact.getString ( "relativePath" ) . endsWith ( string ) ) { return java.util.Optional.of ( artifact ) ; } } return java.util.Optional.empty ( ) ; }
Source:
private java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.Comment > scanDraftComments ( com.google.gerrit.server.project.ChangeControl ctrl , com.google.gerrit.reviewdb.client.PatchSet ps ) throws com.google.gwtorm.server.OrmException { java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.Comment > drafts = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.google.gerrit.reviewdb.client.Comment c : commentsUtil.draftByPatchSetAuthor ( db , ps.getId ( ) , ( ( com.google.gerrit.server.IdentifiedUser ) ( ctrl.getUser ( ) ) ) . getAccountId ( ) , ctrl.getNotes ( ) ) ) { drafts.put ( c.key.uuid , c ) ; } return drafts ; }

Target:
private java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.Comment > scanDraftComments ( com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.reviewdb.client.PatchSet ps , com.google.gerrit.reviewdb.client.Account.Id account ) throws com.google.gwtorm.server.OrmException { java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.Comment > drafts = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.google.gerrit.reviewdb.client.Comment c : commentsUtil.draftByPatchSetAuthor ( db , ps.getId ( ) , account , notes ) ) { drafts.put ( c.key.uuid , c ) ; } return drafts ; }
Source:
static com.google.gerrit.server.notedb.NotesMigration allEnabled ( ) { org.eclipse.jgit.lib.Config cfg = new org.eclipse.jgit.lib.Config ( ) ; cfg.setBoolean ( "notedb" , null , "write" , true ) ; cfg.setBoolean ( "notedb" , "patchSetApprovals" , "read" , true ) ; cfg.setBoolean ( "notedb" , "changeMessages" , "read" , true ) ; cfg.setBoolean ( "notedb" , "publishedComments" , "read" , true ) ; return new com.google.gerrit.server.notedb.NotesMigration ( cfg ) ; }

Target:
static com.google.gerrit.server.notedb.NotesMigration allEnabled ( ) { org.eclipse.jgit.lib.Config cfg = new org.eclipse.jgit.lib.Config ( ) ; cfg.setBoolean ( "notedb" , null , "write" , true ) ; cfg.setBoolean ( "notedb" , "patchSetApprovals" , "read" , true ) ; cfg.setBoolean ( "notedb" , "changeMessages" , "read" , true ) ; cfg.setBoolean ( "notedb" , "comments" , "read" , true ) ; return new com.google.gerrit.server.notedb.NotesMigration ( cfg ) ; }
Source:
protected void onOpenItem ( final java.lang.Object item ) { if ( item instanceof com.google.gerrit.client.patches.PatchLine ) { final com.google.gerrit.client.patches.PatchLine line = ( ( com.google.gerrit.client.patches.PatchLine ) ( item ) ) ; final int row = getCurrentRow ( ) ; createCommentEditor ( ( row + 1 ) , 4 , line.getLineB ( ) , ( ( short ) ( 1 ) ) ) ; return ; } super . onOpenItem ( item ) ; }

Target:
protected void onInsertComment ( final com.google.gerrit.client.patches.PatchLine line ) { final int row = getCurrentRow ( ) ; createCommentEditor ( ( row + 1 ) , 4 , line.getLineB ( ) , ( ( short ) ( 1 ) ) ) ; }
Source:
private java.lang.String setTopic ( java.lang.String sourceId , java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException { if ( ( topic == null ) || ( topic.isEmpty ( ) ) ) { topic = "am-" + ( java.util.UUID.randomUUID ( ) . toString ( ) ) ; com.googlesource.gerrit.plugins.automerger.DownstreamCreator.log.info ( "Setting original change topic to {}" , sourceId , topic ) ; gApi.changes ( ) . id ( sourceId ) . topic ( topic ) ; } return topic ; }

Target:
private java.lang.String setTopic ( java.lang.String sourceId , java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException { if ( ( topic == null ) || ( topic.isEmpty ( ) ) ) { topic = "am-" + ( java.util.UUID.randomUUID ( ) . toString ( ) ) ; com.googlesource.gerrit.plugins.automerger.DownstreamCreator.log.debug ( "Setting original change topic to {}" , sourceId , topic ) ; gApi.changes ( ) . id ( sourceId ) . topic ( topic ) ; } return topic ; }
Source:
private void assertNotBlocked ( java.lang.String p , java.lang.String ref , com.google.gerrit.server.permissions.ProjectControl u ) { com.google.common.truth.Truth.assertThat ( u.controlForRef ( ref ) . canPerform ( p ) ) . named ( ( ( p + " is blocked for " ) + ref ) ) . isTrue ( ) ; }

Target:
public void nonconfiguredCannotVote ( ) { com.google.gerrit.server.project.testing.Util.allow ( local , ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) , ( - 2 ) , ( + 2 ) , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.permissions.ProjectControl u = user ( local , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; com.google.gerrit.common.data.PermissionRange range = u.controlForRef ( "refs/heads/master" ) . getRange ( ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) ) ; assertCannotVote ( ( - 1 ) , range ) ; assertCannotVote ( 1 , range ) ; }
Source:
public void configure ( ) { factory ( ChangeUpdate.Factory.class ) ; factory ( ChangeDraftUpdate.Factory.class ) ; factory ( DraftCommentNotes.Factory.class ) ; factory ( NoteDbUpdateManager.Factory.class ) ; }

Target:
public void configure ( ) { factory ( ChangeUpdate.Factory.class ) ; factory ( ChangeDraftUpdate.Factory.class ) ; factory ( DraftCommentNotes.Factory.class ) ; factory ( NoteDbUpdateManager.Factory.class ) ; if ( ! ( useTestBindings ) ) { bind ( com.google.gerrit.server.notedb.ChangeRebuilder.class ) . to ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.class ) ; } else { bind ( com.google.gerrit.server.notedb.ChangeRebuilder.class ) . toInstance ( new com.google.gerrit.server.notedb.ChangeRebuilder ( null ) { @ java.lang.Override public void rebuild ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change.Id changeId ) { throw new java.lang.UnsupportedOperationException ( ) ; } } ) ; } }
Source:
private void sort ( final java.util.List < com.google.gerrit.server.git.CodeReviewCommit > toSort ) throws com.google.gerrit.server.git.MergeException { try { final java.util.List < com.google.gerrit.server.git.CodeReviewCommit > sorted = new com.google.gerrit.server.git.RebaseSorter ( args.rw , args.alreadyAccepted , args.canMergeFlag ) . sort ( toSort ) ; toSort.clear ( ) ; toSort.addAll ( sorted ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.MergeException ( "Commit sorting failed" , e ) ; } }

Target:
private java.util.List < com.google.gerrit.server.git.CodeReviewCommit > sort ( java.util.Collection < com.google.gerrit.server.git.CodeReviewCommit > toSort ) throws com.google.gerrit.server.git.MergeException { try { java.util.List < com.google.gerrit.server.git.CodeReviewCommit > result = new com.google.gerrit.server.git.RebaseSorter ( args.rw , args.alreadyAccepted , args.canMergeFlag ) . sort ( toSort ) ; java.util.Collections.sort ( result , CodeReviewCommit.ORDER ) ; return result ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.MergeException ( "Commit sorting failed" , e ) ; } }
Source:
public void testMissingDownstreamMerges ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result result = createChange ( "subject" , "filename" , "content" , "testtopic" ) ; pushConfig ( "automerger.config" , result.getChange ( ) . project ( ) . get ( ) ) ; result.assertOkStatus ( ) ; int changeNumber = result.getChange ( ) . getId ( ) . id ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceConflictException.class ) ; exception.expectMessage ( ( ( "Failed to submit 1 change due to the following problems:\nChange " + changeNumber ) + ": Missing downstream branches ds_one. Please recreate the automerges." ) ) ; merge ( result ) ; }

Target:
public void testMissingDownstreamMerges ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result result = createChange ( "subject" , "filename" , "content" , "testtopic" ) ; pushConfig ( "automerger.config" , result.getChange ( ) . project ( ) . get ( ) , "ds_one" ) ; result.assertOkStatus ( ) ; int changeNumber = result.getChange ( ) . getId ( ) . id ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceConflictException.class ) ; exception.expectMessage ( ( ( "Failed to submit 1 change due to the following problems:\nChange " + changeNumber ) + ": Missing downstream branches ds_one. Please recreate the automerges." ) ) ; merge ( result ) ; }
Source:
protected static void runGerrit ( java.lang.String ... args ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( com.google.gerrit.launcher.GerritLauncher.mainImpl ( args ) ) . named ( ( "gerrit.war " + ( java.util.Arrays.stream ( args ) . collect ( java.util.stream.Collectors.joining ( " " ) ) ) ) ) . isEqualTo ( 0 ) ; }

Target:
protected static void runGerrit ( java.lang.String ... args ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( com.google.gerrit.launcher.GerritLauncher.invokeProgram ( com.google.gerrit.acceptance.StandaloneSiteTest.class . getClassLoader ( ) , args ) ) . named ( ( "gerrit.war " + ( java.util.Arrays.stream ( args ) . collect ( java.util.stream.Collectors.joining ( " " ) ) ) ) ) . isEqualTo ( 0 ) ; }
Source:
public void mute ( com.google.gerrit.reviewdb.client.Account.Id accountId , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change change ) throws com.google.gerrit.server.StarredChangesUtil.IllegalLabelException , com.google.gwtorm.server.OrmException { star ( accountId , project , change.getId ( ) , com.google.common.collect.ImmutableSet.of ( com.google.gerrit.server.StarredChangesUtil.getMuteLabel ( change ) ) , com.google.common.collect.ImmutableSet.of ( ) ) ; }

Target:
public void mute ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.server.StarredChangesUtil.IllegalLabelException , com.google.gwtorm.server.OrmException { star ( rsrc.getUser ( ) . asIdentifiedUser ( ) . getAccountId ( ) , rsrc.getProject ( ) , rsrc.getChange ( ) . getId ( ) , com.google.common.collect.ImmutableSet.of ( com.google.gerrit.server.StarredChangesUtil.getMuteLabel ( rsrc.getChange ( ) ) ) , com.google.common.collect.ImmutableSet.of ( ) ) ; }
Source:
public void addGpgKey ( ) throws java.lang.Exception { com.google.gerrit.server.git.gpg.TestKey key = com.google.gerrit.server.git.gpg.TestKey.key1 ( ) ; java.lang.String id = com.google.gerrit.server.git.gpg.PublicKeyStore.keyIdToString ( key.getKeyId ( ) ) ; addExternalIdEmail ( admin , "test1@example.com" ) ; com.google.gerrit.extensions.common.GpgKeyInfo info = gApi.accounts ( ) . self ( ) . putGpgKeys ( com.google.common.collect.ImmutableList.of ( key.getPublicKeyArmored ( ) ) ) . get ( id ) ; info.id = id ; com.google.gerrit.acceptance.api.accounts.AccountIT.assertKeyEquals ( key , info ) ; com.google.gerrit.acceptance.api.accounts.AccountIT.assertKeyEquals ( key , gApi.accounts ( ) . self ( ) . gpgKey ( id ) . get ( ) ) ; org.bouncycastle.openpgp.PGPPublicKey stored = getOnlyKeyFromStore ( key ) ; com.google.common.truth.Truth.assertThat ( stored.getFingerprint ( ) ) . isEqualTo ( key.getPublicKey ( ) . getFingerprint ( ) ) ; setApiUser ( user ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; exception.expectMessage ( id ) ; gApi.accounts ( ) . self ( ) . gpgKey ( id ) . get ( ) ; }

Target:
public void clearPublicKeyStore ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.Ref ref = repo.getRef ( RefNames.REFS_GPG_KEYS ) ; if ( ref != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( RefNames.REFS_GPG_KEYS ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assertThat ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }
Source:
private java.lang.String parseTopic ( org.eclipse.jgit.revwalk.RevCommit commit ) throws org.eclipse.jgit.errors.ConfigInvalidException { java.util.List < java.lang.String > topicLines = commit.getFooterLines ( com.google.gerrit.server.notedb.ChangeNoteUtil.FOOTER_TOPIC ) ; if ( topicLines.isEmpty ( ) ) { return null ; } else if ( ( topicLines.size ( ) ) > 1 ) { throw expectedOneFooter ( com.google.gerrit.server.notedb.ChangeNoteUtil.FOOTER_TOPIC , topicLines ) ; } return topicLines.get ( 0 ) ; }

Target:
private java.lang.String parseOneFooter ( org.eclipse.jgit.revwalk.RevCommit commit , org.eclipse.jgit.revwalk.FooterKey footerKey ) throws org.eclipse.jgit.errors.ConfigInvalidException { java.util.List < java.lang.String > footerLines = commit.getFooterLines ( footerKey ) ; if ( footerLines.isEmpty ( ) ) { return null ; } else if ( ( footerLines.size ( ) ) > 1 ) { throw expectedOneFooter ( footerKey , footerLines ) ; } return footerLines.get ( 0 ) ; }
Source:
private void appliedBy ( com.google.gerrit.common.data.SubmitRecord.Label label , com.googlecode.prolog_cafe.lang.Term status ) { if ( ( status.isStructure ( ) ) && ( ( status.arity ( ) ) == 1 ) ) { com.googlecode.prolog_cafe.lang.Term who = status.arg ( 0 ) ; if ( com.google.gerrit.server.project.ChangeControl.isUser ( who ) ) { label.appliedBy = new com.google.gerrit.reviewdb.client.Account.Id ( ( ( com.googlecode.prolog_cafe.lang.IntegerTerm ) ( who.arg ( 0 ) ) ) . intValue ( ) ) ; } } }

Target:
private void appliedBy ( com.google.gerrit.common.data.SubmitRecord.Label label , com.googlecode.prolog_cafe.lang.Term status ) throws com.google.gerrit.server.project.ChangeControl.UserTermExpected { if ( ( status.isStructure ( ) ) && ( ( status.arity ( ) ) == 1 ) ) { com.googlecode.prolog_cafe.lang.Term who = status.arg ( 0 ) ; if ( com.google.gerrit.server.project.ChangeControl.isUser ( who ) ) { label.appliedBy = new com.google.gerrit.reviewdb.client.Account.Id ( ( ( com.googlecode.prolog_cafe.lang.IntegerTerm ) ( who.arg ( 0 ) ) ) . intValue ( ) ) ; } else { throw new com.google.gerrit.server.project.ChangeControl.UserTermExpected ( label ) ; } } }