auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Change.Id > getChangesByProject ( ) throws com.google.gwtorm.server.OrmException { com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Change.Id > changesByProject = com.google.common.collect.ArrayListMultimap.create ( ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { for ( com.google.gerrit.reviewdb.client.Change c : com.google.gerrit.pgm.RebuildNoteDb.unwrap ( db ) . changes ( ) . all ( ) ) { changesByProject.put ( c.getProject ( ) , c.getId ( ) ) ; } return changesByProject ; } }

Target:
public Change.Id apply ( java.lang.Integer in ) { return new com.google.gerrit.reviewdb.client.Change.Id ( in ) ; }
Source:
private void review ( com.google.gerrit.acceptance.PushOneCommit.Result r , int score ) throws java.lang.Exception { revision ( r ) . review ( new com.google.gerrit.extensions.api.changes.ReviewInput ( ) . label ( "Code-Review" , score ) ) ; }

Target:
private void merge ( com.google.gerrit.acceptance.PushOneCommit.Result r ) throws java.lang.Exception { revision ( r ) . review ( com.google.gerrit.extensions.api.changes.ReviewInput.approve ( ) ) ; revision ( r ) . submit ( ) ; org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( project ) ; try { org.junit.Assert.assertEquals ( r.getCommitId ( ) , repo.getRef ( "refs/heads/master" ) . getObjectId ( ) ) ; } finally { repo.close ( ) ; } }
Source:
private com.google.inject.Injector getPluginInjector ( java.io.File jarFile ) throws java.io.IOException { final java.lang.String pluginName = com.google.common.base.Objects.firstNonNull ( com.google.gerrit.server.plugins.PluginLoader.getGerritPluginName ( jarFile ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( jarFile ) ) ; return initInjector.createChildInjector ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.PluginName.class ) . toInstance ( pluginName ) ; } } ) ; }

Target:
private com.google.inject.Injector getPluginInjector ( java.io.File jarFile ) throws java.io.IOException { final java.lang.String pluginName = com.google.common.base.Objects.firstNonNull ( com.google.gerrit.server.plugins.PluginLoader.getGerritJarPluginName ( jarFile ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( jarFile ) ) ; return initInjector.createChildInjector ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.google.gerrit.extensions.annotations.PluginName.class ) . toInstance ( pluginName ) ; } } ) ; }
Source:
public void visit ( org.pegdown.ast.HeaderNode node ) { java.lang.String tag = "h" + ( node.getLevel ( ) ) ; html.open ( tag ) ; java.lang.String id = toc.idFromHeader ( node ) ; if ( id != null ) { html.attribute ( "id" , id ) ; } visitChildren ( node ) ; html.close ( tag ) ; }

Target:
public void visit ( org.pegdown.ast.HeaderNode node ) { java.lang.String id = toc.idFromHeader ( node ) ; if ( id != null ) { html.open ( "a" ) . attribute ( "name" , id ) ; } try { outputNamedAnchor = false ; wrapChildren ( ( "h" + ( node.getLevel ( ) ) ) , node ) ; } finally { outputNamedAnchor = true ; } if ( id != null ) { html.close ( "a" ) ; } }
Source:
public int getCardinality ( ) { return ( source ) != null ? source.getCardinality ( ) : opts.limit ( ) ; }

Target:
public com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > restart ( int start ) throws com.google.gwtorm.server.OrmException { opts = opts.withStart ( start ) ; try { source = index.getSource ( pred , opts ) ; } catch ( com.google.gerrit.server.query.QueryParseException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } return read ( ) ; }
Source:
public static void toPreparedStatement ( final java.sql.PreparedStatement ps , final int col , final byte [ ] raw ) throws java.sql.SQLException { if ( raw != null ) { ps.setBinaryStream ( col , new java.io.ByteArrayInputStream ( raw ) , raw.length ) ; } else { ps.setNull ( col , java.sql.Types.LONGVARCHAR ) ; } }

Target:
public static void toPreparedStatement ( final java.sql.PreparedStatement ps , final int col , final byte [ ] raw ) throws java.sql.SQLException { if ( raw != null ) { ps.setBinaryStream ( col , new java.io.ByteArrayInputStream ( raw ) , raw.length ) ; } else { ps.setNull ( col , java.sql.Types.VARBINARY ) ; } }
Source:
public com.google.gerrit.reviewdb.client.AccountGroup get ( final com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ) { return byUUID.get ( uuid ) ; }

Target:
public com.google.gerrit.reviewdb.client.AccountGroup get ( com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid ) { if ( uuid == null ) { return null ; } try { return byUUID.get ( uuid.get ( ) ) . orNull ( ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.gerrit.server.account.GroupCacheImpl.log.warn ( java.lang.String.format ( "Cannot lookup group %s by name" , uuid.get ( ) ) , e ) ; return null ; } }
Source:
private void index ( com.google.gerrit.server.project.ProjectControl projectControl ) { try { index.apply ( new com.google.gerrit.server.project.ProjectResource ( projectControl.getProjectState ( ) , projectControl.getUser ( ) ) , null ) ; } catch ( java.lang.Exception e ) { writeError ( "error" , java.lang.String.format ( "Unable to index %s: %s" , projectControl.getProject ( ) . getName ( ) , e.getMessage ( ) ) ) ; } }

Target:
private void index ( com.google.gerrit.server.project.ProjectState projectState ) { try { index.apply ( new com.google.gerrit.server.project.ProjectResource ( projectState , user ) , null ) ; } catch ( java.lang.Exception e ) { writeError ( "error" , java.lang.String.format ( "Unable to index %s: %s" , projectState.getName ( ) , e.getMessage ( ) ) ) ; } }
Source:
private com.google.common.collect.SetMultimap < org.eclipse.jgit.lib.ObjectId , org.eclipse.jgit.lib.Ref > changeRefsById ( ) throws java.io.IOException { if ( ( refsById ) == null ) { refsById = com.google.common.collect.HashMultimap.create ( ) ; for ( org.eclipse.jgit.lib.Ref r : repo.getRefDatabase ( ) . getRefs ( "refs/changes/" ) . values ( ) ) { if ( com.google.gerrit.reviewdb.client.PatchSet.isRef ( r.getName ( ) ) ) { refsById.put ( r.getObjectId ( ) , r ) ; } } } return refsById ; }

Target:
private java.util.Map < org.eclipse.jgit.lib.ObjectId , org.eclipse.jgit.lib.Ref > changeRefsById ( ) throws java.io.IOException { if ( ( refsById ) == null ) { refsById = new java.util.HashMap < org.eclipse.jgit.lib.ObjectId , org.eclipse.jgit.lib.Ref > ( ) ; for ( org.eclipse.jgit.lib.Ref r : repo.getRefDatabase ( ) . getRefs ( "refs/changes/" ) . values ( ) ) { if ( com.google.gerrit.reviewdb.client.PatchSet.isRef ( r.getName ( ) ) ) { refsById.put ( r.getObjectId ( ) , r ) ; } } } return refsById ; }
Source:
public void listNoChildren ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = GET ( ( ( "/projects/" + ( allProjects.get ( ) ) ) + "/children/" ) ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_OK , r.getStatusCode ( ) ) ; java.util.List < com.google.gerrit.extensions.common.ProjectInfo > projectInfoList = com.google.gerrit.acceptance.rest.project.ListChildProjectsIT.toProjectInfoList ( r ) ; org.junit.Assert.assertTrue ( ( ( projectInfoList.size ( ) ) == 2 ) ) ; }

Target:
public void listNoChildren ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = GET ( ( ( "/projects/" + ( allProjects.get ( ) ) ) + "/children/" ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; java.util.List < com.google.gerrit.extensions.common.ProjectInfo > projectInfoList = com.google.gerrit.acceptance.rest.project.ListChildProjectsIT.toProjectInfoList ( r ) ; com.google.common.truth.Truth.assertThat ( projectInfoList ) . hasSize ( 2 ) ; }
Source:
public void upsertComment ( com.google.gerrit.reviewdb.client.PatchLineComment comment ) throws com.google.gwtorm.server.OrmException { if ( ( comment.getStatus ( ) ) == ( PatchLineComment.Status.DRAFT ) ) { upsertDraftComment ( comment ) ; } else { deleteDraftCommentIfPresent ( comment ) ; upsertPublishedComment ( comment ) ; } }

Target:
public void deleteComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { verifyComment ( c ) ; if ( ( c.getStatus ( ) ) == ( PatchLineComment.Status.DRAFT ) ) { createDraftUpdateIfNull ( ) . deleteComment ( c ) ; } else { throw new java.lang.IllegalArgumentException ( ( "Cannot delete published comment " + c ) ) ; } }
Source:
public void multipleUpdatesInBatchWithSameObject ( ) throws java.lang.Exception { com.google.gerrit.server.git.VersionedMetaDataTest.MyMetaData d = load ( 0 ) ; d.setIncrement ( 1 ) ; try ( com.google.gerrit.server.git.VersionedMetaData.BatchMetaDataUpdate batch = d.openUpdate ( newMetaDataUpdate ( ) ) ) { batch.write ( d , newMetaDataUpdate ( ) . getCommitBuilder ( ) ) ; assertMyMetaData ( 0 ) ; d.setIncrement ( 2 ) ; batch.write ( d , newMetaDataUpdate ( ) . getCommitBuilder ( ) ) ; batch.commit ( ) ; } assertMyMetaData ( 3 , "Increment conf.value by 1" , "Increment conf.value by 2" ) ; }

Target:
public void multipleUpdatesInBatchWithSameObject ( ) throws java.lang.Exception { com.google.gerrit.server.git.VersionedMetaDataTest.MyMetaData d = load ( 0 ) ; d.setIncrement ( 1 ) ; try ( com.google.gerrit.server.git.VersionedMetaData.BatchMetaDataUpdate batch = d.openUpdate ( newMetaDataUpdate ( ) ) ) { batch.write ( d , newCommitBuilder ( ) ) ; assertMyMetaData ( 0 ) ; d.setIncrement ( 2 ) ; batch.write ( d , newCommitBuilder ( ) ) ; batch.commit ( ) ; } assertMyMetaData ( 3 , "Increment conf.value by 1" , "Increment conf.value by 2" ) ; }
Source:
private com.google.gerrit.reviewdb.AccountGroup lookup ( final com.google.gerrit.reviewdb.AccountGroup.NameKey groupName ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { return db.accountGroups ( ) . get ( groupName ) ; } finally { db.close ( ) ; } }

Target:
private com.google.gerrit.reviewdb.AccountGroup lookup ( final com.google.gerrit.reviewdb.AccountGroup.NameKey name ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.reviewdb.AccountGroupName r ; final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { r = db.accountGroupNames ( ) . get ( name ) ; } finally { db.close ( ) ; } return r != null ? get ( r.getId ( ) ) : null ; }
Source:
private com.google.inject.Injector createSshInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; modules.add ( sysInjector.getInstance ( com.google.gerrit.sshd.SshModule.class ) ) ; modules.add ( new com.google.gerrit.sshd.commands.MasterCommandModule ( ) ) ; return sysInjector.createChildInjector ( modules ) ; }

Target:
private com.google.inject.Injector createSshInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; modules.add ( sysInjector.getInstance ( com.google.gerrit.sshd.SshModule.class ) ) ; modules.add ( new com.google.gerrit.sshd.SshHostKeyModule ( ) ) ; modules.add ( new com.google.gerrit.sshd.commands.MasterCommandModule ( ) ) ; return sysInjector.createChildInjector ( modules ) ; }
Source:
private boolean isVisibleTo ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.server.CurrentUser user , com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ProjectState pe = projectCache.get ( change.getProject ( ) ) ; if ( pe == null ) { return false ; } com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; return pc.controlFor ( change ) . isVisible ( db ) ; }

Target:
public void doClaSignupHook ( com.google.gerrit.reviewdb.client.Account account , java.lang.String claName ) { if ( ! ( claSignedHook.isPresent ( ) ) ) { return ; } if ( account != null ) { java.util.List < java.lang.String > args = new java.util.ArrayList < > ( ) ; addArg ( args , "--submitter" , getDisplayName ( account ) ) ; addArg ( args , "--user-id" , account.getId ( ) . toString ( ) ) ; addArg ( args , "--cla-name" , claName ) ; runHook ( claSignedHook , args ) ; } }
Source:
protected void preInvoke ( final com.google.gerrit.server.GerritCall call ) { super . preInvoke ( call ) ; if ( call.isComplete ( ) ) { return ; } if ( ( call.getMethod ( ) . getAnnotation ( com.google.gerrit.client.rpc.SignInRequired.class ) ) != null ) { if ( ! ( call.requireXsrfValid ( ) ) ) { return ; } if ( ( call.getAccountId ( ) ) == null ) { call.onFailure ( new com.google.gerrit.client.rpc.NotSignedInException ( ) ) ; return ; } } }

Target:
protected void preInvoke ( final com.google.gerrit.server.http.GerritCall call ) { super . preInvoke ( call ) ; if ( call.isComplete ( ) ) { return ; } if ( ( call.getMethod ( ) . getAnnotation ( com.google.gerrit.client.rpc.SignInRequired.class ) ) != null ) { if ( ! ( call.requireXsrfValid ( ) ) ) { return ; } if ( ( call.getAccountId ( ) ) == null ) { call.onFailure ( new com.google.gerrit.client.rpc.NotSignedInException ( ) ) ; return ; } } }
Source:
public com.google.gerrit.extensions.restapi.BinaryResult file ( java.lang.String path ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.project.FileResource resource = filesCollection.parse ( resource ( ) , com.google.gerrit.extensions.restapi.IdString.fromDecoded ( path ) ) ; return getContent.apply ( resource ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot retrieve file" , e ) ; } }

Target:
public com.google.gerrit.extensions.restapi.BinaryResult file ( java.lang.String path ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.project.FileResource resource = filesCollection.parse ( resource ( ) , com.google.gerrit.extensions.restapi.IdString.fromDecoded ( path ) ) ; return getContent.apply ( resource ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot retrieve file" , e ) ; } }
Source:
public static java.lang.String shortestExample ( java.lang.String refPattern ) { if ( com.google.gerrit.server.project.RefPattern.isRE ( refPattern ) ) { return com.google.gerrit.server.project.RefPattern.toRegExp ( refPattern ) . toAutomaton ( ) . getShortestExample ( true ) . replace ( '' , '-' ) ; } else if ( refPattern.endsWith ( "/*" ) ) { return ( refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return refPattern ; } }

Target:
static java.lang.String example ( java.lang.String refPattern ) { return com.google.gerrit.server.project.RefPattern.toRegExp ( refPattern ) . toAutomaton ( ) . getShortestExample ( true ) . replace ( '' , '-' ) ; }
Source:
public void testParseRef ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit master = repo.branch ( "refs/heads/master" ) . commit ( ) . create ( ) ; assertEquals ( new com.google.gitiles.RevisionParser.Result ( com.google.gitiles.Revision.peeled ( "master" , master ) ) , parser.parse ( "master" ) ) ; assertEquals ( new com.google.gitiles.RevisionParser.Result ( com.google.gitiles.Revision.peeled ( "refs/heads/master" , master ) ) , parser.parse ( "refs/heads/master" ) ) ; assertNull ( parser.parse ( "refs//heads//master" ) ) ; assertNull ( parser.parse ( "refs heads master" ) ) ; }

Target:
public void parseRef ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit master = repo.branch ( "refs/heads/master" ) . commit ( ) . create ( ) ; org.junit.Assert.assertEquals ( new com.google.gitiles.RevisionParser.Result ( com.google.gitiles.Revision.peeled ( "master" , master ) ) , parser.parse ( "master" ) ) ; org.junit.Assert.assertEquals ( new com.google.gitiles.RevisionParser.Result ( com.google.gitiles.Revision.peeled ( "refs/heads/master" , master ) ) , parser.parse ( "refs/heads/master" ) ) ; org.junit.Assert.assertNull ( parser.parse ( "refs//heads//master" ) ) ; org.junit.Assert.assertNull ( parser.parse ( "refs heads master" ) ) ; }
Source:
private void cancel ( ) { label.setVisible ( true ) ; edit.setVisible ( true ) ; input.setVisible ( false ) ; input.setValue ( label.getText ( ) ) ; save.setVisible ( false ) ; save.setEnabled ( false ) ; cancel.setVisible ( false ) ; }

Target:
private void cancel ( ) { label.setVisible ( true ) ; edit.setVisible ( true ) ; input.setVisible ( false ) ; input.setValue ( label.getText ( ) ) ; save.setVisible ( false ) ; save.setEnabled ( false ) ; if ( ( warning ) != null ) { warning.setVisible ( false ) ; } cancel.setVisible ( false ) ; }
Source:
public java.lang.String getProjectName ( ) { return p.get ( ) ; }

Target:
private void fire ( final com.google.gerrit.reviewdb.client.Project.NameKey p , final java.util.Properties statistics ) { if ( ! ( listeners.iterator ( ) . hasNext ( ) ) ) { return ; } com.google.gerrit.server.git.GarbageCollection.Event event = new com.google.gerrit.server.git.GarbageCollection.Event ( p , statistics ) ; for ( com.google.gerrit.extensions.events.GarbageCollectorListener l : listeners ) { try { l.onGarbageCollected ( event ) ; } catch ( java.lang.RuntimeException e ) { com.google.gerrit.server.git.GarbageCollection.log.warn ( "Failure in GarbageCollectorListener" , e ) ; } } }
Source:
net.sf.ehcache.Element get ( final java.lang.String token ) { if ( ( token != null ) && ( ! ( "" . equals ( token ) ) ) ) { try { return self.get ( new com.google.gerrit.server.http.WebSessionManager.Key ( token ) ) ; } catch ( java.lang.IllegalStateException e ) { return null ; } catch ( net.sf.ehcache.CacheException e ) { return null ; } } else { return null ; } }

Target:
com.google.gerrit.server.http.WebSessionManager.Val createVal ( final com.google.gerrit.server.http.WebSessionManager.Key key , final com.google.gerrit.client.reviewdb.Account.Id who ) { final com.google.gerrit.server.http.WebSessionManager.Val val = new com.google.gerrit.server.http.WebSessionManager.Val ( who ) ; self.put ( key , val ) ; return val ; }
Source:
protected java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > getAdvertisedRefs ( org.eclipse.jgit.lib.Repository repository , org.eclipse.jgit.revwalk.RevWalk revWalk ) { return filter ( repository.getAllRefs ( ) ) ; }

Target:
protected java.util.Map < java.lang.String , org.eclipse.jgit.lib.Ref > getAdvertisedRefs ( org.eclipse.jgit.lib.Repository repository , org.eclipse.jgit.revwalk.RevWalk revWalk ) throws org.eclipse.jgit.transport.ServiceMayNotContinueException { try { return filter ( repository.getRefDatabase ( ) . getRefs ( RefDatabase.ALL ) ) ; } catch ( java.io.IOException e ) { org.eclipse.jgit.transport.ServiceMayNotContinueException ex = new org.eclipse.jgit.transport.ServiceMayNotContinueException ( e.getMessage ( ) ) ; ex.initCause ( e ) ; throw ex ; } }
Source:
private java.lang.String getCommand ( java.lang.String command , com.google.gitiles.RevisionParser.Result result , java.lang.String path ) { if ( ! ( com.google.gitiles.ViewFilter.CMD_AUTO.equals ( command ) ) ) { return command ; } else if ( ( result.getOldRevision ( ) ) != null ) { return com.google.gitiles.ViewFilter.CMD_DIFF ; } else { return com.google.gitiles.ViewFilter.CMD_SHOW ; } }

Target:
private GitilesView.Builder parseDiffCommand ( java.lang.String repoName , com.google.gitiles.RevisionParser.Result result , java.lang.String path ) { return com.google.gitiles.GitilesView.diff ( ) . setRepositoryName ( repoName ) . setRevision ( result.getRevision ( ) ) . setOldRevision ( result.getOldRevision ( ) ) . setPathPart ( path.substring ( result.getPathStart ( ) ) ) ; }
Source:
protected void configure ( ) { factory ( AgreementInfoFactory.Factory.class ) ; factory ( CreateGroup.Factory.class ) ; factory ( DeleteExternalIds.Factory.class ) ; factory ( ExternalIdDetailFactory.Factory.class ) ; factory ( GroupDetailFactory.Factory.class ) ; factory ( MyGroupsFactory.Factory.class ) ; factory ( RenameGroup.Factory.class ) ; }

Target:
protected void configure ( ) { factory ( AgreementInfoFactory.Factory.class ) ; factory ( CreateGroup.Factory.class ) ; factory ( DeleteExternalIds.Factory.class ) ; factory ( ExternalIdDetailFactory.Factory.class ) ; factory ( GroupDetailHandler.Factory.class ) ; factory ( MyGroupsFactory.Factory.class ) ; factory ( RenameGroup.Factory.class ) ; }
Source:
private void checkCanRunAs ( ) throws com.google.gerrit.sshd.UnloggedFailure { if ( ( caller ) instanceof com.google.gerrit.server.PeerDaemonUser ) { } else if ( ! ( enableRunAs ) ) { throw die ( "suexec disabled by auth.enableRunAs = false" ) ; } else if ( ! ( caller.getCapabilities ( ) . canRunAs ( ) ) ) { throw die ( "suexec not permitted" ) ; } }

Target:
private void checkCanRunAs ( ) throws com.google.gerrit.sshd.UnloggedFailure { if ( ( caller ) instanceof com.google.gerrit.server.PeerDaemonUser ) { } else if ( ! ( enableRunAs ) ) { throw die ( "suexec disabled by auth.enableRunAs = false" ) ; } else { try { permissionBackend.user ( caller ) . check ( GlobalPermission.RUN_AS ) ; } catch ( com.google.gerrit.extensions.restapi.AuthException e ) { throw die ( "suexec not permitted" ) ; } catch ( com.google.gerrit.server.permissions.PermissionBackendException e ) { throw die ( ( "suexec not available: " + e ) ) ; } } }
Source:
public void basicGroupProperties ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.GroupInfo createdGroup = gApi.groups ( ) . create ( name ( "group" ) ) . get ( ) ; com.google.gerrit.server.group.InternalGroup reviewDbGroup = groups.getGroup ( db , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( createdGroup.id ) ) . get ( ) ; deleteGroupRefs ( reviewDbGroup ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.acceptance.api.group.GroupRebuilderIT.removeRefState ( rebuild ( reviewDbGroup ) ) ) . isEqualTo ( roundToSecond ( reviewDbGroup ) ) ; }

Target:
public void basicGroupProperties ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.GroupInfo createdGroup = gApi.groups ( ) . create ( name ( "group" ) ) . get ( ) ; try ( com.google.gerrit.acceptance.api.group.GroupRebuilderIT.BlockReviewDbUpdatesForGroups ctx = new com.google.gerrit.acceptance.api.group.GroupRebuilderIT.BlockReviewDbUpdatesForGroups ( ) ) { com.google.gerrit.server.group.InternalGroup reviewDbGroup = groups.getGroup ( db , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( createdGroup.id ) ) . get ( ) ; deleteGroupRefs ( reviewDbGroup ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.acceptance.api.group.GroupRebuilderIT.removeRefState ( rebuild ( reviewDbGroup ) ) ) . isEqualTo ( roundToSecond ( reviewDbGroup ) ) ; } }
Source:
public java.nio.file.FileVisitResult preVisitDirectory ( java.nio.file.Path dir , java.nio.file.attribute.BasicFileAttributes attrs ) throws java.io.IOException { java.lang.String fName = dir.getFileName ( ) . toString ( ) ; if ( ( fName.endsWith ( ".deleted" ) ) && ( fName.matches ( ".*\\d{13}.deleted$" ) ) ) { com.googlesource.gerrit.plugins.deleteproject.fs.DeleteTrashFolders.log.warn ( "Will delete this folder: {}" , dir ) ; recursiveDelete ( dir ) ; return java.nio.file.FileVisitResult.SKIP_SUBTREE ; } else if ( org.eclipse.jgit.lib.RepositoryCache.FileKey.isGitRepository ( dir.toFile ( ) , FS.DETECTED ) ) { return java.nio.file.FileVisitResult.SKIP_SUBTREE ; } return super . preVisitDirectory ( dir , attrs ) ; }

Target:
public java.nio.file.FileVisitResult preVisitDirectory ( java.nio.file.Path dir , java.nio.file.attribute.BasicFileAttributes attrs ) throws java.io.IOException { java.lang.String fName = dir.getFileName ( ) . toString ( ) ; if ( fName.matches ( ".*\\.\\d{13}.deleted" ) ) { com.googlesource.gerrit.plugins.deleteproject.fs.DeleteTrashFolders.log.warn ( "Will delete this folder: {}" , dir ) ; recursiveDelete ( dir ) ; return java.nio.file.FileVisitResult.SKIP_SUBTREE ; } else if ( org.eclipse.jgit.lib.RepositoryCache.FileKey.isGitRepository ( dir.toFile ( ) , FS.DETECTED ) ) { return java.nio.file.FileVisitResult.SKIP_SUBTREE ; } return super . preVisitDirectory ( dir , attrs ) ; }
Source:
public void onSuccess ( java.lang.Object result ) { actionsPanel.remove ( b ) ; fireOnSuggestRefresh ( ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { new com.google.gerrit.client.changes.AbandonChangeDialog ( patchSet.getId ( ) , new com.google.gwt.user.client.rpc.AsyncCallback < java.lang.Object > ( ) { public void onSuccess ( java.lang.Object result ) { actionsPanel.remove ( b ) ; fireOnSuggestRefresh ( ) ; } public void onFailure ( java.lang.Throwable caught ) { } } ) . center ( ) ; }
Source:
private java.lang.String extractWhat ( com.google.gerrit.sshd.DispatchCommand dcmd ) { if ( dcmd == null ) { return "Command was already destroyed" ; } java.lang.StringBuilder commandName = new java.lang.StringBuilder ( dcmd.getCommandName ( ) ) ; java.lang.String [ ] args = dcmd.getArguments ( ) ; for ( int i = 1 ; i < ( args.length ) ; i ++ ) { commandName.append ( "." ) . append ( args [ i ] ) ; } return commandName.toString ( ) ; }

Target:
private java.lang.String extractWhat ( com.google.gerrit.sshd.DispatchCommand dcmd , boolean hideSensitive ) { if ( dcmd == null ) { return "Command was already destroyed" ; } return hideSensitive ? dcmd.getFormattedMaskedArguments ( "." ) : extractWhat ( dcmd ) ; }
Source:
public void run ( ) { synchronized ( cleanup ) { for ( final java.util.Iterator < java.lang.Runnable > i = cleanup.iterator ( ) ; i.hasNext ( ) ; ) { try { i.next ( ) . run ( ) ; } catch ( java.lang.Throwable err ) { com.google.gerrit.server.RequestCleanup.log.error ( "Failed to execute per-request cleanup" , err ) ; } i.remove ( ) ; } } }

Target:
public void run ( ) { synchronized ( cleanup ) { ran = true ; for ( final java.util.Iterator < java.lang.Runnable > i = cleanup.iterator ( ) ; i.hasNext ( ) ; ) { try { i.next ( ) . run ( ) ; } catch ( java.lang.Throwable err ) { com.google.gerrit.server.RequestCleanup.log.error ( "Failed to execute per-request cleanup" , err ) ; } i.remove ( ) ; } } }
Source:
public void topoSortCycle ( ) { com.google.gerrit.server.notedb.rebuild.Event e1 = new com.google.gerrit.server.notedb.rebuild.EventSorterTest.TestEvent ( com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; com.google.gerrit.server.notedb.rebuild.Event e2 = new com.google.gerrit.server.notedb.rebuild.EventSorterTest.TestEvent ( com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; java.util.List < com.google.gerrit.server.notedb.rebuild.Event > events = events ( e2 , e1 ) ; new com.google.gerrit.server.notedb.rebuild.EventSorter ( events ) . sort ( ) ; com.google.common.truth.Truth.assertThat ( events ) . containsExactly ( e1 , e2 ) . inOrder ( ) ; }

Target:
private static void assertSorted ( java.util.List < com.google.gerrit.server.notedb.rebuild.Event > unsorted , java.util.List < com.google.gerrit.server.notedb.rebuild.Event > expected ) { java.util.List < com.google.gerrit.server.notedb.rebuild.Event > actual = new java.util.ArrayList ( unsorted ) ; new com.google.gerrit.server.notedb.rebuild.EventSorter ( actual ) . sort ( ) ; com.google.common.truth.Truth.assertThat ( actual ) . named ( ( "sorted" + unsorted ) ) . isEqualTo ( expected ) ; }
Source:
public static java.lang.String owner ( com.google.gerrit.client.account.AccountInfo ai ) { if ( ( ai.email ( ) ) != null ) { return ai.email ( ) ; } else if ( ( ai.name ( ) ) != null ) { return ai.name ( ) ; } else if ( ( ai._accountId ( ) ) != 0 ) { return "" + ( ai._accountId ( ) ) ; } else { return "" ; } }

Target:
public static java.lang.String owner ( com.google.gerrit.client.info.AccountInfo ai ) { if ( ( ai.email ( ) ) != null ) { return ai.email ( ) ; } else if ( ( ai.name ( ) ) != null ) { return ai.name ( ) ; } else if ( ( ai._accountId ( ) ) != 0 ) { return "" + ( ai._accountId ( ) ) ; } else { return "" ; } }
Source:
public boolean deleteChangeFromIndex ( int changeId ) { try { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult result = httpSession.delete ( buildIndexEndpoint ( changeId ) ) ; if ( result.isSuccessful ( ) ) { return true ; } com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.log.error ( "Unable to delete from index change {}. Cause: {}" , changeId , result.getMessage ( ) ) ; } catch ( java.io.IOException e ) { com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.log.error ( ( "Error trying to delete from index change " + changeId ) , e ) ; } return false ; }

Target:
public boolean evict ( final java.lang.String cacheName , final java.lang.Object key ) { return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.Request ( ( "evict for cache " + cacheName ) ) { @ java.lang.Override com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult send ( ) throws java.io.IOException { java.lang.String json = com.ericsson.gerrit.plugins.highavailability.forwarder.rest.GsonParser.toJson ( cacheName , key ) ; return httpSession.post ( com.google.common.base.Joiner.on ( "/" ) . join ( pluginRelativePath , "cache" , cacheName ) , json ) ; } } . execute ( ) ; }
Source:
public void testSortWithRegex ( ) { grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "^refs/heads/.*" ) ; grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.ANONYMOUS , "^refs/heads/.*-QA-.*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertTrue ( "u can read" , u.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; assertTrue ( "d can read" , d.controlForRef ( "refs/heads/foo-QA-bar" ) . isVisible ( ) ) ; }

Target:
public void testUsernamePatternWithRegex ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "^refs/sb/${username}/heads/.*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , "d.v" , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , "dev" , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't read" , u.controlForRef ( "refs/sb/dev/heads/foobar" ) . isVisible ( ) ) ; assertTrue ( "d can read" , d.controlForRef ( "refs/sb/dev/heads/foobar" ) . isVisible ( ) ) ; }
Source:
public void onLoad ( com.google.gerrit.plugin.client.screen.Screen screen ) { screen.setPageTitle ( ( "Reports for patchset " + ( screen.getToken ( 1 ) ) ) ) ; screen.show ( new com.googlesource.gerrit.plugins.verifystatus.client.JobsScreen ( screen.getToken ( 1 ) ) ) ; }

Target:
public void onLoad ( final com.google.gerrit.plugin.client.screen.Screen screen ) { java.lang.String input = screen.getToken ( 1 ) ; java.lang.String [ ] patchsetId = input.split ( "/" ) ; final java.lang.String changeNumber = patchsetId [ 0 ] ; final java.lang.String revisionNumber = patchsetId [ 1 ] ; screen.setPageTitle ( ( "Report History for Change " + input ) ) ; screen.show ( new com.googlesource.gerrit.plugins.verifystatus.client.JobsScreen ( changeNumber , revisionNumber ) ) ; }
Source:
protected void onLoad ( ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { if ( ( revision ) != null ) { rw.markStart ( revision ) ; rw.sort ( RevSort.REVERSE ) ; registeredOn = new java.sql.Timestamp ( ( ( rw.next ( ) . getCommitTime ( ) ) * 1000L ) ) ; org.eclipse.jgit.lib.Config cfg = readConfig ( com.google.gerrit.server.account.AccountConfig.ACCOUNT_CONFIG ) ; account = parse ( cfg ) ; } isLoaded = true ; }

Target:
protected void onLoad ( ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { if ( ( revision ) != null ) { rw.markStart ( revision ) ; rw.sort ( RevSort.REVERSE ) ; registeredOn = new java.sql.Timestamp ( ( ( rw.next ( ) . getCommitTime ( ) ) * 1000L ) ) ; org.eclipse.jgit.lib.Config cfg = readConfig ( com.google.gerrit.server.account.AccountConfig.ACCOUNT_CONFIG ) ; account = parse ( cfg ) ; account.setMetaId ( revision.name ( ) ) ; } isLoaded = true ; }
Source:
public void testOneIndexPredicate ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "foo:a file:b" ) ; com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.query.change.AndSource.class ) . isSameAs ( out.getClass ( ) ) ; com.google.common.truth.Truth.assertThat ( out.getChildren ( ) ) . containsExactly ( query ( in.getChild ( 1 ) ) , in.getChild ( 0 ) ) . inOrder ( ) ; }

Target:
public void testOneIndexPredicate ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "foo:a file:b" ) ; com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.query.change.AndChangeSource.class ) . isSameAs ( out.getClass ( ) ) ; com.google.common.truth.Truth.assertThat ( out.getChildren ( ) ) . containsExactly ( query ( in.getChild ( 1 ) ) , in.getChild ( 0 ) ) . inOrder ( ) ; }
Source:
private void setCreatedOnToVeryOldTimestamp ( com.google.gerrit.reviewdb.client.AccountGroup.Id groupId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup group = db.accountGroups ( ) . get ( groupId ) ; java.time.Instant instant = java.time.LocalDateTime.of ( 1800 , java.time.Month.JANUARY , 1 , 0 , 0 ) . toInstant ( java.time.ZoneOffset.UTC ) ; group.setCreatedOn ( java.sql.Timestamp.from ( instant ) ) ; db.accountGroups ( ) . update ( com.google.common.collect.ImmutableList.of ( group ) ) ; }

Target:
private java.sql.Timestamp getCreatedOn ( com.google.gerrit.reviewdb.client.AccountGroup.Id groupId ) throws java.lang.Exception { createdOnRetrieval.setInt ( 1 , groupId.get ( ) ) ; try ( java.sql.ResultSet results = createdOnRetrieval.executeQuery ( ) ) { if ( results.first ( ) ) { return results.getTimestamp ( 1 ) ; } } return null ; }
Source:
public void onSuccess ( final com.google.gerrit.reviewdb.client.PatchLineComment result ) { enableButtons ( true ) ; notifyDraftDelta ( 1 ) ; findOrCreateEditor ( result , true ) . setOpen ( false ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.changes.CommentInfo result ) { enableButtons ( true ) ; notifyDraftDelta ( 1 ) ; findOrCreateEditor ( com.google.gerrit.client.patches.CommentEditorPanel.toComment ( psId , newComment.getKey ( ) . getParentKey ( ) . get ( ) , result ) , true ) . setOpen ( false ) ; }
Source:
public com.google.gerrit.acceptance.RestResponse putRaw ( java.lang.String endPoint , com.google.gerrit.extensions.restapi.RawInput stream ) throws java.io.IOException { com.google.common.base.Preconditions.checkNotNull ( stream ) ; org.apache.http.client.methods.HttpPut put = new org.apache.http.client.methods.HttpPut ( ( ( ( url ) + "/a" ) + endPoint ) ) ; put.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , stream.getContentType ( ) ) ) ; put.setEntity ( new org.apache.http.entity.BufferedHttpEntity ( new org.apache.http.entity.InputStreamEntity ( stream.getInputStream ( ) , stream.getContentLength ( ) ) ) ) ; return new com.google.gerrit.acceptance.RestResponse ( getClient ( ) . execute ( put ) ) ; }

Target:
public com.google.gerrit.acceptance.RestResponse putRaw ( java.lang.String endPoint , com.google.gerrit.extensions.restapi.RawInput stream ) throws java.io.IOException { com.google.common.base.Preconditions.checkNotNull ( stream ) ; org.apache.http.client.fluent.Request put = org.apache.http.client.fluent.Request.Put ( ( ( ( url ) + "/a" ) + endPoint ) ) ; put.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , stream.getContentType ( ) ) ) ; put.body ( new org.apache.http.entity.BufferedHttpEntity ( new org.apache.http.entity.InputStreamEntity ( stream.getInputStream ( ) , stream.getContentLength ( ) ) ) ) ; return execute ( put ) ; }
Source:
public void cannotGetDashboardWithInheritedForNonDefault ( ) throws java.lang.Exception { java.lang.String id = createDashboard ( DashboardsCollection.DEFAULT_DASHBOARD_NAME , "test" ) ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( "inherited flag can only be used with default" ) ; gApi.projects ( ) . name ( project.get ( ) ) . dashboard ( id ) . get ( true ) ; }

Target:
public void cannotGetDashboardWithInheritedForNonDefault ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.DashboardInfo info = createDashboard ( DashboardsCollection.DEFAULT_DASHBOARD_NAME , "test" ) ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( "inherited flag can only be used with default" ) ; gApi.projects ( ) . name ( project.get ( ) ) . dashboard ( info.id ) . get ( true ) ; }
Source:
public com.google.common.util.concurrent.CheckedFuture < java.lang.Boolean , java.io.IOException > reindexIfStale ( com.google.gerrit.reviewdb.client.Account.Id id ) { java.util.concurrent.Callable < java.lang.Boolean > task = ( ) -> { if ( stalenessChecker.isStale ( id ) ) { index ( id ) ; return true ; } return false ; } ; return com.google.common.util.concurrent.Futures.makeChecked ( com.google.common.util.concurrent.Futures.nonCancellationPropagating ( batchExecutor.submit ( task ) ) , IndexUtils.MAPPER ) ; }

Target:
private com.google.common.util.concurrent.CheckedFuture < java.lang.Boolean , java.io.IOException > reindexIfStaleAsync ( com.google.gerrit.reviewdb.client.Account.Id id ) { return com.google.common.util.concurrent.Futures.makeChecked ( com.google.common.util.concurrent.Futures.nonCancellationPropagating ( batchExecutor.submit ( ( ) -> reindexIfStale ( id ) ) ) , IndexUtils.MAPPER ) ; }
Source:
com.google.gerrit.server.account.externalids.ExternalId get ( com.google.gerrit.server.account.externalids.ExternalId.Key key , org.eclipse.jgit.lib.ObjectId rev ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { checkReadEnabled ( ) ; if ( rev.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) ) ) { return null ; } try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsersName ) ; org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { return com.google.gerrit.server.account.externalids.ExternalIdReader.parse ( key , rw , rev ) ; } }

Target:
com.google.gerrit.server.account.externalids.ExternalId get ( com.google.gerrit.server.account.externalids.ExternalId.Key key , org.eclipse.jgit.lib.ObjectId rev ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { checkReadEnabled ( ) ; try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsersName ) ) { return com.google.gerrit.server.account.externalids.ExternalIdNotes.loadReadOnly ( repo , rev ) . get ( key ) . orElse ( null ) ; } }
Source:
protected boolean updateHead ( org.eclipse.jgit.transport.URIish uri , com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String newHead ) { java.io.OutputStream errStream = sshHelper.newErrorBufferStream ( ) ; java.lang.String cmd = ( ( "gerrit set-head " + ( projectName.get ( ) ) ) + " --new-head " ) + newHead ; try { execute ( uri , cmd , errStream ) ; } catch ( java.io.IOException e ) { com.googlesource.gerrit.plugins.replication.GerritSshApi.log.error ( java.lang.String.format ( ( "Error updating HEAD of remote repository at %s to %s:\n" + " Exception: %s\n Command: %s\n Output: %s" ) , uri , newHead , e , cmd , errStream ) , e ) ; return false ; } return true ; }

Target:
protected boolean updateHead ( org.eclipse.jgit.transport.URIish uri , com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String newHead ) { java.io.OutputStream errStream = sshHelper.newErrorBufferStream ( ) ; java.lang.String cmd = ( ( "gerrit set-head " + ( projectName.get ( ) ) ) + " --new-head " ) + newHead ; try { execute ( uri , cmd , errStream ) ; } catch ( java.io.IOException e ) { com.googlesource.gerrit.plugins.replication.GerritSshApi.log.error ( ( "Error updating HEAD of remote repository at to {}:\n" + " Exception: {}\n Command: {}\n Output: {}" ) , uri , newHead , e , cmd , errStream , e ) ; return false ; } return true ; }
Source:
public void blockPushDraftsUnblockAdmin ( ) { com.google.gerrit.server.project.testing.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.ADMIN , "refs/drafts/*" ) ; com.google.gerrit.server.permissions.ProjectControl u = user ( local ) ; com.google.gerrit.server.permissions.ProjectControl a = user ( local , "a" , com.google.gerrit.server.project.testing.Util.ADMIN ) ; assertBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , u ) ; assertNotBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , a ) ; }

Target:
public void blockPushDrafts ( ) { com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/for/refs/*" ) ; com.google.gerrit.server.project.testing.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/drafts/*" ) ; com.google.gerrit.server.permissions.ProjectControl u = user ( local ) ; assertCreateChange ( "refs/heads/master" , u ) ; com.google.common.truth.Truth.assertThat ( u.controlForRef ( "refs/drafts/master" ) . canPerform ( com.google.gerrit.common.data.Permission.PUSH ) ) . isFalse ( ) ; }
Source:
void setMaxHeight ( int height ) { this . maxHeight = height ; for ( int i = 0 ; i < ( getTabBar ( ) . getTabCount ( ) ) ; i ++ ) { tabs.get ( i ) . setMaxHeight ( height ) ; } }

Target:
void setMaxHeight ( int height ) { maxHeight = height - ( getTabBar ( ) . getOffsetHeight ( ) ) ; for ( int i = 0 ; i < ( getTabBar ( ) . getTabCount ( ) ) ; i ++ ) { tabs.get ( i ) . setMaxHeight ( maxHeight ) ; } }
Source:
public void withDuplicateInternalGroupCaseSensitiveName_Conflict ( ) throws java.lang.Exception { java.lang.String newGroupName = "dupGroupA" ; adminSession.put ( ( "/groups/" + newGroupName ) ) ; sshSession.exec ( ( "gerrit create-group " + newGroupName ) ) ; com.google.common.truth.Truth.assert_ ( ) . withFailureMessage ( sshSession.getError ( ) ) . that ( sshSession.hasError ( ) ) . isTrue ( ) ; }

Target:
public void withDuplicateInternalGroupCaseSensitiveName_Conflict ( ) throws java.lang.Exception { java.lang.String newGroupName = "dupGroupA" ; adminRestSession.put ( ( "/groups/" + newGroupName ) ) ; adminSshSession.exec ( ( "gerrit create-group " + newGroupName ) ) ; com.google.common.truth.Truth.assert_ ( ) . withFailureMessage ( adminSshSession.getError ( ) ) . that ( adminSshSession.hasError ( ) ) . isTrue ( ) ; }
Source:
public com.google.gerrit.extensions.api.config.AccessCheckInfo checkAccess ( com.google.gerrit.extensions.api.config.AccessCheckInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return checkAccess.get ( ) . apply ( new com.google.gerrit.server.config.ConfigResource ( ) , in ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException | com.google.gerrit.server.permissions.PermissionBackendException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot check access" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.config.AccessCheckInfo checkAccess ( com.google.gerrit.extensions.api.config.AccessCheckInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return checkAccess.get ( ) . apply ( new com.google.gerrit.server.config.ConfigResource ( ) , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot check access" , e ) ; } }
Source:
public void changeFields ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.reviewdb.client.Change.Id id = r.getPatchSetId ( ) . getParentKey ( ) ; gApi.changes ( ) . id ( id.get ( ) ) . topic ( name ( "a-topic" ) ) ; com.google.gerrit.reviewdb.client.Change old = db.changes ( ) . get ( id ) ; rebuild ( id ) ; com.google.gerrit.acceptance.server.notedb.ChangeRebuilderIT.assertChangeEqual ( old , notesFactory.create ( db , project , id ) . getChange ( ) ) ; }

Target:
public void changeFields ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.reviewdb.client.Change.Id id = r.getPatchSetId ( ) . getParentKey ( ) ; gApi.changes ( ) . id ( id.get ( ) ) . topic ( name ( "a-topic" ) ) ; checker.checkChanges ( id ) ; }
Source:
protected void display ( com.googlesource.gerrit.plugins.imagare.client.ConfigInfo info ) { super . display ( info ) ; com.google.gwt.user.client.ui.InlineHyperlink uploadLink = new com.google.gwt.user.client.ui.InlineHyperlink ( "Upload Image" , ( ( "/x/" + ( com.google.gerrit.plugin.client.Plugin.get ( ) . getPluginName ( ) ) ) + "/upload" ) ) ; add ( uploadLink ) ; }

Target:
protected void display ( com.googlesource.gerrit.plugins.imagare.client.ConfigInfo info ) { com.google.gwt.user.client.ui.HorizontalPanel p = new com.google.gwt.user.client.ui.HorizontalPanel ( ) ; p.setStyleName ( "imagare-menu-panel" ) ; com.google.gwt.user.client.ui.Anchor prefsAnchor = new com.google.gwt.user.client.ui.Anchor ( new com.google.gwt.user.client.ui.ImageResourceRenderer ( ) . render ( ImagarePlugin.RESOURCES.image ( ) ) , ( ( "#/x/" + ( com.google.gerrit.plugin.client.Plugin.get ( ) . getPluginName ( ) ) ) + "/upload" ) ) ; prefsAnchor.setTitle ( "Upload Image" ) ; p.add ( prefsAnchor ) ; add ( p ) ; super . display ( info ) ; }