auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onFailure ( java.lang.Exception reason ) { com.google.gerrit.client.ErrorDialog d = new com.google.gerrit.client.ErrorDialog ( reason ) ; d.setTitle ( com.google.gerrit.client.Gerrit.M.pluginFailed ( url ) ) ; d.center ( ) ; }

Target:
public void onFailure ( java.lang.Exception reason ) { com.google.gerrit.client.ErrorDialog d ; if ( reason instanceof com.google.gwt.core.client.CodeDownloadException ) { d = new com.google.gerrit.client.ErrorDialog ( com.google.gerrit.client.Gerrit.M.cannotDownloadPlugin ( url ) ) ; } else { d = new com.google.gerrit.client.ErrorDialog ( com.google.gerrit.client.Gerrit.M.pluginFailed ( url ) ) ; } d.center ( ) ; }
Source:
public void setNonExistingParent_UnprocessibleEntity ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/projects/" + ( project.get ( ) ) ) + "/parent" ) , newParentInput ( "non-existing" ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_UNPROCESSABLE_ENTITY ) ; r.consume ( ) ; }

Target:
public void setNonExistingParent_UnprocessibleEntity ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/projects/" + ( project.get ( ) ) ) + "/parent" ) , newParentInput ( "non-existing" ) ) ; r.assertUnprocessableEntity ( ) ; r.consume ( ) ; }
Source:
public void testUpdateOneException ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchException ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , new java.sql.BatchUpdateException ( ) ) ; try { createClassUnderTest ( ) . update ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.client.OrmException e ) { } }

Target:
public void testUpsertTwoBothExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 , 1 ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT ) ; createClassUnderTest ( ) . upsert ( twoRows ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertNotUsed ( insert ) ; }
Source:
protected void assertApproved ( java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.extensions.common.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.DETAILED_LABELS ) ; com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; org.junit.Assert.assertEquals ( 1 , cr.all.size ( ) ) ; org.junit.Assert.assertEquals ( 2 , cr.all.get ( 0 ) . value.intValue ( ) ) ; org.junit.Assert.assertEquals ( admin.getId ( ) , new com.google.gerrit.reviewdb.client.Account.Id ( cr.all.get ( 0 ) . _accountId ) ) ; }

Target:
protected void assertApproved ( java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.extensions.common.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.DETAILED_LABELS ) ; com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; com.google.common.truth.Truth.assertThat ( cr.all ) . hasSize ( 1 ) ; com.google.common.truth.Truth.assertThat ( cr.all.get ( 0 ) . value.intValue ( ) ) . isEqualTo ( 2 ) ; com.google.common.truth.Truth.assertThat ( new com.google.gerrit.reviewdb.client.Account.Id ( cr.all.get ( 0 ) . _accountId ) ) . isEqualTo ( admin.getId ( ) ) ; }
Source:
public void start ( ) { try { createTableIfNotExists ( ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.schema.H2AccountPatchReviewStore.log.error ( "Failed to create table to store account patch reviews" , e ) ; } }

Target:
public com.google.gwtorm.server.OrmException convertError ( java.lang.String op , java.sql.SQLException err ) { switch ( getSQLStateInt ( err ) ) { case 23001 : case 23505 : return new com.google.gwtorm.server.OrmDuplicateKeyException ( "account_patch_reviews" , err ) ; default : if ( ( ( err.getCause ( ) ) == null ) && ( ( err.getNextException ( ) ) != null ) ) { err.initCause ( err.getNextException ( ) ) ; } return new com.google.gwtorm.server.OrmException ( ( op + " failure on account_patch_reviews" ) , err ) ; } }
Source:
private com.google.gerrit.server.git.strategy.SubmitStrategy createStrategy ( com.google.gerrit.server.git.MergeOp.OpenRepo or , com.google.gerrit.server.git.MergeTip mergeTip , com.google.gerrit.reviewdb.client.Branch.NameKey destBranch , com.google.gerrit.extensions.client.SubmitType submitType , com.google.gerrit.server.git.CodeReviewCommit branchTip ) throws com.google.gerrit.server.git.IntegrationException { return submitStrategyFactory.create ( submitType , db , or.repo , or.rw , or.ins , or.canMergeFlag , getAlreadyAccepted ( or , branchTip ) , destBranch , caller , mergeTip , commits , submissionId ) ; }

Target:
private void openRepos ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.git.IntegrationException { for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { try { orm.openRepo ( project , true ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException noProject ) { logWarn ( ( ( ( "Project " + ( noProject.project ( ) ) ) + " no longer exists, " ) + "abandoning open changes" ) ) ; abandonAllOpenChangeForDeletedProject ( noProject.project ( ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.server.git.IntegrationException ( ( "Error opening project " + project ) , e ) ; } } }
Source:
private void delete ( final java.util.List < org.eclipse.jgit.transport.RemoteRefUpdate > cmds , final org.eclipse.jgit.transport.RefSpec spec ) throws java.io.IOException { final java.lang.String dst = spec.getDestination ( ) ; final boolean force = spec.isForceUpdate ( ) ; cmds.add ( new org.eclipse.jgit.transport.RemoteRefUpdate ( db , null , dst , force , null , null ) ) ; }

Target:
private void delete ( final java.util.List < org.eclipse.jgit.transport.RemoteRefUpdate > cmds , final org.eclipse.jgit.transport.RefSpec spec ) throws java.io.IOException { final java.lang.String dst = spec.getDestination ( ) ; final boolean force = spec.isForceUpdate ( ) ; cmds.add ( new org.eclipse.jgit.transport.RemoteRefUpdate ( db , ( ( org.eclipse.jgit.lib.Ref ) ( null ) ) , dst , force , null , null ) ) ; }
Source:
public void run ( ) { java.nio.file.Path pluginPath = pluginDir.resolve ( ( ( pluginName ) + ".ssh" ) ) ; try { java.nio.file.Files.copy ( pluginPath , out ) ; } catch ( java.io.IOException e ) { throw new java.lang.RuntimeException ( ( "Cannot read plugin content of " + pluginPath ) , e ) ; } }

Target:
private void printOne ( java.nio.file.Path p ) { try { java.nio.file.Files.copy ( p , out ) ; } catch ( java.io.IOException e ) { try ( java.io.PrintWriter w = new java.io.PrintWriter ( err ) ) { w.write ( "Error reading contents of " ) ; w.write ( p.toAbsolutePath ( ) . toString ( ) ) ; w.write ( ": \n" ) ; e.printStackTrace ( w ) ; } } }
Source:
private static void validateLabels ( java.util.Collection < java.lang.String > labels ) { if ( labels == null ) { return ; } java.util.SortedSet < java.lang.String > invalidLabels = new java.util.TreeSet < > ( ) ; for ( java.lang.String label : labels ) { if ( com.google.common.base.CharMatcher.whitespace ( ) . matchesAnyOf ( label ) ) { invalidLabels.add ( label ) ; } } if ( ! ( invalidLabels.isEmpty ( ) ) ) { throw com.google.gerrit.server.StarredChangesUtil.IllegalLabelException.invalidLabels ( invalidLabels ) ; } }

Target:
private static void validateLabels ( java.util.Collection < java.lang.String > labels ) { if ( labels == null ) { return ; } java.util.SortedSet < java.lang.String > invalidLabels = new java.util.TreeSet < > ( ) ; for ( java.lang.String label : labels ) { if ( com.google.common.base.CharMatcher.whitespace ( ) . matchesAnyOf ( label ) ) { invalidLabels.add ( label ) ; } } if ( ! ( invalidLabels.isEmpty ( ) ) ) { throw new com.google.gerrit.server.StarredChangesUtil.InvalidLabelsException ( invalidLabels ) ; } }
Source:
void init ( javax.servlet.ServletContext context ) { runtime.setBaseFolder ( sitePaths.site_path ) ; runtime.getStatus ( ) . servletContainer = context.getServerInfo ( ) ; runtime.start ( ) ; startManager ( notificationManager ) ; startManager ( userManager ) ; startManager ( authenticationManager ) ; startManager ( repositoryManager ) ; startManager ( projectManager ) ; startManager ( gitblit ) ; logger.info ( "All Gitblit managers started." ) ; }

Target:
void init ( javax.servlet.ServletContext context ) { runtime.setBaseFolder ( sitePaths.site_path.toFile ( ) ) ; runtime.getStatus ( ) . servletContainer = context.getServerInfo ( ) ; runtime.start ( ) ; startManager ( notificationManager ) ; startManager ( userManager ) ; startManager ( authenticationManager ) ; startManager ( repositoryManager ) ; startManager ( projectManager ) ; startManager ( gitblit ) ; logger.info ( "All Gitblit managers started." ) ; }
Source:
public boolean isReviewer ( com.google.gerrit.reviewdb.server.ReviewDb db , @ com.google.gerrit.common.Nullable com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( getUser ( ) . isIdentifiedUser ( ) ) { java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > results = changeData ( db , cd ) . reviewers ( ) . values ( ) ; return results.contains ( getUser ( ) . getAccountId ( ) ) ; } return false ; }

Target:
public boolean isReviewer ( com.google.gerrit.reviewdb.server.ReviewDb db , @ com.google.gerrit.common.Nullable com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( getUser ( ) . isIdentifiedUser ( ) ) { java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > results = changeData ( db , cd ) . reviewers ( ) . all ( ) ; return results.contains ( getUser ( ) . getAccountId ( ) ) ; } return false ; }
Source:
public com.google.gerrit.extensions.common.ChangeInfo createMergePatchSet ( com.google.gerrit.extensions.common.MergePatchSetInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return updateByMerge.apply ( change , in ) . value ( ) ; } catch ( java.io.IOException | com.google.gerrit.server.update.UpdateException | com.google.gerrit.server.project.InvalidChangeOperationException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot update change by merge" , e ) ; } }

Target:
public com.google.gerrit.extensions.common.ChangeInfo createMergePatchSet ( com.google.gerrit.extensions.common.MergePatchSetInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return updateByMerge.apply ( change , in ) . value ( ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot update change by merge" , e ) ; } }
Source:
public void set ( com.google.gerrit.reviewdb.client.PatchSet.Id base , com.google.gerrit.reviewdb.client.PatchSet.Id curr , com.google.gerrit.client.change.ChangeScreen2.Style style , com.google.gwt.user.client.ui.Widget editButton , com.google.gwt.user.client.ui.Widget replyButton ) { this . base = base ; this . curr = curr ; this . style = style ; this . editButton = editButton ; this . replyButton = replyButton ; }

Target:
public void set ( com.google.gerrit.reviewdb.client.PatchSet.Id base , com.google.gerrit.reviewdb.client.PatchSet.Id curr , com.google.gerrit.client.change.ChangeScreen2.Style style , com.google.gwt.user.client.ui.Widget editButton , com.google.gwt.user.client.ui.Widget replyButton , boolean editExists ) { this . base = base ; this . curr = curr ; this . style = style ; this . editButton = editButton ; this . replyButton = replyButton ; this . editExists = editExists ; }
Source:
public void setUp ( ) throws java.lang.Exception { executorMock = createStrictMock ( WorkQueue.Executor.class ) ; com.google.gerrit.server.git.WorkQueue workQueueMock = createNiceMock ( com.google.gerrit.server.git.WorkQueue.class ) ; org.easymock.EasyMock.expect ( workQueueMock.createQueue ( 4 , "Sync remote index" ) ) . andReturn ( executorMock ) ; com.ericsson.gerrit.plugins.syncindex.Configuration configMock = createStrictMock ( com.ericsson.gerrit.plugins.syncindex.Configuration.class ) ; org.easymock.EasyMock.expect ( configMock.getThreadPoolSize ( ) ) . andReturn ( 4 ) ; replayAll ( ) ; syncIndexExecutorProvider = new com.ericsson.gerrit.plugins.syncindex.SyncIndexExecutorProvider ( workQueueMock , configMock ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { executorMock = org.mockito.Mockito.mock ( WorkQueue.Executor.class ) ; com.google.gerrit.server.git.WorkQueue workQueueMock = org.mockito.Mockito.mock ( com.google.gerrit.server.git.WorkQueue.class ) ; org.mockito.Mockito.when ( workQueueMock.createQueue ( 4 , "Sync remote index" ) ) . thenReturn ( executorMock ) ; com.ericsson.gerrit.plugins.syncindex.Configuration configMock = org.mockito.Mockito.mock ( com.ericsson.gerrit.plugins.syncindex.Configuration.class ) ; org.mockito.Mockito.when ( configMock.getThreadPoolSize ( ) ) . thenReturn ( 4 ) ; syncIndexExecutorProvider = new com.ericsson.gerrit.plugins.syncindex.SyncIndexExecutorProvider ( workQueueMock , configMock ) ; }
Source:
public void testBlockPushDrafts ( ) { com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.REGISTERED , "refs/for/refs/*" ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.ANONYMOUS , "refs/drafts/*" ) . setBlock ( ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local ) ; org.junit.Assert.assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; org.junit.Assert.assertTrue ( "push is blocked to refs/drafts/master" , u.controlForRef ( "refs/drafts/refs/heads/master" ) . isBlocked ( com.google.gerrit.common.data.Permission.PUSH ) ) ; }

Target:
public void testBlockPushDrafts ( ) { com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/for/refs/*" ) ; com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) . setBlock ( ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local ) ; org.junit.Assert.assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; org.junit.Assert.assertTrue ( "push is blocked to refs/drafts/master" , u.controlForRef ( "refs/drafts/refs/heads/master" ) . isBlocked ( com.google.gerrit.common.data.Permission.PUSH ) ) ; }
Source:
public void blockPushDrafts ( ) { 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.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 ) ; }

Target:
public void blockPushDraftsUnblockAdmin ( ) { 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.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.ADMIN , "refs/drafts/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; com.google.gerrit.server.project.ProjectControl a = user ( local , "a" , com.google.gerrit.server.project.testing.Util.ADMIN ) ; assertBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , u ) ; assertNotBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , a ) ; }
Source:
public boolean deleteChangeFromIndex ( int changeId ) { try { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult result = httpSession.delete ( buildIndexEndpoint ( changeId ) ) ; if ( result.isSuccessful ( ) ) { return true ; } com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.log.error ( "Unable to delete from index change {}. Cause: {}" , changeId , result.getMessage ( ) ) ; } catch ( java.io.IOException e ) { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.log.error ( ( "Error trying to delete from index change " + changeId ) , e ) ; } return false ; }

Target:
com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult send ( ) throws java.io.IOException { return httpSession.delete ( buildIndexEndpoint ( changeId ) ) ; }
Source:
public void onSuccess ( final com.google.gerrit.client.diff.DiffInfo diffInfo ) { diff = diffInfo ; new net.codemirror.lib.ModeInjector ( ) . add ( com.google.gerrit.client.diff.CodeMirrorDemo.getContentType ( diff.meta_a ( ) ) ) . add ( com.google.gerrit.client.diff.CodeMirrorDemo.getContentType ( diff.meta_b ( ) ) ) . inject ( loadCallback ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.diff.DiffInfo diffInfo ) { diff = diffInfo ; new net.codemirror.lib.ModeInjector ( ) . add ( com.google.gerrit.client.diff.CodeMirrorDemo.getContentType ( diff.meta_a ( ) ) ) . add ( com.google.gerrit.client.diff.CodeMirrorDemo.getContentType ( diff.meta_b ( ) ) ) . inject ( modeInjectorCb ) ; }
Source:
private java.lang.String readEmail ( ) { java.lang.String email = ui.readString ( "admin@example.com" , "email" ) ; if ( ( email != null ) && ( ! ( org.apache.commons.validator.routines.EmailValidator.getInstance ( ) . isValid ( email ) ) ) ) { ui.message ( "error: invalid email address\n" ) ; return readEmail ( ) ; } return email ; }

Target:
private java.lang.String readEmail ( java.lang.String defaultEmail ) { java.lang.String email = ui.readString ( defaultEmail , "email" ) ; if ( ( email != null ) && ( ! ( org.apache.commons.validator.routines.EmailValidator.getInstance ( ) . isValid ( email ) ) ) ) { ui.message ( "error: invalid email address\n" ) ; return readEmail ( defaultEmail ) ; } return email ; }
Source:
private void addExtensionPoints ( com.google.gerrit.client.info.ChangeInfo change ) { addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER , headerExtension , change ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_BUTTONS , headerExtensionMiddle , change ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS , headerExtensionRight , change ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK , changeExtension , change ) ; }

Target:
private void addExtensionPoints ( com.google.gerrit.client.info.ChangeInfo change , com.google.gerrit.client.info.ChangeInfo.RevisionInfo rev ) { addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER , headerExtension , change , rev ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_BUTTONS , headerExtensionMiddle , change , rev ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS , headerExtensionRight , change , rev ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK , changeExtension , change , rev ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_RELATED_INFO_BLOCK , relatedExtension , change , rev ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_COMMIT_INFO_BLOCK , commitExtension , change , rev ) ; addExtensionPoint ( GerritUiExtensionPoint.CHANGE_SCREEN_HISTORY_RIGHT_OF_BUTTONS , historyExtensionRight , change , rev ) ; }
Source:
private com.google.gerrit.acceptance.RestResponse publishPatchSet ( java.lang.String changeId ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.PatchSet patchSet = com.google.common.collect.Iterables.getOnlyElement ( queryProvider.get ( ) . byKeyPrefix ( changeId ) ) . currentPatchSet ( ) ; return adminSession.post ( ( ( ( ( "/changes/" + changeId ) + "/revisions/" ) + ( patchSet.getRevision ( ) . get ( ) ) ) + "/publish" ) ) ; }

Target:
private com.google.gerrit.acceptance.RestResponse publishPatchSet ( java.lang.String changeId ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.PatchSet patchSet = com.google.common.collect.Iterables.getOnlyElement ( queryProvider.get ( ) . byKeyPrefix ( changeId ) ) . currentPatchSet ( ) ; return adminRestSession.post ( ( ( ( ( "/changes/" + changeId ) + "/revisions/" ) + ( patchSet.getRevision ( ) . get ( ) ) ) + "/publish" ) ) ; }
Source:
private java.util.Collection < com.google.gerrit.reviewdb.client.ChangeMessage > filterChangeMessages ( ) { final com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.PatchSet.Id > upToCurrent = upToCurrentPredicate ( ) ; return com.google.common.collect.Collections2.filter ( changeMessages , new com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.ChangeMessage > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.reviewdb.client.ChangeMessage in ) { com.google.gerrit.reviewdb.client.PatchSet.Id psId = in.getPatchSetId ( ) ; if ( psId == null ) { return true ; } return ( upToCurrent.apply ( psId ) ) && ( patchSets.containsKey ( psId ) ) ; } } ) ; }

Target:
private java.util.Collection < com.google.gerrit.reviewdb.client.ChangeMessage > filterChangeMessages ( ) { final com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.PatchSet.Id > validPatchSet = validPatchSetPredicate ( ) ; return com.google.common.collect.Collections2.filter ( changeMessages , new com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.ChangeMessage > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.reviewdb.client.ChangeMessage in ) { com.google.gerrit.reviewdb.client.PatchSet.Id psId = in.getPatchSetId ( ) ; if ( psId == null ) { return true ; } return validPatchSet.apply ( psId ) ; } } ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { com.google.gwt.core.client.JsArray < com.google.gerrit.client.change.RelatedChanges.ChangeAndCommit > changes = convertChangeList ( result ) ; if ( ( changes.length ( ) ) > 0 ) { getTab ( ) . setTitle ( Resources.M.sameTopic ( changes.length ( ) ) ) ; getTab ( ) . setChanges ( info.project ( ) , revision , changes ) ; } }

Target:
protected abstract com.google.gwt.core.client.JsArray < com.google.gerrit.client.change.RelatedChanges.ChangeAndCommit > convert ( T result ) ;
Source:
private com.google.gerrit.server.group.GroupJson.GroupInfo GET_ONE ( java.lang.String endpoint ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = adminSession.get ( endpoint ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; return newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.server.group.GroupJson.GroupInfo.class ) ; }

Target:
private com.google.gerrit.extensions.common.GroupInfo GET_ONE ( java.lang.String endpoint ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = adminSession.get ( endpoint ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; return newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.extensions.common.GroupInfo.class ) ; }
Source:
private static boolean isUnifiedPatchLink ( final com.google.gerrit.reviewdb.client.Patch patch ) { return ( patch.getPatchType ( ) . equals ( PatchType.BINARY ) ) || ( com.google.gerrit.client.Gerrit.getUserAccount ( ) . getGeneralPreferences ( ) . getDiffView ( ) . equals ( DiffView.UNIFIED_DIFF ) ) ; }

Target:
private static boolean isUnifiedPatchLink ( final com.google.gerrit.reviewdb.client.Patch patch ) { return ( patch.getPatchType ( ) . equals ( PatchType.BINARY ) ) || ( ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) && ( com.google.gerrit.client.Gerrit.getUserAccount ( ) . getGeneralPreferences ( ) . getDiffView ( ) . equals ( DiffView.UNIFIED_DIFF ) ) ) ; }
Source:
public void run ( ) { try { com.google.gerrit.server.mail.CreateChangeSender cm = createChangeSenderFactory.create ( change.getId ( ) ) ; cm.setFrom ( change.getOwner ( ) ) ; cm.setPatchSet ( patchSet , patchSetInfo ) ; cm.addReviewers ( reviewers ) ; cm.addExtraCC ( extraCC ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.change.ChangeInserter.log.error ( ( "Cannot send email for new change " + ( change.getId ( ) ) ) , e ) ; } }

Target:
public void run ( ) { try { com.google.gerrit.server.mail.CreateChangeSender cm = createChangeSenderFactory.create ( change.getProject ( ) , change.getId ( ) ) ; cm.setFrom ( change.getOwner ( ) ) ; cm.setPatchSet ( patchSet , patchSetInfo ) ; cm.setNotify ( notify ) ; cm.addReviewers ( reviewers ) ; cm.addExtraCC ( extraCC ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.change.ChangeInserter.log.error ( ( "Cannot send email for new change " + ( change.getId ( ) ) ) , e ) ; } }
Source:
public static java.io.File storeInTemp ( java.lang.String pluginName , java.io.InputStream in , com.google.gerrit.server.config.SitePaths sitePaths ) throws java.io.IOException { if ( ! ( java.nio.file.Files.exists ( sitePaths.tmp_dir ) ) ) { java.nio.file.Files.createDirectories ( sitePaths.tmp_dir ) ; } return com.google.gerrit.server.plugins.PluginLoader.asTemp ( in , com.google.gerrit.server.plugins.JarPluginProvider.tempNameFor ( pluginName ) , ".jar" , sitePaths.tmp_dir.toFile ( ) ) ; }

Target:
public static java.nio.file.Path storeInTemp ( java.lang.String pluginName , java.io.InputStream in , com.google.gerrit.server.config.SitePaths sitePaths ) throws java.io.IOException { if ( ! ( java.nio.file.Files.exists ( sitePaths.tmp_dir ) ) ) { java.nio.file.Files.createDirectories ( sitePaths.tmp_dir ) ; } return com.google.gerrit.server.plugins.PluginLoader.asTemp ( in , com.google.gerrit.server.plugins.JarPluginProvider.tempNameFor ( pluginName ) , ".jar" , sitePaths.tmp_dir ) ; }
Source:
private java.util.List < java.lang.reflect.Field > fieldsOf ( java.lang.Class < ? > type ) { java.util.List < java.lang.reflect.Field > r = new java.util.ArrayList < > ( ) ; if ( ( type.getSuperclass ( ) ) != null ) { r.addAll ( fieldsOf ( type.getSuperclass ( ) ) ) ; } r.addAll ( java.util.Arrays.asList ( type.getDeclaredFields ( ) ) ) ; return r ; }

Target:
private int getEffectiveLimit ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) { java.util.List < java.lang.Integer > possibleLimits = new java.util.ArrayList < > ( 3 ) ; possibleLimits.add ( permittedLimit ) ; if ( ( limitFromCaller ) > 0 ) { possibleLimits.add ( limitFromCaller ) ; } java.lang.Integer limitFromPredicate = com.google.gerrit.server.query.change.LimitPredicate.getLimit ( p ) ; if ( limitFromPredicate != null ) { possibleLimits.add ( limitFromPredicate ) ; } return com.google.common.collect.Ordering.natural ( ) . min ( possibleLimits ) ; }
Source:
public void rejectMissingEmail ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; exception.expect ( com.google.gerrit.extensions.restapi.UnprocessableEntityException.class ) ; exception.expectMessage ( "email invalid" ) ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . addReviewer ( "" ) ; }

Target:
public void rejectMissingEmail ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; exception.expect ( com.google.gerrit.extensions.restapi.UnprocessableEntityException.class ) ; exception.expectMessage ( "email invalid" ) ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . addReviewer ( "" ) ; }
Source:
public static java.util.List < com.google.gerrit.reviewdb.client.Change > scan ( com.google.gerrit.server.notedb.NotesMigration notesMigration , com.google.gerrit.server.notedb.ChangeNotes.Factory notesFactory , org.eclipse.jgit.lib.Repository repo , com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project ) throws com.google.gwtorm.server.OrmException , java.io.IOException { if ( ! ( notesMigration.readChanges ( ) ) ) { return com.google.gerrit.server.git.ScanningChangeCacheImpl.scanDb ( repo , db ) ; } return com.google.gerrit.server.git.ScanningChangeCacheImpl.scanNotedb ( notesFactory , repo , db , project ) ; }

Target:
private static java.util.List < com.google.gerrit.reviewdb.client.Change > scanChangesFromNotedb ( com.google.gerrit.server.notedb.ChangeNotes.Factory notesFactory , org.eclipse.jgit.lib.Repository repo , com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project ) throws com.google.gwtorm.server.OrmException , java.io.IOException { java.util.List < com.google.gerrit.server.notedb.ChangeNotes > changeNotes = com.google.gerrit.server.git.ScanningChangeCacheImpl.scanNotedb ( notesFactory , repo , db , project ) ; return com.google.common.collect.Lists.transform ( changeNotes , new com.google.common.base.Function < com.google.gerrit.server.notedb.ChangeNotes , com.google.gerrit.reviewdb.client.Change > ( ) { @ java.lang.Override public com.google.gerrit.reviewdb.client.Change apply ( com.google.gerrit.server.notedb.ChangeNotes notes ) { return notes.getChange ( ) ; } } ) ; }
Source:
public static com.google.common.cache.CacheBuilder < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > weigher ( com.google.common.cache.CacheBuilder < ? super com.google.gitiles.blame.BlameCacheImpl.Key , ? super java.util.List < com.google.gitiles.blame.Region > > builder ) { return builder.weigher ( new com.google.common.cache.Weigher < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > ( ) { @ java.lang.Override public int weigh ( com.google.gitiles.blame.BlameCacheImpl.Key key , java.util.List < com.google.gitiles.blame.Region > value ) { return value.size ( ) ; } } ) ; }

Target:
public static com.google.common.cache.CacheBuilder < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > weigher ( com.google.common.cache.CacheBuilder < ? super com.google.gitiles.blame.BlameCacheImpl.Key , ? super java.util.List < com.google.gitiles.blame.Region > > builder ) { return builder.weigher ( ( k , v ) -> v.size ( ) ) ; }
Source:
public void testUnblockVisibilityByRegisteredUsers ( ) { com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; 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/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; org.junit.Assert.assertTrue ( "u can read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }

Target:
public void testUnblockInLocalVisibilityByRegisteredUsers_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; 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/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; com.google.common.truth.Truth.assertThat ( u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) . named ( "u can't read" ) . isFalse ( ) ; }
Source:
public com.google.gerrit.extensions.api.changes.ChangeApi revert ( com.google.gerrit.extensions.api.changes.RevertInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return changeApi.id ( revert.apply ( change , 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 revert change" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.changes.ChangeApi revert ( com.google.gerrit.extensions.api.changes.RevertInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return changeApi.id ( revert.apply ( change , in ) . _number ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot revert change" , e ) ; } }
Source:
public com.googlesource.gerrit.plugins.lfs.LfsProjectConfigInfo apply ( com.google.gerrit.server.project.ProjectResource resource ) throws com.google.gerrit.extensions.restapi.RestApiException { com.googlesource.gerrit.plugins.lfs.LfsProjectConfigInfo info = new com.googlesource.gerrit.plugins.lfs.LfsProjectConfigInfo ( ) ; com.googlesource.gerrit.plugins.lfs.LfsProjectConfigSection config = lfsConfigFactory.getProjectsConfig ( ) . getForProject ( resource.getNameKey ( ) ) ; if ( config != null ) { info.enabled = config.isEnabled ( ) ; info.maxObjectSize = config.getMaxObjectSize ( ) ; } return info ; }

Target:
public com.googlesource.gerrit.plugins.lfs.LfsProjectConfigInfo apply ( com.google.gerrit.server.project.ProjectResource resource ) throws com.google.gerrit.extensions.restapi.RestApiException { com.googlesource.gerrit.plugins.lfs.LfsProjectConfigInfo info = new com.googlesource.gerrit.plugins.lfs.LfsProjectConfigInfo ( ) ; com.googlesource.gerrit.plugins.lfs.LfsProjectConfigSection config = lfsConfigFactory.getProjectsConfig ( ) . getForProject ( resource.getNameKey ( ) ) ; if ( config != null ) { info.enabled = config.isEnabled ( ) ; info.maxObjectSize = config.getMaxObjectSize ( ) ; info.readOnly = config.isReadOnly ( ) ; } return info ; }
Source:
public void publishesWhenMessageMatchesIgnore ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockChange.commitMessage = "WIP:This is a title\nAnd a the body." ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; org.junit.Assert.assertThat ( messageGenerator.shouldPublish ( ) , org.hamcrest.core.Is.is ( true ) ) ; }

Target:
public void publishesWhenMessageMatchesIgnore ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockChange.commitMessage = "WIP:This is a title\nand a the body." ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; org.junit.Assert.assertThat ( messageGenerator.shouldPublish ( ) , org.hamcrest.core.Is.is ( true ) ) ; }
Source:
public void testRejectJavaScript_FormAction ( ) { final java.lang.String href = "javascript:window.close();" ; try { new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . openElement ( "form" ) . setAttribute ( "action" , href ) ; fail ( "accepted javascript in form action" ) ; } catch ( java.lang.RuntimeException e ) { assertEquals ( ( "javascript unsafe in href: " + href ) , e.getMessage ( ) ) ; } }

Target:
public void testRejectJavaScript_AnchorHref ( ) { final java.lang.String href = "javascript:window.close();" ; try { new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . openAnchor ( ) . setAttribute ( "href" , href ) ; org.junit.Assert.fail ( "accepted javascript in a href" ) ; } catch ( java.lang.RuntimeException e ) { org.junit.Assert.assertEquals ( ( "javascript unsafe in href: " + href ) , e.getMessage ( ) ) ; } }
Source:
private void applyAllSuccess ( ) { if ( ( ( ! ( failed ) ) && ( finalAdded ) ) && ( remaining.isEmpty ( ) ) ) { for ( com.google.gerrit.client.rpc.CallbackGroup.CallbackImpl < ? > cb : callbacks ) { cb.applySuccess ( ) ; } callbacks.clear ( ) ; } }

Target:
public < 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 ; }
Source:
protected void configure ( ) { install ( new com.google.gerrit.extensions.restapi.RestApiModule ( ) { @ java.lang.Override protected void configure ( ) { post ( com.google.gerrit.server.change.RevisionResource.REVISION_KIND , "say-hello" ) . to ( com.googlesource.gerrit.plugins.cookbook.HelloWorldAction.class ) ; } } ) ; }

Target:
protected void configure ( ) { com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.extensions.webui.TopMenu.class ) . to ( com.googlesource.gerrit.plugins.cookbook.HelloTopMenu.class ) ; install ( new com.google.gerrit.extensions.restapi.RestApiModule ( ) { @ java.lang.Override protected void configure ( ) { post ( com.google.gerrit.server.change.RevisionResource.REVISION_KIND , "say-hello" ) . to ( com.googlesource.gerrit.plugins.cookbook.HelloWorldAction.class ) ; } } ) ; }
Source:
public com.google.gerrit.client.diff.DiffApi base ( com.google.gerrit.reviewdb.client.PatchSet.Id id ) { if ( id != null ) { call.addParameter ( "base" , id.get ( ) ) ; } return this ; }

Target:
public com.google.gerrit.client.diff.DiffApi base ( com.google.gerrit.reviewdb.client.PatchSet.Id id ) { if ( id != null ) { if ( ( id.get ( ) ) < 0 ) { call.addParameter ( "parent" , ( - ( id.get ( ) ) ) ) ; } else { call.addParameter ( "base" , id.get ( ) ) ; } } return this ; }
Source:
protected void onPostExecute ( java.lang.String errorMsg ) { if ( errorMsg != null ) { widgetUtil.showError ( errorMsg ) ; } else { com.google.reviewit.AddReviewerFragment fragment = new com.google.reviewit.AddReviewerFragment ( ) ; android.os.Bundle bundle = new android.os.Bundle ( ) ; bundle.putAll ( getArguments ( ) ) ; fragment.setArguments ( bundle ) ; display ( fragment , false ) ; } }

Target:
protected void onPostExecute ( java.lang.String errorMsg ) { if ( errorMsg != null ) { widgetUtil.showError ( errorMsg ) ; } else { widgetUtil.toast ( R.string.reviewer_added ) ; com.google.reviewit.AddReviewerFragment fragment = new com.google.reviewit.AddReviewerFragment ( ) ; android.os.Bundle bundle = new android.os.Bundle ( ) ; bundle.putAll ( getArguments ( ) ) ; fragment.setArguments ( bundle ) ; display ( fragment , false ) ; } }
Source:
public void testUnblockForceWithAllowNoForce_NotPossible ( ) { 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/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't 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.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 ( ) ) ; }
Source:
private com.google.gerrit.client.diff.DraftBox addDraftBox ( com.google.gerrit.client.changes.CommentInfo info , boolean doSave ) { com.google.gerrit.client.diff.DraftBox box = new com.google.gerrit.client.diff.DraftBox ( this , revision , info , commentLinkProcessor , true , doSave ) ; addCommentBox ( info , box ) ; if ( ! doSave ) { box.setEdit ( true ) ; } getLineBoxMapFromSide ( info.side ( ) ) . put ( ( ( info.line ( ) ) - 1 ) , box ) ; return box ; }

Target:
private com.google.gerrit.client.diff.DraftBox addDraftBox ( com.google.gerrit.client.changes.CommentInfo info , boolean doSave ) { com.google.gerrit.client.diff.DraftBox box = new com.google.gerrit.client.diff.DraftBox ( this , revision , info , commentLinkProcessor , true , doSave ) ; addCommentBox ( info , box ) ; if ( ! doSave ) { box.setEdit ( true ) ; } net.codemirror.lib.CodeMirror.LineHandle handle = getCmFromSide ( info.side ( ) ) . getLineHandle ( ( ( info.line ( ) ) - 1 ) ) ; lineActiveBoxMap.put ( handle , box ) ; return box ; }
Source:
public boolean match ( T object ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.server.query.Predicate < T > c : children ) { com.google.common.base.Preconditions.checkState ( c.isMatchable ( ) , "match invoked, but child predicate %s doesn't implement %s" , c , com.google.gerrit.server.query.Matchable.class . getName ( ) ) ; if ( c.asMatchable ( ) . match ( object ) ) { return true ; } } return false ; }

Target:
public boolean match ( T object ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.index.query.Predicate < T > c : children ) { com.google.common.base.Preconditions.checkState ( c.isMatchable ( ) , "match invoked, but child predicate %s doesn't implement %s" , c , com.google.gerrit.index.query.Matchable.class . getName ( ) ) ; if ( c.asMatchable ( ) . match ( object ) ) { return true ; } } return false ; }
Source:
public void onSuccess ( com.google.gerrit.client.VoidResult result ) { for ( int row = 1 ; row < ( table.getRowCount ( ) ) ; ) { com.google.gerrit.client.projects.BranchInfo k = getRowItem ( row ) ; if ( ( k != null ) && ( branches.contains ( k.ref ( ) ) ) ) { table.removeRow ( row ) ; } else { row ++ ; } } }

Target:
public void onOk ( ) { deleteBranches ( ids ) ; }
Source:
public void errorWhileSendingErrorMessage ( ) throws java.lang.Exception { org.easymock.EasyMock.expect ( request.getPathInfo ( ) ) . andReturn ( "/someCache" ) ; java.lang.String errorMessage = "someError" ; org.easymock.EasyMock.expect ( request.getReader ( ) ) . andThrow ( new java.io.IOException ( errorMessage ) ) ; response.sendError ( javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST , errorMessage ) ; org.easymock.EasyMock.expectLastCall ( ) . andThrow ( new java.io.IOException ( "someOtherError" ) ) ; replayAll ( ) ; servlet.doPost ( request , response ) ; verifyAll ( ) ; }

Target:
public void badRequest ( ) throws java.lang.Exception { org.mockito.Mockito.when ( request.getPathInfo ( ) ) . thenReturn ( "/someCache" ) ; java.lang.String errorMessage = "someError" ; org.mockito.Mockito.doThrow ( new java.io.IOException ( errorMessage ) ) . when ( request ) . getReader ( ) ; servlet.doPost ( request , response ) ; org.mockito.Mockito.verify ( response ) . sendError ( javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST , errorMessage ) ; }
Source:
public java.lang.Void call ( ) throws java.io.IOException { for ( com.google.gerrit.server.index.change.ChangeIndex i : getWriteIndexes ( ) ) { i.delete ( id ) ; } fireChangeDeletedFromIndexEvent ( id.get ( ) ) ; return null ; }

Target:
public java.lang.Void call ( ) throws java.io.IOException { for ( com.google.gerrit.server.index.change.ChangeIndex i : getWriteIndexes ( ) ) { i.delete ( id ) ; } com.google.gerrit.server.index.change.ChangeIndexer.log.info ( "Deleted change from index." , id.get ( ) ) ; fireChangeDeletedFromIndexEvent ( id.get ( ) ) ; return null ; }
Source:
public com.google.common.collect.ImmutableSetMultimap < com.google.gerrit.server.notedb.ReviewerState , com.google.gerrit.reviewdb.client.Account.Id > getReviewers ( com.google.gerrit.server.notedb.ChangeNotes notes , java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > allApprovals ) throws com.google.gwtorm.server.OrmException { if ( ! ( migration.readPatchSetApprovals ( ) ) ) { return com.google.gerrit.server.ApprovalsUtil.getReviewers ( allApprovals ) ; } return notes.load ( ) . getReviewers ( ) ; }

Target:
public com.google.common.collect.ImmutableSetMultimap < com.google.gerrit.server.notedb.ReviewerState , com.google.gerrit.reviewdb.client.Account.Id > getReviewers ( com.google.gerrit.server.notedb.ChangeNotes notes , java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > allApprovals ) throws com.google.gwtorm.server.OrmException { if ( ! ( migration.readChanges ( ) ) ) { return com.google.gerrit.server.ApprovalsUtil.getReviewers ( allApprovals ) ; } return notes.load ( ) . getReviewers ( ) ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.HostPageData result ) { com.google.gwt.dom.client.Document.get ( ) . getElementById ( "gerrit_hostpagedata" ) . removeFromParent ( ) ; com.google.gerrit.client.Gerrit.myConfig = result.config ; com.google.gerrit.client.Gerrit.myTheme = result.theme ; com.google.gerrit.client.Gerrit.isNoteDbEnabled = result.isNoteDbEnabled ; if ( ( result.account ) != null ) { com.google.gerrit.client.Gerrit.myAccount = result.account ; com.google.gerrit.client.Gerrit.xGerritAuth = result.xGerritAuth ; } if ( ( result.accountDiffPref ) != null ) { com.google.gerrit.client.Gerrit.myAccountDiffPref = result.accountDiffPref ; com.google.gerrit.client.Gerrit.applyUserPreferences ( ) ; } onModuleLoad2 ( result ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.info.AccountPreferencesInfo prefs ) { com.google.gerrit.client.Gerrit.myPrefs = prefs ; onModuleLoad2 ( result ) ; }