auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void setOpen ( boolean open ) { if ( open ) { removeStyleName ( res.style ( ) . close ( ) ) ; addStyleName ( res.style ( ) . open ( ) ) ; } else { removeStyleName ( res.style ( ) . open ( ) ) ; addStyleName ( res.style ( ) . close ( ) ) ; } }

Target:
protected void setOpen ( boolean open ) { if ( open ) { removeStyleName ( res.style ( ) . close ( ) ) ; addStyleName ( res.style ( ) . open ( ) ) ; } else { removeStyleName ( res.style ( ) . open ( ) ) ; addStyleName ( res.style ( ) . close ( ) ) ; } resizePaddingWidget ( ) ; }
Source:
private java.lang.String createChangeWith2PS ( java.lang.String ref ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.git.PushOneCommit push = new com.google.gerrit.acceptance.git.PushOneCommit ( db , admin.getIdent ( ) ) ; com.google.gerrit.acceptance.git.PushOneCommit.Result result = push.to ( git , ref ) ; push = new com.google.gerrit.acceptance.git.PushOneCommit ( db , admin.getIdent ( ) , com.google.gerrit.acceptance.git.PushOneCommit.SUBJECT , "b.txt" , "4711" , result.getChangeId ( ) ) ; return push.to ( git , ref ) . getChangeId ( ) ; }

Target:
private java.lang.String createChangeWith2PS ( java.lang.String ref ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) ) ; com.google.gerrit.acceptance.PushOneCommit.Result result = push.to ( git , ref ) ; push = pushFactory.create ( db , admin.getIdent ( ) , PushOneCommit.SUBJECT , "b.txt" , "4711" , result.getChangeId ( ) ) ; return push.to ( git , ref ) . getChangeId ( ) ; }
Source:
private void enableForm ( final boolean on ) { ownerTxtBox.setEnabled ( on ) ; descTxt.setEnabled ( on ) ; delRight.setEnabled ( on ) ; }

Target:
private void enableForm ( final boolean on ) { ownerTxtBox.setEnabled ( on ) ; descTxt.setEnabled ( on ) ; delRight.setEnabled ( on ) ; final boolean canAdd = on && ( ( catBox.getItemCount ( ) ) > 0 ) ; addRight.setEnabled ( canAdd ) ; nameTxtBox.setEnabled ( canAdd ) ; catBox.setEnabled ( canAdd ) ; rangeMinBox.setEnabled ( canAdd ) ; rangeMaxBox.setEnabled ( canAdd ) ; }
Source:
private void loadRules ( ) { if ( ( rules ) == null ) { try { forceLoadRules ( ) ; } catch ( java.lang.Exception e ) { com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.log.error ( "Invalid ITS action configuration" , e ) ; rules = java.util.Collections.emptySet ( ) ; } } }

Target:
private void reloadRules ( ) { rules = com.google.common.collect.Lists.newArrayList ( ) ; java.io.File faultyNameRuleFile = new java.io.File ( sitePath , ( ( ( ( "etc" + ( java.io.File.separatorChar ) ) + "its" ) + ( java.io.File.separator ) ) + "action.config" ) ) ; if ( faultyNameRuleFile.exists ( ) ) { com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.log.warn ( ( "Loading rules from deprecated 'etc/its/action.config' (No " + ( "trailing 's' in 'action'). Please migrate to " + "'etc/its/actions.config' (Trailing 's' in 'actions')." ) ) ) ; addRulesFromFile ( faultyNameRuleFile ) ; } java.io.File globalRuleFile = new java.io.File ( sitePath , com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.ITS_CONFIG_FILE ) ; addRulesFromFile ( globalRuleFile ) ; }
Source:
public void init ( final javax.servlet.ServletConfig config ) throws javax.servlet.ServletException { super . init ( config ) ; try { allowed = java.lang.Boolean.getBoolean ( getClass ( ) . getName ( ) ) ; } catch ( java.lang.SecurityException se ) { allowed = false ; } try { server = com.google.gerrit.server.GerritServer.getInstance ( ) ; } catch ( com.google.gwtorm.client.OrmException e ) { throw new javax.servlet.ServletException ( "Cannot load GerritServer" , e ) ; } catch ( com.google.gwtjsonrpc.server.XsrfException e ) { throw new javax.servlet.ServletException ( "Cannot load GerritServer" , e ) ; } }

Target:
static boolean isAllowed ( ) { try { return java.lang.Boolean.getBoolean ( com.google.gerrit.server.BecomeAnyAccountLoginServlet.class . getName ( ) ) ; } catch ( java.lang.SecurityException se ) { return false ; } }
Source:
public void delete ( java.lang.Iterable < T > instances ) throws com.google.gwtorm.client.OrmException { for ( T obj : instances ) { db.delete ( dataRowKey ( obj ) ) ; for ( com.google.gwtorm.nosql.IndexFunction < T > f : com.google.gwtorm.nosql.generic.GenericAccess.getQueryIndexes ( ) ) { if ( f.includes ( obj ) ) { db.delete ( indexRowKey ( f , obj ) ) ; } } } }

Target:
public void delete ( java.lang.Iterable < T > instances ) throws com.google.gwtorm.client.OrmException { for ( T oldObj : instances ) { db.delete ( dataRowKey ( com.google.gwtorm.nosql.generic.GenericAccess.primaryKey ( oldObj ) ) ) ; pruneOldIndexes ( oldObj , null ) ; } }
Source:
private com.google.inject.Injector createSshInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; modules.add ( sysInjector.getInstance ( com.google.gerrit.sshd.SshModule.class ) ) ; modules.add ( new com.google.gerrit.sshd.SshHostKeyModule ( ) ) ; modules.add ( new com.google.gerrit.sshd.commands.MasterCommandModule ( ) ) ; return sysInjector.createChildInjector ( modules ) ; }

Target:
private com.google.inject.Injector createSshInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; modules.add ( sysInjector.getInstance ( com.google.gerrit.sshd.SshModule.class ) ) ; modules.add ( new com.google.gerrit.sshd.SshHostKeyModule ( ) ) ; modules.add ( new com.google.gerrit.sshd.commands.DefaultCommandModule ( false ) ) ; return sysInjector.createChildInjector ( modules ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { com.google.gerrit.testutil.FakeAccountByEmailCache accountCache = new com.google.gerrit.testutil.FakeAccountByEmailCache ( ) ; lifecycle = new com.google.gerrit.lifecycle.LifecycleManager ( ) ; schemaFactory = com.google.gerrit.testutil.InMemoryDatabase.newDatabase ( lifecycle ) ; lifecycle.start ( ) ; schemaFactory.create ( ) ; db = schemaFactory.open ( ) ; repoManager = new com.google.gerrit.testutil.InMemoryRepositoryManager ( ) ; checker = new com.google.gerrit.server.change.ConsistencyChecker ( com.google.inject.util.Providers.< com.google.gerrit.reviewdb.server.ReviewDb > of ( db ) , repoManager , com.google.inject.util.Providers.< com.google.gerrit.server.CurrentUser > of ( new com.google.gerrit.server.InternalUser ( null ) ) , com.google.inject.util.Providers.of ( new org.eclipse.jgit.lib.PersonIdent ( "server" , "noreply@example.com" ) ) , new com.google.gerrit.server.patch.PatchSetInfoFactory ( repoManager , accountCache ) ) ; project = new com.google.gerrit.reviewdb.client.Project.NameKey ( "repo" ) ; repo = new org.eclipse.jgit.junit.TestRepository ( repoManager.createRepository ( project ) ) ; userId = new com.google.gerrit.reviewdb.client.Account.Id ( 1 ) ; accountCache.putAny ( userId ) ; db.accounts ( ) . insert ( java.util.Collections.singleton ( new com.google.gerrit.reviewdb.client.Account ( userId , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ) ) ; tip = repo.branch ( "master" ) . commit ( ) . create ( ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { testRepo = new org.eclipse.jgit.junit.TestRepository ( ( ( org.eclipse.jgit.internal.storage.dfs.InMemoryRepository ) ( repoManager.openRepository ( project ) ) ) ) ; tip = testRepo.getRevWalk ( ) . parseCommit ( testRepo.getRepository ( ) . getRef ( "HEAD" ) . getObjectId ( ) ) ; adminId = admin.getId ( ) ; checker = checkerProvider.get ( ) ; }
Source:
private java.util.List < com.google.gerrit.extensions.api.projects.TagInfo > listTags ( com.google.gerrit.server.api.projects.ListRefsRequest < com.google.gerrit.extensions.api.projects.TagInfo > request ) throws com.google.gerrit.extensions.restapi.RestApiException { listTags.setLimit ( request.getLimit ( ) ) ; listTags.setStart ( request.getStart ( ) ) ; listTags.setMatchSubstring ( request.getSubstring ( ) ) ; listTags.setMatchRegex ( request.getRegex ( ) ) ; try { return listTags.apply ( checkExists ( ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot list tags" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.config.AccessCheckInfo checkAccess ( com.google.gerrit.extensions.api.config.AccessCheckInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return checkAccess.apply ( checkExists ( ) , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot check access rights" , e ) ; } }
Source:
public < T > com.google.gerrit.client.rpc.HttpCallback < T > add ( com.google.gerrit.client.rpc.HttpCallback < T > cb ) { checkFinalAdded ( ) ; if ( failed ) { cb.onFailure ( failedThrowable ) ; return new com.google.gerrit.client.rpc.HttpCallback < T > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.rpc.HttpResponse < T > result ) { } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ; } com.google.gerrit.client.rpc.CallbackGroup.HttpCallbackImpl < T > w = new com.google.gerrit.client.rpc.CallbackGroup.HttpCallbackImpl ( cb ) ; callbacks.add ( w ) ; remaining.add ( w ) ; return w ; }

Target:
private < T > com.google.gerrit.client.rpc.HttpCallback < T > handleAdd ( com.google.gerrit.client.rpc.HttpCallback < T > cb ) { if ( failed ) { cb.onFailure ( failedThrowable ) ; return new com.google.gerrit.client.rpc.HttpCallback < T > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.rpc.HttpResponse < T > result ) { } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ; } com.google.gerrit.client.rpc.CallbackGroup.HttpCallbackImpl < T > w = new com.google.gerrit.client.rpc.CallbackGroup.HttpCallbackImpl ( cb ) ; callbacks.add ( w ) ; remaining.add ( w ) ; return w ; }
Source:
public void testCreatePermissionOnlyProject ( ) throws java.lang.Exception { final java.lang.String newProjectName = "newProject" ; com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.permissionsOnly = true ; adminSession.put ( ( "/projects/" + newProjectName ) , in ) ; assertHead ( newProjectName , RefNames.REFS_CONFIG ) ; }

Target:
public void testCreatePermissionOnlyProject ( ) throws java.lang.Exception { final java.lang.String newProjectName = "newProject" ; com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = newProjectName ; in.permissionsOnly = true ; gApi.projects ( ) . create ( in ) ; assertHead ( newProjectName , RefNames.REFS_CONFIG ) ; }
Source:
public void testUnblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) ; r.setBlock ( ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }

Target:
public void testUnblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; r.setBlock ( ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.schema.DataSourceType.class ) . toInstance ( dst ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.schema.DataSourceType.class ) . toInstance ( dst ) ; bind ( DataSourceProvider.Context.class ) . toInstance ( DataSourceProvider.Context.MULTI_USER ) ; bind ( com.google.inject.Key.get ( javax.sql.DataSource.class , com.google.inject.name.Names.named ( "ReviewDb" ) ) ) . toProvider ( com.google.gerrit.server.schema.DataSourceProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; listener ( ) . to ( com.google.gerrit.server.schema.DataSourceProvider.class ) ; }
Source:
public void onSuccess ( java.util.List < com.google.gerrit.reviewdb.client.Project > result ) { if ( ( result != null ) && ( ! ( result.isEmpty ( ) ) ) ) { suggestedParentsTab.setVisible ( true ) ; suggestedParentsTab.display ( result ) ; suggestedParentsTab.finishDisplay ( ) ; } }

Target:
public void onSuccess ( com.google.gerrit.client.projects.ProjectMap list ) { if ( ! ( list.isEmpty ( ) ) ) { suggestedParentsTab.setVisible ( true ) ; suggestedParentsTab.display ( list ) ; suggestedParentsTab.finishDisplay ( ) ; } }
Source:
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.resizeCodeMirror ( ) ; } }

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 com.google.gerrit.acceptance.RestResponse post ( java.lang.String endPoint , java.lang.Object content ) throws java.io.IOException { org.apache.http.client.methods.HttpPost post = new org.apache.http.client.methods.HttpPost ( ( ( ( url ) + "/a" ) + endPoint ) ) ; if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.setEntity ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , com.google.common.base.Charsets.UTF_8.name ( ) ) ) ; } return new com.google.gerrit.acceptance.RestResponse ( getClient ( ) . execute ( post ) ) ; }

Target:
public com.google.gerrit.acceptance.RestResponse post ( java.lang.String endPoint , java.lang.Object content ) throws java.io.IOException { org.apache.http.client.fluent.Request post = org.apache.http.client.fluent.Request.Post ( ( ( ( url ) + "/a" ) + endPoint ) ) ; if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.body ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , com.google.common.base.Charsets.UTF_8.name ( ) ) ) ; } return execute ( post ) ; }
Source:
public void testErrorWhileSendingUnhealthyResponse ( ) throws java.io.IOException { javax.servlet.http.HttpServletResponse responseMock = mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; responseMock = mock ( javax.servlet.http.HttpServletResponse.class ) ; doThrow ( new java.io.IOException ( "someError" ) ) . when ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE ) ; servlet.doGet ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }

Target:
public void testTransitionToUnhealthyByNonAdmins ( ) throws java.io.IOException { assertIsHealthy ( ) ; org.mockito.Mockito.when ( capabilityControlMock.canAdministrateServer ( ) ) . thenReturn ( false ) ; javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_FORBIDDEN ) ; assertIsHealthy ( ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo.MergeableInfo result ) { if ( canSubmit ) { actions.setSubmitEnabled ( result.mergeable ( ) ) ; if ( status == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) { statusText.setInnerText ( ( result.mergeable ( ) ? Util.C.readyToSubmit ( ) : Util.C.mergeConflict ( ) ) ) ; } } setVisible ( notMergeable , ( ! ( result.mergeable ( ) ) ) ) ; renderSubmitType ( result.submit_type ( ) ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString result ) { if ( com.google.gerrit.client.Gerrit.getConfig ( ) . testChangeMerge ( ) ) { if ( canSubmit ) { actions.setSubmitEnabled ( changeInfo.mergeable ( ) ) ; if ( status == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) { statusText.setInnerText ( ( changeInfo.mergeable ( ) ? Util.C.readyToSubmit ( ) : Util.C.mergeConflict ( ) ) ) ; } } setVisible ( notMergeable , ( ! ( changeInfo.mergeable ( ) ) ) ) ; } renderSubmitType ( result.asString ( ) ) ; }
Source:
private static void updateHeadLocally ( org.eclipse.jgit.transport.URIish uri , java.lang.String newHead ) { try ( org.eclipse.jgit.lib.Repository repo = new org.eclipse.jgit.internal.storage.file.FileRepository ( uri.getPath ( ) ) ) { if ( newHead != null ) { org.eclipse.jgit.lib.RefUpdate u = repo.updateRef ( Constants.HEAD ) ; u.link ( newHead ) ; } } catch ( java.io.IOException e ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.error ( java.lang.String.format ( "Failed to update HEAD of repository %s to %s" , uri.getPath ( ) , newHead ) , e ) ; } }

Target:
private static void updateHeadLocally ( org.eclipse.jgit.transport.URIish uri , java.lang.String newHead ) { try ( org.eclipse.jgit.lib.Repository repo = new org.eclipse.jgit.internal.storage.file.FileRepository ( uri.getPath ( ) ) ) { if ( newHead != null ) { org.eclipse.jgit.lib.RefUpdate u = repo.updateRef ( Constants.HEAD ) ; u.link ( newHead ) ; } } catch ( java.io.IOException e ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.error ( "Failed to update HEAD of repository to {}" , uri.getPath ( ) , newHead , e ) ; } }
Source:
public void onClose ( com.google.gwt.event.logical.shared.CloseEvent < com.google.gwt.user.client.ui.PopupPanel > event ) { if ( ( popup ) == p ) { popup = null ; } }

Target:
public void onClose ( com.google.gwt.event.logical.shared.CloseEvent < com.google.gwt.user.client.ui.PopupPanel > event ) { if ( ( popup ) == p ) { popup = null ; if ( ( hasDraftComments ) || ( replyBox.hasMessage ( ) ) ) { replyButton.setStyleName ( style.highlight ( ) ) ; } } }
Source:
public java.lang.String apply ( com.google.gerrit.server.change.RevisionResource rev , com.googlesource.gerrit.plugins.cookbook.HelloWorldAction.Input input ) { final java.lang.String greeting = ( input.french ) ? "Bonjour" : "Hello" ; return java.lang.String.format ( "%s %s from change %s, patch set %d!" , greeting , ( com.google.common.base.Strings.isNullOrEmpty ( input.message ) ? com.google.common.base.Objects.firstNonNull ( user.get ( ) . getUserName ( ) , "world" ) : input.message ) , rev.getChange ( ) . getId ( ) . toString ( ) , rev.getPatchSet ( ) . getPatchSetId ( ) ) ; }

Target:
public java.lang.String apply ( com.google.gerrit.server.project.ProjectResource rsrc , com.googlesource.gerrit.plugins.cookbook.HelloProjectAction.Input input ) { final java.lang.String greeting = ( input.french ) ? "Bonjour" : "Hello" ; return java.lang.String.format ( "%s %s from project %s!" , greeting , ( com.google.common.base.Strings.isNullOrEmpty ( input.message ) ? com.google.common.base.Objects.firstNonNull ( user.get ( ) . getUserName ( ) , "world" ) : input.message ) , rsrc.getName ( ) ) ; }
Source:
private java.lang.String parseResponse ( org.apache.http.HttpResponse response ) { org.apache.http.HttpEntity entity = response.getEntity ( ) ; java.lang.String asString = "" ; if ( entity != null ) { try { asString = org.apache.http.util.EntityUtils.toString ( entity ) ; } catch ( java.io.IOException e ) { com.ericsson.gerrit.plugins.multimaster.IndexResponseHandler.log.error ( "Error parsing entity" , e ) ; } } return asString ; }

Target:
private java.lang.String parseResponse ( org.apache.http.HttpResponse response ) { org.apache.http.HttpEntity entity = response.getEntity ( ) ; java.lang.String asString = "" ; if ( entity != null ) { try { asString = org.apache.http.util.EntityUtils.toString ( entity ) ; } catch ( java.io.IOException e ) { com.ericsson.gerrit.plugins.multimaster.HttpResponseHandler.log.error ( "Error parsing entity" , e ) ; } } return asString ; }
Source:
private void assertSubmitApproval ( com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSetApproval a = approvalsUtil.getSubmitter ( db , patchSetId ) ; org.junit.Assert.assertTrue ( a.isSubmit ( ) ) ; org.junit.Assert.assertEquals ( 1 , a.getValue ( ) ) ; org.junit.Assert.assertEquals ( admin.id , a.getAccountId ( ) ) ; }

Target:
private void assertSubmitApproval ( com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change c = db.changes ( ) . get ( patchSetId.getParentKey ( ) ) ; com.google.gerrit.server.notedb.ChangeNotes notes = changeNotesFactory.create ( c ) . load ( ) ; com.google.gerrit.reviewdb.client.PatchSetApproval a = approvalsUtil.getSubmitter ( db , notes , patchSetId ) ; org.junit.Assert.assertTrue ( a.isSubmit ( ) ) ; org.junit.Assert.assertEquals ( 1 , a.getValue ( ) ) ; org.junit.Assert.assertEquals ( admin.id , a.getAccountId ( ) ) ; }
Source:
public com.google.gerrit.server.config.GetServerInfo.ServerInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc ) throws java.net.MalformedURLException { com.google.gerrit.server.config.GetServerInfo.ServerInfo info = new com.google.gerrit.server.config.GetServerInfo.ServerInfo ( ) ; info.auth = getAuthInfo ( authConfig , realm ) ; info.change = getChangeInfo ( config ) ; info.contactStore = getContactStoreInfo ( ) ; info.download = getDownloadInfo ( downloadSchemes , downloadCommands , archiveFormats ) ; info.gerrit = getGerritInfo ( config , allProjectsName , allUsersName ) ; info.gitWeb = getGitWebInfo ( gitWebConfig ) ; info.suggest = getSuggestInfo ( config ) ; info.user = getUserInfo ( anonymousCowardName ) ; return info ; }

Target:
public com.google.gerrit.server.config.GetServerInfo.ServerInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc ) throws java.net.MalformedURLException { com.google.gerrit.server.config.GetServerInfo.ServerInfo info = new com.google.gerrit.server.config.GetServerInfo.ServerInfo ( ) ; info.auth = getAuthInfo ( authConfig , realm ) ; info.change = getChangeInfo ( config ) ; info.contactStore = getContactStoreInfo ( ) ; info.download = getDownloadInfo ( downloadSchemes , downloadCommands , cloneCommands , archiveFormats ) ; info.gerrit = getGerritInfo ( config , allProjectsName , allUsersName ) ; info.gitWeb = getGitWebInfo ( gitWebConfig ) ; info.suggest = getSuggestInfo ( config ) ; info.user = getUserInfo ( anonymousCowardName ) ; return info ; }
Source:
public void testItsAssociationPolicyOptional ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getEnum ( "commentLink" , "ItsTestName" , "association" , ItsAssociationPolicy.OPTIONAL ) ) . andReturn ( ItsAssociationPolicy.OPTIONAL ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated associated policy do not match" , ItsAssociationPolicy.OPTIONAL , itsConfig.getItsAssociationPolicy ( ) ) ; }

Target:
public void testItsAssociationPolicyOptional ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getEnum ( "commentlink" , "ItsTestName" , "association" , ItsAssociationPolicy.OPTIONAL ) ) . andReturn ( ItsAssociationPolicy.OPTIONAL ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated associated policy do not match" , ItsAssociationPolicy.OPTIONAL , itsConfig.getItsAssociationPolicy ( ) ) ; }
Source:
public void dryRunMerge_Conflicts ( ) throws java.lang.Exception { changeInTwoBranches ( "a.txt" , "a.txt" ) ; com.google.gerrit.acceptance.RestResponse r = adminRestSession.get ( ( ( "/projects/" + ( project.get ( ) ) ) + "/branches/master/mergeable?source=branchA" ) ) ; com.google.gerrit.extensions.common.MergeableInfo m = newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.extensions.common.MergeableInfo.class ) ; com.google.common.truth.Truth.assertThat ( m.mergeable ) . isFalse ( ) ; com.google.common.truth.Truth.assertThat ( m.conflicts ) . containsExactly ( "a.txt" ) ; }

Target:
public void invalidStrategy ( ) throws java.lang.Exception { changeInTwoBranches ( "branchA" , "a.txt" , "branchB" , "b.txt" ) ; com.google.gerrit.extensions.common.ChangeInput in = newMergeChangeInput ( "branchA" , "branchB" , "octopus" ) ; assertCreateFails ( in , com.google.gerrit.extensions.restapi.BadRequestException.class , "invalid merge strategy: octopus" ) ; }
Source:
public static com.ericsson.gerrit.plugins.highavailability.forwarder.rest.CacheRestApiServlet.CacheParameters getCacheParameters ( java.lang.String cache ) { int dot = cache.indexOf ( "." ) ; if ( dot > 0 ) { return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.CacheRestApiServlet.CacheParameters ( cache.substring ( 0 , dot ) , cache.substring ( ( dot + 1 ) ) ) ; } return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.CacheRestApiServlet.CacheParameters ( com.ericsson.gerrit.plugins.highavailability.cache.Constants.GERRIT , cache ) ; }

Target:
public static com.ericsson.gerrit.plugins.highavailability.forwarder.rest.CacheRestApiServlet.CacheParameters getCacheParameters ( java.lang.String cache ) { int dot = cache.indexOf ( '.' ) ; if ( dot > 0 ) { return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.CacheRestApiServlet.CacheParameters ( cache.substring ( 0 , dot ) , cache.substring ( ( dot + 1 ) ) ) ; } return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.CacheRestApiServlet.CacheParameters ( com.ericsson.gerrit.plugins.highavailability.cache.Constants.GERRIT , cache ) ; }
Source:
public void largeObjectTombstoneGetsCached ( ) { com.google.gerrit.server.diff.PatchListKey key = com.google.gerrit.server.diff.PatchListKey.againstDefaultBase ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) , Whitespace.IGNORE_ALL ) ; com.google.gerrit.server.patch.PatchListCacheImpl.LargeObjectTombstone tombstone = new com.google.gerrit.server.patch.PatchListCacheImpl.LargeObjectTombstone ( ) ; abstractPatchListCache.put ( key , tombstone ) ; com.google.common.truth.Truth.assertThat ( abstractPatchListCache.getIfPresent ( key ) ) . isSameAs ( tombstone ) ; }

Target:
public void largeObjectTombstoneGetsCached ( ) { com.google.gerrit.server.patch.PatchListKey key = com.google.gerrit.server.patch.PatchListKey.againstDefaultBase ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) , Whitespace.IGNORE_ALL ) ; com.google.gerrit.server.patch.PatchListCacheImpl.LargeObjectTombstone tombstone = new com.google.gerrit.server.patch.PatchListCacheImpl.LargeObjectTombstone ( ) ; abstractPatchListCache.put ( key , tombstone ) ; com.google.common.truth.Truth.assertThat ( abstractPatchListCache.getIfPresent ( key ) ) . isSameAs ( tombstone ) ; }
Source:
public int compare ( com.google.gerrit.reviewdb.client.AccountExternalId a , com.google.gerrit.reviewdb.client.AccountExternalId b ) { return emailOf ( a ) . compareTo ( emailOf ( b ) ) ; }

Target:
void display ( final com.google.gwt.core.client.JsArray < com.google.gerrit.client.account.ExternalIdInfo > results ) { java.util.List < com.google.gerrit.client.account.ExternalIdInfo > idList = com.google.gerrit.client.rpc.Natives.asList ( results ) ; java.util.Collections.sort ( idList ) ; while ( 1 < ( table.getRowCount ( ) ) ) { table.removeRow ( ( ( table.getRowCount ( ) ) - 1 ) ) ; } for ( final com.google.gerrit.client.account.ExternalIdInfo k : idList ) { addOneId ( k ) ; } updateDeleteButton ( ) ; }
Source:
public com.google.gerrit.common.data.GroupReference apply ( com.google.gerrit.server.account.AccountState state ) { com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ; if ( ( state.getUserName ( ) ) != null ) { uuid = com.googlesource.gerrit.plugins.singleusergroup.SingleUserGroup.uuid ( state.getUserName ( ) ) ; } else { uuid = com.googlesource.gerrit.plugins.singleusergroup.SingleUserGroup.uuid ( state.getAccount ( ) . getId ( ) ) ; } return new com.google.gerrit.common.data.GroupReference ( uuid , com.googlesource.gerrit.plugins.singleusergroup.SingleUserGroup.nameOf ( uuid , state ) ) ; }

Target:
public com.google.gerrit.common.data.GroupReference apply ( com.google.gerrit.server.account.AccountState state ) { com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ; if ( state.getUserName ( ) . isPresent ( ) ) { uuid = com.googlesource.gerrit.plugins.singleusergroup.SingleUserGroup.uuid ( state.getUserName ( ) . get ( ) ) ; } else { uuid = com.googlesource.gerrit.plugins.singleusergroup.SingleUserGroup.uuid ( state.getAccount ( ) . getId ( ) ) ; } return new com.google.gerrit.common.data.GroupReference ( uuid , com.googlesource.gerrit.plugins.singleusergroup.SingleUserGroup.nameOf ( uuid , state ) ) ; }
Source:
void send ( java.lang.String message ) { com.google.gerrit.client.changes.ChangeApi.createChange ( project , branch , message , base , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.changes.ChangeInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo result ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( result.legacyId ( ) ) ) ; hide ( ) ; } } ) ; }

Target:
void send ( java.lang.String message ) { com.google.gerrit.client.changes.ChangeApi.createChange ( project , branch , topic , message , base , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.info.ChangeInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.info.ChangeInfo result ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( result.legacyId ( ) ) ) ; hide ( ) ; } } ) ; }
Source:
void onValueChange ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > event ) { com.google.gerrit.client.rpc.RestApi api = com.google.gerrit.client.changes.ChangeApi.revision ( patchSetId ) . view ( "files" ) . id ( path ) . view ( "reviewed" ) ; if ( event.getValue ( ) ) { api.put ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } else { api.delete ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } }

Target:
void onValueChange ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > event ) { if ( event.getValue ( ) ) { reviewed ( ) . put ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } else { reviewed ( ) . delete ( com.google.gerrit.client.rpc.CallbackGroup.< com.google.gerrit.client.changes.ReviewInfo > emptyCallback ( ) ) ; } }
Source:
public void updateExisting ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key5 = com.google.gerrit.gpg.testutil.TestKey.key5 ( ) ; org.bouncycastle.openpgp.PGPPublicKeyRing keyRing = key5.getPublicKeyRing ( ) ; org.bouncycastle.openpgp.PGPPublicKey key = keyRing.getPublicKey ( ) ; store.add ( keyRing ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertUserIds ( store.get ( key5.getKeyId ( ) ) . iterator ( ) . next ( ) , "Testuser Five <test5@example.com>" , "foo:myId" ) ; keyRing = org.bouncycastle.openpgp.PGPPublicKeyRing.removePublicKey ( keyRing , key ) ; key = org.bouncycastle.openpgp.PGPPublicKey.removeCertification ( key , "foo:myId" ) ; keyRing = org.bouncycastle.openpgp.PGPPublicKeyRing.insertPublicKey ( keyRing , key ) ; store.add ( keyRing ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FAST_FORWARD , store.save ( newCommitBuilder ( ) ) ) ; java.util.Iterator < org.bouncycastle.openpgp.PGPPublicKeyRing > keyRings = store.get ( key.getKeyID ( ) ) . iterator ( ) ; keyRing = keyRings.next ( ) ; org.junit.Assert.assertFalse ( keyRings.hasNext ( ) ) ; assertUserIds ( keyRing , "Testuser Five <test5@example.com>" ) ; }

Target:
public void updateExisting ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key5 = com.google.gerrit.gpg.testutil.TestKeys.key5 ( ) ; org.bouncycastle.openpgp.PGPPublicKeyRing keyRing = key5.getPublicKeyRing ( ) ; org.bouncycastle.openpgp.PGPPublicKey key = keyRing.getPublicKey ( ) ; store.add ( keyRing ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertUserIds ( store.get ( key5.getKeyId ( ) ) . iterator ( ) . next ( ) , "Testuser Five <test5@example.com>" , "foo:myId" ) ; keyRing = org.bouncycastle.openpgp.PGPPublicKeyRing.removePublicKey ( keyRing , key ) ; key = org.bouncycastle.openpgp.PGPPublicKey.removeCertification ( key , "foo:myId" ) ; keyRing = org.bouncycastle.openpgp.PGPPublicKeyRing.insertPublicKey ( keyRing , key ) ; store.add ( keyRing ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FAST_FORWARD , store.save ( newCommitBuilder ( ) ) ) ; java.util.Iterator < org.bouncycastle.openpgp.PGPPublicKeyRing > keyRings = store.get ( key.getKeyID ( ) ) . iterator ( ) ; keyRing = keyRings.next ( ) ; org.junit.Assert.assertFalse ( keyRings.hasNext ( ) ) ; assertUserIds ( keyRing , "Testuser Five <test5@example.com>" ) ; }
Source:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.git.ProjectConfig cfg ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { try ( com.google.gerrit.server.git.MetaDataUpdate md = new com.google.gerrit.server.git.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , cfg.getProject ( ) . getNameKey ( ) , db ) ) { tr.tick ( 5 ) ; tr.setAuthorAndCommitter ( md.getCommitBuilder ( ) ) ; md.setMessage ( "Edit\n" ) ; cfg.commit ( md ) ; org.eclipse.jgit.lib.Ref ref = db.exactRef ( RefNames.REFS_CONFIG ) ; return tr.getRevWalk ( ) . parseCommit ( ref.getObjectId ( ) ) ; } }

Target:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.git.ProjectConfig cfg ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { try ( com.google.gerrit.server.git.meta.MetaDataUpdate md = new com.google.gerrit.server.git.meta.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , cfg.getProject ( ) . getNameKey ( ) , db ) ) { tr.tick ( 5 ) ; tr.setAuthorAndCommitter ( md.getCommitBuilder ( ) ) ; md.setMessage ( "Edit\n" ) ; cfg.commit ( md ) ; org.eclipse.jgit.lib.Ref ref = db.exactRef ( RefNames.REFS_CONFIG ) ; return tr.getRevWalk ( ) . parseCommit ( ref.getObjectId ( ) ) ; } }
Source:
public com.google.gitiles.GitilesView.Builder setRevision ( com.google.gitiles.Revision revision ) { switch ( type ) { case HOST_INDEX : case REPOSITORY_INDEX : case REFS : throw new java.lang.IllegalStateException ( java.lang.String.format ( "cannot set revision on %s view" , type ) ) ; default : this . revision = com.google.common.base.Preconditions.checkNotNull ( revision ) ; return this ; } }

Target:
public com.google.gitiles.GitilesView.Builder setRevision ( com.google.gitiles.Revision revision ) { switch ( type ) { case HOST_INDEX : case REPOSITORY_INDEX : case REFS : case DESCRIBE : throw new java.lang.IllegalStateException ( java.lang.String.format ( "cannot set revision on %s view" , type ) ) ; default : this . revision = com.google.common.base.Preconditions.checkNotNull ( revision ) ; return this ; } }
Source:
protected void initName ( final java.lang.String fieldName , final com.google.gwtorm.client.Column col ) throws com.google.gwtorm.client.OrmException { if ( col == null ) { throw new com.google.gwtorm.client.OrmException ( ( ( ( ( "Field " + fieldName ) + " is missing " ) + ( com.google.gwtorm.client.Column.class . getName ( ) ) ) + " annotation" ) ) ; } column = col ; origName = com.google.gwtorm.schema.Util.any ( column.name ( ) , com.google.gwtorm.schema.Util.makeSqlFriendly ( fieldName ) ) ; columnName = origName ; }

Target:
protected void initName ( final java.lang.String fieldName , final com.google.gwtorm.client.Column col ) throws com.google.gwtorm.client.OrmException { if ( col == null ) { throw new com.google.gwtorm.client.OrmException ( ( ( ( ( "Field " + fieldName ) + " is missing " ) + ( com.google.gwtorm.client.Column.class . getName ( ) ) ) + " annotation" ) ) ; } column = col ; origName = com.google.gwtorm.schema.Util.any ( column.name ( ) , com.google.gwtorm.schema.Util.makeSqlFriendly ( fieldName ) ) ; columnName = origName ; notNull = column.notNull ( ) ; }
Source:
java.util.Map < java.lang.String , com.google.gerrit.extensions.common.FileInfo > toFileInfoMap ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.RevId revision , int parent ) throws com.google.gerrit.server.diff.PatchListNotAvailableException { org.eclipse.jgit.lib.ObjectId b = org.eclipse.jgit.lib.ObjectId.fromString ( revision.get ( ) ) ; return toFileInfoMap ( change , com.google.gerrit.server.diff.PatchListKey.againstParentNum ( ( parent + 1 ) , b , Whitespace.IGNORE_NONE ) ) ; }

Target:
java.util.Map < java.lang.String , com.google.gerrit.extensions.common.FileInfo > toFileInfoMap ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.RevId revision , int parent ) throws com.google.gerrit.server.patch.PatchListNotAvailableException { org.eclipse.jgit.lib.ObjectId b = org.eclipse.jgit.lib.ObjectId.fromString ( revision.get ( ) ) ; return toFileInfoMap ( change , com.google.gerrit.server.patch.PatchListKey.againstParentNum ( ( parent + 1 ) , b , Whitespace.IGNORE_NONE ) ) ; }
Source:
public void run ( ) { cmB.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { apply.run ( ) ; } } ) ; }

Target:
private java.lang.Runnable adjustGutters ( final net.codemirror.lib.CodeMirror cm ) { return new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { net.codemirror.lib.CodeMirror.Viewport fromTo = cm.getViewport ( ) ; int size = ( ( fromTo.getTo ( ) ) - ( fromTo.getFrom ( ) ) ) + 1 ; if ( ( cm.getOldViewportSize ( ) ) == size ) { return ; } cm.setOldViewportSize ( size ) ; diffTable.sidePanel.adjustGutters ( cmB ) ; } } ; }
Source:
public void onSuccess ( final java.util.Set < com.google.gerrit.reviewdb.client.AccountExternalId.Key > removed ) { for ( int row = 1 ; row < ( table.getRowCount ( ) ) ; ) { final com.google.gerrit.reviewdb.client.AccountExternalId k = getRowItem ( row ) ; if ( ( k != null ) && ( removed.contains ( k.getKey ( ) ) ) ) { table.removeRow ( row ) ; } else { row ++ ; } } updateDeleteButton ( ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.VoidResult result ) { for ( int row = 1 ; row < ( table.getRowCount ( ) ) ; ) { final com.google.gerrit.client.account.ExternalIdInfo k = getRowItem ( row ) ; if ( ( k != null ) && ( keys.contains ( k.identity ( ) ) ) ) { table.removeRow ( row ) ; } else { row ++ ; } } updateDeleteButton ( ) ; }
Source:
private static com.google.gerrit.server.git.CodeReviewCommit failed ( com.google.gerrit.server.git.CodeReviewCommit.CodeReviewRevWalk rw , org.eclipse.jgit.revwalk.RevFlag canMergeFlag , com.google.gerrit.server.git.CodeReviewCommit mergeTip , com.google.gerrit.server.git.CodeReviewCommit n , com.google.gerrit.server.git.CommitMergeStatus failure ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { rw.resetRetain ( canMergeFlag ) ; rw.markStart ( n ) ; rw.markUninteresting ( mergeTip ) ; com.google.gerrit.server.git.CodeReviewCommit failed ; while ( ( failed = rw.next ( ) ) != null ) { failed.setStatusCode ( failure ) ; } return failed ; }

Target:
private static com.google.gerrit.server.git.CodeReviewCommit failed ( com.google.gerrit.server.git.CodeReviewCommit.CodeReviewRevWalk rw , org.eclipse.jgit.revwalk.RevFlag canMergeFlag , com.google.gerrit.server.git.CodeReviewCommit mergeTip , com.google.gerrit.server.git.CodeReviewCommit n , com.google.gerrit.server.git.strategy.CommitMergeStatus failure ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { rw.resetRetain ( canMergeFlag ) ; rw.markStart ( n ) ; rw.markUninteresting ( mergeTip ) ; com.google.gerrit.server.git.CodeReviewCommit failed ; while ( ( failed = rw.next ( ) ) != null ) { failed.setStatusCode ( failure ) ; } return failed ; }
Source:
private void deleteProject ( org.eclipse.jgit.transport.URIish replicateURI ) { if ( ! ( replicateURI.isRemote ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.deleteLocally ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.log.info ( ( "Deleted local repository: " + replicateURI ) ) ; } else if ( com.googlesource.gerrit.plugins.replication.ReplicationQueue.isSSH ( replicateURI ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.deleteRemoteSsh ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.log.info ( ( "Deleted remote repository: " + replicateURI ) ) ; } else { com.googlesource.gerrit.plugins.replication.ReplicationQueue.log.warn ( java.lang.String.format ( ( "Cannot delete project on remote site %s." + ( " Only local paths and SSH URLs are supported" + " for remote repository deletion" ) ) , replicateURI ) ) ; } }

Target:
private void deleteProject ( org.eclipse.jgit.transport.URIish replicateURI ) { if ( ! ( replicateURI.isRemote ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.deleteLocally ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.info ( ( "Deleted local repository: " + replicateURI ) ) ; } else if ( com.googlesource.gerrit.plugins.replication.ReplicationQueue.isSSH ( replicateURI ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.deleteRemoteSsh ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.info ( ( "Deleted remote repository: " + replicateURI ) ) ; } else { com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.warn ( java.lang.String.format ( ( "Cannot delete project on remote site %s." + ( " Only local paths and SSH URLs are supported" + " for remote repository deletion" ) ) , replicateURI ) ) ; } }
Source:
public void entity ( java.lang.String entity ) { com.google.common.base.Preconditions.checkArgument ( com.google.gitiles.doc.html.HtmlBuilder.HTML_ENTITY.matcher ( entity ) . matches ( ) , "invalid entity %s" , entity ) ; finishActiveTag ( ) ; htmlBuf.append ( entity ) ; }

Target:
public void entity ( java.lang.String entity ) { com.google.common.base.Preconditions.checkArgument ( com.google.gitiles.doc.html.HtmlBuilder.HTML_ENTITY.matcher ( entity ) . matches ( ) , "invalid entity %s" , entity ) ; finishActiveTag ( ) ; try { htmlBuf.append ( entity ) ; } catch ( java.io.IOException e ) { throw new com.google.gitiles.doc.RuntimeIOException ( e ) ; } }
Source:
public void setHeader ( java.lang.String name , java.lang.String value ) { com.googlesource.gerrit.plugins.manager.XAuthFilter.log.info ( "{}: {}" , name , value ) ; if ( name.equalsIgnoreCase ( "Content-Length" ) ) { origContentLength = java.lang.Integer.parseInt ( value ) ; } else { super . setHeader ( name , value ) ; } }

Target:
public void setHeader ( java.lang.String name , java.lang.String value ) { com.googlesource.gerrit.plugins.manager.XAuthFilter.log.debug ( "{}: {}" , name , value ) ; if ( name.equalsIgnoreCase ( "Content-Length" ) ) { origContentLength = java.lang.Integer.parseInt ( value ) ; } else { super . setHeader ( name , value ) ; } }
Source:
public boolean areDraftsUpToDate ( com.google.gerrit.server.git.RefCache draftsRepoRefs , com.google.gerrit.reviewdb.client.Account.Id accountId ) throws java.io.IOException { com.google.common.base.Optional < org.eclipse.jgit.lib.ObjectId > id = draftsRepoRefs.get ( com.google.gerrit.reviewdb.client.RefNames.refsDraftComments ( changeId , accountId ) ) ; if ( ! ( id.isPresent ( ) ) ) { return ! ( draftIds.containsKey ( accountId ) ) ; } return id.get ( ) . equals ( draftIds.get ( accountId ) ) ; }

Target:
public boolean areDraftsUpToDate ( com.google.gerrit.server.git.RefCache draftsRepoRefs , com.google.gerrit.reviewdb.client.Account.Id accountId ) throws java.io.IOException { java.util.Optional < org.eclipse.jgit.lib.ObjectId > id = draftsRepoRefs.get ( com.google.gerrit.reviewdb.client.RefNames.refsDraftComments ( changeId , accountId ) ) ; if ( ! ( id.isPresent ( ) ) ) { return ! ( draftIds.containsKey ( accountId ) ) ; } return id.get ( ) . equals ( draftIds.get ( accountId ) ) ; }
Source:
public void doGet ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { if ( ! ( isValidFile ( req ) ) ) { res.setStatus ( HttpServletResponse.SC_FORBIDDEN ) ; return ; } streamFile ( req , res ) ; }

Target:
public void doPut ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { if ( ! ( isValidPath ( req ) ) ) { res.setStatus ( HttpServletResponse.SC_FORBIDDEN ) ; return ; } if ( isGerritConfig ( req ) ) { writeFileAndFireAuditEvent ( req , res ) ; } else { writeFile ( req , res ) ; } }
Source:
private void addProjectOwnersAsReviewers ( com.google.gerrit.reviewdb.client.Change change ) { final java.lang.String projectOwners = groupBackend.get ( SystemGroupBackend.PROJECT_OWNERS ) . getName ( ) ; try { com.google.gerrit.server.change.ChangeResource rsrc = new com.google.gerrit.server.change.ChangeResource ( changeFactory.controlFor ( change , user ) ) ; com.google.gerrit.server.change.PostReviewers.Input input = new com.google.gerrit.server.change.PostReviewers.Input ( ) ; input.reviewer = projectOwners ; reviewersProvider.get ( ) . apply ( rsrc , input ) ; } catch ( java.lang.Exception e ) { } }

Target:
private void addProjectOwnersAsReviewers ( com.google.gerrit.reviewdb.client.Change change ) { final java.lang.String projectOwners = groupBackend.get ( SystemGroupBackend.PROJECT_OWNERS ) . getName ( ) ; try { com.google.gerrit.server.change.ChangeResource rsrc = new com.google.gerrit.server.change.ChangeResource ( changeFactory.controlFor ( change , user ) ) ; com.google.gerrit.extensions.api.changes.AddReviewerInput input = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; input.reviewer = projectOwners ; reviewersProvider.get ( ) . apply ( rsrc , input ) ; } catch ( java.lang.Exception e ) { } }
Source:
void setContext ( final int context ) { operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { renderSkips ( context ) ; } } ) ; }

Target:
void setLineLength ( int columns ) { columnMarginA.getStyle ( ) . setMarginLeft ( ( columns * ( cmA.defaultCharWidth ( ) ) ) , Unit.PX ) ; columnMarginB.getStyle ( ) . setMarginLeft ( ( columns * ( cmB.defaultCharWidth ( ) ) ) , Unit.PX ) ; }