auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void configureServlets ( ) { serve ( "/say-hello/*" ) . with ( com.googlesource.gerrit.plugins.cookbook.HelloWorldServlet.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.extensions.webui.WebUiPlugin.class ) . toInstance ( new com.google.gerrit.extensions.webui.JavaScriptPlugin ( "hello.js" ) ) ; }

Target:
protected void configureServlets ( ) { serve ( "/say-hello/*" ) . with ( com.googlesource.gerrit.plugins.cookbook.HelloWorldServlet.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.extensions.webui.WebUiPlugin.class ) . toInstance ( new com.google.gerrit.extensions.webui.JavaScriptPlugin ( "hello-project.js" ) ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.extensions.webui.WebUiPlugin.class ) . toInstance ( new com.google.gerrit.extensions.webui.JavaScriptPlugin ( "hello-revision.js" ) ) ; }
Source:
public void onBrowserEvent ( final com.google.gwt.user.client.Event event ) { if ( ( com.google.gwt.user.client.DOM.eventGetType ( event ) ) == ( com.google.gwt.user.client.Event.ONCLICK ) ) { com.google.gwt.user.client.History.newItem ( getTargetHistoryToken ( ) , false ) ; com.google.gerrit.client.Gerrit.display ( createScreen ( ) ) ; com.google.gwt.user.client.DOM.eventPreventDefault ( event ) ; } }

Target:
public void onBrowserEvent ( final com.google.gwt.user.client.Event event ) { if ( ( com.google.gwt.user.client.DOM.eventGetType ( event ) ) == ( com.google.gwt.user.client.Event.ONCLICK ) ) { onClick ( event ) ; } }
Source:
private void initProviderBouncyCastle ( org.eclipse.jgit.lib.Config cfg ) { setKeyExchangeFactories ( NamedFactory.Utils.setUpTransformedFactories ( true , java.util.Collections.unmodifiableList ( java.util.Arrays.asList ( BuiltinDHFactories.dhg14 , BuiltinDHFactories.dhg1 ) ) , ServerBuilder.DH2KEX ) ) ; org.apache.sshd.common.NamedFactory < org.apache.sshd.common.random.Random > factory ; if ( cfg.getBoolean ( "sshd" , null , "testUseInsecureRandom" , false ) ) { factory = new com.google.gerrit.sshd.SshDaemon.InsecureBouncyCastleRandom.Factory ( ) ; } else { factory = org.apache.sshd.common.util.SecurityUtils.getRandomFactory ( ) ; } setRandomFactory ( new org.apache.sshd.common.random.SingletonRandomFactory ( factory ) ) ; }

Target:
private void initKeyExchanges ( org.eclipse.jgit.lib.Config cfg ) { java.util.List < org.apache.sshd.common.NamedFactory < org.apache.sshd.common.kex.KeyExchange > > a = org.apache.sshd.server.ServerBuilder.setUpDefaultKeyExchanges ( true ) ; setKeyExchangeFactories ( com.google.gerrit.sshd.SshDaemon.filter ( cfg , "kex" , ( ( org.apache.sshd.common.NamedFactory < org.apache.sshd.common.kex.KeyExchange > [ ] ) ( a.toArray ( new org.apache.sshd.common.NamedFactory [ a.size ( ) ] ) ) ) ) ) ; }
Source:
protected final com.google.gerrit.server.mail.send.ProjectWatch.Watchers getWatchers ( com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType type ) throws com.google.gwtorm.server.OrmException { if ( ! ( NotifyHandling.ALL.equals ( notify ) ) ) { return new com.google.gerrit.server.mail.send.ProjectWatch.Watchers ( ) ; } com.google.gerrit.server.mail.send.ProjectWatch watch = new com.google.gerrit.server.mail.send.ProjectWatch ( args , branch.getParentKey ( ) , projectState , changeData ) ; return watch.getWatchers ( type ) ; }

Target:
protected final com.google.gerrit.server.mail.send.ProjectWatch.Watchers getWatchers ( com.google.gerrit.server.account.WatchConfig.NotifyType type ) throws com.google.gwtorm.server.OrmException { if ( ! ( NotifyHandling.ALL.equals ( notify ) ) ) { return new com.google.gerrit.server.mail.send.ProjectWatch.Watchers ( ) ; } com.google.gerrit.server.mail.send.ProjectWatch watch = new com.google.gerrit.server.mail.send.ProjectWatch ( args , branch.getParentKey ( ) , projectState , changeData ) ; return watch.getWatchers ( type ) ; }
Source:
public com.google.gerrit.server.plugins.RegistrationHandle replace ( final com.google.gerrit.sshd.CommandName name , final com.google.inject.Provider < org.apache.sshd.server.Command > cmd ) { final java.util.concurrent.ConcurrentMap < java.lang.String , com.google.inject.Provider < org.apache.sshd.server.Command > > m = getMap ( ) ; m.put ( name.value ( ) , cmd ) ; return new com.google.gerrit.server.plugins.RegistrationHandle ( ) { @ java.lang.Override public void remove ( ) { m.remove ( name.value ( ) , cmd ) ; } } ; }

Target:
public com.google.gerrit.extensions.registration.RegistrationHandle replace ( final com.google.gerrit.sshd.CommandName name , final com.google.inject.Provider < org.apache.sshd.server.Command > cmd ) { final java.util.concurrent.ConcurrentMap < java.lang.String , com.google.inject.Provider < org.apache.sshd.server.Command > > m = getMap ( ) ; m.put ( name.value ( ) , cmd ) ; return new com.google.gerrit.extensions.registration.RegistrationHandle ( ) { @ java.lang.Override public void remove ( ) { m.remove ( name.value ( ) , cmd ) ; } } ; }
Source:
public void invalidRevision ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = insertChange ( ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , "fooooooooooooooooooooooooooooooooooooooo" , userId ) ) ) ; incrementPatchSet ( c ) ; insertPatchSet ( c ) ; assertProblems ( c , ( "Invalid revision on patch set 1:" + " fooooooooooooooooooooooooooooooooooooooo" ) ) ; }

Target:
public void invalidRevision ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = insertChange ( ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , "fooooooooooooooooooooooooooooooooooooooo" , adminId ) ) ) ; incrementPatchSet ( c ) ; insertPatchSet ( c ) ; assertProblems ( c , ( "Invalid revision on patch set 1:" + " fooooooooooooooooooooooooooooooooooooooo" ) ) ; }
Source:
private void assertDeleteForbidden ( com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.lang.Exception { exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( "delete not permitted" ) ; branch ( branch ) . delete ( ) ; }

Target:
private void assertDeleteForbidden ( com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( branch ( branch ) . get ( ) . canDelete ) . isNull ( ) ; exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( "delete not permitted" ) ; branch ( branch ) . delete ( ) ; }
Source:
public com.google.gerrit.client.data.PatchSetDetail run ( final com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gerrit.server.rpc.Failure , com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.PatchSet ps = db.patchSets ( ) . get ( id ) ; if ( ps == null ) { throw new com.google.gerrit.server.rpc.Failure ( new com.google.gerrit.client.rpc.NoSuchEntityException ( ) ) ; } assertCanRead ( db.changes ( ) . get ( ps.getId ( ) . getParentKey ( ) ) ) ; final com.google.gerrit.client.data.PatchSetDetail d = new com.google.gerrit.client.data.PatchSetDetail ( ) ; d.load ( db , ps ) ; return d ; }

Target:
public void patchSetDetail ( final com.google.gerrit.client.reviewdb.PatchSet.Id id , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.data.PatchSetDetail > callback ) { run ( callback , patchSetDetail.create ( id ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { index = new com.google.gerrit.server.index.FakeIndex ( FakeIndex.V2 ) ; indexes = new com.google.gerrit.server.index.IndexCollection ( ) ; indexes.setSearchIndex ( index ) ; queryBuilder = new com.google.gerrit.server.index.FakeQueryBuilder ( indexes ) ; rewrite = new com.google.gerrit.server.index.IndexRewriteImpl ( indexes ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { index = new com.google.gerrit.server.index.FakeIndex ( FakeIndex.V2 ) ; indexes = new com.google.gerrit.server.index.IndexCollection ( ) ; indexes.setSearchIndex ( index ) ; queryBuilder = new com.google.gerrit.server.index.FakeQueryBuilder ( indexes ) ; rewrite = new com.google.gerrit.server.index.IndexRewriteImpl ( indexes , com.google.gerrit.server.index.IndexConfig.create ( 0 , 0 , 3 , 100 ) ) ; }
Source:
public void queryChangesStart ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r1 = createChange ( ) ; createChange ( ) ; java.util.List < com.google.gerrit.extensions.common.ChangeInfo > results = gApi.changes ( ) . query ( ) . withStart ( 1 ) . get ( ) ; com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getOnlyElement ( results ) . changeId ) . isEqualTo ( r1.getChangeId ( ) ) ; }

Target:
public void queryChangesStart ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r1 = createChange ( ) ; createChange ( ) ; java.util.List < com.google.gerrit.extensions.common.ChangeInfo > results = gApi.changes ( ) . query ( ( ( "project:{" + ( project.get ( ) ) ) + "}" ) ) . withStart ( 1 ) . get ( ) ; com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getOnlyElement ( results ) . changeId ) . isEqualTo ( r1.getChangeId ( ) ) ; }
Source:
public static void prev ( java.lang.String query , int limit , java.lang.String sortkey , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.ChangeList > callback ) { com.google.gerrit.client.rpc.RestApi call = com.google.gerrit.client.changes.ChangeList.newQuery ( query ) ; if ( limit > 0 ) { call.addParameter ( "n" , limit ) ; } com.google.gerrit.client.changes.ChangeList.addOptions ( call , ListChangesOption.LABELS ) ; if ( ! ( PagedSingleListScreen.MIN_SORTKEY.equals ( sortkey ) ) ) { call.addParameter ( "P" , sortkey ) ; } call.get ( callback ) ; }

Target:
public static void prev ( java.lang.String query , int limit , java.lang.String sortkey , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.ChangeList > callback ) { com.google.gerrit.client.rpc.RestApi call = com.google.gerrit.client.changes.ChangeList.newQuery ( query ) ; if ( limit > 0 ) { call.addParameter ( "n" , limit ) ; } com.google.gerrit.client.changes.ChangeList.addOptions ( call , java.util.EnumSet.of ( ListChangesOption.LABELS ) ) ; if ( ! ( PagedSingleListScreen.MIN_SORTKEY.equals ( sortkey ) ) ) { call.addParameter ( "P" , sortkey ) ; } call.get ( callback ) ; }
Source:
public int compare ( final com.google.gerrit.reviewdb.client.PatchSetApproval a , final com.google.gerrit.reviewdb.client.PatchSetApproval b ) { return a.getGranted ( ) . compareTo ( b.getGranted ( ) ) ; }

Target:
private java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > safeGetApprovals ( com.google.gerrit.server.git.CodeReviewCommit n ) { try { return approvalsUtil.byPatchSet ( db.get ( ) , n.getControl ( ) , n.getPatchsetId ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.git.MergeUtil.log.error ( ( "Can't read approval records for " + ( n.getPatchsetId ( ) ) ) , e ) ; return java.util.Collections.emptyList ( ) ; } }
Source:
public com.google.gerrit.extensions.common.ChangeInfo apply ( com.google.gerrit.server.change.ChangeResource req , final com.google.gerrit.extensions.api.changes.AbandonInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; com.google.gerrit.server.IdentifiedUser caller = control.getUser ( ) . asIdentifiedUser ( ) ; if ( ! ( control.canAbandon ( ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "abandon not permitted" ) ; } com.google.gerrit.reviewdb.client.Change change = abandon ( control , input.message , caller.getAccount ( ) ) ; return json.create ( ChangeJson.NO_OPTIONS ) . format ( change ) ; }

Target:
public com.google.gerrit.extensions.common.ChangeInfo apply ( com.google.gerrit.server.change.ChangeResource req , final com.google.gerrit.extensions.api.changes.AbandonInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; com.google.gerrit.server.IdentifiedUser caller = control.getUser ( ) . asIdentifiedUser ( ) ; if ( ! ( control.canAbandon ( dbProvider.get ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "abandon not permitted" ) ; } com.google.gerrit.reviewdb.client.Change change = abandon ( control , input.message , caller.getAccount ( ) ) ; return json.create ( ChangeJson.NO_OPTIONS ) . format ( change ) ; }
Source:
private void assertCreateFails ( java.lang.Class < ? extends com.google.gerrit.extensions.restapi.RestApiException > errType ) throws java.lang.Exception { exception.expect ( errType ) ; branch ( ) . create ( new com.google.gerrit.extensions.api.projects.BranchInput ( ) ) ; }

Target:
private void assertCreateFails ( java.lang.Class < ? extends com.google.gerrit.extensions.restapi.RestApiException > errType , java.lang.String errMsg ) throws java.lang.Exception { exception.expect ( errType ) ; if ( errMsg != null ) { exception.expectMessage ( errMsg ) ; } branch ( ) . create ( new com.google.gerrit.extensions.api.projects.BranchInput ( ) ) ; }
Source:
protected com.google.gerrit.client.reviewdb.Project getProject ( ) { final com.google.gerrit.server.project.ProjectState r ; r = projectCache.get ( change.getDest ( ) . getParentKey ( ) ) ; return r != null ? r.getProject ( ) : null ; }

Target:
private boolean isVisibleTo ( final com.google.gerrit.client.reviewdb.Account.Id to ) { return ( ( ( projectState ) == null ) || ( ( change ) == null ) ) || ( projectState.controlFor ( identifiedUserFactory.create ( to ) ) . controlFor ( change ) . isVisible ( ) ) ; }
Source:
public java.util.List < com.google.gerrit.server.account.GetSshKeys.SshKeyInfo > apply ( com.google.gerrit.server.IdentifiedUser user ) throws com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.server.account.GetSshKeys.SshKeyInfo > sshKeys = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.reviewdb.client.AccountSshKey sshKey : dbProvider.get ( ) . accountSshKeys ( ) . byAccount ( user.getAccountId ( ) ) . toList ( ) ) { sshKeys.add ( new com.google.gerrit.server.account.GetSshKeys.SshKeyInfo ( sshKey ) ) ; } return sshKeys ; }

Target:
public java.util.List < com.google.gerrit.extensions.common.SshKeyInfo > apply ( com.google.gerrit.server.IdentifiedUser user ) throws com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.extensions.common.SshKeyInfo > sshKeys = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.reviewdb.client.AccountSshKey sshKey : dbProvider.get ( ) . accountSshKeys ( ) . byAccount ( user.getAccountId ( ) ) . toList ( ) ) { sshKeys.add ( com.google.gerrit.server.account.GetSshKeys.newSshKeyInfo ( sshKey ) ) ; } return sshKeys ; }
Source:
public void addReviewers ( com.google.gerrit.reviewdb.client.Change change , java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > reviewers ) throws com.vmware.gerrit.owners.common.ReviewerManagerException { try { com.google.gerrit.extensions.api.changes.ChangeApi cApi = gApi.changes ( ) . id ( change.getId ( ) . get ( ) ) ; for ( com.google.gerrit.reviewdb.client.Account.Id account : reviewers ) { cApi.addReviewer ( account.toString ( ) ) ; } } catch ( com.google.gerrit.extensions.restapi.RestApiException e ) { com.vmware.gerrit.owners.common.ReviewerManager.log.error ( "Couldn't add reviewers to the change" , e ) ; throw new com.vmware.gerrit.owners.common.ReviewerManagerException ( e ) ; } }

Target:
public void addReviewers ( com.google.gerrit.reviewdb.client.Change change , java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > reviewers ) throws com.vmware.gerrit.owners.common.ReviewerManagerException { try ( com.google.gerrit.server.util.ManualRequestContext ctx = requestContext.openAs ( change.getOwner ( ) ) ) { com.google.gerrit.extensions.api.changes.ChangeApi cApi = gApi.changes ( ) . id ( change.getId ( ) . get ( ) ) ; for ( com.google.gerrit.reviewdb.client.Account.Id account : reviewers ) { cApi.addReviewer ( account.toString ( ) ) ; } } catch ( com.google.gerrit.extensions.restapi.RestApiException | com.google.gwtorm.server.OrmException e ) { com.vmware.gerrit.owners.common.ReviewerManager.log.error ( "Couldn't add reviewers to the change" , e ) ; throw new com.vmware.gerrit.owners.common.ReviewerManagerException ( e ) ; } }
Source:
protected void preDisplay ( java.lang.Void result ) { initEditor ( content ) ; renderLinks ( editFileInfo , diffLinks ) ; editFileInfo = null ; diffLinks = null ; }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.HttpResponse < com.google.gerrit.client.rpc.NativeString > fc ) { content = fc ; if ( ( revision.get ( ) ) > 0 ) { baseContent = fc ; } if ( prefs.syntaxHighlighting ( ) ) { injectMode ( fc.getContentType ( ) , modeCallback ) ; } else { modeCallback.onSuccess ( null ) ; } }
Source:
private com.google.gerrit.acceptance.TestAccount user ( java.lang.String name , com.google.gerrit.reviewdb.client.AccountGroup ... groups ) throws java.lang.Exception { name = name ( name ) ; java.lang.String [ ] groupNames = com.google.common.collect.FluentIterable.from ( java.util.Arrays.asList ( groups ) ) . transform ( new com.google.common.base.Function < com.google.gerrit.reviewdb.client.AccountGroup , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( com.google.gerrit.reviewdb.client.AccountGroup in ) { return in.getName ( ) ; } } ) . toArray ( java.lang.String.class ) ; return accounts.create ( name , ( name + "@example.com" ) , name , groupNames ) ; }

Target:
private com.google.gerrit.acceptance.TestAccount user ( java.lang.String name , java.lang.String fullName , com.google.gerrit.reviewdb.client.AccountGroup ... groups ) throws java.lang.Exception { name = name ( name ) ; java.lang.String [ ] groupNames = com.google.common.collect.FluentIterable.from ( java.util.Arrays.asList ( groups ) ) . transform ( new com.google.common.base.Function < com.google.gerrit.reviewdb.client.AccountGroup , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( com.google.gerrit.reviewdb.client.AccountGroup in ) { return in.getName ( ) ; } } ) . toArray ( java.lang.String.class ) ; return accounts.create ( name , ( name + "@example.com" ) , fullName , groupNames ) ; }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.Account > load ( java.lang.Boolean key ) throws java.lang.Exception { return com.google.common.collect.ImmutableList.copyOf ( com.google.common.collect.Iterables.filter ( dbProvider.get ( ) . accounts ( ) . all ( ) , new com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.Account > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.reviewdb.client.Account in ) { return in.isActive ( ) ; } } ) ) ; }

Target:
public org.apache.lucene.search.IndexSearcher load ( java.lang.Boolean key ) throws java.lang.Exception { return index ( ) ; }
Source:
public static com.google.gerrit.extensions.client.EditPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.EditPreferencesInfo i = new com.google.gerrit.extensions.client.EditPreferencesInfo ( ) ; i.tabSize = 8 ; i.lineLength = 100 ; i.indentUnit = 2 ; i.cursorBlinkRate = 0 ; i.hideTopMenu = false ; i.showTabs = true ; i.showWhitespaceErrors = false ; i.syntaxHighlighting = true ; i.hideLineNumbers = false ; i.matchBrackets = true ; i.lineWrapping = false ; i.autoCloseBrackets = false ; i.showBase = false ; i.theme = Theme.DEFAULT ; i.keyMapType = KeyMapType.DEFAULT ; return i ; }

Target:
public static com.google.gerrit.extensions.client.EditPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.EditPreferencesInfo i = new com.google.gerrit.extensions.client.EditPreferencesInfo ( ) ; i.tabSize = 8 ; i.lineLength = 100 ; i.indentUnit = 2 ; i.cursorBlinkRate = 0 ; i.hideTopMenu = false ; i.showTabs = true ; i.showWhitespaceErrors = false ; i.syntaxHighlighting = true ; i.hideLineNumbers = false ; i.matchBrackets = true ; i.lineWrapping = false ; i.indentWithTabs = false ; i.autoCloseBrackets = false ; i.showBase = false ; i.theme = Theme.DEFAULT ; i.keyMapType = KeyMapType.DEFAULT ; return i ; }
Source:
public void logEventListenerError ( org.slf4j.Logger log , java.lang.Exception error ) { if ( log.isDebugEnabled ( ) ) { log.debug ( "Error in event listener" , error ) ; } else { log.warn ( "Error in event listener: {}" , error.getMessage ( ) ) ; } }

Target:
public void logEventListenerError ( java.lang.Object event , java.lang.Object listener , java.lang.Exception error ) { if ( com.google.gerrit.server.extensions.events.EventUtil.log.isDebugEnabled ( ) ) { com.google.gerrit.server.extensions.events.EventUtil.log.debug ( java.lang.String.format ( "Error in event listener %s for event %s" , listener.getClass ( ) . getName ( ) , event.getClass ( ) . getName ( ) ) , error ) ; } else { com.google.gerrit.server.extensions.events.EventUtil.log.warn ( "Error in listener for event {}: {}" , listener.getClass ( ) . getName ( ) , event.getClass ( ) . getName ( ) , error.getMessage ( ) ) ; } }
Source:
public void index ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change change ) throws java.io.IOException { index ( changeDataFactory.create ( db , change ) ) ; }

Target:
public void index ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change change ) throws com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.server.query.change.ChangeData cd ; if ( notesMigration.readChanges ( ) ) { cd = changeDataFactory.create ( db , change ) ; } else if ( notesMigration.writeChanges ( ) ) { com.google.gerrit.server.notedb.ChangeNotes notes = changeNotesFactory.createWithAutoRebuildingDisabled ( change , null ) ; cd = changeDataFactory.create ( db , notes ) ; } else { cd = changeDataFactory.create ( db , change ) ; } index ( cd ) ; }
Source:
public void addMembers ( java.lang.String ... members ) throws com.google.gerrit.extensions.restapi.RestApiException { try { addMembers.apply ( rsrc , AddMembers.Input.fromMembers ( java.util.Arrays.asList ( members ) ) ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot add group members" , e ) ; } }

Target:
public void addMembers ( java.lang.String ... members ) throws com.google.gerrit.extensions.restapi.RestApiException { try { addMembers.apply ( rsrc , AddMembers.Input.fromMembers ( java.util.Arrays.asList ( members ) ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot add group members" , e ) ; } }
Source:
private void deleteGitRepository ( final com.google.gerrit.reviewdb.client.Project.NameKey project , final java.io.File repoFile ) throws java.io.IOException { java.nio.file.Path trash = moveToTrash ( repoFile.toPath ( ) , project ) ; try { recursiveDelete ( trash ) ; } catch ( java.io.IOException e ) { com.googlesource.gerrit.plugins.deleteproject.fs.FilesystemDeleteHandler.log.warn ( ( "Error trying to delete " + trash ) , e ) ; } HEAD ( 0 ) ; com.googlesource.gerrit.plugins.deleteproject.fs.ad Close ; com.googlesource.gerrit.plugins.deleteproject.fs.repo using = ( - ( with ) ) - ( resource ) ; recursiveDeleteParent ( repoParentFile , gitDir.toFile ( ) ) ; }

Target:
public java.lang.String getProjectName ( ) { return project.get ( ) ; }
Source:
public static boolean matches ( java.lang.String refName , java.lang.String refPattern ) { if ( refPattern.endsWith ( "/*" ) ) { java.lang.String prefix = refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ; return refName.startsWith ( prefix ) ; } else { return refName.equals ( refPattern ) ; } }

Target:
public static boolean matches ( java.lang.String refName , java.lang.String refPattern ) { if ( refPattern.startsWith ( RefRight.REGEX_PREFIX ) ) { return java.util.regex.Pattern.matches ( refPattern , refName ) ; } if ( refPattern.endsWith ( "/*" ) ) { java.lang.String prefix = refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ; return refName.startsWith ( prefix ) ; } else { return refName.equals ( refPattern ) ; } }
Source:
public void want ( final com.google.gerrit.reviewdb.Account.Id id ) { if ( ( id != null ) && ( ! ( out.containsKey ( id ) ) ) ) { out.put ( id , accountCache.get ( id ) . getAccount ( ) ) ; } }

Target:
public com.google.gerrit.reviewdb.Account get ( final com.google.gerrit.reviewdb.Account.Id id ) { if ( ! ( out.containsKey ( id ) ) ) { wants.add ( id ) ; fetchWants ( ) ; } return out.get ( id ) ; }
Source:
public int compare ( com.google.gerrit.reviewdb.client.ChangeMessage a , com.google.gerrit.reviewdb.client.ChangeMessage b ) { return b.getWrittenOn ( ) . compareTo ( a.getWrittenOn ( ) ) ; }

Target:
private boolean isChangeReviewed ( com.google.gerrit.reviewdb.client.Account.Id self , com.google.gerrit.server.query.change.ChangeData cd , java.util.List < com.google.gerrit.reviewdb.client.ChangeMessage > msgs ) throws com.google.gwtorm.server.OrmException { msgs = ChangeNotes.MESSAGE_BY_TIME.sortedCopy ( msgs ) ; com.google.gerrit.reviewdb.client.Account.Id changeOwnerId = cd.change ( ) . getOwner ( ) ; for ( com.google.gerrit.reviewdb.client.ChangeMessage cm : msgs ) { if ( self.equals ( cm.getAuthor ( ) ) ) { return true ; } else if ( changeOwnerId.equals ( cm.getAuthor ( ) ) ) { return false ; } } return false ; }
Source:
public void testUpsertOneNotExisting ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; verifyIds ( insert , 1 ) ; }

Target:
public void testUpsertOneException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement update = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.upsert ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; }
Source:
private java.util.Optional < com.google.gerrit.common.data.GroupReference > getGroupReference ( org.eclipse.jgit.notes.NoteMap noteMap , com.google.gerrit.reviewdb.client.AccountGroup.NameKey groupName ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.ObjectId noteKey = com.google.gerrit.server.group.db.GroupNameNotes.getNoteKey ( groupName ) ; org.eclipse.jgit.lib.ObjectId blobId = noteMap.get ( noteKey ) ; if ( blobId == null ) { return java.util.Optional.empty ( ) ; } byte [ ] noteData = rw.getObjectReader ( ) . open ( blobId , org.eclipse.jgit.lib.Constants.OBJ_BLOB ) . getCachedBytes ( ) ; com.google.gerrit.common.data.GroupReference groupReference = com.google.gerrit.server.group.db.GroupNameNotes.getFromNoteData ( noteData ) ; return java.util.Optional.of ( groupReference ) ; }

Target:
private static void removeNote ( org.eclipse.jgit.notes.NoteMap noteMap , com.google.gerrit.reviewdb.client.AccountGroup.NameKey groupName , org.eclipse.jgit.lib.ObjectInserter inserter ) throws java.io.IOException { org.eclipse.jgit.lib.ObjectId noteKey = com.google.gerrit.server.group.db.GroupNameNotes.getNoteKey ( groupName ) ; noteMap.set ( noteKey , null , inserter ) ; }
Source:
private java.util.Set < java.lang.String > getAllGroups ( com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gwtorm.server.OrmException { java.util.Set < java.lang.String > result = new java.util.HashSet < > ( ) ; for ( com.google.gerrit.reviewdb.client.PatchSet ps : db.get ( ) . patchSets ( ) . byChange ( changeId ) ) { java.util.List < java.lang.String > groups = ps.getGroups ( ) ; if ( groups != null ) { result.addAll ( groups ) ; } } return result ; }

Target:
private java.util.Set < java.lang.String > getAllGroups ( com.google.gerrit.server.notedb.ChangeNotes notes ) throws com.google.gwtorm.server.OrmException { java.util.Set < java.lang.String > result = new java.util.HashSet < > ( ) ; for ( com.google.gerrit.reviewdb.client.PatchSet ps : psUtil.byChange ( db.get ( ) , notes ) ) { java.util.List < java.lang.String > groups = ps.getGroups ( ) ; if ( groups != null ) { result.addAll ( groups ) ; } } return result ; }
Source:
public static void suggest ( java.lang.String prefix , int limit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.ProjectMap > cb ) { new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . addParameter ( "p" , prefix ) . addParameter ( "n" , limit ) . addParameterRaw ( "type" , "ALL" ) . addParameterTrue ( "d" ) . get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( cb ) ) ; }

Target:
public static void suggest ( java.lang.String prefix , int limit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.ProjectMap > cb ) { new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . addParameter ( "p" , prefix ) . addParameter ( "n" , limit ) . addParameterRaw ( "type" , "ALL" ) . addParameterTrue ( "d" ) . background ( ) . get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( cb ) ) ; }
Source:
public void onSuccess ( java.util.List < com.google.gerrit.reviewdb.Project > result ) { if ( ( result != null ) && ( ! ( result.isEmpty ( ) ) ) ) { suggestedParentsTab.setVisible ( true ) ; suggestedParentsTab.display ( result ) ; suggestedParentsTab.finishDisplay ( ) ; } }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { int top = ( grid.getAbsoluteTop ( ) ) - 50 ; int left = 5 + ( java.lang.Math.max ( ( ( grid.getAbsoluteLeft ( ) ) + ( grid.getOffsetWidth ( ) ) ) , ( ( suggestedParentsTab.getAbsoluteLeft ( ) ) + ( suggestedParentsTab.getOffsetWidth ( ) ) ) ) ) ; projectsPopup.setPreferredCoordinates ( top , left ) ; projectsPopup.displayPopup ( ) ; }
Source:
private static void setBooleanConfigKey ( org.eclipse.jgit.lib.Config rc , java.lang.String name , java.lang.String key , boolean value , boolean defaultValue ) { if ( value == defaultValue ) { rc.unset ( com.google.gerrit.server.git.ProjectConfig.LABEL , name , key ) ; } else { rc.setBoolean ( com.google.gerrit.server.git.ProjectConfig.LABEL , name , key , value ) ; } }

Target:
private static void setBooleanConfigKey ( org.eclipse.jgit.lib.Config rc , java.lang.String section , java.lang.String name , java.lang.String key , boolean value , boolean defaultValue ) { if ( value == defaultValue ) { rc.unset ( section , name , key ) ; } else { rc.setBoolean ( section , name , key , value ) ; } }
Source:
public java.lang.String toString ( ) { if ( ( retryCount ) == 0 ) { return "push " + ( uri ) ; } return ( ( ( "(retry " + ( retryCount ) ) + ") " ) + "push " ) + ( uri ) ; }

Target:
public java.lang.String toString ( ) { java.lang.String print = ( ( "[" + ( com.google.gerrit.server.util.IdGenerator.format ( id ) ) ) + "] push " ) + ( uri ) ; if ( ( retryCount ) > 0 ) { print = ( ( "(retry " + ( retryCount ) ) + ") " ) + print ; } return print ; }
Source:
public static com.google.gerrit.client.account.AccountInfo asInfo ( com.google.gerrit.reviewdb.client.Account acct ) { if ( acct == null ) { return com.google.gerrit.client.account.AccountInfo.create ( 0 , null , null ) ; } return com.google.gerrit.client.account.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) ) ; }

Target:
public static com.google.gerrit.client.account.AccountInfo asInfo ( com.google.gerrit.reviewdb.client.Account acct ) { if ( acct == null ) { return com.google.gerrit.client.account.AccountInfo.create ( 0 , null , null , null ) ; } return com.google.gerrit.client.account.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) , acct.getUserName ( ) ) ; }
Source:
public void setUp ( ) throws java.io.IOException { org.mockito.Mockito.when ( cfgFactoryMock.getGlobalPluginConfig ( pluginName ) ) . thenReturn ( configMock ) ; org.mockito.Mockito.when ( configMock.getString ( com.ericsson.gerrit.plugins.highavailability.Configuration.MAIN_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.SHARED_DIRECTORY_KEY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SHARED_DIRECTORY ) ; site = new com.google.gerrit.server.config.SitePaths ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SITE_PATH ) ; }

Target:
public void setUp ( ) throws java.io.IOException { org.mockito.Mockito.when ( cfgFactoryMock.getGlobalPluginConfig ( pluginName ) ) . thenReturn ( configMock ) ; org.mockito.Mockito.when ( configMock.getString ( com.ericsson.gerrit.plugins.highavailability.Configuration.MAIN_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.SHARED_DIRECTORY_KEY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SHARED_DIRECTORY ) ; org.mockito.Mockito.when ( configMock.getEnum ( com.ericsson.gerrit.plugins.highavailability.Configuration.PEER_INFO_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.STRATEGY_KEY , com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_PEER_INFO_STRATEGY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_PEER_INFO_STRATEGY ) ; site = new com.google.gerrit.server.config.SitePaths ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SITE_PATH ) ; }
Source:
private < T > org.elasticsearch.index.query.QueryBuilder notTimestamp ( com.google.gerrit.server.index.TimestampRangePredicate < T > r ) throws com.google.gerrit.index.query.QueryParseException { if ( ( r.getMinTimestamp ( ) . getTime ( ) ) == 0 ) { return org.elasticsearch.index.query.QueryBuilders.rangeQuery ( r.getField ( ) . getName ( ) ) . gt ( java.time.Instant.ofEpochMilli ( r.getMaxTimestamp ( ) . getTime ( ) ) ) ; } throw new com.google.gerrit.index.query.QueryParseException ( ( "cannot negate: " + r ) ) ; }

Target:
private < T > org.elasticsearch.index.query.QueryBuilder notTimestamp ( com.google.gerrit.index.query.TimestampRangePredicate < T > r ) throws com.google.gerrit.index.query.QueryParseException { if ( ( r.getMinTimestamp ( ) . getTime ( ) ) == 0 ) { return org.elasticsearch.index.query.QueryBuilders.rangeQuery ( r.getField ( ) . getName ( ) ) . gt ( java.time.Instant.ofEpochMilli ( r.getMaxTimestamp ( ) . getTime ( ) ) ) ; } throw new com.google.gerrit.index.query.QueryParseException ( ( "cannot negate: " + r ) ) ; }
Source:
public static com.google.gerrit.client.account.AccountInfo asInfo ( com.google.gerrit.client.account.AccountInfo acct ) { if ( acct == null ) { return com.google.gerrit.client.account.AccountInfo.create ( 0 , null , null , null ) ; } return com.google.gerrit.client.account.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) , acct.getUsername ( ) ) ; }

Target:
public static com.google.gerrit.client.info.AccountInfo asInfo ( com.google.gerrit.client.info.AccountInfo acct ) { if ( acct == null ) { return com.google.gerrit.client.info.AccountInfo.create ( 0 , null , null , null ) ; } return com.google.gerrit.client.info.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) , acct.getUsername ( ) ) ; }
Source:
public java.util.List < com.google.gerrit.server.query.Predicate < T > > parse ( java.util.List < java.lang.String > queries ) throws com.google.gerrit.index.query.QueryParseException { java.util.List < com.google.gerrit.server.query.Predicate < T > > predicates = new java.util.ArrayList < > ( queries.size ( ) ) ; for ( java.lang.String query : queries ) { predicates.add ( parse ( query ) ) ; } return predicates ; }

Target:
public java.util.List < com.google.gerrit.index.query.Predicate < T > > parse ( java.util.List < java.lang.String > queries ) throws com.google.gerrit.index.query.QueryParseException { java.util.List < com.google.gerrit.index.query.Predicate < T > > predicates = new java.util.ArrayList < > ( queries.size ( ) ) ; for ( java.lang.String query : queries ) { predicates.add ( parse ( query ) ) ; } return predicates ; }
Source:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > submitRecords ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( ( cd.getSubmitRecords ( ) ) != null ) { return cd.getSubmitRecords ( ) ; } cd.setSubmitRecords ( new com.google.gerrit.server.project.SubmitRuleEvaluator ( cd ) . setFastEvalLabels ( true ) . setAllowDraft ( true ) . evaluate ( ) ) ; return cd.getSubmitRecords ( ) ; }

Target:
public com.google.gerrit.extensions.common.RevisionInfo getRevisionInfo ( com.google.gerrit.server.project.ChangeControl ctl , com.google.gerrit.reviewdb.client.PatchSet in ) throws com.google.gerrit.server.GpgException , com.google.gerrit.server.patch.PatchListNotAvailableException , com.google.gwtorm.server.OrmException , java.io.IOException { accountLoader = accountLoaderFactory.create ( has ( com.google.gerrit.extensions.client.ListChangesOption.DETAILED_ACCOUNTS ) ) ; com.google.gerrit.extensions.common.RevisionInfo rev = toRevisionInfo ( ctl , in ) ; accountLoader.fill ( ) ; return rev ; }
Source:
public void parseNonVisibleCommitSha ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit other = repo.commit ( ) . create ( ) ; repo.branch ( "master" ) . commit ( ) . create ( ) ; org.junit.Assert.assertEquals ( null , parser.parse ( other.name ( ) ) ) ; repo.branch ( "other" ) . update ( other ) ; org.junit.Assert.assertEquals ( new com.google.gitiles.RevisionParser.Result ( com.google.gitiles.Revision.peeled ( other.name ( ) , other ) ) , parser.parse ( other.name ( ) ) ) ; }

Target:
public void parseNonVisibleCommitSha ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit other = repo.commit ( ) . create ( ) ; repo.branch ( "master" ) . commit ( ) . create ( ) ; org.junit.Assert.assertNull ( parser.parse ( other.name ( ) ) ) ; repo.branch ( "other" ) . update ( other ) ; org.junit.Assert.assertEquals ( new com.google.gitiles.RevisionParser.Result ( com.google.gitiles.Revision.peeled ( other.name ( ) , other ) ) , parser.parse ( other.name ( ) ) ) ; }
Source:
protected com.google.gerrit.common.data.ProjectAccess updateProjectConfig ( com.google.gerrit.server.git.ProjectConfig config , com.google.gerrit.server.git.MetaDataUpdate md ) throws com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { config.commit ( md ) ; projectCache.evict ( config.getProject ( ) ) ; return projectAccessFactory.create ( projectName ) . call ( ) ; }

Target:
protected com.google.gerrit.common.data.ProjectAccess updateProjectConfig ( com.google.gerrit.server.git.ProjectConfig config , com.google.gerrit.server.git.MetaDataUpdate md , boolean parentProjectUpdate ) throws com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { config.commit ( md ) ; projectCache.evict ( config.getProject ( ) ) ; return projectAccessFactory.create ( projectName ) . call ( ) ; }
Source:
private void savePatchSet ( com.google.gerrit.server.update.BatchUpdate.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException { if ( ! ( patchSet.isDraft ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( "Patch set is not a draft" ) ; } psUtil.publish ( ctx.getDb ( ) , ctx.getUpdate ( psId ) , patchSet ) ; }

Target:
private void savePatchSet ( com.google.gerrit.server.update.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException { if ( ! ( patchSet.isDraft ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( "Patch set is not a draft" ) ; } psUtil.publish ( ctx.getDb ( ) , ctx.getUpdate ( psId ) , patchSet ) ; }
Source:
private < T extends java.lang.Enum < ? > > T getListBox ( final com.google.gwt.user.client.ui.ListBox f , final T defaultValue , T [ ] all ) { final int idx = f.getSelectedIndex ( ) ; if ( 0 <= idx ) { java.lang.String v = f.getValue ( idx ) ; for ( T t : all ) { if ( t.name ( ) . equals ( v ) ) { return t ; } } } return defaultValue ; }

Target:
private < T extends java.lang.Enum < ? > > T getListBox ( final com.google.gwt.user.client.ui.ListBox f , final T defaultValue , T [ ] all ) { final int idx = f.getSelectedIndex ( ) ; if ( 0 <= idx ) { java.lang.String v = f.getValue ( idx ) ; if ( "" . equals ( v ) ) { return defaultValue ; } for ( T t : all ) { if ( t.name ( ) . equals ( v ) ) { return t ; } } } return defaultValue ; }
Source:
public void children ( ) { final com.google.gerrit.server.query.TestPredicate p = f ( "author" , "bob" ) ; final com.google.gerrit.server.query.Predicate < java.lang.String > n = com.google.gerrit.server.query.Predicate.not ( p ) ; org.junit.Assert.assertEquals ( 1 , n.getChildCount ( ) ) ; org.junit.Assert.assertSame ( p , n.getChild ( 0 ) ) ; }

Target:
public void children ( ) { final com.google.gerrit.index.query.TestPredicate p = f ( "author" , "bob" ) ; final com.google.gerrit.index.query.Predicate < java.lang.String > n = com.google.gerrit.index.query.Predicate.not ( p ) ; org.junit.Assert.assertEquals ( 1 , n.getChildCount ( ) ) ; org.junit.Assert.assertSame ( p , n.getChild ( 0 ) ) ; }
Source:
protected java.lang.String velocify ( java.lang.String tpl ) { try { java.io.StringWriter w = new java.io.StringWriter ( ) ; org.apache.velocity.app.Velocity.evaluate ( velocityContext , w , "OutgoingEmail" , tpl ) ; return w.toString ( ) ; } catch ( java.lang.Exception e ) { return tpl.toString ( ) ; } }

Target:
protected java.lang.String velocify ( java.lang.String tpl ) throws com.google.gerrit.server.mail.EmailException { try { java.io.StringWriter w = new java.io.StringWriter ( ) ; org.apache.velocity.app.Velocity.evaluate ( velocityContext , w , "OutgoingEmail" , tpl ) ; return w.toString ( ) ; } catch ( java.lang.Exception e ) { throw new com.google.gerrit.server.mail.EmailException ( ( "Velocity template " + ( tpl.toString ( ) ) ) , e ) ; } }
Source:
public void addReviewers ( com.google.gerrit.reviewdb.client.Change change , java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > reviewers ) throws com.vmware.gerrit.owners.common.ReviewerManagerException { try ( com.google.gerrit.server.util.ManualRequestContext ctx = requestContext.openAs ( change.getOwner ( ) ) ) { com.google.gerrit.extensions.api.changes.ChangeApi cApi = gApi.changes ( ) . id ( change.getId ( ) . get ( ) ) ; for ( com.google.gerrit.reviewdb.client.Account.Id account : reviewers ) { cApi.addReviewer ( account.toString ( ) ) ; } } catch ( com.google.gerrit.extensions.restapi.RestApiException | com.google.gwtorm.server.OrmException e ) { com.vmware.gerrit.owners.common.ReviewerManager.log.error ( "Couldn't add reviewers to the change" , e ) ; throw new com.vmware.gerrit.owners.common.ReviewerManagerException ( e ) ; } }

Target:
public void addReviewers ( com.google.gerrit.reviewdb.client.Change change , java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > reviewers ) throws com.vmware.gerrit.owners.common.ReviewerManagerException { try ( com.vmware.gerrit.owners.common.Gerrit214ManualRequestContext ctx = requestContext.openAs ( change.getOwner ( ) ) ) { com.google.gerrit.extensions.api.changes.ChangeApi cApi = gApi.changes ( ) . id ( change.getId ( ) . get ( ) ) ; for ( com.google.gerrit.reviewdb.client.Account.Id account : reviewers ) { cApi.addReviewer ( account.toString ( ) ) ; } } catch ( com.google.gerrit.extensions.restapi.RestApiException | com.google.gwtorm.server.OrmException e ) { com.vmware.gerrit.owners.common.ReviewerManager.log.error ( "Couldn't add reviewers to the change" , e ) ; throw new com.vmware.gerrit.owners.common.ReviewerManagerException ( e ) ; } }
Source:
public com.google.gerrit.extensions.common.AccountInfo apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddMembers.PutMember.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gerrit.extensions.restapi.UnprocessableEntityException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddMembers.Input in = new com.google.gerrit.server.group.AddMembers.Input ( ) ; in._oneMember = id ; java.util.List < com.google.gerrit.extensions.common.AccountInfo > list = put.apply ( resource , in ) ; if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } throw new java.lang.IllegalStateException ( ) ; }

Target:
public com.google.gerrit.extensions.common.AccountInfo apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddMembers.PutMember.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddMembers.Input in = new com.google.gerrit.server.group.AddMembers.Input ( ) ; in._oneMember = id ; try { java.util.List < com.google.gerrit.extensions.common.AccountInfo > list = put.apply ( resource , in ) ; if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } throw new java.lang.IllegalStateException ( ) ; } catch ( com.google.gerrit.extensions.restapi.UnprocessableEntityException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } }
Source:
public synchronized void stop ( ) { if ( ( acceptor ) != null ) { try { acceptor.close ( true ) . await ( ) ; com.google.gerrit.sshd.SshDaemon.log.info ( "Stopped Gerrit SSHD" ) ; } catch ( java.lang.InterruptedException e ) { com.google.gerrit.sshd.SshDaemon.log.warn ( "Exception caught while closing" , e ) ; } finally { acceptor = null ; } } }

Target:
public synchronized void stop ( ) { if ( ( acceptor ) != null ) { try { acceptor.dispose ( ) ; com.google.gerrit.sshd.SshDaemon.log.info ( "Stopped Gerrit SSHD" ) ; } finally { acceptor = null ; } } }
Source:
public Account.Id lookup ( final java.lang.String externalId ) throws com.google.gerrit.server.account.AccountException { try { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.reviewdb.AccountExternalId ext = db.accountExternalIds ( ) . get ( new com.google.gerrit.reviewdb.AccountExternalId.Key ( externalId ) ) ; return ext != null ? ext.getAccountId ( ) : null ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { throw new com.google.gerrit.server.account.AccountException ( ( "Cannot lookup account " + externalId ) , e ) ; } }

Target:
public Account.Id lookup ( final java.lang.String externalId ) throws com.google.gerrit.server.account.AccountException { try { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.reviewdb.AccountExternalId ext = accountExternalIdCache.get ( new com.google.gerrit.reviewdb.AccountExternalId.Key ( externalId ) ) ; return ext != null ? ext.getAccountId ( ) : null ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { throw new com.google.gerrit.server.account.AccountException ( ( "Cannot lookup account " + externalId ) , e ) ; } }