auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean filterSessionAuth ( final com.google.gerrit.extensions.registration.DynamicItem < com.google.gerrit.httpd.WebSession > webSession , javax.servlet.http.HttpServletRequest request ) { request.setAttribute ( "gerrit-username" , webSession.get ( ) . getCurrentUser ( ) . getUserName ( ) ) ; request.setAttribute ( "gerrit-token" , webSession.get ( ) . getSessionId ( ) ) ; return true ; }

Target:
public boolean filterSessionAuth ( final com.google.inject.Provider < com.google.gerrit.httpd.WebSession > webSession , javax.servlet.http.HttpServletRequest request ) { request.setAttribute ( "gerrit-username" , webSession.get ( ) . getCurrentUser ( ) . getUserName ( ) ) ; request.setAttribute ( "gerrit-token" , webSession.get ( ) . getSessionId ( ) ) ; return true ; }
Source:
public com.gitblit.models.UserModel authenticate ( java.lang.String username , char [ ] password ) { java.lang.String passwordString = new java.lang.String ( password ) ; if ( username.equals ( GerritToGitBlitUserModel.ANONYMOUS_USER ) ) { return com.googlesource.gerrit.plugins.gitblit.auth.GerritToGitBlitUserModel.getAnonymous ( projectControl ) ; } else if ( passwordString.startsWith ( com.googlesource.gerrit.plugins.gitblit.auth.GerritToGitBlitUserService.SESSIONAUTH ) ) { return authenticateSSO ( username , passwordString.substring ( com.googlesource.gerrit.plugins.gitblit.auth.GerritToGitBlitUserService.SESSIONAUTH.length ( ) ) ) ; } else { return authenticateBasicAuth ( username , passwordString ) ; } }

Target:
public com.gitblit.models.UserModel authenticate ( java.lang.String username , char [ ] password , java.lang.String remoteIP ) { java.lang.String passwordString = new java.lang.String ( password ) ; if ( username.equals ( GerritToGitBlitUserModel.ANONYMOUS_USER ) ) { return com.googlesource.gerrit.plugins.gitblit.auth.GerritToGitBlitUserModel.getAnonymous ( projectControl ) ; } else if ( passwordString.startsWith ( com.googlesource.gerrit.plugins.gitblit.auth.GerritToGitBlitUserService.SESSIONAUTH ) ) { return authenticateSSO ( username , passwordString.substring ( com.googlesource.gerrit.plugins.gitblit.auth.GerritToGitBlitUserService.SESSIONAUTH.length ( ) ) ) ; } else { return authenticateBasicAuth ( username , passwordString ) ; } }
Source:
public org.eclipse.jgit.lib.ObjectInserter getInserter ( ) throws java.io.IOException { initRepository ( ) ; return inserter ; }

Target:
private void executeUpdateRepo ( ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException { try { com.google.gerrit.server.git.BatchUpdate.RepoContext ctx = new com.google.gerrit.server.git.BatchUpdate.RepoContext ( ) ; for ( com.google.gerrit.server.git.BatchUpdate.Op op : ops.values ( ) ) { op.updateRepo ( ctx ) ; } if ( ( inserter ) != null ) { inserter.flush ( ) ; } } catch ( java.lang.Exception e ) { com.google.common.base.Throwables.propagateIfPossible ( e , com.google.gerrit.extensions.restapi.RestApiException.class ) ; throw new com.google.gerrit.server.git.UpdateException ( e ) ; } }
Source:
private java.lang.String getLogFileCompressorTaskId ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.get ( "/config/server/tasks/" ) ; java.util.List < com.google.gerrit.server.config.ListTasks.TaskInfo > result = newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.server.config.ListTasks.TaskInfo > > ( ) { } . getType ( ) ) ; r.consume ( ) ; for ( com.google.gerrit.server.config.ListTasks.TaskInfo info : result ) { if ( "Log File Compressor" . equals ( info.command ) ) { return info.id ; } } return null ; }

Target:
private java.lang.String getLogFileCompressorTaskId ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminRestSession.get ( "/config/server/tasks/" ) ; java.util.List < com.google.gerrit.server.config.ListTasks.TaskInfo > result = newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.server.config.ListTasks.TaskInfo > > ( ) { } . getType ( ) ) ; r.consume ( ) ; for ( com.google.gerrit.server.config.ListTasks.TaskInfo info : result ) { if ( "Log File Compressor" . equals ( info.command ) ) { return info.id ; } } return null ; }
Source:
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 ( ) ; } }

Target:
private void rebase ( com.google.gerrit.acceptance.PushOneCommit.Result r ) throws java.lang.Exception { revision ( r ) . rebase ( ) ; }
Source:
private java.lang.String getFileType ( ) { java.lang.String srcType = settings.getFilename ( ) ; if ( srcType == null ) { return null ; } int dot = srcType.lastIndexOf ( '.' ) ; if ( 0 < dot ) { srcType = srcType.substring ( ( dot + 1 ) ) ; } return srcType ; }

Target:
private java.lang.String getFileType ( ) { java.lang.String srcType = settings.getFilename ( ) ; if ( srcType == null ) { return null ; } int dot = srcType.lastIndexOf ( '.' ) ; if ( dot < 0 ) { return null ; } if ( 0 < dot ) { srcType = srcType.substring ( ( dot + 1 ) ) ; } if ( "txt" . equalsIgnoreCase ( srcType ) ) { return null ; } return srcType ; }
Source:
private com.google.gerrit.server.git.BatchUpdate.ChangeContext newChangeContext ( com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChanges.get ( id ) ; if ( c == null ) { c = com.google.gerrit.server.git.BatchUpdate.unwrap ( db ) . changes ( ) . get ( id ) ; } com.google.gerrit.server.notedb.ChangeNotes notes = changeNotesFactory.createForNew ( c ) ; com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx = new com.google.gerrit.server.git.BatchUpdate.ChangeContext ( changeControlFactory.controlFor ( notes , user ) , new com.google.gerrit.server.git.BatchUpdateReviewDb ( db ) ) ; return ctx ; }

Target:
private com.google.gerrit.server.git.BatchUpdate.ChangeContext newChangeContext ( com.google.gerrit.reviewdb.server.ReviewDb db , org.eclipse.jgit.lib.Repository repo , org.eclipse.jgit.revwalk.RevWalk rw , com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChanges.get ( id ) ; if ( c == null ) { c = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( id ) ; } com.google.gerrit.server.notedb.ChangeNotes notes = changeNotesFactory.createForBatchUpdate ( c ) ; com.google.gerrit.server.project.ChangeControl ctl = changeControlFactory.controlFor ( notes , user ) ; return new com.google.gerrit.server.git.BatchUpdate.ChangeContext ( ctl , new com.google.gerrit.server.git.BatchUpdateReviewDb ( db ) , repo , rw ) ; }
Source:
public void run ( ) { store.put ( key , h ) ; }

Target:
public void put ( final K key , V val ) { final com.google.gerrit.server.cache.h2.H2CacheImpl.ValueHolder < V > h = new com.google.gerrit.server.cache.h2.H2CacheImpl.ValueHolder < > ( val ) ; h.created = com.google.gerrit.common.TimeUtil.nowMs ( ) ; mem.put ( key , h ) ; executor.execute ( ( ) -> store.put ( key , h ) ) ; }
Source:
public void onSuccess ( com.google.gerrit.common.data.PatchSetDetail result ) { if ( patchSet.getId ( ) . equals ( diffBaseId ) ) { patchTable.setVisible ( false ) ; actionsPanel.setVisible ( false ) ; } else { if ( ( patchTable ) != null ) { patchTable.removeFromParent ( ) ; } patchTable = new com.google.gerrit.client.changes.PatchTable ( ) ; patchTable.display ( diffBaseId , result ) ; body.add ( patchTable ) ; for ( com.google.gwt.event.dom.client.ClickHandler clickHandler : registeredClickHandler ) { patchTable.addClickHandler ( clickHandler ) ; } } }

Target:
public void onSuccess ( com.google.gerrit.common.data.PatchSetDetail result ) { if ( ( actionsPanel ) != null ) { actionsPanel.setVisible ( true ) ; } else { loadActionPanel ( result ) ; } loadPatchTable ( result ) ; }
Source:
public boolean evict ( final java.lang.String cacheName , final java.lang.Object key ) { return new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarder.Request ( ( ( ( ( "invalidate cache " + cacheName ) + "[" ) + key ) + "]" ) ) { @ 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 ( ) ; }

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 ( ( ( ( ( "invalidate cache " + cacheName ) + "[" ) + ( keyToString ( key ) ) ) + "]" ) ) { @ 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:
protected void doGet ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { org.eclipse.jgit.revwalk.RevWalk walk = new org.eclipse.jgit.revwalk.RevWalk ( org.eclipse.jgit.http.server.ServletUtils.getRepository ( req ) ) ; java.util.List < java.util.Map < java.lang.String , java.lang.Object > > tags ; try { tags = com.google.gitiles.RefServlet.getTags ( req , timeCache , walk , 0 ) ; } finally { walk.release ( ) ; } render ( req , res , "gitiles.refsDetail" , com.google.common.collect.ImmutableMap.of ( "branches" , com.google.gitiles.RefServlet.getBranches ( req , 0 ) , "tags" , tags ) ) ; }

Target:
protected void doGet ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { org.eclipse.jgit.revwalk.RevWalk walk = new org.eclipse.jgit.revwalk.RevWalk ( org.eclipse.jgit.http.server.ServletUtils.getRepository ( req ) ) ; java.util.List < java.util.Map < java.lang.String , java.lang.Object > > tags ; try { tags = com.google.gitiles.RefServlet.getTags ( req , timeCache , walk , 0 ) ; } finally { walk.release ( ) ; } renderHtml ( req , res , "gitiles.refsDetail" , com.google.common.collect.ImmutableMap.of ( "branches" , com.google.gitiles.RefServlet.getBranches ( req , 0 ) , "tags" , tags ) ) ; }
Source:
private void initCreateTxt ( ) { project = new com.google.gwtexpui.globalkey.client.NpTextBox ( ) ; project.setVisibleLength ( 50 ) ; project.addKeyPressHandler ( new com.google.gwt.event.dom.client.KeyPressHandler ( ) { @ java.lang.Override public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( ( event.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { doCreateProject ( ) ; } } } ) ; }

Target:
public void execute ( ) { if ( ( project.getValue ( ) . trim ( ) . length ( ) ) != 0 ) { create.setEnabled ( true ) ; } }
Source:
private void grant ( com.google.gerrit.reviewdb.Project.NameKey project , com.google.gerrit.reviewdb.ApprovalCategory.Id categoryId , com.google.gerrit.reviewdb.AccountGroup.UUID group , java.lang.String ref , int maxValue ) { grant ( project , categoryId , group , ref , maxValue , maxValue ) ; }

Target:
private com.google.gerrit.common.data.PermissionRule grant ( com.google.gerrit.server.git.ProjectConfig project , java.lang.String permissionName , com.google.gerrit.reviewdb.AccountGroup.UUID group , java.lang.String ref ) { com.google.gerrit.common.data.PermissionRule rule = newRule ( project , group ) ; project.getAccessSection ( ref , true ) . getPermission ( permissionName , true ) . add ( rule ) ; return rule ; }
Source:
private boolean requestRegistration ( final org.openid4java.message.AuthRequest aReq ) { if ( AuthRequest.SELECT_ID.equals ( aReq.getIdentity ( ) ) ) { return true ; } else { return accountManager.equals ( aReq.getIdentity ( ) ) ; } }

Target:
private boolean requestRegistration ( final org.openid4java.message.AuthRequest aReq ) { if ( AuthRequest.SELECT_ID.equals ( aReq.getIdentity ( ) ) ) { return true ; } try { return accountManager.exists ( aReq.getIdentity ( ) ) ; } catch ( com.google.gerrit.server.account.AccountException e ) { com.google.gerrit.server.openid.OpenIdServiceImpl.log.warn ( "Cannot determine if user account exists" , e ) ; return true ; } }
Source:
private void mockUnconnectableBugzilla ( ) { org.easymock.EasyMock.expect ( serverConfig.getString ( "bugzilla" , null , "url" ) ) . andReturn ( "<no-url>" ) . anyTimes ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "bugzilla" , null , "username" ) ) . andReturn ( "none" ) . anyTimes ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "bugzilla" , null , "password" ) ) . andReturn ( "none" ) . anyTimes ( ) ; }

Target:
private void mockUnconnectableBugzilla ( ) { org.easymock.EasyMock.expect ( serverConfig.getString ( "its-bugzilla" , null , "url" ) ) . andReturn ( "<no-url>" ) . anyTimes ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "its-bugzilla" , null , "username" ) ) . andReturn ( "none" ) . anyTimes ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "its-bugzilla" , null , "password" ) ) . andReturn ( "none" ) . anyTimes ( ) ; }
Source:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.account.AccountResource.Email rsrc , com.google.gerrit.server.account.PutPreferred.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException , java.io.IOException { if ( ( ( self.get ( ) ) != ( rsrc.getUser ( ) ) ) && ( ! ( self.get ( ) . getCapabilities ( ) . canModifyAccount ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "not allowed to set preferred email address" ) ; } return apply ( rsrc.getUser ( ) , rsrc.getEmail ( ) ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.account.AccountResource.Email rsrc , com.google.gerrit.server.account.PutPreferred.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gerrit.server.permissions.PermissionBackendException , com.google.gwtorm.server.OrmException , java.io.IOException { if ( ( self.get ( ) ) != ( rsrc.getUser ( ) ) ) { permissionBackend.user ( self ) . check ( GlobalPermission.MODIFY_ACCOUNT ) ; } return apply ( rsrc.getUser ( ) , rsrc.getEmail ( ) ) ; }
Source:
protected void configure ( ) { propertyExtractor = createMock ( com.googlesource.gerrit.plugins.hooks.util.PropertyExtractor.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.util.PropertyExtractor.class ) . toInstance ( propertyExtractor ) ; ruleBase = createMock ( com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.class ) . toInstance ( ruleBase ) ; actionExecutor = createMock ( com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor.class ) . toInstance ( actionExecutor ) ; bind ( com.googlesource.gerrit.plugins.hooks.its.ItsConfig.class ) . toInstance ( new com.googlesource.gerrit.plugins.hooks.its.ItsConfig ( null , null , null ) { @ java.lang.Override public boolean isEnabled ( com.google.gerrit.server.events.Event event ) { return true ; } } ) ; }

Target:
protected void configure ( ) { propertyExtractor = createMock ( com.googlesource.gerrit.plugins.hooks.util.PropertyExtractor.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.util.PropertyExtractor.class ) . toInstance ( propertyExtractor ) ; ruleBase = createMock ( com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.workflow.RuleBase.class ) . toInstance ( ruleBase ) ; actionExecutor = createMock ( com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor.class ) . toInstance ( actionExecutor ) ; itsConfig = createMock ( com.googlesource.gerrit.plugins.hooks.its.ItsConfig.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.its.ItsConfig.class ) . toInstance ( itsConfig ) ; }
Source:
public void createProject ( ) throws java.lang.Exception { java.lang.String name = name ( "foo" ) ; com.google.common.truth.Truth.assertThat ( name ) . isEqualTo ( gApi.projects ( ) . create ( name ) . get ( ) . name ) ; org.eclipse.jgit.revwalk.RevCommit head = getRemoteHead ( name , "refs/meta/config" ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/meta/config" , null , head ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/heads/master" , new java.lang.String [ ] { } ) ; }

Target:
public void createProject ( ) throws java.lang.Exception { java.lang.String name = name ( "foo" ) ; com.google.common.truth.Truth.assertThat ( name ) . isEqualTo ( gApi.projects ( ) . create ( name ) . get ( ) . name ) ; org.eclipse.jgit.revwalk.RevCommit head = getRemoteHead ( name , RefNames.REFS_CONFIG ) ; eventRecorder.assertRefUpdatedEvents ( name , RefNames.REFS_CONFIG , null , head ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/heads/master" , new java.lang.String [ ] { } ) ; }
Source:
private void enable ( final boolean on ) { showSiteHeader.setEnabled ( on ) ; useFlashClipboard.setEnabled ( on ) ; copySelfOnEmails.setEnabled ( on ) ; maximumPageSize.setEnabled ( on ) ; dateFormat.setEnabled ( on ) ; timeFormat.setEnabled ( on ) ; relativeDateInChangeTable.setEnabled ( on ) ; sizeBarInChangeTable.setEnabled ( on ) ; legacycidInChangeTable.setEnabled ( on ) ; reviewCategoryStrategy.setEnabled ( on ) ; diffView.setEnabled ( on ) ; }

Target:
private void enable ( final boolean on ) { showSiteHeader.setEnabled ( on ) ; useFlashClipboard.setEnabled ( on ) ; copySelfOnEmails.setEnabled ( on ) ; maximumPageSize.setEnabled ( on ) ; dateFormat.setEnabled ( on ) ; timeFormat.setEnabled ( on ) ; relativeDateInChangeTable.setEnabled ( on ) ; sizeBarInChangeTable.setEnabled ( on ) ; legacycidInChangeTable.setEnabled ( on ) ; muteCommonPathPrefixes.setEnabled ( on ) ; reviewCategoryStrategy.setEnabled ( on ) ; diffView.setEnabled ( on ) ; }
Source:
protected void movePointerTo ( final java.lang.Object oldId ) { if ( oldId != null ) { final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final RowItem c = com.google.gerrit.client.ui.NavigationTable.getRowItem ( row ) ; if ( ( c != null ) && ( oldId.equals ( getRowItemKey ( c ) ) ) ) { movePointerTo ( row ) ; break ; } } } }

Target:
protected int findRow ( final java.lang.Object oldId ) { if ( oldId != null ) { final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final RowItem c = com.google.gerrit.client.ui.NavigationTable.getRowItem ( row ) ; if ( ( c != null ) && ( oldId.equals ( getRowItemKey ( c ) ) ) ) { return row ; } } } return - 1 ; }
Source:
protected void afterExecute ( java.lang.Runnable r , java.lang.Throwable t ) { remove ( ( ( com.google.gerrit.server.git.WorkQueue.Task < ? > ) ( r ) ) ) ; super . afterExecute ( r , t ) ; }

Target:
protected void afterExecute ( java.lang.Runnable r , java.lang.Throwable t ) { final com.google.gerrit.server.git.WorkQueue.Task < ? > task = ( ( com.google.gerrit.server.git.WorkQueue.Task < ? > ) ( r ) ) ; if ( ! ( task.isPeriodic ( ) ) ) { remove ( task ) ; } super . afterExecute ( r , t ) ; }
Source:
public static com.google.common.cache.CacheBuilder < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > newBuilder ( ) { return com.google.common.cache.CacheBuilder.newBuilder ( ) . weigher ( new com.google.common.cache.Weigher < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > ( ) { @ java.lang.Override public int weigh ( com.google.gitiles.blame.BlameCacheImpl.Key key , java.util.List < com.google.gitiles.blame.Region > value ) { return value.size ( ) ; } } ) . maximumWeight ( ( 10 << 10 ) ) ; }

Target:
public static com.google.common.cache.CacheBuilder < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > weigher ( com.google.common.cache.CacheBuilder < ? super com.google.gitiles.blame.BlameCacheImpl.Key , ? super java.util.List < com.google.gitiles.blame.Region > > builder ) { return builder.weigher ( new com.google.common.cache.Weigher < com.google.gitiles.blame.BlameCacheImpl.Key , java.util.List < com.google.gitiles.blame.Region > > ( ) { @ java.lang.Override public int weigh ( com.google.gitiles.blame.BlameCacheImpl.Key key , java.util.List < com.google.gitiles.blame.Region > value ) { return value.size ( ) ; } } ) ; }
Source:
public void doPost ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { try { rsp.setHeader ( "Expires" , "Fri, 01 Jan 1980 00:00:00 GMT" ) ; rsp.setHeader ( "Pragma" , "no-cache" ) ; rsp.setHeader ( "Cache-Control" , "no-cache, must-revalidate" ) ; impl.doAuth ( req , rsp ) ; } catch ( java.lang.Exception e ) { getServletContext ( ) . log ( "Unexpected error during authentication" , e ) ; rsp.reset ( ) ; rsp.sendError ( 500 ) ; } }

Target:
public void doPost ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { try { com.google.gwtexpui.server.CacheHeaders.setNotCacheable ( rsp ) ; impl.doAuth ( req , rsp ) ; } catch ( java.lang.Exception e ) { getServletContext ( ) . log ( "Unexpected error during authentication" , e ) ; rsp.reset ( ) ; rsp.sendError ( 500 ) ; } }
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { for ( com.google.gerrit.reviewdb.Patch p : detail.getPatches ( ) ) { com.google.gerrit.client.ui.PatchLink.Unified link = new com.google.gerrit.client.ui.PatchLink.Unified ( p.getFileName ( ) , p.getKey ( ) , 0 , null ) ; com.google.gwt.user.client.Window.open ( link.getElement ( ) . toString ( ) , p.getFileName ( ) , null ) ; } }

Target:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { for ( com.google.gerrit.reviewdb.Patch p : detail.getPatches ( ) ) { com.google.gwt.user.client.Window.open ( ( ( ( Window.Location.getPath ( ) ) + "#" ) + ( com.google.gerrit.client.Dispatcher.toPatchUnified ( p.getKey ( ) ) ) ) , "_blank" , null ) ; } }
Source:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.git.ProjectConfig cfg ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { try ( com.google.gerrit.server.git.MetaDataUpdate md = new com.google.gerrit.server.git.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , cfg.getProject ( ) . getNameKey ( ) , db ) ) { util.tick ( 5 ) ; util.setAuthorAndCommitter ( md.getCommitBuilder ( ) ) ; md.setMessage ( "Edit\n" ) ; cfg.commit ( md ) ; org.eclipse.jgit.lib.Ref ref = db.getRef ( RefNames.REFS_CONFIG ) ; return util.getRevWalk ( ) . parseCommit ( ref.getObjectId ( ) ) ; } }

Target:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.git.ProjectConfig cfg ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { try ( com.google.gerrit.server.git.MetaDataUpdate md = new com.google.gerrit.server.git.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , cfg.getProject ( ) . getNameKey ( ) , db ) ) { util.tick ( 5 ) ; util.setAuthorAndCommitter ( md.getCommitBuilder ( ) ) ; md.setMessage ( "Edit\n" ) ; cfg.commit ( md ) ; org.eclipse.jgit.lib.Ref ref = db.exactRef ( RefNames.REFS_CONFIG ) ; return util.getRevWalk ( ) . parseCommit ( ref.getObjectId ( ) ) ; } }
Source:
private void initCompression ( boolean enableCompression ) { java.util.List < org.apache.sshd.common.NamedFactory < org.apache.sshd.common.Compression > > compressionFactories = com.google.common.collect.Lists.newArrayList ( ) ; compressionFactories.add ( new org.apache.sshd.common.compression.CompressionNone.Factory ( ) ) ; if ( enableCompression ) { compressionFactories.add ( new org.apache.sshd.common.compression.CompressionZlib.Factory ( ) ) ; } setCompressionFactories ( compressionFactories ) ; }

Target:
private void initCompression ( boolean enableCompression ) { java.util.List < org.apache.sshd.common.NamedFactory < org.apache.sshd.common.compression.Compression > > compressionFactories = new java.util.ArrayList < > ( ) ; compressionFactories.add ( BuiltinCompressions.none ) ; if ( enableCompression ) { compressionFactories.add ( BuiltinCompressions.zlib ) ; } setCompressionFactories ( compressionFactories ) ; }
Source:
private void insertOne ( T nObj ) throws com.google.gwtorm.client.OrmException { writeNewIndexes ( null , nObj ) ; final byte [ ] key = dataRowKey ( com.google.gwtorm.nosql.generic.GenericAccess.primaryKey ( nObj ) ) ; db.insert ( key , com.google.gwtorm.nosql.generic.GenericAccess.getObjectCodec ( ) . encode ( nObj ) . toByteArray ( ) ) ; }

Target:
private void insertOne ( T nObj ) throws com.google.gwtorm.client.OrmException { writeNewIndexes ( null , nObj ) ; final byte [ ] key = dataRowKey ( com.google.gwtorm.nosql.generic.GenericAccess.primaryKey ( nObj ) ) ; db.insert ( key , com.google.gwtorm.nosql.generic.GenericAccess.getObjectCodec ( ) . encodeToByteString ( nObj ) . toByteArray ( ) ) ; }
Source:
public void findOkRecord ( ) { java.util.Collection < com.google.gerrit.common.data.SubmitRecord > submitRecords = new java.util.ArrayList < > ( ) ; submitRecords.add ( com.google.gerrit.common.data.SubmitRecordTest.NOT_READY_RECORD ) ; submitRecords.add ( com.google.gerrit.common.data.SubmitRecordTest.OK_RECORD ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.common.data.SubmitRecord.findOkRecord ( submitRecords ) . isPresent ( ) ) . isTrue ( ) ; }

Target:
public void emptyResultIfInvalid ( ) { java.util.Collection < com.google.gerrit.common.data.SubmitRecord > submitRecords = new java.util.ArrayList < > ( ) ; submitRecords.add ( com.google.gerrit.common.data.SubmitRecordTest.NOT_READY_RECORD ) ; submitRecords.add ( com.google.gerrit.common.data.SubmitRecordTest.OK_RECORD ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.common.data.SubmitRecord.allRecordsOK ( submitRecords ) ) . isFalse ( ) ; }
Source:
private static void sbs2 ( final java.lang.String token , final com.google.gerrit.reviewdb.client.PatchSet.Id baseId , final com.google.gerrit.reviewdb.client.Patch.Key id , final com.google.gerrit.client.diff.DisplaySide side , final int line , final boolean edit ) { com.google.gwt.core.client.GWT.runAsync ( new com.google.gerrit.client.Dispatcher.AsyncSplit ( token ) { @ java.lang.Override public void onSuccess ( ) { com.google.gerrit.client.Gerrit.display ( token , ( edit ? new com.google.gerrit.client.editor.EditScreen ( id ) : new com.google.gerrit.client.diff.SideBySide2 ( baseId , id.getParentKey ( ) , id.get ( ) , side , line ) ) ) ; } } ) ; }

Target:
private static void sbs ( final java.lang.String token , final com.google.gerrit.reviewdb.client.PatchSet.Id baseId , final com.google.gerrit.reviewdb.client.Patch.Key id , final com.google.gerrit.client.diff.DisplaySide side , final int line , final boolean edit ) { com.google.gwt.core.client.GWT.runAsync ( new com.google.gerrit.client.Dispatcher.AsyncSplit ( token ) { @ java.lang.Override public void onSuccess ( ) { com.google.gerrit.client.Gerrit.display ( token , ( edit ? new com.google.gerrit.client.editor.EditScreen ( id ) : new com.google.gerrit.client.diff.SideBySide ( baseId , id.getParentKey ( ) , id.get ( ) , side , line ) ) ) ; } } ) ; }
Source:
public void testSubscriptionToDifferentBranches ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; createSubscription ( superRepo , "master" , "subscribed-to-project" , "foo" ) ; org.eclipse.jgit.lib.ObjectId subFoo = pushChangeTo ( subRepo , "foo" ) ; pushChangeTo ( subRepo , "master" ) ; expectToHaveSubmoduleState ( superRepo , "master" , "subscribed-to-project" , subFoo ) ; }

Target:
public void testSubscriptionToDifferentBranches ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; createSubmoduleSubscription ( superRepo , "master" , "subscribed-to-project" , "foo" ) ; org.eclipse.jgit.lib.ObjectId subFoo = pushChangeTo ( subRepo , "foo" ) ; pushChangeTo ( subRepo , "master" ) ; expectToHaveSubmoduleState ( superRepo , "master" , "subscribed-to-project" , subFoo ) ; }
Source:
private boolean isVisibleTo ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.server.IdentifiedUser user , com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { final com.google.gerrit.server.project.ProjectState pe = projectCache.get ( change.getProject ( ) ) ; if ( pe == null ) { return false ; } final com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; return pc.controlFor ( change ) . isVisible ( db ) ; }

Target:
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 { final com.google.gerrit.server.project.ProjectState pe = projectCache.get ( change.getProject ( ) ) ; if ( pe == null ) { return false ; } final com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; return pc.controlFor ( change ) . isVisible ( db ) ; }
Source:
public void onFailure ( java.lang.Throwable err ) { setTabTitle ( tabInfo , tabInfo.getTitle ( Resources.C.notAvailable ( ) ) ) ; getTab ( tabInfo ) . setError ( err.getMessage ( ) ) ; onDone ( true ) ; }

Target:
public void onFailure ( java.lang.Throwable err ) { if ( com.google.gerrit.client.change.RelatedChanges.TabCallback.isAttached ( ) ) { setTabTitle ( tabInfo , tabInfo.getTitle ( Resources.C.notAvailable ( ) ) ) ; getTab ( tabInfo ) . setError ( err.getMessage ( ) ) ; onDone ( true ) ; } }
Source:
private static org.spearce.jgit.transport.URIish expandURI ( org.spearce.jgit.transport.URIish uri , final com.google.gerrit.client.reviewdb.Project.NameKey project ) { uri = uri.setPath ( com.google.gerrit.git.PushQueue.replace ( uri.getPath ( ) , "name" , project.get ( ) ) ) ; return uri ; }

Target:
java.util.List < org.spearce.jgit.transport.URIish > getURIs ( final com.google.gerrit.client.reviewdb.Project.NameKey project ) { final java.util.List < org.spearce.jgit.transport.URIish > r = new java.util.ArrayList < org.spearce.jgit.transport.URIish > ( remote.getURIs ( ) . size ( ) ) ; for ( org.spearce.jgit.transport.URIish uri : remote.getURIs ( ) ) { uri = uri.setPath ( com.google.gerrit.git.PushQueue.replace ( uri.getPath ( ) , "name" , project.get ( ) ) ) ; r.add ( uri ) ; } return r ; }
Source:
java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > getForPatchSet ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.project.ChangeControl ctl , com.google.gerrit.reviewdb.client.PatchSet.Id psId , @ com.google.gerrit.common.Nullable org.eclipse.jgit.revwalk.RevWalk rw , @ com.google.gerrit.common.Nullable org.eclipse.jgit.lib.Config repoConfig , java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > dontCopy ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSet ps = psUtil.get ( db , ctl.getNotes ( ) , psId ) ; if ( ps == null ) { return java.util.Collections.emptyList ( ) ; } return getForPatchSet ( db , ctl , ps , rw , repoConfig , dontCopy ) ; }

Target:
java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > getForPatchSet ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.server.CurrentUser user , com.google.gerrit.reviewdb.client.PatchSet.Id psId , @ com.google.gerrit.common.Nullable org.eclipse.jgit.revwalk.RevWalk rw , @ com.google.gerrit.common.Nullable org.eclipse.jgit.lib.Config repoConfig , java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > dontCopy ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSet ps = psUtil.get ( db , notes , psId ) ; if ( ps == null ) { return java.util.Collections.emptyList ( ) ; } return getForPatchSet ( db , notes , user , ps , rw , repoConfig , dontCopy ) ; }
Source:
public com.google.gerrit.reviewdb.client.AccountGroup createEntry ( final com.google.gerrit.reviewdb.client.AccountGroup.NameKey key ) throws java.lang.Exception { final com.google.gerrit.reviewdb.client.AccountGroupName r ; final com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ; try { r = db.accountGroupNames ( ) . get ( key ) ; if ( r != null ) { return db.accountGroups ( ) . get ( r.getId ( ) ) ; } else { return null ; } } finally { db.close ( ) ; } }

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:
public void validatePreMerge ( org.eclipse.jgit.lib.Repository repo , com.google.gerrit.server.git.CodeReviewCommit commit , com.google.gerrit.server.project.ProjectState destProject , com.google.gerrit.reviewdb.client.Branch.NameKey destBranch , com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId , com.google.gerrit.server.IdentifiedUser caller ) throws com.google.gerrit.server.git.validators.MergeValidationException { java.util.List < com.google.gerrit.server.git.validators.MergeValidationListener > validators = com.google.common.collect.Lists.newLinkedList ( ) ; validators.add ( new com.google.gerrit.server.git.validators.PluginMergeValidationListener ( mergeValidationListeners ) ) ; validators.add ( projectConfigValidatorFactory.create ( ) ) ; for ( com.google.gerrit.server.git.validators.MergeValidationListener validator : validators ) { validator.onPreMerge ( repo , commit , destProject , destBranch , patchSetId , caller ) ; } }

Target:
public void validatePreMerge ( org.eclipse.jgit.lib.Repository repo , com.google.gerrit.server.git.CodeReviewCommit commit , com.google.gerrit.server.project.ProjectState destProject , com.google.gerrit.reviewdb.client.Branch.NameKey destBranch , com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId , com.google.gerrit.server.IdentifiedUser caller ) throws com.google.gerrit.server.git.validators.MergeValidationException { java.util.List < com.google.gerrit.server.git.validators.MergeValidationListener > validators = com.google.common.collect.Lists.newLinkedList ( ) ; validators.add ( new com.google.gerrit.server.git.validators.MergeValidators.PluginMergeValidationListener ( mergeValidationListeners ) ) ; validators.add ( projectConfigValidatorFactory.create ( ) ) ; for ( com.google.gerrit.server.git.validators.MergeValidationListener validator : validators ) { validator.onPreMerge ( repo , commit , destProject , destBranch , patchSetId , caller ) ; } }
Source:
private void deployPlugin ( ) throws java.io.IOException , java.lang.InterruptedException { locatePaths ( ) ; retrievePluginName ( ) ; buildPluginJar ( ) ; createTestSite ( ) ; copyJarToTestSite ( ) ; }

Target:
protected void setPluginConfigString ( java.lang.String name , java.lang.String value ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.server.config.SitePaths sitePath = new com.google.gerrit.server.config.SitePaths ( testSite ) ; org.eclipse.jgit.storage.file.FileBasedConfig cfg = getGerritConfigFile ( sitePath ) ; cfg.load ( ) ; cfg.setString ( "plugin" , pluginName , name , value ) ; cfg.save ( ) ; }
Source:
private void addSshKeys ( java.util.List < java.lang.String > sshKeys ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.permissions.PermissionBackendException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { for ( java.lang.String sshKey : sshKeys ) { com.google.gerrit.extensions.common.SshKeyInput in = new com.google.gerrit.extensions.common.SshKeyInput ( ) ; in.raw = com.google.gerrit.common.RawInputUtil.create ( sshKey.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) , "plain/text" ) ; addSshKey.apply ( rsrc , in ) ; } }

Target:
private void addSshKeys ( java.util.List < java.lang.String > sshKeys ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.permissions.PermissionBackendException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { for ( java.lang.String sshKey : sshKeys ) { com.google.gerrit.extensions.api.accounts.SshKeyInput in = new com.google.gerrit.extensions.api.accounts.SshKeyInput ( ) ; in.raw = com.google.gerrit.common.RawInputUtil.create ( sshKey.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) , "plain/text" ) ; addSshKey.apply ( rsrc , in ) ; } }
Source:
public void renameFile ( java.lang.String oldFilePath , java.lang.String newFilePath ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeEdits.Post.Input renameInput = new com.google.gerrit.server.change.ChangeEdits.Post.Input ( ) ; renameInput.oldPath = oldFilePath ; renameInput.newPath = newFilePath ; changeEditsPost.apply ( changeResource , renameInput ) ; } catch ( java.io.IOException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot rename file of change edit" , e ) ; } }

Target:
public void renameFile ( java.lang.String oldFilePath , java.lang.String newFilePath ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeEdits.Post.Input renameInput = new com.google.gerrit.server.change.ChangeEdits.Post.Input ( ) ; renameInput.oldPath = oldFilePath ; renameInput.newPath = newFilePath ; changeEditsPost.apply ( changeResource , renameInput ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot rename file of change edit" , e ) ; } }
Source:
public void testUpdateOneModified ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 0 ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.update ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; org.junit.Assert.fail ( "missing OrmConcurrencyException" ) ; } catch ( com.google.gwtorm.client.OrmConcurrencyException e ) { } }

Target:
public void testUpdateOneConcurrentlyModifiedException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 0 ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.update ( oneRow ) ; org.junit.Assert.fail ( "missing OrmConcurrencyException" ) ; } catch ( com.google.gwtorm.server.OrmConcurrencyException e ) { } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; }
Source:
private com.google.gerrit.server.patch.PatchList getPatchList ( com.vmware.gerrit.owners.common.Event event , com.google.gerrit.reviewdb.client.Change change ) { org.eclipse.jgit.lib.ObjectId newId = null ; if ( ( event.getNewObjectId ( ) ) != null ) { newId = org.eclipse.jgit.lib.ObjectId.fromString ( event.getNewObjectId ( ) ) ; } com.google.gerrit.server.patch.PatchListKey plKey = new com.google.gerrit.server.patch.PatchListKey ( change.getProject ( ) , null , newId , com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace.IGNORE_NONE ) ; try { return patchListCache.get ( plKey ) ; } catch ( com.google.gerrit.server.patch.PatchListNotAvailableException e ) { com.vmware.gerrit.owners.common.GitRefListener.logger.warn ( "Could not load patch list: {}" , plKey , e ) ; } return null ; }

Target:
private com.google.gerrit.server.patch.PatchList getPatchList ( com.vmware.gerrit.owners.common.Event event , com.google.gerrit.reviewdb.client.Change change ) { org.eclipse.jgit.lib.ObjectId newId = null ; if ( ( event.getNewObjectId ( ) ) != null ) { newId = org.eclipse.jgit.lib.ObjectId.fromString ( event.getNewObjectId ( ) ) ; } com.google.gerrit.server.patch.PatchListKey plKey = new com.google.gerrit.server.patch.PatchListKey ( null , newId , com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_NONE ) ; try { return patchListCache.get ( plKey , change.getProject ( ) ) ; } catch ( com.google.gerrit.server.patch.PatchListNotAvailableException e ) { com.vmware.gerrit.owners.common.GitRefListener.logger.warn ( "Could not load patch list: {}" , plKey , e ) ; } return null ; }
Source:
private static void assertFormat ( long ageFromNow , long timeUnit , java.lang.String expectedFormat ) { java.util.Date d = new java.util.Date ( ( ( java.lang.System.currentTimeMillis ( ) ) - ( ageFromNow * timeUnit ) ) ) ; java.lang.String s = org.eclipse.jgit.util.RelativeDateFormatter.format ( d ) ; org.junit.Assert.assertEquals ( expectedFormat , s ) ; }

Target:
private static void assertFormat ( long ageFromNow , long timeUnit , java.lang.String expectedFormat ) { java.util.Date d = new java.util.Date ( ( ( java.lang.System.currentTimeMillis ( ) ) - ( ageFromNow * timeUnit ) ) ) ; java.lang.String s = com.google.gerrit.client.RelativeDateFormatter.format ( d ) ; org.junit.Assert.assertEquals ( expectedFormat , s ) ; }
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 ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_BAD_REQUEST , r.getStatusCode ( ) ) ; 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 ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.post ( "/changes/" , ci ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_BAD_REQUEST , r.getStatusCode ( ) ) ; org.junit.Assert.assertTrue ( r.getEntityContent ( ) . contains ( "unsupported change status" ) ) ; }
Source:
public static java.util.Set < java.lang.String > accountFields ( com.google.gerrit.index.QueryOptions opts ) { java.util.Set < java.lang.String > fs = opts.fields ( ) ; return fs.contains ( AccountField.ID.getName ( ) ) ? fs : com.google.common.collect.Sets.union ( fs , com.google.common.collect.ImmutableSet.of ( AccountField.ID.getName ( ) ) ) ; }

Target:
public static java.util.Set < java.lang.String > accountFields ( java.util.Set < java.lang.String > fields ) { return fields.contains ( AccountField.ID.getName ( ) ) ? fields : com.google.common.collect.Sets.union ( fields , com.google.common.collect.ImmutableSet.of ( AccountField.ID.getName ( ) ) ) ; }
Source:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource resource ) { boolean canRestore = false ; try { canRestore = resource.getControl ( ) . canRestore ( dbProvider.get ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.change.Restore.log.error ( "Cannot check canRestore status. Assuming false." , e ) ; } return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Restore" ) . setTitle ( "Restore the change" ) . setVisible ( ( ( ( resource.getChange ( ) . getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.ABANDONED ) ) && canRestore ) ) ; }

Target:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setLabel ( "Restore" ) . setTitle ( "Restore the change" ) . setVisible ( ( ( ( rsrc.getChange ( ) . getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.ABANDONED ) ) && ( rsrc.permissions ( ) . database ( dbProvider ) . testOrFalse ( ChangePermission.RESTORE ) ) ) ) ; }
Source:
public void addSection ( final com.google.gerrit.client.changes.ChangeTable.Section s ) { assert ( s.table ) == null ; if ( ( s.titleText ) != null ) { s.titleRow = getRowCount ( ) ; setText ( s.titleRow , 0 , s.titleText ) ; getFlexCellFormatter ( ) . setColSpan ( s.titleRow , 0 , com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; setStyleName ( s.titleRow , 0 , "gerrit-ChangeTable-SectionHeader" ) ; } else { s.titleRow = - 1 ; } s.table = this ; s.dataBegin = getRowCount ( ) ; insertNoneRow ( s.dataBegin ) ; sections.add ( s ) ; }

Target:
private void insertNoneRow ( final int row ) { insertRow ( row ) ; table.setText ( row , 0 , Util.C.changeTableNone ( ) ) ; table.getFlexCellFormatter ( ) . setColSpan ( row , 0 , com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; setStyleName ( row , 0 , "gerrit-ChangeTable-EmptySectionRow" ) ; }
Source:
public void testEmpty1 ( ) { final java.lang.String name = "empty-file" ; final com.google.gerrit.server.patch.PatchListEntry e = com.google.gerrit.server.patch.PatchListEntry.empty ( name ) ; assertNull ( e.getOldName ( ) ) ; assertEquals ( name , e.getNewName ( ) ) ; assertSame ( Patch.PatchType.BINARY , e.getPatchType ( ) ) ; assertSame ( Patch.ChangeType.MODIFIED , e.getChangeType ( ) ) ; assertNotNull ( e.getFileHeader ( ) ) ; assertTrue ( e.getEdits ( ) . isEmpty ( ) ) ; }

Target:
public void testEmpty1 ( ) { final java.lang.String name = "empty-file" ; final com.google.gerrit.server.patch.PatchListEntry e = com.google.gerrit.server.patch.PatchListEntry.empty ( name ) ; assertNull ( e.getOldName ( ) ) ; assertEquals ( name , e.getNewName ( ) ) ; assertSame ( Patch.PatchType.UNIFIED , e.getPatchType ( ) ) ; assertSame ( Patch.ChangeType.MODIFIED , e.getChangeType ( ) ) ; assertTrue ( e.getEdits ( ) . isEmpty ( ) ) ; }
Source:
public void createEmptyChange_MissingBranch ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo ci = new com.google.gerrit.extensions.common.ChangeInfo ( ) ; ci.project = project.get ( ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.post ( "/changes/" , ci ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_BAD_REQUEST , r.getStatusCode ( ) ) ; r.getEntityContent ( ) . contains ( "branch must be non-empty" ) ; }

Target:
public void createEmptyChange_MissingBranch ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo ci = new com.google.gerrit.extensions.common.ChangeInfo ( ) ; ci.project = project.get ( ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.post ( "/changes/" , ci ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_BAD_REQUEST , r.getStatusCode ( ) ) ; org.junit.Assert.assertTrue ( r.getEntityContent ( ) . contains ( "branch must be non-empty" ) ) ; }