auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { double y = cm.heightAtLine ( line , "local" ) ; double viewport = cm.getScrollInfo ( ) . getClientHeight ( ) ; cm.setCursor ( net.codemirror.lib.LineCharacter.create ( line ) ) ; cm.scrollToY ( ( y - ( 0.5 * viewport ) ) ) ; cm.focus ( ) ; }

Target:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent e ) { if ( ( ( height ) == 1 ) || ( ! ( visible ( ) ) ) ) { e.stopPropagation ( ) ; double y = cm.heightAtLine ( line , "local" ) ; double viewport = cm.getScrollInfo ( ) . getClientHeight ( ) ; cm.setCursor ( net.codemirror.lib.LineCharacter.create ( line ) ) ; cm.scrollToY ( ( y - ( 0.5 * viewport ) ) ) ; cm.focus ( ) ; } }
Source:
public void testIndexTaskToString ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.highavailability.index.IndexEventHandler.IndexTask indexTask = indexEventHandler.new com.ericsson.gerrit.plugins.highavailability.index.IndexEventHandler.IndexTask ( com.ericsson.gerrit.plugins.highavailability.index.IndexEventHandlerTest.CHANGE_ID , false ) ; com.google.common.truth.Truth.assertThat ( indexTask.toString ( ) ) . isEqualTo ( java.lang.String.format ( "[%s] Index change %s in target instance" , com.ericsson.gerrit.plugins.highavailability.index.IndexEventHandlerTest.PLUGIN_NAME , com.ericsson.gerrit.plugins.highavailability.index.IndexEventHandlerTest.CHANGE_ID ) ) ; }

Target:
public void shouldNotCallRemoteWhenAccountEventIsForwarded ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.highavailability.forwarder.Context.setForwardedEvent ( true ) ; indexEventHandler.onAccountIndexed ( accountId.get ( ) ) ; indexEventHandler.onAccountIndexed ( accountId.get ( ) ) ; com.ericsson.gerrit.plugins.highavailability.forwarder.Context.unsetForwardedEvent ( ) ; org.mockito.Mockito.verifyZeroInteractions ( forwarder ) ; }
Source:
void openCloseAll ( ) { boolean open = false ; for ( int i = 0 ; i < ( getBoxCount ( ) ) ; i ++ ) { if ( ! ( getCommentBox ( i ) . isOpen ( ) ) ) { open = true ; break ; } } for ( int i = 0 ; i < ( getBoxCount ( ) ) ; i ++ ) { getCommentBox ( i ) . setOpen ( open ) ; } }

Target:
void setOpenAll ( boolean open ) { for ( int i = 0 ; i < ( getBoxCount ( ) ) ; i ++ ) { getCommentBox ( i ) . setOpen ( open ) ; } }
Source:
public void onPluginLoad ( ) { com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "" , new com.googlesource.gerrit.plugins.cookbook.client.IndexScreen.Factory ( ) ) ; }

Target:
public void onPluginLoad ( ) { com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "" , new com.googlesource.gerrit.plugins.cookbook.client.IndexScreen.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM , new com.googlesource.gerrit.plugins.cookbook.client.CookBookProfileExtension.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK , new com.googlesource.gerrit.plugins.cookbook.client.CookBookChangeScreenExtension.Factory ( ) ) ; }
Source:
public static boolean havePGP ( ) { try { java.lang.Class.forName ( org.bouncycastle.openpgp.PGPPublicKey.class . getName ( ) ) ; com.google.gerrit.server.util.BouncyCastleUtil.addBouncyCastleProvider ( ) ; return true ; } catch ( java.lang.NoClassDefFoundError | java.lang.ClassNotFoundException | java.lang.SecurityException | java.lang.NoSuchMethodException | java.lang.InstantiationException | java.lang.IllegalAccessException | java.lang.reflect.InvocationTargetException | java.lang.ClassCastException noBouncyCastle ) { return false ; } }

Target:
public static boolean havePGP ( ) { try { java.lang.Class.forName ( org.bouncycastle.openpgp.PGPPublicKey.class . getName ( ) ) ; com.google.gerrit.gpg.BouncyCastleUtil.addBouncyCastleProvider ( ) ; return true ; } catch ( java.lang.NoClassDefFoundError | java.lang.ClassNotFoundException | java.lang.SecurityException | java.lang.NoSuchMethodException | java.lang.InstantiationException | java.lang.IllegalAccessException | java.lang.reflect.InvocationTargetException | java.lang.ClassCastException noBouncyCastle ) { return false ; } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.pgm.util.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.Objects.firstNonNull ( getInstallPlugins ( ) , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.InstallPlugins.class ) . toInstance ( plugins ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.pgm.util.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.Objects.firstNonNull ( getInstallPlugins ( ) , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.InstallPlugins.class ) . toInstance ( plugins ) ; bind ( com.google.gerrit.pgm.init.PluginsDistribution.class ) . toInstance ( pluginsDistribution ) ; }
Source:
public void abandonWipChangeInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; abandon ( sc.changeId , sc.owner ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . notTo ( sc.owner ) . cc ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }

Target:
public void abandonWipChangeNotifyAll ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; abandon ( sc.changeId , sc.owner , com.google.gerrit.acceptance.server.mail.ALL ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . notTo ( sc.owner ) . cc ( sc.reviewer , sc.ccer ) . to ( sc.reviewerByEmail ) . cc ( sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }
Source:
public void testUnblockForceWithAllowNoForce_NotPossible ( ) { com.google.gerrit.common.data.PermissionRule r = grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) ; r.setBlock ( ) ; r.setForce ( true ) ; 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 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 ( ) ) ; }
Source:
public com.google.gerrit.server.change.ConsistencyChecker.Result check ( com.google.gerrit.server.query.change.ChangeData cd ) { reset ( ) ; try { return check ( cd.change ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { error ( "Error looking up change" , e ) ; return com.google.gerrit.server.change.ConsistencyChecker.Result.create ( cd.getId ( ) , problems ) ; } }

Target:
public com.google.gerrit.server.change.ConsistencyChecker.Result check ( com.google.gerrit.server.query.change.ChangeData cd , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput f ) { reset ( ) ; try { return check ( cd.change ( ) , f ) ; } catch ( com.google.gwtorm.server.OrmException e ) { error ( "Error looking up change" , e ) ; return com.google.gerrit.server.change.ConsistencyChecker.Result.create ( cd.getId ( ) , problems ) ; } }
Source:
void apply ( com.google.gerrit.server.notedb.ChangeUpdate update ) { checkUpdate ( update ) ; if ( ( ps.getPatchSetId ( ) ) == 1 ) { update.setSubject ( "Create change" ) ; update.setBranch ( change.getDest ( ) . get ( ) ) ; } else { update.setSubject ( ( "Create patch set " + ( ps.getPatchSetId ( ) ) ) ) ; } }

Target:
void apply ( com.google.gerrit.server.notedb.ChangeUpdate update ) { checkUpdate ( update ) ; update.setSubject ( change.getSubject ( ) ) ; if ( ( ps.getPatchSetId ( ) ) == 1 ) { update.setSubjectForCommit ( "Create change" ) ; update.setBranch ( change.getDest ( ) . get ( ) ) ; } else { update.setSubjectForCommit ( ( "Create patch set " + ( ps.getPatchSetId ( ) ) ) ) ; } }
Source:
public void owner ( java.lang.String owner ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.extensions.common.OwnerInput in = new com.google.gerrit.extensions.common.OwnerInput ( ) ; in.owner = owner ; try { putOwner.apply ( rsrc , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot put group owner" , e ) ; } }

Target:
public void owner ( java.lang.String owner ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.extensions.api.groups.OwnerInput in = new com.google.gerrit.extensions.api.groups.OwnerInput ( ) ; in.owner = owner ; try { putOwner.apply ( rsrc , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot put group owner" , e ) ; } }
Source:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { if ( ( result.length ( ) ) > 0 ) { getTab ( ) . setTitle ( Resources.M.conflictingChanges ( result.length ( ) ) ) ; getTab ( ) . setChanges ( info.project ( ) , revision , convertChangeList ( result ) ) ; } }

Target:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { if ( ( result.length ( ) ) > 0 ) { getTab ( ) . setTitle ( Resources.M.cherryPicks ( result.length ( ) ) ) ; getTab ( ) . setChanges ( info.project ( ) , revision , convertChangeList ( result ) ) ; } }
Source:
private boolean isEmpty ( ) { if ( ! ( migration.commitChangeWrites ( ) ) ) { return true ; } return ( ( ( changeUpdates.isEmpty ( ) ) && ( draftUpdates.isEmpty ( ) ) ) && ( robotCommentUpdates.isEmpty ( ) ) ) && ( toDelete.isEmpty ( ) ) ; }

Target:
private boolean isEmpty ( ) { if ( ! ( migration.commitChangeWrites ( ) ) ) { return true ; } return ( ( ( ( ( changeUpdates.isEmpty ( ) ) && ( draftUpdates.isEmpty ( ) ) ) && ( robotCommentUpdates.isEmpty ( ) ) ) && ( toDelete.isEmpty ( ) ) ) && ( ! ( com.google.gerrit.server.notedb.NoteDbUpdateManager.hasCommands ( changeRepo ) ) ) ) && ( ! ( com.google.gerrit.server.notedb.NoteDbUpdateManager.hasCommands ( allUsersRepo ) ) ) ; }
Source:
protected void setMessageText ( java.lang.String message ) { if ( message == null ) { message = "" ; } else { message = message.trim ( ) ; } messageSummary.setText ( com.google.gerrit.client.ui.CommentPanel.summarize ( message ) ) ; com.google.gwtexpui.safehtml.client.SafeHtml buf = new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( message ) . wikify ( ) ; buf = com.google.gerrit.client.ui.CommentLinkProcessor.apply ( buf ) ; com.google.gwtexpui.safehtml.client.SafeHtml.set ( messageText , buf ) ; }

Target:
protected void setMessageText ( java.lang.String message ) { if ( message == null ) { message = "" ; } else { message = message.trim ( ) ; } messageSummary.setText ( com.google.gerrit.client.ui.CommentPanel.summarize ( message ) ) ; com.google.gwtexpui.safehtml.client.SafeHtml buf = new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( message ) . wikify ( ) ; buf = commentLinkProcessor.apply ( buf ) ; com.google.gwtexpui.safehtml.client.SafeHtml.set ( messageText , buf ) ; }
Source:
public boolean equals ( java.lang.Object o ) { if ( o instanceof com.google.gerrit.server.util.LabelVote ) { com.google.gerrit.server.util.LabelVote l = ( ( com.google.gerrit.server.util.LabelVote ) ( o ) ) ; return ( com.google.common.base.Objects.equal ( name , l.name ) ) && ( ( value ) == ( l.value ) ) ; } return false ; }

Target:
public boolean equals ( java.lang.Object o ) { if ( o instanceof com.google.gerrit.server.util.LabelVote ) { com.google.gerrit.server.util.LabelVote l = ( ( com.google.gerrit.server.util.LabelVote ) ( o ) ) ; return ( java.util.Objects.equals ( name , l.name ) ) && ( ( value ) == ( l.value ) ) ; } return false ; }
Source:
private void resizeFrame ( final int width , final int height ) { final int w = java.lang.Math.min ( 630 , ( width - 15 ) ) ; final int h = java.lang.Math.min ( 440 , ( height - 60 ) ) ; panel.setWidth ( ( w + "px" ) ) ; panel.setHeight ( ( h + "px" ) ) ; }

Target:
private void resizeFrame ( final int width , final int height ) { final int w = java.lang.Math.min ( 630 , ( width - 15 ) ) ; final int h = java.lang.Math.min ( 460 , ( height - 60 ) ) ; panel.setWidth ( ( w + "px" ) ) ; panel.setHeight ( ( h + "px" ) ) ; }
Source:
public void rangeOfFixReplacementNeedsToBeValid ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; fixReplacementInfo.range = createRange ( 13 , 9 , 5 , 10 ) ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( java.lang.String.format ( ( "Range (13:9 - 5:10) is not " + "valid for the replacement of the robot comment on %s" ) , withFixRobotCommentInput.path ) ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; }

Target:
public void rangeOfFixReplacementNeedsToBeValid ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; fixReplacementInfo.range = createRange ( 13 , 9 , 5 , 10 ) ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( java.lang.String.format ( "Range (13:9 - 5:10) is not valid for the replacement of the robot comment on %s" , withFixRobotCommentInput.path ) ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; }
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { for ( com.google.gerrit.reviewdb.Patch p : detail.getPatches ( ) ) { com.google.gerrit.client.ui.PatchLink.SideBySide link = new com.google.gerrit.client.ui.PatchLink.SideBySide ( p.getFileName ( ) , p.getKey ( ) , 0 , null , null ) ; com.google.gwt.user.client.Window.open ( link.getElement ( ) . toString ( ) , p.getFileName ( ) , null ) ; } }

Target:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { for ( com.google.gerrit.reviewdb.Patch p : detail.getPatches ( ) ) { com.google.gerrit.client.ui.PatchLink.SideBySide link = new com.google.gerrit.client.ui.PatchLink.SideBySide ( p.getFileName ( ) , p.getKey ( ) , 0 , null , null ) ; com.google.gwt.user.client.Window.open ( ( ( ( Window.Location.getPath ( ) ) + "#" ) + ( link.getTargetHistoryToken ( ) ) ) , "_blank" , null ) ; } }
Source:
public void deleteGpgKeys ( ) throws java.lang.Exception { java.lang.String ref = com.google.gerrit.reviewdb.client.RefNames.REFS_GPG_KEYS ; try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { if ( ( repo.getRefDatabase ( ) . exactRef ( ref ) ) != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( ref ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assert_ ( ) . withFailureMessage ( ( "Failed to delete " + ref ) ) . that ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }

Target:
public void deleteGpgKeys ( ) throws java.lang.Exception { java.lang.String ref = com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ; try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { if ( ( repo.getRefDatabase ( ) . exactRef ( ref ) ) != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( ref ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assert_ ( ) . withFailureMessage ( ( "Failed to delete " + ref ) ) . that ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }
Source:
public void setUp ( ) { listenerMock = org.mockito.Mockito.mock ( com.google.gerrit.common.EventListener.class ) ; com.google.gerrit.extensions.registration.DynamicSet < com.google.gerrit.common.EventListener > listeners = com.google.gerrit.extensions.registration.DynamicSet.emptySet ( ) ; listeners.add ( listenerMock ) ; broker = new com.ericsson.gerrit.plugins.syncevents.SyncEventBroker ( null , listeners , null , null , null ) ; }

Target:
public void setUp ( ) { listenerMock = org.mockito.Mockito.mock ( com.google.gerrit.common.EventListener.class ) ; com.google.gerrit.extensions.registration.DynamicSet < com.google.gerrit.common.EventListener > listeners = com.google.gerrit.extensions.registration.DynamicSet.emptySet ( ) ; listeners.add ( listenerMock ) ; broker = new com.ericsson.gerrit.plugins.highavailability.event.ForwardedAwareEventBroker ( null , listeners , null , null , null ) ; }
Source:
private java.lang.String url ( com.google.gerrit.client.diff.FileInfo info ) { return info.binary ( ) ? com.google.gerrit.client.Dispatcher.toUnified ( base , curr , info.path ( ) ) : com.google.gerrit.client.Dispatcher.toSideBySide ( base , curr , info.path ( ) ) ; }

Target:
private java.lang.String url ( com.google.gerrit.client.diff.FileInfo info ) { return info.binary ( ) ? com.google.gerrit.client.Dispatcher.toUnified ( base , curr , info.path ( ) ) : ( mode ) == ( com.google.gerrit.client.change.FileTable.Mode.REVIEW ) ? com.google.gerrit.client.Dispatcher.toSideBySide ( base , curr , info.path ( ) ) : com.google.gerrit.client.Dispatcher.toEditScreen ( curr , info.path ( ) ) ; }
Source:
public void testEvictAccountsOK ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Account.Id key = Account.Id.parse ( "123" ) ; java.lang.String keyJson = new com.google.gson.GsonBuilder ( ) . create ( ) . toJson ( key ) ; org.mockito.Mockito.when ( httpSessionMock.post ( buildCacheEndpoint ( Constants.ACCOUNTS ) , keyJson ) ) . thenReturn ( new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.SUCCESSFUL , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.EMPTY_MSG ) ) ; com.google.common.truth.Truth.assertThat ( forwarder.evict ( Constants.ACCOUNTS , key ) ) . isTrue ( ) ; }

Target:
public void testEvictAccountsOK ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Account.Id key = new com.google.gerrit.reviewdb.client.Account.Id ( 123 ) ; java.lang.String keyJson = new com.google.gson.GsonBuilder ( ) . create ( ) . toJson ( key ) ; org.mockito.Mockito.when ( httpSessionMock.post ( buildCacheEndpoint ( Constants.ACCOUNTS ) , keyJson ) ) . thenReturn ( new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.SUCCESSFUL , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.EMPTY_MSG ) ) ; com.google.common.truth.Truth.assertThat ( forwarder.evict ( Constants.ACCOUNTS , key ) ) . isTrue ( ) ; }
Source:
public void setId ( java.lang.String id ) { this . id = ( id != null ) ? com.google.gerrit.common.data.LabelType.checkId ( id ) : null ; }

Target:
private static java.lang.String checkId ( java.lang.String id ) { if ( "SUBM" . equals ( id ) ) { throw new java.lang.IllegalArgumentException ( ( ( "Reserved label ID \"" + id ) + "\"" ) ) ; } if ( ( id != null ) && ( ( id.length ( ) ) > 4 ) ) { throw new java.lang.IllegalArgumentException ( ( ( "Illegal label ID \"" + id ) + "\"" ) ) ; } return id ; }
Source:
public java.util.Collection < com.google.gerrit.reviewdb.ProjectRight > getWildcardRights ( final com.google.gerrit.reviewdb.ApprovalCategory.Id id ) { if ( ( inheritedRights ) == null ) { inheritedRights = com.google.gerrit.server.workflow.FunctionState.index ( project.getInheritedRights ( ) ) ; } final java.util.Collection < com.google.gerrit.reviewdb.ProjectRight > l = inheritedRights.get ( id ) ; return l != null ? l : java.util.Collections.< com.google.gerrit.reviewdb.ProjectRight > emptySet ( ) ; }

Target:
public java.util.Collection < com.google.gerrit.reviewdb.RefRight > getWildcardRights ( final com.google.gerrit.reviewdb.ApprovalCategory.Id id ) { if ( ( inheritedRights ) == null ) { inheritedRights = index ( project.getInheritedRights ( ) ) ; } final java.util.Collection < com.google.gerrit.reviewdb.RefRight > l = inheritedRights.get ( id ) ; return l != null ? l : java.util.Collections.< com.google.gerrit.reviewdb.RefRight > emptySet ( ) ; }
Source:
public com.google.common.util.concurrent.ListenableFuture < java.util.List < java.lang.Void > > apply ( java.util.List < com.google.gerrit.reviewdb.client.Change > changes ) { java.util.List < com.google.common.util.concurrent.ListenableFuture < java.lang.Void > > result = com.google.common.collect.Lists.newArrayListWithCapacity ( changes.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Change c : changes ) { result.add ( executor.submit ( new com.google.gerrit.server.index.ReindexAfterUpdate.Index ( event , c ) ) ) ; } return com.google.common.util.concurrent.Futures.allAsList ( result ) ; }

Target:
public com.google.common.util.concurrent.ListenableFuture < java.util.List < java.lang.Void > > apply ( java.util.List < com.google.gerrit.reviewdb.client.Change > changes ) { java.util.List < com.google.common.util.concurrent.ListenableFuture < java.lang.Void > > result = com.google.common.collect.Lists.newArrayListWithCapacity ( changes.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Change c : changes ) { result.add ( executor.submit ( new com.google.gerrit.server.index.ReindexAfterUpdate.Index ( event , c.getOwner ( ) , c.getId ( ) ) ) ) ; } return com.google.common.util.concurrent.Futures.allAsList ( result ) ; }
Source:
private void addGutterTag ( com.google.gerrit.client.diff.DiffInfo.Region region , int startA , int startB ) { if ( ( region.a ( ) ) == null ) { sidePanel.addGutter ( cmB , startB , SidePanel.GutterType.INSERT ) ; } else if ( ( region.b ( ) ) == null ) { sidePanel.addGutter ( cmA , startA , SidePanel.GutterType.DELETE ) ; } else { sidePanel.addGutter ( cmB , startB , SidePanel.GutterType.EDIT ) ; } }

Target:
private void addGutterTag ( com.google.gerrit.client.diff.DiffInfo.Region region , int startA , int startB ) { if ( ( region.a ( ) ) == null ) { sidePanel.addGutter ( cmB , startB , OverviewBar.GutterType.INSERT ) ; } else if ( ( region.b ( ) ) == null ) { sidePanel.addGutter ( cmA , startA , OverviewBar.GutterType.DELETE ) ; } else { sidePanel.addGutter ( cmB , startB , OverviewBar.GutterType.EDIT ) ; } }
Source:
private com.google.gerrit.acceptance.rest.group.AccountInfo GET_ONE ( java.lang.String endpoint ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = session.get ( endpoint ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_OK , r.getStatusCode ( ) ) ; return new com.google.gson.Gson ( ) . fromJson ( r.getReader ( ) , new com.google.common.reflect.TypeToken < com.google.gerrit.acceptance.rest.group.AccountInfo > ( ) { } . getType ( ) ) ; }

Target:
private com.google.gerrit.acceptance.rest.group.AccountInfo GET_ONE ( java.lang.String endpoint ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = session.get ( endpoint ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_OK , r.getStatusCode ( ) ) ; return new com.google.gson.Gson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < com.google.gerrit.acceptance.rest.group.AccountInfo > ( ) { } . getType ( ) ) ; }
Source:
private java.util.Set < java.lang.String > allRefPatterns ( com.google.gerrit.reviewdb.ApprovalCategory.Id actionId ) { final java.util.Set < java.lang.String > all = new java.util.HashSet < java.lang.String > ( ) ; for ( final com.google.gerrit.reviewdb.RefRight pr : state.getAllRights ( actionId , true ) ) { all.add ( pr.getRefPattern ( ) ) ; } return all ; }

Target:
private java.util.Set < java.lang.String > allRefPatterns ( java.lang.String permissionName ) { java.util.Set < java.lang.String > all = new java.util.HashSet < java.lang.String > ( ) ; for ( com.google.gerrit.common.data.AccessSection section : access ( ) ) { com.google.gerrit.common.data.Permission permission = section.getPermission ( permissionName ) ; if ( permission != null ) { all.add ( section.getRefPattern ( ) ) ; } } return all ; }
Source:
public static com.googlesource.gerrit.plugins.github.group.GitHubOrganisationGroup fromUUID ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ) { com.google.common.base.Preconditions.checkArgument ( uuid.get ( ) . startsWith ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationGroup.UUID_PREFIX ) , ( ( "Invalid GitHub UUID '" + uuid ) + "'" ) ) ; return new com.googlesource.gerrit.plugins.github.group.GitHubOrganisationGroup ( uuid.get ( ) . substring ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationGroup.UUID_PREFIX.length ( ) ) , null ) ; }

Target:
public static com.googlesource.gerrit.plugins.github.group.GitHubOrganisationGroup fromUUID ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ) { com.google.common.base.Preconditions.checkArgument ( uuid.get ( ) . startsWith ( com.googlesource.gerrit.plugins.github.group.UUID_PREFIX ) , ( ( "Invalid GitHub UUID '" + uuid ) + "'" ) ) ; return new com.googlesource.gerrit.plugins.github.group.GitHubOrganisationGroup ( uuid.get ( ) . substring ( com.googlesource.gerrit.plugins.github.group.UUID_PREFIX.length ( ) ) , null ) ; }
Source:
com.google.gerrit.client.diff.DraftBox addReplyBox ( com.google.gerrit.client.changes.CommentInfo replyTo , java.lang.String initMessage , boolean doSave ) { com.google.gerrit.client.changes.CommentInfo info = com.google.gerrit.client.changes.CommentInfo.create ( path , replyTo.side ( ) , replyTo.line ( ) , replyTo.id ( ) , initMessage ) ; com.google.gerrit.client.diff.DraftBox box = new com.google.gerrit.client.diff.DraftBox ( this , revision , info , commentLinkProcessor , true , ( ! doSave ) ) ; addCommentBox ( info , 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 ) ; } getLineBoxMapFromSide ( info.side ( ) ) . put ( ( ( info.line ( ) ) - 1 ) , box ) ; return box ; }
Source:
public void unblockRangeForNotChangeOwner ( ) { com.google.gerrit.server.project.Util.allow ( local , ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) , ( - 2 ) , ( + 2 ) , com.google.gerrit.server.group.SystemGroupBackend.CHANGE_OWNER , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.common.data.PermissionRange range = u.controlForRef ( "refs/heads/master" ) . getRange ( ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) ) ; assertCannotVote ( ( - 2 ) , range ) ; assertCannotVote ( 2 , range ) ; }

Target:
public void unblockRangeForNotChangeOwner ( ) { com.google.gerrit.server.project.testing.Util.allow ( local , ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) , ( - 2 ) , ( + 2 ) , com.google.gerrit.server.group.SystemGroupBackend.CHANGE_OWNER , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; com.google.gerrit.common.data.PermissionRange range = u.controlForRef ( "refs/heads/master" ) . getRange ( ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) ) ; assertCannotVote ( ( - 2 ) , range ) ; assertCannotVote ( 2 , range ) ; }
Source:
private java.lang.String changeKindMessage ( com.google.gerrit.server.change.ChangeKind changeKind ) { switch ( changeKind ) { case TRIVIAL_REBASE : case NO_CHANGE : return ( ": Patch Set " + ( priorPatchSet.get ( ) ) ) + " was rebased" ; case NO_CODE_CHANGE : return ": Commit message was updated" ; case REWORK : default : return null ; } }

Target:
private java.lang.String changeKindMessage ( com.google.gerrit.server.change.ChangeKind changeKind ) { switch ( changeKind ) { case MERGE_FIRST_PARENT_UPDATE : case TRIVIAL_REBASE : case NO_CHANGE : return ( ": Patch Set " + ( priorPatchSet.get ( ) ) ) + " was rebased" ; case NO_CODE_CHANGE : return ": Commit message was updated" ; case REWORK : default : return null ; } }
Source:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource resource ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Abandon" ) . setTitle ( "Abandon the change" ) . setVisible ( ( ( resource.getChange ( ) . getStatus ( ) . isOpen ( ) ) && ( resource.getControl ( ) . canAbandon ( ) ) ) ) ; }

Target:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource resource ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Abandon" ) . setTitle ( "Abandon the change" ) . setVisible ( ( ( ( resource.getChange ( ) . getStatus ( ) . isOpen ( ) ) && ( ( resource.getChange ( ) . getStatus ( ) ) != ( Change.Status.DRAFT ) ) ) && ( resource.getControl ( ) . canAbandon ( ) ) ) ) ; }
Source:
public void onSuccess ( com.google.gerrit.common.data.PatchSetDetail result ) { patchSetDetail = result ; if ( ( fileList ) == null ) { fileList = new com.google.gerrit.client.changes.PatchTable ( prefs ) ; fileList.display ( idSideA , result ) ; patchIndex = fileList.indexOf ( patchKey ) ; } refresh ( true ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.diff.DiffInfo diffInfo ) { topNav.display ( patchIndex , getPatchScreenType ( ) , fileList , getLinks ( ) , getWebLinks ( diffInfo ) ) ; bottomNav.display ( patchIndex , getPatchScreenType ( ) , fileList , getLinks ( ) , getWebLinks ( diffInfo ) ) ; }
Source:
public void resetToDefaults ( ) { maximumPageSize = com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DEFAULT_PAGESIZE ; showSiteHeader = true ; useFlashClipboard = true ; copySelfOnEmail = false ; reversePatchSetOrder = false ; showUserInReview = false ; downloadUrl = null ; downloadCommand = null ; dateFormat = null ; timeFormat = null ; relativeDateInChangeTable = false ; commentVisibilityStrategy = null ; diffView = null ; }

Target:
public void resetToDefaults ( ) { maximumPageSize = com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DEFAULT_PAGESIZE ; showSiteHeader = true ; useFlashClipboard = true ; copySelfOnEmail = false ; reversePatchSetOrder = false ; showUserInReview = false ; downloadUrl = null ; downloadCommand = null ; dateFormat = null ; timeFormat = null ; relativeDateInChangeTable = false ; commentVisibilityStrategy = null ; diffView = null ; changeScreen = null ; }
Source:
private void onPatchSetCreated ( final com.google.gerrit.server.events.PatchSetCreatedEvent event ) { com.google.gerrit.server.data.ChangeAttribute change = event.change.get ( ) ; if ( atomicityHelper.isAtomicReview ( change ) ) { processNewAtomicPatchSet ( change ) ; } }

Target:
private void onPatchSetCreated ( final com.google.gerrit.server.events.PatchSetCreatedEvent event ) { com.google.gerrit.server.data.ChangeAttribute change = event.change.get ( ) ; if ( atomicityHelper.isAtomicReview ( change ) ) { processNewAtomicPatchSet ( change ) ; } try { autoSubmitIfMergeable ( change ) ; } catch ( com.google.gwtorm.server.OrmException | com.google.gerrit.extensions.restapi.RestApiException | java.io.IOException | com.google.gerrit.server.update.UpdateException e ) { com.criteo.gerrit.plugins.automerge.AutomaticMerger.log.error ( ( "An exception occured while trying to merge change #" + ( change.number ) ) , e ) ; } }
Source:
protected void assertTipCommit ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid , java.lang.String expectedMessage ) throws java.lang.Exception { try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( allUsersRepo ) ) { org.eclipse.jgit.lib.Ref ref = allUsersRepo.exactRef ( com.google.gerrit.reviewdb.client.RefNames.refsGroups ( uuid ) ) ; com.google.gerrit.server.group.db.AbstractGroupTest.assertCommit ( com.google.gerrit.server.git.CommitUtil.toCommitInfo ( rw.parseCommit ( ref.getObjectId ( ) ) , rw ) , expectedMessage , com.google.gerrit.server.group.db.AbstractGroupTest.getAccountName ( userId ) , com.google.gerrit.server.group.db.AbstractGroupTest.getAccountEmail ( userId ) ) ; } }

Target:
protected void assertTipCommit ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid , java.lang.String expectedMessage , java.lang.String expectedName , java.lang.String expectedEmail ) throws java.lang.Exception { try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( allUsersRepo ) ) { org.eclipse.jgit.lib.Ref ref = allUsersRepo.exactRef ( com.google.gerrit.reviewdb.client.RefNames.refsGroups ( uuid ) ) ; com.google.gerrit.server.group.db.AbstractGroupTest.assertCommit ( com.google.gerrit.server.git.CommitUtil.toCommitInfo ( rw.parseCommit ( ref.getObjectId ( ) ) , rw ) , expectedMessage , expectedName , expectedEmail ) ; } }
Source:
void audit ( com.google.gerrit.sshd.SshScope.Context ctx , java.lang.Object result , java.lang.String commandName , java.lang.String [ ] args ) { final java.lang.String sid = extractSessionId ( ctx ) ; final long created = extractCreated ( ctx ) ; final java.lang.String what = extractWhat ( commandName , args ) ; auditService.dispatch ( new com.google.gerrit.audit.AuditEvent ( sid , extractCurrentUser ( ctx ) , ( "ssh:" + what ) , created , java.util.Arrays.asList ( args ) , result ) ) ; }

Target:
void audit ( com.google.gerrit.sshd.SshScope.Context ctx , java.lang.Object result , com.google.gerrit.sshd.DispatchCommand cmd ) { final java.lang.String sid = extractSessionId ( ctx ) ; final long created = extractCreated ( ctx ) ; auditService.dispatch ( new com.google.gerrit.audit.SshAuditEvent ( sid , extractCurrentUser ( ctx ) , extractWhat ( cmd ) , created , extractParameters ( cmd ) , result ) ) ; }
Source:
public void contributorAgreements ( final com.google.gwt.user.client.rpc.AsyncCallback < java.util.List < com.google.gerrit.reviewdb.client.ContributorAgreement > > callback ) { try { final com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ; try { callback.onSuccess ( db.contributorAgreements ( ) . active ( ) . toList ( ) ) ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.server.OrmException e ) { callback.onFailure ( e ) ; } }

Target:
public void contributorAgreements ( final com.google.gwtjsonrpc.common.AsyncCallback < java.util.List < com.google.gerrit.reviewdb.client.ContributorAgreement > > callback ) { try { final com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ; try { callback.onSuccess ( db.contributorAgreements ( ) . active ( ) . toList ( ) ) ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.server.OrmException e ) { callback.onFailure ( e ) ; } }
Source:
public void index ( com.google.gerrit.reviewdb.client.Account.Id id ) throws java.io.IOException { for ( com.google.gerrit.server.index.Index < ? , com.google.gerrit.server.account.AccountState > i : getWriteIndexes ( ) ) { i.replace ( byIdCache.get ( id ) ) ; } fireAccountIndexedEvent ( id.get ( ) ) ; }

Target:
public void index ( com.google.gerrit.reviewdb.client.Account.Id id ) throws java.io.IOException { for ( com.google.gerrit.server.index.Index < com.google.gerrit.reviewdb.client.Account.Id , com.google.gerrit.server.account.AccountState > i : getWriteIndexes ( ) ) { com.google.gerrit.server.account.AccountState accountState = byIdCache.getOrNull ( id ) ; if ( accountState != null ) { i.replace ( accountState ) ; } else { i.delete ( id ) ; } } fireAccountIndexedEvent ( id.get ( ) ) ; }
Source:
public void setAssigneeForNonVisibleChange ( ) throws java.lang.Exception { git ( ) . fetch ( ) . setRefSpecs ( new org.eclipse.jgit.transport.RefSpec ( "refs/meta/config:refs/meta/config" ) ) . call ( ) ; testRepo.reset ( RefNames.REFS_CONFIG ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( "refs/for/refs/meta/config" ) ; exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( "is not visible to" ) ; setAssignee ( r , user.email ) ; }

Target:
public void setAssigneeForNonVisibleChange ( ) throws java.lang.Exception { git ( ) . fetch ( ) . setRefSpecs ( new org.eclipse.jgit.transport.RefSpec ( "refs/meta/config:refs/meta/config" ) ) . call ( ) ; testRepo.reset ( RefNames.REFS_CONFIG ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( "refs/for/refs/meta/config" ) ; exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( "read not permitted" ) ; setAssignee ( r , user.email ) ; }
Source:
private com.google.gerrit.client.reviewdb.AccountGroup missingGroup ( final com.google.gerrit.client.reviewdb.AccountGroup.Id groupId ) { final com.google.gerrit.client.reviewdb.AccountGroup.NameKey name = new com.google.gerrit.client.reviewdb.AccountGroup.NameKey ( ( "Deleted Group" + ( groupId.toString ( ) ) ) ) ; final com.google.gerrit.client.reviewdb.AccountGroup g = new com.google.gerrit.client.reviewdb.AccountGroup ( name , groupId ) ; g.setAutomaticMembership ( true ) ; g.setOwnerGroupId ( administrators ) ; return g ; }

Target:
private com.google.gerrit.client.reviewdb.AccountGroup missingGroup ( final com.google.gerrit.client.reviewdb.AccountGroup.Id groupId ) { final com.google.gerrit.client.reviewdb.AccountGroup.NameKey name = new com.google.gerrit.client.reviewdb.AccountGroup.NameKey ( ( "Deleted Group" + ( groupId.toString ( ) ) ) ) ; final com.google.gerrit.client.reviewdb.AccountGroup g = new com.google.gerrit.client.reviewdb.AccountGroup ( name , groupId ) ; g.setType ( AccountGroup.Type.SYSTEM ) ; g.setOwnerGroupId ( administrators ) ; return g ; }
Source:
public com.google.gerrit.server.patch.PatchList get ( com.google.gerrit.server.patch.PatchListKey key ) throws com.google.gerrit.server.patch.PatchListNotAvailableException { try { return fileCache.get ( key ) ; } catch ( java.util.concurrent.ExecutionException e ) { PatchListLoader.log.warn ( ( "Error computing " + key ) , e ) ; throw new com.google.gerrit.server.patch.PatchListNotAvailableException ( e.getCause ( ) ) ; } }

Target:
public com.google.gerrit.server.patch.PatchList get ( com.google.gerrit.server.patch.PatchListKey key ) throws com.google.gerrit.server.patch.PatchListNotAvailableException { try { return fileCache.get ( key ) ; } catch ( java.util.concurrent.ExecutionException | org.eclipse.jgit.errors.LargeObjectException e ) { PatchListLoader.log.warn ( ( "Error computing " + key ) , e ) ; throw new com.google.gerrit.server.patch.PatchListNotAvailableException ( e.getCause ( ) ) ; } }
Source:
private void restoreEvent ( com.ericsson.gerrit.plugins.eventslog.SQLClient.SQLEntry entry ) { try { eventsDb.storeEvent ( entry.getName ( ) , entry.getTimestamp ( ) , entry.getEvent ( ) ) ; } catch ( java.sql.SQLException e ) { com.ericsson.gerrit.plugins.eventslog.SQLStore.log.warn ( "Could not restore events from local" , e ) ; } }

Target:
private void restoreEvent ( com.ericsson.gerrit.plugins.eventslog.SQLEntry entry ) { try { eventsDb.storeEvent ( entry.getName ( ) , entry.getTimestamp ( ) , entry.getEvent ( ) ) ; } catch ( java.sql.SQLException e ) { com.ericsson.gerrit.plugins.eventslog.SQLStore.log.warn ( "Could not restore events from local" , e ) ; } }
Source:
protected void configure ( ) { com.google.gerrit.sshd.CommandName gerrit = com.google.gerrit.sshd.Commands.named ( "gerrit" ) ; com.google.gerrit.sshd.CommandName index = com.google.gerrit.sshd.Commands.named ( gerrit , "index" ) ; command ( index ) . toProvider ( new com.google.gerrit.sshd.DispatchCommandProvider ( index ) ) ; command ( index , com.google.gerrit.sshd.commands.IndexActivateCommand.class ) ; command ( index , com.google.gerrit.sshd.commands.IndexStartCommand.class ) ; command ( index , com.google.gerrit.sshd.commands.IndexChangesCommand.class ) ; }

Target:
protected void configure ( ) { com.google.gerrit.sshd.CommandName gerrit = com.google.gerrit.sshd.Commands.named ( "gerrit" ) ; com.google.gerrit.sshd.CommandName index = com.google.gerrit.sshd.Commands.named ( gerrit , "index" ) ; command ( index ) . toProvider ( new com.google.gerrit.sshd.DispatchCommandProvider ( index ) ) ; command ( index , com.google.gerrit.sshd.commands.IndexActivateCommand.class ) ; command ( index , com.google.gerrit.sshd.commands.IndexStartCommand.class ) ; command ( index , com.google.gerrit.sshd.commands.IndexChangesCommand.class ) ; command ( index , com.google.gerrit.sshd.commands.IndexProjectCommand.class ) ; }
Source:
public java.util.List < com.google.gerrit.server.project.CommentLinkInfo > getCommentLinks ( ) { return commentLinks ; }

Target:
public java.util.List < com.google.gerrit.server.project.CommentLinkInfo > getCommentLinks ( ) { java.util.Map < java.lang.String , com.google.gerrit.server.project.CommentLinkInfo > cls = com.google.common.collect.Maps.newLinkedHashMap ( ) ; for ( com.google.gerrit.server.project.CommentLinkInfo cl : commentLinks ) { cls.put ( cl.name.toLowerCase ( ) , cl ) ; } for ( com.google.gerrit.server.project.ProjectState s : treeInOrder ( ) ) { for ( com.google.gerrit.server.project.CommentLinkInfo cl : s.getConfig ( ) . getCommentLinkSections ( ) ) { cls.put ( cl.name.toLowerCase ( ) , cl ) ; } } return com.google.common.collect.ImmutableList.copyOf ( cls.values ( ) ) ; }
Source:
public void testGcAll ( ) throws com.jcraft.jsch.JSchException , java.io.IOException { java.lang.String response = sshSession.exec ( "gerrit gc --all" ) ; org.junit.Assert.assertFalse ( sshSession.hasError ( ) ) ; assertNoError ( response ) ; gcAssert.assertHasPackFile ( allProjects , project1 , project2 , project3 ) ; }

Target:
public void testGcAll ( ) throws com.jcraft.jsch.JSchException , java.io.IOException { java.lang.String response = sshSession.exec ( "gerrit gc --all" ) ; org.junit.Assert.assertFalse ( sshSession.getError ( ) , sshSession.hasError ( ) ) ; assertNoError ( response ) ; gcAssert.assertHasPackFile ( allProjects , project1 , project2 , project3 ) ; }
Source:
private com.google.gerrit.reviewdb.client.ChangeMessage message ( com.google.gerrit.reviewdb.client.Change c , java.lang.String body ) { java.lang.String uuid ; try { uuid = com.google.gerrit.server.ChangeUtil.messageUUID ( db ) ; } catch ( com.google.gwtorm.server.OrmException e ) { return null ; } com.google.gerrit.reviewdb.client.ChangeMessage m = new com.google.gerrit.reviewdb.client.ChangeMessage ( new com.google.gerrit.reviewdb.client.ChangeMessage.Key ( c.getId ( ) , uuid ) , null , com.google.gerrit.common.TimeUtil.nowTs ( ) , c.currentPatchSetId ( ) ) ; m.setMessage ( body ) ; return m ; }

Target:
private static java.util.List < com.google.gerrit.common.data.SubmitRecord > getSubmitRecords ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.common.data.SubmitRecord > results = cd.getSubmitRecords ( ) ; if ( results == null ) { results = new com.google.gerrit.server.project.SubmitRuleEvaluator ( cd ) . evaluate ( ) ; cd.setSubmitRecords ( results ) ; } return results ; }
Source:
public < T extends com.google.gerrit.server.permissions.GlobalOrPluginPermission > java.util.Set < T > test ( java.util.Collection < T > permSet ) throws com.google.gerrit.server.permissions.PermissionBackendException { java.util.Set < T > ok = com.google.gerrit.server.project.DefaultPermissionBackend.newSet ( permSet ) ; for ( T perm : permSet ) { if ( can ( perm ) ) { ok.add ( perm ) ; } } return ok ; }

Target:
public < T extends com.google.gerrit.extensions.api.access.GlobalOrPluginPermission > java.util.Set < T > test ( java.util.Collection < T > permSet ) throws com.google.gerrit.server.permissions.PermissionBackendException { java.util.Set < T > ok = com.google.gerrit.server.project.DefaultPermissionBackend.newSet ( permSet ) ; for ( T perm : permSet ) { if ( can ( perm ) ) { ok.add ( perm ) ; } } return ok ; }
Source:
public boolean canDelete ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change.Status status ) throws com.google.gwtorm.server.OrmException { if ( ! ( isVisible ( db ) ) ) { return false ; } switch ( status ) { case DRAFT : return ( isOwner ( ) ) || ( getRefControl ( ) . canDeleteDrafts ( ) ) ; case NEW : case ABANDONED : return isAdmin ( ) ; case MERGED : default : return false ; } }

Target:
public boolean canDelete ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change.Status status ) throws com.google.gwtorm.server.OrmException { if ( ! ( isVisible ( db ) ) ) { return false ; } switch ( status ) { case DRAFT : return ( isOwner ( ) ) || ( getRefControl ( ) . canDeleteDrafts ( ) ) ; case NEW : case ABANDONED : return ( isAdmin ( ) ) || ( ( isOwner ( ) ) && ( getRefControl ( ) . canDeleteOwnChanges ( ) ) ) ; case MERGED : default : return false ; } }
Source:
public void badRequest ( ) throws java.io.IOException , javax.servlet.ServletException { 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 ( ) . once ( ) ; replayAll ( ) ; servlet.doPost ( request , response ) ; verifyAll ( ) ; }

Target:
public void errorWhileSendingErrorMessage ( ) 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 com.google.gerrit.httpd.raw.ResourceServlet.Resource call ( ) throws java.io.IOException { try { return new com.google.gerrit.httpd.raw.ResourceServlet.Resource ( getLastModifiedTime ( p ) , com.google.gerrit.httpd.raw.ResourceServlet.contentType ( p.toString ( ) ) , java.nio.file.Files.readAllBytes ( p ) ) ; } catch ( java.nio.file.NoSuchFileException e ) { return com.google.gerrit.httpd.raw.ResourceServlet.Resource.NOT_FOUND ; } }

Target:
private java.util.concurrent.Callable < com.google.gerrit.httpd.raw.ResourceServlet.Resource > newLoader ( final java.nio.file.Path p ) { return ( ) -> { try { return new com.google.gerrit.httpd.raw.ResourceServlet.Resource ( getLastModifiedTime ( p ) , com.google.gerrit.httpd.raw.ResourceServlet.contentType ( p.toString ( ) ) , java.nio.file.Files.readAllBytes ( p ) ) ; } catch ( java.nio.file.NoSuchFileException e ) { return com.google.gerrit.httpd.raw.ResourceServlet.Resource.NOT_FOUND ; } } ; }