auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gerrit.reviewdb.server.ReviewDb open ( ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.server.ReviewDb db = delegate.open ( ) ; if ( ! ( migration.readChanges ( ) ) ) { return db ; } if ( migration.disableChangeReviewDb ( ) ) { db = new com.google.gerrit.server.schema.NoChangesReviewDbWrapper ( db ) ; } return new com.google.gerrit.reviewdb.server.DisallowReadFromChangesReviewDbWrapper ( db ) ; }

Target:
public com.google.gerrit.reviewdb.server.ReviewDb open ( ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.server.ReviewDb db = delegate.open ( ) ; if ( migration.readChanges ( ) ) { if ( migration.disableChangeReviewDb ( ) ) { db = new com.google.gerrit.server.schema.NoChangesReviewDbWrapper ( db ) ; } db = new com.google.gerrit.reviewdb.server.DisallowReadFromChangesReviewDbWrapper ( db ) ; } if ( groupsMigration.readFromNoteDb ( ) ) { db = new com.google.gerrit.reviewdb.server.DisallowReadFromGroupsReviewDbWrapper ( db ) ; } return db ; }
Source:
private void preMerge ( final com.google.gerrit.server.git.SubmitStrategy strategy , final java.util.List < com.google.gerrit.server.git.CodeReviewCommit > toMerge ) throws com.google.gerrit.server.git.MergeException { mergeTip = strategy.run ( branchTip , toMerge ) ; refLogIdent = strategy.getRefLogIdent ( ) ; commits.putAll ( strategy.getNewCommits ( ) ) ; }

Target:
private com.google.gerrit.server.git.MergeTip preMerge ( com.google.gerrit.server.git.strategy.SubmitStrategy strategy , java.util.List < com.google.gerrit.server.git.CodeReviewCommit > toMerge ) throws com.google.gerrit.server.git.MergeException { logDebug ( "Running submit strategy for commits" , strategy.getClass ( ) . getSimpleName ( ) , toMerge.size ( ) ) ; mergeTip = strategy.run ( branchTip , toMerge ) ; refLogIdent = strategy.getRefLogIdent ( ) ; logDebug ( "Produced new commits" , strategy.getNewCommits ( ) . size ( ) ) ; commits.putAll ( strategy.getNewCommits ( ) ) ; return mergeTip ; }
Source:
public boolean equals ( final java.lang.Object o ) { return ( ( o instanceof com.google.gerrit.client.reviewdb.AccountGroupMember.Key ) && ( ( ( com.google.gerrit.client.reviewdb.AccountGroupMember.Key ) ( o ) ) . accountId.equals ( accountId ) ) ) && ( ( ( com.google.gerrit.client.reviewdb.AccountGroupMember.Key ) ( o ) ) . groupId.equals ( groupId ) ) ; }

Target:
public com.google.gerrit.client.reviewdb.com.google.gwtorm [ ] members ( ) { return new com.google.gwtorm.client.Key < ? > [ ] { groupId } ; }
Source:
public void errorWhileSendingErrorMessage ( ) throws java.lang.Exception { org.easymock.EasyMock.expect ( request.getPathInfo ( ) ) . andReturn ( "/someCache" ) ; java.lang.String errorMessage = "someError" ; org.easymock.EasyMock.expect ( request.getReader ( ) ) . andThrow ( new java.io.IOException ( errorMessage ) ) ; response.sendError ( javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST , errorMessage ) ; org.easymock.EasyMock.expectLastCall ( ) . andThrow ( new java.io.IOException ( "someOtherError" ) ) ; replayAll ( ) ; servlet.doPost ( request , response ) ; verifyAll ( ) ; }

Target:
private void verifyResponseIsOK ( ) throws java.lang.Exception { servlet.doPost ( request , response ) ; org.mockito.Mockito.verify ( response ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; }
Source:
public void currentPatchSetMissing ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = insertChange ( ) ; assertProblems ( c , "Current patch set 1 not found" ) ; }

Target:
public void missingDestRef ( ) throws java.lang.Exception { com.google.gerrit.server.project.ChangeControl ctl = insertChange ( ) ; java.lang.String ref = "refs/heads/master" ; testRepo.reset ( testRepo.getRepository ( ) . exactRef ( ref ) . getObjectId ( ) ) ; org.eclipse.jgit.lib.RefUpdate ru = testRepo.getRepository ( ) . updateRef ( ref ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assertThat ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; assertProblems ( ctl , null , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Destination ref not found (may be new branch): " + ref ) ) ) ; }
Source:
public void clearPublicKeyStore ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.Ref ref = repo.getRef ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) ; if ( ref != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assertThat ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }

Target:
public void clearPublicKeyStore ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.Ref ref = repo.exactRef ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) ; if ( ref != null ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) ; ru.setForceUpdate ( true ) ; com.google.common.truth.Truth.assertThat ( ru.delete ( ) ) . isEqualTo ( RefUpdate.Result.FORCED ) ; } } }
Source:
private static java.lang.String formatChangeUrl ( java.lang.String url , com.google.gerrit.reviewdb.client.Change change ) { java.lang.StringBuilder m = new java.lang.StringBuilder ( ) . append ( " " ) . append ( url ) . append ( change.getChangeId ( ) ) . append ( " " ) . append ( com.google.gerrit.server.ChangeUtil.cropSubject ( change.getSubject ( ) ) ) ; if ( ( change.getStatus ( ) ) == ( Change.Status.DRAFT ) ) { m.append ( " [DRAFT]" ) ; } return m.toString ( ) ; }

Target:
private static java.lang.String formatChangeUrl ( java.lang.String url , com.google.gerrit.reviewdb.client.Change change , java.lang.String subject , boolean draft , boolean edit ) { java.lang.StringBuilder m = new java.lang.StringBuilder ( ) . append ( " " ) . append ( url ) . append ( change.getChangeId ( ) ) . append ( " " ) . append ( com.google.gerrit.server.ChangeUtil.cropSubject ( subject ) ) ; if ( draft ) { m.append ( " [DRAFT]" ) ; } if ( edit ) { m.append ( " [EDIT]" ) ; } return m.toString ( ) ; }
Source:
private boolean isRefDeleted ( com.google.gerrit.server.events.RefUpdatedEvent event ) { if ( event.refUpdate.newRev.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) . getName ( ) ) ) { com.googlesource.gerrit.plugins.refprotection.RefUpdateListener.log.info ( java.lang.String.format ( "Ref Deleted: project [%s] refname [%s] old object id [%s]" , event.getProjectNameKey ( ) . toString ( ) , event.getRefName ( ) , event.refUpdate.oldRev ) ) ; return true ; } return false ; }

Target:
private boolean isRefDeleted ( com.google.gerrit.server.events.RefUpdatedEvent event ) { com.google.gerrit.server.data.RefUpdateAttribute refUpdate = event.refUpdate.get ( ) ; if ( refUpdate.newRev.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) . getName ( ) ) ) { com.googlesource.gerrit.plugins.refprotection.RefUpdateListener.log.info ( java.lang.String.format ( "Ref Deleted: project [%s] refname [%s] old object id [%s]" , event.getProjectNameKey ( ) . toString ( ) , event.getRefName ( ) , refUpdate.oldRev ) ) ; return true ; } return false ; }
Source:
com.google.gerrit.extensions.client.Side getStoredSideFromDisplaySide ( com.google.gerrit.client.diff.DisplaySide side ) { return ( side == ( DisplaySide.A ) ) && ( ( base ) == null ) ? com.google.gerrit.extensions.client.Side.PARENT : com.google.gerrit.extensions.client.Side.REVISION ; }

Target:
com.google.gerrit.client.diff.DisplaySide displaySide ( com.google.gerrit.client.changes.CommentInfo info , com.google.gerrit.client.diff.DisplaySide forSide ) { if ( ( info.side ( ) ) == ( com.google.gerrit.extensions.client.Side.PARENT ) ) { return ( ( base ) == null ) || ( ( base.get ( ) ) < 0 ) ? DisplaySide.A : null ; } return forSide ; }
Source:
public com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme getDownloadUrl ( ) { if ( ( downloadUrl ) == null ) { return null ; } return com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.valueOf ( downloadUrl ) ; }

Target:
public java.lang.String getDownloadUrl ( ) { if ( ( downloadUrl ) != null ) { switch ( downloadUrl ) { case "ANON_GIT" : return CoreDownloadSchemes.ANON_GIT ; case "ANON_HTTP" : return CoreDownloadSchemes.ANON_HTTP ; case "HTTP" : return CoreDownloadSchemes.HTTP ; case "SSH" : return CoreDownloadSchemes.SSH ; case "REPO_DOWNLOAD" : return CoreDownloadSchemes.REPO_DOWNLOAD ; } } return downloadUrl ; }
Source:
private com.google.inject.Injector createCfgInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; modules.add ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toProvider ( com.google.gerrit.server.config.SitePathFromSystemConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; modules.add ( new com.google.gerrit.server.config.GerritServerConfigModule ( ) ) ; modules.add ( new com.google.gerrit.server.config.AuthConfigModule ( ) ) ; return dbInjector.createChildInjector ( modules ) ; }

Target:
private com.google.inject.Injector createCfgInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; if ( ( sitePath ) == null ) { modules.add ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toProvider ( com.google.gerrit.server.config.SitePathFromSystemConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; } } ) ; modules.add ( new com.google.gerrit.server.config.GerritServerConfigModule ( ) ) ; } modules.add ( new com.google.gerrit.server.config.AuthConfigModule ( ) ) ; return dbInjector.createChildInjector ( modules ) ; }
Source:
public void afterUpdateRepos ( ) throws com.google.gerrit.extensions.restapi.ResourceConflictException { try { markCleanMerges ( ) ; checkCommitStatus ( ) ; findUnmergedChanges ( ) ; } catch ( com.google.gerrit.server.git.IntegrationException e ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( e.getMessage ( ) , e ) ; } }

Target:
public void afterUpdateRepos ( ) throws com.google.gerrit.extensions.restapi.ResourceConflictException { try { markCleanMerges ( ) ; java.util.List < com.google.gerrit.reviewdb.client.Change.Id > alreadyMerged = checkCommitStatus ( ) ; findUnmergedChanges ( alreadyMerged ) ; } catch ( com.google.gerrit.server.git.IntegrationException e ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( e.getMessage ( ) , e ) ; } }
Source:
protected void movePointerTo ( final int newRow ) { super . movePointerTo ( newRow ) ; if ( ( ( 0 <= newRow ) && ( newRow < ( table.getRowCount ( ) ) ) ) && ( ( getRowItem ( newRow ) ) != null ) ) { delSel.setEnabled ( true ) ; } else { delSel.setEnabled ( false ) ; } }

Target:
protected boolean onKeyPress ( final char keyCode , final int modifiers ) { if ( super . onKeyPress ( keyCode , modifiers ) ) { return true ; } if ( modifiers == 0 ) { switch ( keyCode ) { case 's' : case 'c' : toggleCurrentRow ( ) ; return true ; } } return false ; }
Source:
private java.util.List < com.google.gerrit.extensions.api.projects.TagInfo > listTags ( com.google.gerrit.server.api.projects.ListRefsRequest < com.google.gerrit.extensions.api.projects.TagInfo > request ) throws com.google.gerrit.extensions.restapi.RestApiException { listTags.setLimit ( request.getLimit ( ) ) ; listTags.setStart ( request.getStart ( ) ) ; listTags.setMatchSubstring ( request.getSubstring ( ) ) ; listTags.setMatchRegex ( request.getRegex ( ) ) ; try { return listTags.apply ( checkExists ( ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot list tags" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.projects.DashboardApi dashboard ( java.lang.String name ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return dashboardApi.create ( checkExists ( ) , name ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot parse dashboard" , e ) ; } }
Source:
private com.google.inject.Key < javax.servlet.http.HttpServlet > changeQuery ( ) { return key ( new javax.servlet.http.HttpServlet ( ) { private static final long serialVersionUID = 1L ; @ java.lang.Override protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { toGerrit ( com.google.gerrit.common.PageLinks.toChangeQuery ( req.getPathInfo ( ) ) , req , rsp ) ; } } ) ; }

Target:
private com.google.inject.Key < javax.servlet.http.HttpServlet > directChangeById ( ) { return key ( new javax.servlet.http.HttpServlet ( ) { private static final long serialVersionUID = 1L ; @ java.lang.Override protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { try { com.google.gerrit.reviewdb.Change.Id id = Change.Id.parse ( req.getPathInfo ( ) ) ; com.google.gerrit.httpd.UrlModule.toGerrit ( com.google.gerrit.common.PageLinks.toChange ( id ) , req , rsp ) ; } catch ( java.lang.IllegalArgumentException err ) { rsp.sendError ( HttpServletResponse.SC_NOT_FOUND ) ; } } } ) ; }
Source:
private void formatHtmlDiff ( java.io.OutputStream out , org.eclipse.jgit.lib.Repository repo , org.eclipse.jgit.treewalk.AbstractTreeIterator oldTree , org.eclipse.jgit.treewalk.AbstractTreeIterator newTree , java.lang.String path ) throws java.io.IOException { org.eclipse.jgit.diff.DiffFormatter diff = new com.google.gitiles.HtmlDiffFormatter ( renderer , out ) ; try { if ( ! ( path.equals ( "" ) ) ) { diff.setPathFilter ( org.eclipse.jgit.treewalk.filter.PathFilter.create ( path ) ) ; } diff.setRepository ( repo ) ; diff.setDetectRenames ( true ) ; diff.format ( oldTree , newTree ) ; } finally { diff.release ( ) ; } }

Target:
private void formatHtmlDiff ( java.io.OutputStream out , com.google.gitiles.GitilesView view , org.eclipse.jgit.lib.Repository repo , org.eclipse.jgit.treewalk.AbstractTreeIterator oldTree , org.eclipse.jgit.treewalk.AbstractTreeIterator newTree , java.lang.String path ) throws java.io.IOException { org.eclipse.jgit.diff.DiffFormatter diff = new com.google.gitiles.HtmlDiffFormatter ( renderer , view , out ) ; try { if ( ! ( path.equals ( "" ) ) ) { diff.setPathFilter ( org.eclipse.jgit.treewalk.filter.PathFilter.create ( path ) ) ; } diff.setRepository ( repo ) ; diff.setDetectRenames ( true ) ; diff.format ( oldTree , newTree ) ; } finally { diff.release ( ) ; } }
Source:
public static com.google.gerrit.extensions.common.GroupOptionsInfo createOptions ( com.google.gerrit.common.data.GroupDescription.Basic group ) { com.google.gerrit.extensions.common.GroupOptionsInfo options = new com.google.gerrit.extensions.common.GroupOptionsInfo ( ) ; com.google.gerrit.reviewdb.client.AccountGroup ag = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( group ) ; if ( ( ag != null ) && ( ag.isVisibleToAll ( ) ) ) { options.visibleToAll = true ; } return options ; }

Target:
public static com.google.gerrit.extensions.common.GroupOptionsInfo createOptions ( com.google.gerrit.common.data.GroupDescription.Basic group ) { com.google.gerrit.extensions.common.GroupOptionsInfo options = new com.google.gerrit.extensions.common.GroupOptionsInfo ( ) ; if ( ( com.google.gerrit.server.group.GroupJson.isInternalGroup ( group ) ) && ( ( ( com.google.gerrit.common.data.GroupDescription.Internal ) ( group ) ) . isVisibleToAll ( ) ) ) { options.visibleToAll = true ; } return options ; }
Source:
private void testPushWithMultipleChangeIds ( ) throws java.lang.Exception { }

Target:
private void testPushWithMultipleChangeIds ( ) throws java.lang.Exception { com.google.gerrit.acceptance.git.AbstractPushForReview.createCommit ( testRepo , ( "Message with multiple Change-Id\n" + ( ( "\n" + "Change-Id: I10f98c2ef76e52e23aa23be5afeb71e40b350e86\n" ) + "Change-Id: Ie9a132e107def33bdd513b7854b50de911edba0a\n" ) ) ) ; com.google.gerrit.acceptance.git.AbstractPushForReview.pushForReviewRejected ( testRepo , "multiple Change-Id lines in commit message footer" ) ; com.google.gerrit.server.git.ProjectConfig config = projectCache.checkedGet ( project ) . getConfig ( ) ; config.getProject ( ) . setRequireChangeID ( InheritableBoolean.FALSE ) ; saveProjectConfig ( project , config ) ; com.google.gerrit.acceptance.git.AbstractPushForReview.pushForReviewRejected ( testRepo , "multiple Change-Id lines in commit message footer" ) ; }
Source:
protected void pushSubscriptionConfig ( org.eclipse.jgit.junit.TestRepository < ? > repo , java.lang.String branch , org.eclipse.jgit.lib.Config config ) throws java.lang.Exception { repo.branch ( "HEAD" ) . commit ( ) . insertChangeId ( ) . message ( "subject: adding new subscription" ) . add ( ".gitmodules" , config.toText ( ) . toString ( ) ) . create ( ) ; repo.git ( ) . push ( ) . setRemote ( "origin" ) . setRefSpecs ( new org.eclipse.jgit.transport.RefSpec ( ( "HEAD:refs/heads/" + branch ) ) ) . call ( ) ; }

Target:
protected void pushSubmoduleConfig ( org.eclipse.jgit.junit.TestRepository < ? > repo , java.lang.String branch , org.eclipse.jgit.lib.Config config ) throws java.lang.Exception { repo.branch ( "HEAD" ) . commit ( ) . insertChangeId ( ) . message ( "subject: adding new subscription" ) . add ( ".gitmodules" , config.toText ( ) . toString ( ) ) . create ( ) ; repo.git ( ) . push ( ) . setRemote ( "origin" ) . setRefSpecs ( new org.eclipse.jgit.transport.RefSpec ( ( "HEAD:refs/heads/" + branch ) ) ) . call ( ) ; }
Source:
private void deleteAll ( ) throws java.io.IOException { for ( java.lang.String index : com.google.gerrit.lucene.IndexVersionCheck.SCHEMA_VERSIONS.keySet ( ) ) { java.io.File file = new java.io.File ( sitePaths.index_dir , index ) ; if ( file.exists ( ) ) { org.apache.lucene.store.Directory dir = org.apache.lucene.store.FSDirectory.open ( file ) ; try { for ( java.lang.String name : dir.listAll ( ) ) { dir.deleteFile ( name ) ; } } finally { dir.close ( ) ; } } } }

Target:
private void deleteAll ( ) throws java.io.IOException { if ( dryRun ) { return ; } for ( java.lang.String index : com.google.gerrit.lucene.IndexVersionCheck.SCHEMA_VERSIONS.keySet ( ) ) { java.io.File file = new java.io.File ( sitePaths.index_dir , index ) ; if ( file.exists ( ) ) { org.apache.lucene.store.Directory dir = org.apache.lucene.store.FSDirectory.open ( file ) ; try { for ( java.lang.String name : dir.listAll ( ) ) { dir.deleteFile ( name ) ; } } finally { dir.close ( ) ; } } } }
Source:
public com.google.gerrit.extensions.common.PluginInfo apply ( com.google.gerrit.server.plugins.PluginResource resource , com.google.gerrit.server.plugins.DisablePlugin.Input input ) throws com.google.gerrit.extensions.restapi.MethodNotAllowedException { if ( ! ( loader.isRemoteAdminEnabled ( ) ) ) { throw new com.google.gerrit.extensions.restapi.MethodNotAllowedException ( "remote plugin administration is disabled" ) ; } java.lang.String name = resource.getName ( ) ; loader.disablePlugins ( com.google.common.collect.ImmutableSet.of ( name ) ) ; return com.google.gerrit.server.plugins.ListPlugins.toPluginInfo ( loader.get ( name ) ) ; }

Target:
public com.google.gerrit.extensions.common.PluginInfo apply ( com.google.gerrit.server.plugins.PluginResource resource , com.google.gerrit.server.plugins.DisablePlugin.Input input ) throws com.google.gerrit.extensions.restapi.RestApiException { try { permissionBackend.user ( user ) . check ( GlobalPermission.ADMINISTRATE_SERVER ) ; } catch ( com.google.gerrit.server.permissions.PermissionBackendException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Could not check permission" , e ) ; } if ( ! ( loader.isRemoteAdminEnabled ( ) ) ) { throw new com.google.gerrit.extensions.restapi.MethodNotAllowedException ( "remote plugin administration is disabled" ) ; } java.lang.String name = resource.getName ( ) ; loader.disablePlugins ( com.google.common.collect.ImmutableSet.of ( name ) ) ; return com.google.gerrit.server.plugins.ListPlugins.toPluginInfo ( loader.get ( name ) ) ; }
Source:
private java.lang.String extractWhat ( java.lang.String commandName , java.lang.String [ ] args ) { java.lang.String result = commandName ; if ( "gerrit" . equals ( commandName ) ) { if ( ( args.length ) > 1 ) result = ( "gerrit" + "." ) + ( args [ 1 ] ) ; } return result ; }

Target:
void audit ( com.google.gerrit.sshd.SshScope.Context ctx , java.lang.Object result , com.google.gerrit.sshd.DispatchCommand cmd ) { final java.lang.String sid = extractSessionId ( ctx ) ; final long created = extractCreated ( ctx ) ; auditService.dispatch ( new com.google.gerrit.audit.SshAuditEvent ( sid , extractCurrentUser ( ctx ) , extractWhat ( cmd ) , created , extractParameters ( cmd ) , result ) ) ; }
Source:
private static void appendTextFromChildren ( java.lang.StringBuilder b , org.pegdown.ast.Node node ) { for ( org.pegdown.ast.Node child : node.getChildren ( ) ) { if ( child instanceof org.pegdown.ast.TextNode ) { b.append ( ( ( org.pegdown.ast.TextNode ) ( child ) ) . getText ( ) ) ; } else { com.google.gitiles.doc.MarkdownUtil.appendTextFromChildren ( b , child ) ; } } }

Target:
private static void appendTextFromChildren ( java.lang.StringBuilder b , org.commonmark.node.Node node ) { for ( org.commonmark.node.Node c = node.getFirstChild ( ) ; c != null ; c = c.getNext ( ) ) { if ( c instanceof org.commonmark.node.Text ) { b.append ( ( ( org.commonmark.node.Text ) ( c ) ) . getLiteral ( ) ) ; } else { com.google.gitiles.doc.MarkdownUtil.appendTextFromChildren ( b , c ) ; } } }
Source:
public void testIsEnabledRefUpdatedEvent ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { } ; setupIsEnabled ( "true" , null , branches ) ; com.google.gerrit.server.events.RefUpdatedEvent event = new com.google.gerrit.server.events.RefUpdatedEvent ( ) ; event.refUpdate = new com.google.gerrit.server.data.RefUpdateAttribute ( ) ; event.refUpdate.project = "testProject" ; event.refUpdate.refName = "refs/heads/testBranch" ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertTrue ( itsConfig.isEnabled ( event ) ) ; }

Target:
public void testIsEnabledRefUpdatedEvent ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { } ; setupIsEnabled ( "true" , null , branches ) ; com.google.gerrit.server.events.RefUpdatedEvent event = new com.google.gerrit.server.events.RefUpdatedEvent ( ) ; com.google.gerrit.server.data.RefUpdateAttribute refUpdateAttribute = new com.google.gerrit.server.data.RefUpdateAttribute ( ) ; refUpdateAttribute.project = "testProject" ; refUpdateAttribute.refName = "refs/heads/testBranch" ; event.refUpdate = com.google.common.base.Suppliers.ofInstance ( refUpdateAttribute ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertTrue ( itsConfig.isEnabled ( event ) ) ; }
Source:
protected void prepareSubscriptionConfigEntry ( org.eclipse.jgit.lib.Config config , java.lang.String subscribeToRepo , java.lang.String subscribeToBranch ) { subscribeToRepo = name ( subscribeToRepo ) ; java.lang.String url = ( ( cfg.getString ( "gerrit" , null , "canonicalWebUrl" ) ) + "/" ) + subscribeToRepo ; config.setString ( "submodule" , subscribeToRepo , "path" , subscribeToRepo ) ; config.setString ( "submodule" , subscribeToRepo , "url" , url ) ; config.setString ( "submodule" , subscribeToRepo , "branch" , subscribeToBranch ) ; }

Target:
protected void prepareSubmoduleConfigEntry ( org.eclipse.jgit.lib.Config config , java.lang.String subscribeToRepo , java.lang.String subscribeToBranch ) { subscribeToRepo = name ( subscribeToRepo ) ; java.lang.String url = ( ( cfg.getString ( "gerrit" , null , "canonicalWebUrl" ) ) + "/" ) + subscribeToRepo ; config.setString ( "submodule" , subscribeToRepo , "path" , subscribeToRepo ) ; config.setString ( "submodule" , subscribeToRepo , "url" , url ) ; if ( subscribeToBranch != null ) { config.setString ( "submodule" , subscribeToRepo , "branch" , subscribeToBranch ) ; } }
Source:
public void testUpdateOne ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 ) ; createClassUnderTest ( ) . update ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; }

Target:
public void testUpsertTwoSecondExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 0 , 1 ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( twoRows ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertExpectedIdsUsed ( insert , 1 ) ; }
Source:
public void onSuccess ( final com.google.gerrit.client.reviewdb.PatchLineComment result ) { if ( isNew ( ) ) { notifyDraftDelta ( 1 ) ; } comment = result ; text.setReadOnly ( false ) ; save.setEnabled ( true ) ; cancel.setEnabled ( true ) ; discard.setEnabled ( true ) ; render ( ) ; }

Target:
public void onSuccess ( final com.google.gerrit.client.reviewdb.PatchLineComment result ) { if ( isNew ( ) ) { notifyDraftDelta ( 1 ) ; } comment = result ; text.setReadOnly ( false ) ; save.setEnabled ( true ) ; cancel.setEnabled ( true ) ; discard.setEnabled ( true ) ; render ( ) ; onSave.onSuccess ( VoidResult.INSTANCE ) ; }
Source:
public boolean match ( com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { try { for ( com.google.gerrit.server.query.change.ChangeData cData : index.getSource ( com.google.gerrit.server.query.Predicate.and ( new com.google.gerrit.server.query.change.LegacyChangeIdPredicate ( object.getId ( ) ) , this ) , 0 , 1 ) . read ( ) ) { if ( cData.getId ( ) . equals ( object.getId ( ) ) ) { return true ; } } } catch ( com.google.gerrit.server.query.QueryParseException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } return false ; }

Target:
public boolean match ( com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { try { for ( com.google.gerrit.server.query.change.ChangeData cData : index.getSource ( com.google.gerrit.server.query.Predicate.and ( new com.google.gerrit.server.query.change.LegacyChangeIdPredicate ( index.getSchema ( ) , object.getId ( ) ) , this ) , 0 , 1 ) . read ( ) ) { if ( cData.getId ( ) . equals ( object.getId ( ) ) ) { return true ; } } } catch ( com.google.gerrit.server.query.QueryParseException e ) { throw new com.google.gwtorm.server.OrmException ( e ) ; } return false ; }
Source:
public void testDiffAgainstEmptyCommit ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit master = repo.branch ( "refs/heads/master" ) . commit ( ) . create ( ) ; com.google.gitiles.GitilesView view = getView ( "/repo/+diff/master^!" ) ; assertEquals ( Type.DIFF , view.getType ( ) ) ; assertEquals ( "master" , view.getRevision ( ) . getName ( ) ) ; assertEquals ( master , view.getRevision ( ) . getId ( ) ) ; assertEquals ( Revision.NULL , view.getOldRevision ( ) ) ; assertEquals ( "" , view.getTreePath ( ) ) ; }

Target:
public void testDiffAgainstEmptyCommit ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit master = repo.branch ( "refs/heads/master" ) . commit ( ) . create ( ) ; com.google.gitiles.GitilesView view = getView ( "/repo/+diff/master^!" ) ; assertEquals ( Type.DIFF , view.getType ( ) ) ; assertEquals ( "master" , view.getRevision ( ) . getName ( ) ) ; assertEquals ( master , view.getRevision ( ) . getId ( ) ) ; assertEquals ( Revision.NULL , view.getOldRevision ( ) ) ; assertEquals ( "" , view.getPathPart ( ) ) ; }
Source:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > submitRecords ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( ( cd.getSubmitRecords ( ) ) != null ) { return cd.getSubmitRecords ( ) ; } com.google.gerrit.reviewdb.client.PatchSet ps = cd.currentPatchSet ( ) ; if ( ps == null ) { return com.google.common.collect.ImmutableList.of ( ) ; } cd.setSubmitRecords ( new com.google.gerrit.server.project.SubmitRuleEvaluator ( cd ) . setPatchSet ( ps ) . setFastEvalLabels ( true ) . setAllowDraft ( true ) . canSubmit ( ) ) ; return cd.getSubmitRecords ( ) ; }

Target:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > submitRecords ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( ( cd.getSubmitRecords ( ) ) != null ) { return cd.getSubmitRecords ( ) ; } com.google.gerrit.reviewdb.client.PatchSet ps = cd.currentPatchSet ( ) ; if ( ps == null ) { return com.google.common.collect.ImmutableList.of ( ) ; } cd.setSubmitRecords ( new com.google.gerrit.server.project.SubmitRuleEvaluator ( cd ) . setPatchSet ( ps ) . setFastEvalLabels ( true ) . setAllowDraft ( true ) . evaluate ( ) ) ; return cd.getSubmitRecords ( ) ; }
Source:
public void renameTable ( final com.google.gwtorm.server.StatementExecutor e , java.lang.String from , java.lang.String to ) throws com.google.gwtorm.server.OrmException { try { final java.sql.Statement s = getConnection ( ) . createStatement ( ) ; try { getDialect ( ) . renameTable ( e , from , to ) ; } finally { s.close ( ) ; } } catch ( java.sql.SQLException err ) { throw new com.google.gwtorm.server.OrmException ( ( ( ( "Cannot rename table " + from ) + " to " ) + to ) , err ) ; } }

Target:
public void renameTable ( final com.google.gwtorm.server.StatementExecutor e , java.lang.String from , java.lang.String to ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkNotNull ( e ) ; com.google.common.base.Preconditions.checkNotNull ( from ) ; com.google.common.base.Preconditions.checkNotNull ( to ) ; getDialect ( ) . renameTable ( e , from , to ) ; }
Source:
protected java.sql.PreparedStatement prepareStatement ( final java.lang.String sql ) throws com.google.gwtorm.client.OrmException { try { return schema.getConnection ( ) . prepareStatement ( sql ) ; } catch ( java.sql.SQLException e ) { throw new com.google.gwtorm.client.OrmException ( ( "Prepare failure\n" + sql ) , e ) ; } }

Target:
protected java.sql.PreparedStatement prepareStatement ( final java.lang.String sql ) throws com.google.gwtorm.client.OrmException { try { return schema.getConnection ( ) . prepareStatement ( sql ) ; } catch ( java.sql.SQLException e ) { com.google.gwtorm.jdbc.JdbcAccess.linkCause ( e ) ; throw new com.google.gwtorm.client.OrmException ( ( "Prepare failure\n" + sql ) , e ) ; } }
Source:
public void changeAssigneeToSelfOnReviewableChangeInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; assign ( sc , sc.owner , sc.assignee ) ; sender.clear ( ) ; assign ( sc , sc.owner , sc.owner ) ; assertThat ( sender ) . sent ( "setassignee" , sc ) . notTo ( sc.owner , sc.reviewer , sc.ccer , sc.starrer , sc.assignee ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) ; }

Target:
public void changeAssigneeToSelfOnReviewableChangeInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; assign ( sc , sc.owner , sc.assignee ) ; sender.clear ( ) ; assign ( sc , sc.owner , sc.owner ) ; assertThat ( sender ) . sent ( "setassignee" , sc ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . noOneElse ( ) ; }
Source:
public void onClick ( com.google.gwt.user.client.ui.Widget sender ) { final boolean prior = starred ; setStarred ( ( ! prior ) ) ; final com.google.gerrit.client.changes.ToggleStarRequest req = new com.google.gerrit.client.changes.ToggleStarRequest ( ) ; req.toggle ( changeId , starred ) ; Util.LIST_SVC.toggleStars ( req , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { super . onFailure ( caught ) ; setStarred ( prior ) ; } } ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { final boolean prior = starred ; setStarred ( ( ! prior ) ) ; final com.google.gerrit.client.changes.ToggleStarRequest req = new com.google.gerrit.client.changes.ToggleStarRequest ( ) ; req.toggle ( changeId , starred ) ; Util.LIST_SVC.toggleStars ( req , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { super . onFailure ( caught ) ; setStarred ( prior ) ; } } ) ; }
Source:
public void testAddMultipleHashtags ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; java.util.List < java.lang.String > expected = java.util.Arrays.asList ( "tag1" , "tag3" ) ; assertResult ( POST ( changeId , "tag3, tag1" , null ) , expected ) ; assertResult ( GET ( changeId ) , expected ) ; expected = java.util.Arrays.asList ( "tag1" , "tag2" , "tag3" , "tag4" ) ; assertResult ( POST ( changeId , "tag2, tag4" , null ) , expected ) ; assertResult ( GET ( changeId ) , expected ) ; }

Target:
public void testAddAlreadyExistingHashtag ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; addHashtags ( r , "tag2" ) ; assertThatGet ( r ) . containsExactly ( "tag2" ) ; addHashtags ( r , "tag2" ) ; assertThatGet ( r ) . containsExactly ( "tag2" ) ; addHashtags ( r , "tag1" , "tag2" ) ; assertThatGet ( r ) . containsExactly ( "tag1" , "tag2" ) . inOrder ( ) ; }
Source:
public void testUnblockInLocalForceEditTopicName_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , 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.group.SystemGroupBackend.REGISTERED_USERS ) ; org.junit.Assert.assertFalse ( "u can't edit topic name" , u.controlForRef ( "refs/heads/master" ) . canForceEditTopicName ( ) ) ; }

Target:
public void testUnblockInLocalForceEditTopicName_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , 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.group.SystemGroupBackend.REGISTERED_USERS ) ; com.google.common.truth.Truth.assertThat ( u.controlForRef ( "refs/heads/master" ) . canForceEditTopicName ( ) ) . named ( "u can't edit topic name" ) . isFalse ( ) ; }
Source:
void onSyntaxHighlighting ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.syntaxHighlighting ( e.getValue ( ) ) ; mode.setEnabled ( prefs.syntaxHighlighting ( ) ) ; if ( prefs.syntaxHighlighting ( ) ) { setMode ( view.getContentType ( ) ) ; } view.setSyntaxHighlighting ( prefs.syntaxHighlighting ( ) ) ; }

Target:
public void onSuccess ( java.lang.Void result ) { if ( ( ( prefs.syntaxHighlighting ( ) ) && ( java.util.Objects.equals ( mode , getSelectedMode ( ) ) ) ) && ( view.isAttached ( ) ) ) { view.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { view.getCmFromSide ( DisplaySide.A ) . setOption ( "mode" , mode ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "mode" , mode ) ; } } ) ; } }
Source:
public void run ( ) { if ( ( active ) == null ) { active = this ; fixup.scheduleRepeating ( 20 ) ; } if ( ( active ) == ( this ) ) { net.codemirror.lib.ScrollInfo si = src.getScrollInfo ( ) ; updateScreenHeader ( si ) ; dst.scrollTo ( si.getLeft ( ) , si.getTop ( ) ) ; state = 0 ; } }

Target:
public void run ( ) { if ( ( active ) == null ) { active = this ; fixup.scheduleRepeating ( 20 ) ; } if ( ( active ) == ( this ) ) { net.codemirror.lib.ScrollInfo si = src.getScrollInfo ( ) ; updateScreenHeader ( si ) ; dst.scrollTo ( si.getLeft ( ) , align ( si.getTop ( ) ) ) ; state = 0 ; } }
Source:
public void run ( final com.google.gerrit.client.data.ApprovalType at , final com.google.gerrit.server.workflow.FunctionState state ) { boolean rejected = false ; boolean passed = false ; for ( final com.google.gerrit.client.reviewdb.ChangeApproval a : state.getApprovals ( at ) ) { state.normalize ( at , a ) ; rejected |= at.isMaxNegative ( a ) ; passed |= at.isMaxPositive ( a ) ; } state.valid ( at , ( ( ! rejected ) && passed ) ) ; }

Target:
public void run ( final com.google.gerrit.client.data.ApprovalType at , final com.google.gerrit.server.workflow.FunctionState state ) { boolean rejected = false ; boolean passed = false ; for ( final com.google.gerrit.client.reviewdb.PatchSetApproval a : state.getApprovals ( at ) ) { state.normalize ( at , a ) ; rejected |= at.isMaxNegative ( a ) ; passed |= at.isMaxPositive ( a ) ; } state.valid ( at , ( ( ! rejected ) && passed ) ) ; }
Source:
private org.eclipse.jgit.revwalk.RevTree aFor ( org.eclipse.jgit.revwalk.RevCommit b , org.eclipse.jgit.revwalk.RevWalk walk ) throws java.io.IOException { switch ( b.getParentCount ( ) ) { case 0 : return walk.parseTree ( emptyTree ( ) ) ; case 1 : org.eclipse.jgit.revwalk.RevCommit a = b.getParent ( 0 ) ; walk.parseBody ( a ) ; return walk.parseTree ( a.getTree ( ) ) ; case 2 : return com.google.gerrit.server.patch.PatchListLoader.automerge ( repo , walk , b , mergeStrategy ) ; default : return null ; } }

Target:
private org.eclipse.jgit.revwalk.RevTree aFor ( org.eclipse.jgit.revwalk.RevCommit b , org.eclipse.jgit.revwalk.RevWalk walk ) throws java.io.IOException { switch ( b.getParentCount ( ) ) { case 0 : return walk.parseTree ( emptyTree ( ) ) ; case 1 : org.eclipse.jgit.revwalk.RevCommit a = b.getParent ( 0 ) ; walk.parseBody ( a ) ; return walk.parseTree ( a.getTree ( ) ) ; case 2 : return autoMerger.merge ( repo , walk , b , mergeStrategy ) ; default : return null ; } }
Source:
public static com.google.gerrit.extensions.client.GeneralPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo p = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; p.changesPerPage = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE ; p.showSiteHeader = true ; p.useFlashClipboard = true ; p.emailStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ; p.reviewCategoryStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy.NONE ; p.downloadScheme = null ; p.downloadCommand = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand.CHECKOUT ; p.dateFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat.STD ; p.timeFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat.HHMM_12 ; p.highlightAssigneeInChangeTable = true ; p.relativeDateInChangeTable = false ; p.diffView = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ; p.sizeBarInChangeTable = true ; p.legacycidInChangeTable = false ; p.muteCommonPathPrefixes = true ; p.signedOffBy = false ; p.defaultBaseForMerges = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DefaultBase.FIRST_PARENT ; return p ; }

Target:
public static com.google.gerrit.extensions.client.GeneralPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo p = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; p.changesPerPage = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE ; p.showSiteHeader = true ; p.useFlashClipboard = true ; p.emailStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ; p.reviewCategoryStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy.NONE ; p.downloadScheme = null ; p.downloadCommand = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand.CHECKOUT ; p.dateFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat.STD ; p.timeFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat.HHMM_12 ; p.expandInlineDiffs = false ; p.highlightAssigneeInChangeTable = true ; p.relativeDateInChangeTable = false ; p.diffView = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ; p.sizeBarInChangeTable = true ; p.legacycidInChangeTable = false ; p.muteCommonPathPrefixes = true ; p.signedOffBy = false ; p.defaultBaseForMerges = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DefaultBase.FIRST_PARENT ; return p ; }
Source:
public void testCreateProjectHttpWithInvalidRefName_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.branches = java.util.Collections.singletonList ( name ( "invalid ref name" ) ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( "/projects/" + ( name ( "newProject" ) ) ) , in ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_BAD_REQUEST ) ; }

Target:
public void testCreateProjectHttpWithInvalidRefName_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.branches = java.util.Collections.singletonList ( name ( "invalid ref name" ) ) ; adminSession.put ( ( "/projects/" + ( name ( "newProject" ) ) ) , in ) . assertBadRequest ( ) ; }
Source:
public int run ( ) throws java.lang.Exception { mustHaveValidSite ( ) ; dbInjector = createDbInjector ( ) ; manager.add ( dbInjector ) ; manager.start ( ) ; com.google.gerrit.pgm.RuntimeShutdown.add ( new java.lang.Runnable ( ) { public void run ( ) { try { java.lang.System.in.close ( ) ; } catch ( java.io.IOException e ) { } manager.stop ( ) ; } } ) ; shellFactory ( ) . create ( java.lang.System.in , java.lang.System.out ) . run ( ) ; return 0 ; }

Target:
public int run ( ) throws java.lang.Exception { mustHaveValidSite ( ) ; dbInjector = createDbInjector ( ) ; manager.add ( dbInjector ) ; manager.start ( ) ; com.google.gerrit.pgm.util.RuntimeShutdown.add ( new java.lang.Runnable ( ) { public void run ( ) { try { java.lang.System.in.close ( ) ; } catch ( java.io.IOException e ) { } manager.stop ( ) ; } } ) ; shellFactory ( ) . create ( java.lang.System.in , java.lang.System.out ) . run ( ) ; return 0 ; }
Source:
void display ( final com.google.gerrit.reviewdb.Account account ) { info.setText ( 0 , fieldIdx , account.getFullName ( ) ) ; info.setText ( 1 , fieldIdx , account.getPreferredEmail ( ) ) ; info.setText ( 2 , fieldIdx , com.google.gerrit.client.FormatUtil.mediumFormat ( account.getRegisteredOn ( ) ) ) ; info.setText ( 3 , fieldIdx , account.getId ( ) . toString ( ) ) ; }

Target:
void display ( final com.google.gerrit.reviewdb.Account account ) { info.setText ( 0 , fieldIdx , account.getUserName ( ) ) ; info.setText ( 1 , fieldIdx , account.getFullName ( ) ) ; info.setText ( 2 , fieldIdx , account.getPreferredEmail ( ) ) ; info.setText ( 3 , fieldIdx , com.google.gerrit.client.FormatUtil.mediumFormat ( account.getRegisteredOn ( ) ) ) ; info.setText ( 4 , fieldIdx , account.getId ( ) . toString ( ) ) ; }
Source:
private void assertApproval ( com.google.gerrit.acceptance.PushOneCommit.Result r , int expected ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo c = get ( r.getChangeId ( ) ) ; com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; org.junit.Assert.assertEquals ( 1 , cr.all.size ( ) ) ; org.junit.Assert.assertEquals ( "Administrator" , cr.all.get ( 0 ) . name ) ; org.junit.Assert.assertEquals ( expected , cr.all.get ( 0 ) . value.intValue ( ) ) ; }

Target:
private void doAssertApproval ( int expected , com.google.gerrit.extensions.common.ChangeInfo c ) { com.google.gerrit.extensions.common.LabelInfo cr = c.labels.get ( "Code-Review" ) ; org.junit.Assert.assertEquals ( 1 , cr.all.size ( ) ) ; org.junit.Assert.assertEquals ( "Administrator" , cr.all.get ( 0 ) . name ) ; org.junit.Assert.assertEquals ( expected , cr.all.get ( 0 ) . value.intValue ( ) ) ; }
Source:
private com.google.gerrit.server.notedb.ChangeNotes createFromChangeOnlyWhenNotedbDisabled ( com.google.gerrit.reviewdb.client.Change change ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( ( ! ( args.migration.readChanges ( ) ) ) , ( "do not call" + " createFromChangeWhenNotedbDisabled when notedb is enabled" ) ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( args , change.getProject ( ) , change ) . load ( ) ; }

Target:
private com.google.gerrit.server.notedb.ChangeNotes createFromChangeOnlyWhenNoteDbDisabled ( com.google.gerrit.reviewdb.client.Change change ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( ( ! ( args.migration.readChanges ( ) ) ) , ( "do not call" + " createFromChangeWhenNoteDbDisabled when NoteDb is enabled" ) ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( args , change.getProject ( ) , change ) . load ( ) ; }
Source:
protected void initColumnHeaders ( ) { super . initColumnHeaders ( ) ; if ( ( com.google.gerrit.client.Gerrit.getGitwebLink ( ) ) != null ) { table.setText ( 0 , 3 , Util.C.projectRepoBrowser ( ) ) ; table.getFlexCellFormatter ( ) . addStyleName ( 0 , 3 , Gerrit.RESOURCES.css ( ) . dataHeader ( ) ) ; } }

Target:
protected void initColumnHeaders ( ) { super . initColumnHeaders ( ) ; if ( ( com.google.gerrit.client.Gerrit.getGitwebLink ( ) ) != null ) { table.setText ( 0 , ProjectsTable.C_REPO_BROWSER , Util.C.projectRepoBrowser ( ) ) ; table.getFlexCellFormatter ( ) . addStyleName ( 0 , ProjectsTable.C_REPO_BROWSER , Gerrit.RESOURCES.css ( ) . dataHeader ( ) ) ; } }
Source:
protected void onUnload ( ) { super . onUnload ( ) ; removeKeyHandlerRegs ( ) ; if ( ( resizeHandler ) != null ) { resizeHandler.removeHandler ( ) ; resizeHandler = null ; } if ( ( cmA ) != null ) { cmA.getWrapperElement ( ) . removeFromParent ( ) ; } if ( ( cmB ) != null ) { cmB.getWrapperElement ( ) . removeFromParent ( ) ; } com.google.gwt.user.client.Window.enableScrolling ( true ) ; com.google.gerrit.client.Gerrit.setHeaderVisible ( true ) ; }

Target:
protected void onUnload ( ) { super . onUnload ( ) ; saveAllDrafts ( null ) ; removeKeyHandlerRegs ( ) ; if ( ( resizeHandler ) != null ) { resizeHandler.removeHandler ( ) ; resizeHandler = null ; } if ( ( cmA ) != null ) { cmA.getWrapperElement ( ) . removeFromParent ( ) ; } if ( ( cmB ) != null ) { cmB.getWrapperElement ( ) . removeFromParent ( ) ; } com.google.gwt.user.client.Window.enableScrolling ( true ) ; com.google.gerrit.client.Gerrit.setHeaderVisible ( true ) ; }