auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.common.changes.ListChangesOption.CURRENT_REVISION ) ; org.junit.Assert.assertEquals ( expectedId.name ( ) , c.current_revision ) ; org.junit.Assert.assertEquals ( expectedNum , c.revisions.get ( expectedId.name ( ) ) . _number ) ; }

Target:
protected void assertApproved ( java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.server.change.ChangeJson.ChangeInfo c = getChange ( changeId , com.google.gerrit.common.changes.ListChangesOption.DETAILED_LABELS ) ; com.google.gerrit.server.change.ChangeJson.LabelInfo cr = c.labels.get ( "Code-Review" ) ; org.junit.Assert.assertEquals ( 1 , cr.all.size ( ) ) ; org.junit.Assert.assertEquals ( 2 , cr.all.get ( 0 ) . value.intValue ( ) ) ; org.junit.Assert.assertEquals ( "Administrator" , cr.all.get ( 0 ) . name ) ; }
Source:
private static java.lang.String getContentType ( com.google.gerrit.client.diff.DiffInfo.FileMeta meta ) { return ( meta != null ) && ( ( meta.content_type ( ) ) != null ) ? net.codemirror.lib.ModeInjector.getContentType ( meta.content_type ( ) ) : null ; }

Target:
private java.lang.String getContentType ( com.google.gerrit.client.diff.DiffInfo.FileMeta meta ) { return ( ( pref.isSyntaxHighlighting ( ) ) && ( meta != null ) ) && ( ( meta.content_type ( ) ) != null ) ? net.codemirror.lib.ModeInjector.getContentType ( meta.content_type ( ) ) : null ; }
Source:
void onAddPermission ( java.lang.String varName ) { com.google.gerrit.common.data.Permission p = value.getPermission ( varName , true ) ; permissions.getList ( ) . add ( p ) ; rebuildPermissionSelector ( ) ; }

Target:
void onAddPermission ( java.lang.String varName ) { int idx = permissions.getList ( ) . size ( ) ; com.google.gerrit.common.data.Permission p = value.getPermission ( varName , true ) ; permissions.getList ( ) . add ( p ) ; com.google.gerrit.client.admin.PermissionEditor e = permissions.getEditors ( ) . get ( idx ) ; e.beginAddRule ( ) ; rebuildPermissionSelector ( ) ; }
Source:
public void multipleIndexPredicates ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "file:a OR foo:b OR file:c OR foo:d" ) ; com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; com.google.common.truth.Truth.assertThat ( out.getClass ( ) ) . isSameAs ( com.google.gerrit.server.query.change.OrSource.class ) ; com.google.common.truth.Truth.assertThat ( out.getChildren ( ) ) . containsExactly ( query ( com.google.gerrit.server.query.Predicate.or ( in.getChild ( 0 ) , in.getChild ( 2 ) ) ) , in.getChild ( 1 ) , in.getChild ( 3 ) ) . inOrder ( ) ; }

Target:
public void multipleIndexPredicates ( ) throws java.lang.Exception { com.google.gerrit.index.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "file:a OR foo:b OR file:c OR foo:d" ) ; com.google.gerrit.index.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; com.google.common.truth.Truth.assertThat ( out.getClass ( ) ) . isSameAs ( com.google.gerrit.server.query.change.OrSource.class ) ; com.google.common.truth.Truth.assertThat ( out.getChildren ( ) ) . containsExactly ( query ( com.google.gerrit.index.query.Predicate.or ( in.getChild ( 0 ) , in.getChild ( 2 ) ) ) , in.getChild ( 1 ) , in.getChild ( 3 ) ) . inOrder ( ) ; }
Source:
void addClickHandler ( final java.lang.Runnable callback ) { headerClick = header.addDomHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { setOpen ( ( ! ( isOpen ( ) ) ) ) ; callback.run ( ) ; } } , com.google.gwt.event.dom.client.ClickEvent.getType ( ) ) ; }

Target:
void setOpenCloseHandler ( final java.lang.Runnable callback ) { clickCallback = callback ; }
Source:
public void deleteBranchByRestWithoutRefsHeadsPrefix ( ) throws java.lang.Exception { grantDelete ( ) ; java.lang.String ref = branch.getShortName ( ) ; com.google.common.truth.Truth.assertThat ( ref ) . doesNotMatch ( org.eclipse.jgit.lib.Constants.R_HEADS ) ; com.google.gerrit.acceptance.RestResponse r = userRestSession.delete ( ( ( ( "/projects/" + ( project.get ( ) ) ) + "/branches/" ) + ref ) ) ; r.assertNoContent ( ) ; }

Target:
public void deleteBranchByRestWithoutRefsHeadsPrefix ( ) throws java.lang.Exception { grantDelete ( ) ; java.lang.String ref = branch.getShortName ( ) ; com.google.common.truth.Truth.assertThat ( ref ) . doesNotMatch ( org.eclipse.jgit.lib.Constants.R_HEADS ) ; assertDeleteByRestSucceeds ( ref ) ; }
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 onSuccess ( com.google.gerrit.client.projects.ProjectMap list ) { if ( ! ( list.isEmpty ( ) ) ) { suggestedParentsTab.setVisible ( true ) ; suggestedParentsTab.display ( list ) ; suggestedParentsTab.finishDisplay ( ) ; } }
Source:
public org.apache.sshd.common.file.FileSystemView createFileSystemView ( org.apache.sshd.common.Session session ) throws java.io.IOException { return new org.apache.sshd.common.file.FileSystemView ( ) { @ java.lang.Override public org.apache.sshd.common.file.SshFile getFile ( org.apache.sshd.common.file.SshFile baseDir , java.lang.String file ) { return null ; } @ java.lang.Override public org.apache.sshd.common.file.SshFile getFile ( java.lang.String file ) { return null ; } @ java.lang.Override public org.apache.sshd.common.file.FileSystemView getNormalizedView ( ) { return this ; } } ; }

Target:
public java.nio.file.attribute.UserPrincipalLookupService getUserPrincipalLookupService ( ) { return null ; }
Source:
private void deleteLock ( java.lang.String project , java.lang.String lockId , com.googlesource.gerrit.plugins.lfs.locks.LfsLocksContext action ) throws java.io.IOException { com.googlesource.gerrit.plugins.lfs.locks.LfsDeleteLockInput input = action.input ( com.googlesource.gerrit.plugins.lfs.locks.LfsDeleteLockInput.class ) ; com.googlesource.gerrit.plugins.lfs.locks.LfsPutLocksAction.log.debug ( "Delete (-f {}) lock for in project {}" , java.lang.Boolean.TRUE.equals ( input.force ) , lockId , project ) ; com.googlesource.gerrit.plugins.lfs.locks.LfsLock lock = new com.googlesource.gerrit.plugins.lfs.locks.LfsLock ( "random_id" , "some/path/to/file" , now ( ) , new com.googlesource.gerrit.plugins.lfs.locks.LfsLockOwner ( "Lock Owner <lock_owner@example.com>" ) ) ; action.sendResponse ( lock ) ; }

Target:
public void run ( com.google.gerrit.server.project.ProjectState project , com.google.gerrit.server.CurrentUser user ) throws java.io.IOException , org.eclipse.jgit.lfs.errors.LfsException { com.googlesource.gerrit.plugins.lfs.locks.LfsCreateLockInput input = context.input ( com.googlesource.gerrit.plugins.lfs.locks.LfsCreateLockInput.class ) ; com.googlesource.gerrit.plugins.lfs.locks.LfsPutLocksAction.log.debug ( "Create lock for in project {}" , input.path , project ) ; com.googlesource.gerrit.plugins.lfs.locks.LfsLock lock = new com.googlesource.gerrit.plugins.lfs.locks.LfsLock ( "random_id" , input.path , now ( ) , new com.googlesource.gerrit.plugins.lfs.locks.LfsLockOwner ( "Lock Owner <lock_owner@example.com>" ) ) ; context.sendResponse ( lock ) ; }
Source:
void populate ( final int row , final com.google.gerrit.client.reviewdb.Project k ) { table.setWidget ( row , 1 , new com.google.gwt.user.client.ui.Hyperlink ( k.getName ( ) , com.google.gerrit.client.Link.toProjectAdmin ( k.getId ( ) ) ) ) ; table.setText ( row , 2 , k.getDescription ( ) ) ; final com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter fmt = table.getFlexCellFormatter ( ) ; fmt.addStyleName ( row , 1 , com.google.gerrit.client.admin.S_DATA_CELL ) ; fmt.addStyleName ( row , 2 , com.google.gerrit.client.admin.S_DATA_CELL ) ; setRowItem ( row , k ) ; }

Target:
void populate ( final int row , final com.google.gerrit.client.reviewdb.Project k ) { table.setWidget ( row , 1 , new com.google.gwt.user.client.ui.Hyperlink ( k.getName ( ) , link ( k ) ) ) ; table.setText ( row , 2 , k.getDescription ( ) ) ; final com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter fmt = table.getFlexCellFormatter ( ) ; fmt.addStyleName ( row , 1 , com.google.gerrit.client.admin.S_DATA_CELL ) ; fmt.addStyleName ( row , 2 , com.google.gerrit.client.admin.S_DATA_CELL ) ; setRowItem ( row , k ) ; }
Source:
public static net.codemirror.lib.TextMarker.FromTo create ( com.google.gerrit.client.diff.CommentRange range ) { return net.codemirror.lib.TextMarker.FromTo.create ( net.codemirror.lib.LineCharacter.create ( ( ( range.start_line ( ) ) - 1 ) , range.start_character ( ) ) , net.codemirror.lib.LineCharacter.create ( ( ( range.end_line ( ) ) - 1 ) , range.end_character ( ) ) ) ; }

Target:
public static net.codemirror.lib.TextMarker.FromTo create ( com.google.gerrit.client.diff.CommentRange range ) { return net.codemirror.lib.TextMarker.FromTo.create ( net.codemirror.lib.Pos.create ( ( ( range.start_line ( ) ) - 1 ) , range.start_character ( ) ) , net.codemirror.lib.Pos.create ( ( ( range.end_line ( ) ) - 1 ) , range.end_character ( ) ) ) ; }
Source:
public UiAction.Description getDescription ( com.google.gerrit.server.change.RevisionResource resource ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Cherry Pick" ) . setTitle ( "Cherry pick change to a different branch" ) . setVisible ( ( ( resource.getControl ( ) . getProjectControl ( ) . canUpload ( ) ) && ( resource.isCurrent ( ) ) ) ) ; }

Target:
public UiAction.Description getDescription ( com.google.gerrit.server.change.RevisionResource rsrc ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Cherry Pick" ) . setTitle ( "Cherry pick change to a different branch" ) . setVisible ( ( ( rsrc.isCurrent ( ) ) && ( permissionBackend.user ( user ) . project ( rsrc.getProject ( ) ) . testOrFalse ( ProjectPermission.CREATE_CHANGE ) ) ) ) ; }
Source:
public com.google.gerrit.reviewdb.client.PatchLineComment apply ( com.google.gerrit.server.notedb.RevisionNoteData.Comment c ) { com.google.gerrit.reviewdb.client.PatchLineComment plc = c.export ( ) ; plc.setStatus ( status ) ; return plc ; }

Target:
com.google.common.collect.ImmutableList < com.google.gerrit.reviewdb.client.PatchLineComment > exportComments ( com.google.gerrit.reviewdb.client.PatchLineComment.Status status ) { return com.google.common.collect.ImmutableList.copyOf ( comments.stream ( ) . map ( ( c ) -> { com.google.gerrit.reviewdb.client.PatchLineComment plc = c.export ( ) ; plc.setStatus ( status ) ; return plc ; } ) . collect ( java.util.stream.Collectors.toList ( ) ) ) ; }
Source:
protected void configure ( ) { install ( new com.google.gerrit.server.index.IndexModule ( 1 ) ) ; bind ( com.google.gerrit.server.index.IndexConfig.class ) . toInstance ( com.google.gerrit.server.index.IndexConfig.createDefault ( ) ) ; bind ( com.google.gerrit.server.index.Index.class ) . toInstance ( new com.google.gerrit.server.index.change.DummyChangeIndex ( ) ) ; bind ( AccountIndex.Factory.class ) . toInstance ( new com.google.gerrit.server.index.DummyIndexModule.DummyAccountIndexFactory ( ) ) ; bind ( ChangeIndex.Factory.class ) . toInstance ( new com.google.gerrit.server.index.DummyIndexModule.DummyChangeIndexFactory ( ) ) ; bind ( GroupIndex.Factory.class ) . toInstance ( new com.google.gerrit.server.index.DummyIndexModule.DummyGroupIndexFactory ( ) ) ; }

Target:
protected void configure ( ) { install ( new com.google.gerrit.server.index.IndexModule ( 1 ) ) ; bind ( com.google.gerrit.index.IndexConfig.class ) . toInstance ( com.google.gerrit.index.IndexConfig.createDefault ( ) ) ; bind ( com.google.gerrit.index.Index.class ) . toInstance ( new com.google.gerrit.server.index.change.DummyChangeIndex ( ) ) ; bind ( AccountIndex.Factory.class ) . toInstance ( new com.google.gerrit.server.index.DummyIndexModule.DummyAccountIndexFactory ( ) ) ; bind ( ChangeIndex.Factory.class ) . toInstance ( new com.google.gerrit.server.index.DummyIndexModule.DummyChangeIndexFactory ( ) ) ; bind ( GroupIndex.Factory.class ) . toInstance ( new com.google.gerrit.server.index.DummyIndexModule.DummyGroupIndexFactory ( ) ) ; }
Source:
public void testUnblockForceWithAllowNoForce_NotPossible ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; r.setBlock ( ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }

Target:
public void testUnblockMoreSpecificRef_Fails ( ) { com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/master" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }
Source:
public void createEmptyChange_InvalidStatus ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo ci = newChangeInfo ( ChangeStatus.SUBMITTED ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.post ( "/changes/" , ci ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_BAD_REQUEST ) ; com.google.common.truth.Truth.assertThat ( r.getEntityContent ( ) ) . contains ( "unsupported change status" ) ; }

Target:
public void createEmptyChange_InvalidStatus ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo ci = newChangeInfo ( ChangeStatus.SUBMITTED ) ; assertCreateFails ( ci , com.google.gerrit.extensions.restapi.BadRequestException.class , "unsupported change status" ) ; }
Source:
protected java.util.Optional < com.googlesource.gerrit.plugins.lfs.LfsSshRequestAuthorizer.LfsSshAuthToken > createToken ( java.util.List < java.lang.String > values ) { if ( ( values.size ( ) ) != 4 ) { return java.util.Optional.empty ( ) ; } return java.util.Optional.of ( new com.googlesource.gerrit.plugins.lfs.LfsSshRequestAuthorizer.LfsSshAuthToken ( values.get ( 0 ) , values.get ( 1 ) , values.get ( 2 ) , values.get ( 3 ) ) ) ; }

Target:
protected java.util.Optional < com.googlesource.gerrit.plugins.lfs.LfsSshRequestAuthorizer.LfsSshAuthToken > createToken ( java.util.List < java.lang.String > values ) { if ( ( values.size ( ) ) != 5 ) { return java.util.Optional.empty ( ) ; } return java.util.Optional.of ( new com.googlesource.gerrit.plugins.lfs.LfsSshRequestAuthorizer.LfsSshAuthToken ( values.get ( 0 ) , values.get ( 1 ) , values.get ( 2 ) , values.get ( 3 ) , java.lang.Long.valueOf ( values.get ( 4 ) ) ) ) ; }
Source:
private void parsePostRequest ( final CallType call , final java.io.Reader in ) { final com.google.gson.GsonBuilder gb = createGsonBuilder ( ) ; gb.registerTypeAdapter ( com.google.gwtjsonrpc.server.ActiveCall.class , new com.google.gwtjsonrpc.server.CallDeserializer < CallType > ( call , this ) ) ; gb.create ( ) . fromJson ( in , com.google.gwtjsonrpc.server.ActiveCall.class ) ; }

Target:
private void parsePostRequest ( final CallType call ) throws java.io.IOException , java.io.UnsupportedEncodingException { try { final com.google.gson.GsonBuilder gb = createGsonBuilder ( ) ; gb.registerTypeAdapter ( com.google.gwtjsonrpc.server.ActiveCall.class , new com.google.gwtjsonrpc.server.CallDeserializer < CallType > ( call , this ) ) ; gb.create ( ) . fromJson ( com.google.gwtjsonrpc.server.JsonServlet.readBody ( call ) , com.google.gwtjsonrpc.server.ActiveCall.class ) ; } catch ( com.google.gson.JsonParseException err ) { call.method = null ; call.params = null ; throw err ; } }
Source:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( com.google.inject.Stage.PRODUCTION , new com.google.gerrit.server.config.DatabaseModule ( ) , new com.google.gerrit.server.config.GerritGlobalModule ( ) , new com.google.gerrit.server.ssh.SshDaemonModule ( ) , new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; com.google.gerrit.client.rpc.Common.setGerritConfig ( injector.getInstance ( com.google.gerrit.client.data.GerritConfig.class ) ) ; injector.getInstance ( com.google.gerrit.server.ssh.SshDaemon.class ) . start ( ) ; return never ( ) ; }

Target:
public int run ( ) throws java.lang.Exception { final com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( com.google.inject.Stage.PRODUCTION , new com.google.gerrit.server.config.DatabaseModule ( ) , new com.google.gerrit.server.config.GerritGlobalModule ( ) , new com.google.gerrit.server.ssh.SshModule ( ) , new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; com.google.gerrit.client.rpc.Common.setGerritConfig ( injector.getInstance ( com.google.gerrit.client.data.GerritConfig.class ) ) ; injector.getInstance ( com.google.gerrit.server.ssh.SshDaemon.class ) . start ( ) ; return never ( ) ; }
Source:
public void createEditByDeletingExistingFileRest ( ) throws java.lang.Exception { adminRestSession.delete ( urlEditFile ( ) ) . assertNoContent ( ) ; com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( change ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; fileUtil.getContent ( projectCache.get ( edit.get ( ) . getChange ( ) . getProject ( ) ) , org.eclipse.jgit.lib.ObjectId.fromString ( edit.get ( ) . getRevision ( ) . get ( ) ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME ) ; }

Target:
public void createEditByDeletingExistingFileRest ( ) throws java.lang.Exception { adminRestSession.delete ( urlEditFile ( ) ) . assertNoContent ( ) ; java.util.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( change ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; fileUtil.getContent ( projectCache.get ( edit.get ( ) . getChange ( ) . getProject ( ) ) , org.eclipse.jgit.lib.ObjectId.fromString ( edit.get ( ) . getRevision ( ) . get ( ) ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME ) ; }
Source:
public static com.google.gerrit.extensions.common.ApprovalInfo getApprovalInfo ( com.google.gerrit.reviewdb.client.Account.Id id , java.lang.Integer value , java.lang.String tag , java.sql.Timestamp date ) { com.google.gerrit.extensions.common.ApprovalInfo ai = new com.google.gerrit.extensions.common.ApprovalInfo ( id.get ( ) ) ; ai.value = value ; ai.date = date ; ai.tag = tag ; return ai ; }

Target:
public static com.google.gerrit.extensions.common.ApprovalInfo getApprovalInfo ( com.google.gerrit.reviewdb.client.Account.Id id , java.lang.Integer value , com.google.gerrit.extensions.common.VotingRangeInfo permittedVotingRange , java.lang.String tag , java.sql.Timestamp date ) { com.google.gerrit.extensions.common.ApprovalInfo ai = new com.google.gerrit.extensions.common.ApprovalInfo ( id.get ( ) ) ; ai.value = value ; ai.permittedVotingRange = permittedVotingRange ; ai.date = date ; ai.tag = tag ; return ai ; }
Source:
private com.google.gwt.user.client.ui.Button createChangeAction ( ) { final com.google.gwt.user.client.ui.Button createChange = new com.google.gwt.user.client.ui.Button ( Util.C.buttonCreateChange ( ) ) ; createChange.setStyleName ( "" ) ; createChange.setTitle ( Util.C.buttonCreateChangeDescription ( ) ) ; createChange.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { com.google.gerrit.client.admin.CreateChangeAction.call ( createChange , getProjectKey ( ) . get ( ) ) ; } } ) ; return createChange ; }

Target:
private com.google.gwt.user.client.ui.Button createChangeAction ( ) { final com.google.gwt.user.client.ui.Button createChange = new com.google.gwt.user.client.ui.Button ( AdminConstants.I.buttonCreateChange ( ) ) ; createChange.setStyleName ( "" ) ; createChange.setTitle ( AdminConstants.I.buttonCreateChangeDescription ( ) ) ; createChange.addClickHandler ( new com.google.gwt.event.dom.client.ClickHandler ( ) { @ java.lang.Override public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { com.google.gerrit.client.admin.CreateChangeAction.call ( createChange , getProjectKey ( ) . get ( ) ) ; } } ) ; return createChange ; }
Source:
protected void configure ( ) { try { bind ( com.google.gerrit.server.GerritServer.class ) . toInstance ( com.google.gerrit.server.GerritServer.getInstance ( true ) ) ; } catch ( com.google.gwtorm.client.OrmException e ) { addError ( e ) ; } catch ( com.google.gwtjsonrpc.server.XsrfException e ) { addError ( e ) ; } bind ( com.google.gerrit.server.ContactStore.class ) . toProvider ( com.google.gerrit.server.EncryptedContactStoreProvider.class ) ; bind ( com.google.gerrit.server.FileTypeRegistry.class ) . to ( com.google.gerrit.server.MimeUtilFileTypeRegistry.class ) ; }

Target:
public void contextInitialized ( final javax.servlet.ServletContextEvent event ) { super . contextInitialized ( event ) ; try { injector.getInstance ( com.google.gerrit.server.ssh.GerritSshDaemon.class ) . start ( ) ; } catch ( com.google.inject.ConfigurationException e ) { event.getServletContext ( ) . log ( "Unable to start SSHD" , e ) ; } catch ( java.security.ProviderException e ) { event.getServletContext ( ) . log ( "Unable to start SSHD" , e ) ; } catch ( java.io.IOException e ) { event.getServletContext ( ) . log ( "Unable to start SSHD" , e ) ; } }
Source:
public void topic ( java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.change.PutTopic.Input in = new com.google.gerrit.server.change.PutTopic.Input ( ) ; in.topic = topic ; try { putTopic.apply ( change , in ) ; } catch ( com.google.gerrit.server.update.UpdateException | com.google.gerrit.server.permissions.PermissionBackendException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot set topic" , e ) ; } }

Target:
public void topic ( java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.change.PutTopic.Input in = new com.google.gerrit.server.change.PutTopic.Input ( ) ; in.topic = topic ; try { putTopic.apply ( change , in ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot set topic" , e ) ; } }
Source:
public void testOwnerGroupsForStarFilter ( ) { java.lang.String [ ] ownerGroups = new java.lang.String [ ] { "group1" , "group2" } ; configureOwnerGroups ( "*" , com.google.common.collect.Lists.newArrayList ( ownerGroups ) ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getOwnerGroups ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someProject" ) ) ) . isEqualTo ( ownerGroups ) ; }

Target:
public void testOwnerGroupsForStarFilter ( ) { com.google.common.collect.ImmutableList < java.lang.String > ownerGroups = com.google.common.collect.ImmutableList.of ( "group1" , "group2" ) ; configureOwnerGroups ( "*" , ownerGroups ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getOwnerGroups ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someProject" ) ) ) . containsExactlyElementsIn ( ownerGroups ) ; }
Source:
private com.google.common.collect.Multimap < java.lang.String , org.eclipse.jgit.diff.Edit > getEditsDueToRebasePerFilePath ( org.eclipse.jgit.revwalk.RevWalk revWalk , org.eclipse.jgit.revwalk.RevCommit commitB , org.eclipse.jgit.revwalk.RevCommit commitA ) throws com.google.gerrit.server.patch.PatchListNotAvailableException , java.io.IOException { if ( ! ( arePatchSetCommitsWithRebaseInBetween ( revWalk , commitA , commitB ) ) ) { return com.google.common.collect.ImmutableMultimap.of ( ) ; } return getEditsDueToRebasePerFilePath ( commitA , commitB ) ; }

Target:
private static boolean areParentChild ( org.eclipse.jgit.revwalk.RevCommit commitA , org.eclipse.jgit.revwalk.RevCommit commitB ) { return ( org.eclipse.jgit.lib.ObjectId.equals ( commitA.getParent ( 0 ) , commitB ) ) || ( org.eclipse.jgit.lib.ObjectId.equals ( commitB.getParent ( 0 ) , commitA ) ) ; }
Source:
protected void execute ( com.google.gerrit.reviewdb.server.ReviewDb db , java.lang.String sql ) throws java.sql.SQLException { java.sql.Statement s = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . createStatement ( ) ; try { s.execute ( sql ) ; } finally { s.close ( ) ; } }

Target:
protected static java.sql.PreparedStatement prepareStatement ( com.google.gerrit.reviewdb.server.ReviewDb db , java.lang.String sql ) throws java.sql.SQLException { return ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . prepareStatement ( sql ) ; }
Source:
public void groupNameNoteFailToParse ( ) throws java.lang.Exception { updateGroupNamesRef ( "g-1" , "[invalid" ) ; java.util.List < com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo > problems = com.google.gerrit.server.group.db.GroupsNoteDbConsistencyChecker.checkWithGroupNameNotes ( allUsersRepo , "g-1" , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( "uuid-1" ) ) ; com.google.common.truth.Truth.assertThat ( problems ) . containsExactly ( com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo.warning ( "fail to check consistency with group name notes: Unexpected end of config file" ) ) ; }

Target:
public void groupNameNoteFailToParse ( ) throws java.lang.Exception { updateGroupNamesRef ( "g-1" , "[invalid" ) ; java.util.List < com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo > problems = com.google.gerrit.server.group.db.GroupsNoteDbConsistencyChecker.checkWithGroupNameNotes ( allUsersRepo , new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( "g-1" ) , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( "uuid-1" ) ) ; com.google.common.truth.Truth.assertThat ( problems ) . containsExactly ( com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo.warning ( "fail to check consistency with group name notes: Unexpected end of config file" ) ) ; }
Source:
private static void whoAmI ( ) { final java.lang.String name = com.google.gerrit.client.FormatUtil.nameEmail ( com.google.gerrit.client.Gerrit.getUserAccount ( ) ) ; final com.google.gwt.user.client.ui.InlineLabel l = new com.google.gwt.user.client.ui.InlineLabel ( name ) ; l.setStyleName ( com.google.gerrit.client.Gerrit.RESOURCES.css ( ) . menuBarUserName ( ) ) ; com.google.gerrit.client.Gerrit.menuRight.add ( l ) ; }

Target:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { if ( userPopup.isShowing ( ) ) { userPopup.hide ( ) ; } else { userPopup.showRelativeTo ( l ) ; } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.RequestCleanup.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; bind ( com.google.gerrit.client.reviewdb.ReviewDb.class ) . toProvider ( com.google.gerrit.server.config.RequestScopedReviewDbProvider.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.RequestCleanup.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; bind ( com.google.gerrit.client.reviewdb.ReviewDb.class ) . toProvider ( com.google.gerrit.server.config.RequestScopedReviewDbProvider.class ) ; bind ( IdentifiedUser.RequestFactory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; bind ( ChangeControl.Factory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; bind ( ProjectControl.Factory.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; }
Source:
private java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.UUID > collectGroups ( org.eclipse.jgit.lib.ProgressMonitor progress ) throws com.google.gwtorm.server.OrmException { progress.beginTask ( "Collecting groups" , ProgressMonitor.UNKNOWN ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { return groups.getAllUuids ( db ) . collect ( com.google.common.collect.ImmutableList.toImmutableList ( ) ) ; } finally { progress.endTask ( ) ; } }

Target:
private java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.UUID > collectGroups ( org.eclipse.jgit.lib.ProgressMonitor progress ) throws com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { progress.beginTask ( "Collecting groups" , ProgressMonitor.UNKNOWN ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { return groups.getAllGroupReferences ( db ) . map ( GroupReference :: getUUID ) . collect ( com.google.common.collect.ImmutableList.toImmutableList ( ) ) ; } finally { progress.endTask ( ) ; } }
Source:
public static com.google.gerrit.server.notedb.ChangeNotesCommit.ChangeNotesRevWalk newStagedRevWalk ( org.eclipse.jgit.lib.Repository repo , java.lang.Iterable < com.google.gerrit.server.notedb.InsertedObject > stagedObjs ) { final com.google.gerrit.server.notedb.InMemoryInserter ins = new com.google.gerrit.server.notedb.InMemoryInserter ( repo ) ; for ( com.google.gerrit.server.notedb.InsertedObject obj : stagedObjs ) { ins.insert ( obj ) ; } return new com.google.gerrit.server.notedb.ChangeNotesCommit.ChangeNotesRevWalk ( ins.newReader ( ) ) { @ java.lang.Override public void close ( ) { ins.close ( ) ; super . close ( ) ; } } ; }

Target:
public static com.google.gerrit.server.notedb.ChangeNotesCommit.ChangeNotesRevWalk newStagedRevWalk ( org.eclipse.jgit.lib.Repository repo , java.lang.Iterable < com.google.gerrit.server.git.InsertedObject > stagedObjs ) { final com.google.gerrit.server.git.InMemoryInserter ins = new com.google.gerrit.server.git.InMemoryInserter ( repo ) ; for ( com.google.gerrit.server.git.InsertedObject obj : stagedObjs ) { ins.insert ( obj ) ; } return new com.google.gerrit.server.notedb.ChangeNotesCommit.ChangeNotesRevWalk ( ins.newReader ( ) ) { @ java.lang.Override public void close ( ) { ins.close ( ) ; super . close ( ) ; } } ; }
Source:
public T decode ( byte [ ] data , int offset , int length ) { return decode ( com.google.protobuf.CodedInputStream.newInstance ( data , offset , length ) ) ; }

Target:
public T decode ( byte [ ] data , int offset , int length ) { try { return decode ( com.google.protobuf.CodedInputStream.newInstance ( data , offset , length ) ) ; } catch ( java.io.IOException err ) { throw new java.lang.RuntimeException ( "Cannot decode message" , err ) ; } }
Source:
public void publishEdit ( ) throws java.lang.Exception { org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , modifier.createEdit ( change , ps ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FORCED , modifier.modifyFile ( editUtil.byChange ( change ) . get ( ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME , com.google.gerrit.acceptance.edit.ChangeEditIT.CONTENT_NEW ) ) ; editUtil.publish ( editUtil.byChange ( change ) . get ( ) ) ; org.junit.Assert.assertFalse ( editUtil.byChange ( change ) . isPresent ( ) ) ; }

Target:
public void publishEdit ( ) throws java.lang.Exception { org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , modifier.createEdit ( change , getCurrentPatchSet ( changeId ) ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FORCED , modifier.modifyFile ( editUtil.byChange ( change ) . get ( ) , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME , com.google.gerrit.acceptance.edit.ChangeEditIT.CONTENT_NEW2 ) ) ; editUtil.publish ( editUtil.byChange ( change ) . get ( ) ) ; org.junit.Assert.assertFalse ( editUtil.byChange ( change ) . isPresent ( ) ) ; }
Source:
public com.google.gerrit.extensions.common.ChangeInfo get ( java.util.EnumSet < com.google.gerrit.extensions.common.ListChangesOption > s ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return changeJson.get ( ) . addOptions ( s ) . format ( change ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot retrieve change" , e ) ; } }

Target:
public com.google.gerrit.extensions.common.ChangeInfo get ( java.util.EnumSet < com.google.gerrit.extensions.client.ListChangesOption > s ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.CurrentUser u = user.get ( ) ; if ( u.isIdentifiedUser ( ) ) { u.asIdentifiedUser ( ) . clearStarredChanges ( ) ; } return changeJson.create ( s ) . format ( change ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot retrieve change" , e ) ; } }
Source:
public boolean allowsEdit ( final com.google.gerrit.reviewdb.client.Account.FieldName field ) { return true ; }

Target:
public boolean allowsEdit ( final com.google.gerrit.reviewdb.client.Account.FieldName field ) { if ( ( authConfig.getAuthType ( ) ) == ( com.google.gerrit.reviewdb.client.AuthType.HTTP ) ) { switch ( field ) { case USER_NAME : return false ; case FULL_NAME : return ( com.google.common.base.Strings.emptyToNull ( authConfig.getHttpDisplaynameHeader ( ) ) ) == null ; case REGISTER_NEW_EMAIL : return ( com.google.common.base.Strings.emptyToNull ( authConfig.getHttpEmailHeader ( ) ) ) == null ; default : return true ; } } else { return true ; } }
Source:
private void deleteProject ( org.eclipse.jgit.transport.URIish replicateURI ) { if ( ! ( replicateURI.isRemote ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.deleteLocally ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.info ( ( "Deleted local repository: " + replicateURI ) ) ; } else if ( com.googlesource.gerrit.plugins.replication.ReplicationQueue.isSSH ( replicateURI ) ) { deleteRemoteSsh ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.info ( ( "Deleted remote repository: " + replicateURI ) ) ; } else { com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.warn ( java.lang.String.format ( ( "Cannot delete project on remote site %s." + ( " Only local paths and SSH URLs are supported" + " for remote repository deletion" ) ) , replicateURI ) ) ; } }

Target:
private void deleteProject ( org.eclipse.jgit.transport.URIish replicateURI ) { if ( ! ( replicateURI.isRemote ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationQueue.deleteLocally ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.info ( "Deleted local repository: {}" , replicateURI ) ; } else if ( com.googlesource.gerrit.plugins.replication.ReplicationQueue.isSSH ( replicateURI ) ) { deleteRemoteSsh ( replicateURI ) ; com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.info ( "Deleted remote repository: {}" , replicateURI ) ; } else { com.googlesource.gerrit.plugins.replication.ReplicationQueue.repLog.warn ( ( "Cannot delete project on remote site {}. " + ( "Only local paths and SSH URLs are supported" + " for remote repository deletion" ) ) , replicateURI ) ; } }
Source:
private java.lang.String getTokenForScreen ( int skip ) { java.lang.String token = com.google.gerrit.common.PageLinks.toProjectBranches ( getProjectKey ( ) ) ; if ( skip > 0 ) { token += "?skip=" + skip ; } return token ; }

Target:
private java.lang.String getTokenForScreen ( java.lang.String filter , int skip ) { java.lang.String token = com.google.gerrit.common.PageLinks.toProjectBranches ( getProjectKey ( ) ) ; if ( ( filter != null ) && ( ! ( filter.isEmpty ( ) ) ) ) { token += "?filter=" + ( com.google.gwt.http.client.URL.encodeQueryString ( filter ) ) ; } if ( skip > 0 ) { if ( token.contains ( "?filter=" ) ) { token += "," ; } else { token += "?" ; } token += "skip=" + skip ; } return token ; }
Source:
public java.lang.String getPluginName ( java.io.File srcFile ) { try { return com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.plugins.JarPluginProvider.getJarPluginName ( srcFile ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( srcFile ) ) ; } catch ( java.io.IOException e ) { throw new java.lang.IllegalArgumentException ( ( ( "Invalid plugin file " + srcFile ) + ": cannot get plugin name" ) , e ) ; } }

Target:
public java.lang.String getPluginName ( java.nio.file.Path srcPath ) { try { return com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.plugins.JarPluginProvider.getJarPluginName ( srcPath ) , com.google.gerrit.server.plugins.PluginLoader.nameOf ( srcPath ) ) ; } catch ( java.io.IOException e ) { throw new java.lang.IllegalArgumentException ( ( ( "Invalid plugin file " + srcPath ) + ": cannot get plugin name" ) , e ) ; } }
Source:
private com.google.common.base.Optional < org.kohsuke.github.GHRepository > getGHRepository ( com.googlesource.gerrit.plugins.github.oauth.GitHubLogin login , com.google.gerrit.reviewdb.client.Project.NameKey gerritRepoName ) throws java.io.IOException { try { return com.google.common.base.Optional.of ( login.hub.getRepository ( gerritRepoName.get ( ) ) ) ; } catch ( java.io.FileNotFoundException e ) { com.googlesource.gerrit.plugins.github.wizard.PullRequestListController.LOG.debug ( "GitHub repository cannot be found" , gerritRepoName.get ( ) ) ; return com.google.common.base.Optional.absent ( ) ; } }

Target:
private com.google.common.base.Optional < org.kohsuke.github.GHRepository > getGHRepository ( com.googlesource.gerrit.plugins.github.oauth.GitHubLogin login , com.google.gerrit.reviewdb.client.Project.NameKey gerritRepoName ) throws java.io.IOException { try { return com.google.common.base.Optional.of ( login.getHub ( ) . getRepository ( gerritRepoName.get ( ) ) ) ; } catch ( java.io.FileNotFoundException e ) { com.googlesource.gerrit.plugins.github.wizard.PullRequestListController.LOG.debug ( "GitHub repository cannot be found" , gerritRepoName.get ( ) ) ; return com.google.common.base.Optional.absent ( ) ; } }
Source:
private boolean isTrusted ( com.google.gerrit.server.account.ExternalId id ) { if ( id.isScheme ( com.google.gerrit.server.account.ExternalId.SCHEME_MAILTO ) ) { return true ; } if ( id.isScheme ( com.google.gerrit.server.account.ExternalId.SCHEME_UUID ) ) { return true ; } if ( id.isScheme ( com.google.gerrit.server.account.ExternalId.SCHEME_USERNAME ) ) { return true ; } for ( com.google.gerrit.server.auth.openid.OpenIdProviderPattern p : trustedOpenIDs ) { if ( p.matches ( id ) ) { return true ; } } return false ; }

Target:
private boolean isTrusted ( com.google.gerrit.server.account.externalids.ExternalId id ) { if ( id.isScheme ( com.google.gerrit.server.account.externalids.ExternalId.SCHEME_MAILTO ) ) { return true ; } if ( id.isScheme ( com.google.gerrit.server.account.externalids.ExternalId.SCHEME_UUID ) ) { return true ; } if ( id.isScheme ( com.google.gerrit.server.account.externalids.ExternalId.SCHEME_USERNAME ) ) { return true ; } for ( com.google.gerrit.server.auth.openid.OpenIdProviderPattern p : trustedOpenIDs ) { if ( p.matches ( id ) ) { return true ; } } return false ; }
Source:
public void mergedChangeIsNotMerged ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = insertChange ( ) ; c.setStatus ( Change.Status.MERGED ) ; com.google.gerrit.reviewdb.client.PatchSet ps = insertPatchSet ( c ) ; java.lang.String rev = ps.getRevision ( ) . get ( ) ; assertProblems ( c , ( ( ( ( ( "Patch set 1 (" + rev ) + ") is not merged into destination ref" ) + " master (" ) + ( tip.name ( ) ) ) + "), but change status is MERGED" ) ) ; }

Target:
public void mergedChangeIsNotMerged ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = insertChange ( ) ; c.setStatus ( Change.Status.MERGED ) ; com.google.gerrit.reviewdb.client.PatchSet ps = insertPatchSet ( c ) ; java.lang.String rev = ps.getRevision ( ) . get ( ) ; assertProblems ( c , ( ( ( ( ( "Patch set 1 (" + rev ) + ") is not merged into destination ref" ) + " refs/heads/master (" ) + ( tip.name ( ) ) ) + "), but change status is MERGED" ) ) ; }
Source:
public static boolean canRead ( final com.google.gerrit.client.reviewdb.Account.Id who , final com.google.gerrit.client.reviewdb.Project.NameKey projectKey ) { final com.google.gerrit.client.data.ProjectCache.Entry e = com.google.gerrit.client.rpc.Common.getProjectCache ( ) . get ( projectKey ) ; if ( e == null ) { return false ; } final java.util.Set < com.google.gerrit.client.reviewdb.AccountGroup.Id > myGroups = com.google.gerrit.client.rpc.Common.getGroupCache ( ) . getGroups ( who ) ; return com.google.gerrit.client.rpc.BaseServiceImplementation.canPerform ( myGroups , e , ApprovalCategory.READ , ( ( short ) ( 1 ) ) , true ) ; }

Target:
public static boolean canRead ( final com.google.gerrit.client.reviewdb.Account.Id who , final com.google.gerrit.client.reviewdb.Project.NameKey projectKey ) { final com.google.gerrit.client.data.ProjectCache.Entry e = com.google.gerrit.client.rpc.Common.getProjectCache ( ) . get ( projectKey ) ; if ( e == null ) { return false ; } final java.util.Set < com.google.gerrit.client.reviewdb.AccountGroup.Id > myGroups = com.google.gerrit.client.rpc.Common.getGroupCache ( ) . getEffectiveGroups ( who ) ; return com.google.gerrit.client.rpc.BaseServiceImplementation.canPerform ( myGroups , e , ApprovalCategory.READ , ( ( short ) ( 1 ) ) , true ) ; }
Source:
public void setUp ( ) throws java.io.IOException { site = new com.google.gerrit.server.config.SitePaths ( gerrit_site.getRoot ( ) . toPath ( ) ) ; java.nio.file.Files.createDirectories ( site.etc_dir ) ; defaultLocalStorePath = ( site.site_path.toString ( ) ) + "/events-db/" ; org.mockito.Mockito.when ( cfgFactoryMock.getFromGerritConfig ( com.ericsson.gerrit.plugins.eventslog.EventsLogConfigTest.PLUGIN_NAME , true ) ) . thenReturn ( configMock ) ; }

Target:
public void setUp ( ) throws java.io.IOException { site = new com.google.gerrit.server.config.SitePaths ( gerrit_site.getRoot ( ) . toPath ( ) ) ; java.nio.file.Files.createDirectories ( site.etc_dir ) ; defaultLocalStorePath = ( site.site_path.toString ( ) ) + "/events-db/" ; defaultUrl = ( "jdbc:h2:" + ( site.data_dir.toString ( ) ) ) + "/db" ; org.mockito.Mockito.when ( cfgFactoryMock.getFromGerritConfig ( com.ericsson.gerrit.plugins.eventslog.EventsLogConfigTest.PLUGIN_NAME , true ) ) . thenReturn ( configMock ) ; }
Source:
private void showInitialScreen ( ) { com.google.gwt.user.client.History.addHistoryListener ( new com.google.gerrit.client.Link ( ) ) ; if ( "" . equals ( com.google.gwt.user.client.History.getToken ( ) ) ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { com.google.gwt.user.client.History.newItem ( Link.MINE ) ; } else { com.google.gwt.user.client.History.newItem ( Link.ALL_OPEN ) ; } } else { com.google.gwt.user.client.History.fireCurrentHistoryState ( ) ; } }

Target:
private void showInitialScreen ( ) { final com.google.gwt.user.client.ui.RootPanel sg = com.google.gwt.user.client.ui.RootPanel.get ( "gerrit_startinggerrit" ) ; sg.getElement ( ) . getParentElement ( ) . removeChild ( sg.getElement ( ) ) ; com.google.gwt.user.client.History.addHistoryListener ( new com.google.gerrit.client.Link ( ) ) ; if ( "" . equals ( com.google.gwt.user.client.History.getToken ( ) ) ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { com.google.gwt.user.client.History.newItem ( Link.MINE ) ; } else { com.google.gwt.user.client.History.newItem ( Link.ALL_OPEN ) ; } } else { com.google.gwt.user.client.History.fireCurrentHistoryState ( ) ; } }
Source:
public void onResize ( com.google.gwt.event.logical.shared.ResizeEvent event ) { int h = ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + ( reviewed.getOffsetHeight ( ) ) ; if ( ( cmA ) != null ) { cmA.setHeight ( ( ( event.getHeight ( ) ) - h ) ) ; cmA.refresh ( ) ; } if ( ( cmB ) != null ) { cmB.setHeight ( ( ( event.getHeight ( ) ) - h ) ) ; cmB.refresh ( ) ; } resizeBoxPaddings ( ) ; }

Target:
private void resizeCodeMirror ( ) { int h = ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + ( reviewed.getOffsetHeight ( ) ) ; if ( ( cmA ) != null ) { cmA.setHeight ( ( ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - h ) ) ; cmA.refresh ( ) ; } if ( ( cmB ) != null ) { cmB.setHeight ( ( ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - h ) ) ; cmB.refresh ( ) ; } }
Source:
public void testUnblockNoForce ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }
Source:
public void tearDown ( ) { if ( ( repo ) != null ) { repo.getRepository ( ) . close ( ) ; } if ( ( lifecycle ) != null ) { lifecycle.stop ( ) ; } requestContext.setContext ( null ) ; if ( ( db ) != null ) { db.close ( ) ; } com.google.gerrit.testutil.InMemoryDatabase.drop ( inMemoryDatabase ) ; }

Target:
public void tearDown ( ) { if ( ( repo ) != null ) { repo.getRepository ( ) . close ( ) ; } if ( ( lifecycle ) != null ) { lifecycle.stop ( ) ; } requestContext.setContext ( null ) ; if ( ( db ) != null ) { db.close ( ) ; } com.google.gerrit.testing.InMemoryDatabase.drop ( inMemoryDatabase ) ; }