auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static com.google.gerrit.common.data.PermissionRule block ( com.google.gerrit.server.git.ProjectConfig project , java.lang.String permissionName , int min , int max , com.google.gerrit.reviewdb.client.AccountGroup.UUID group , java.lang.String ref ) { com.google.gerrit.common.data.PermissionRule rule = com.google.gerrit.server.project.testing.Util.newRule ( project , group ) ; rule.setMin ( min ) ; rule.setMax ( max ) ; com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.testing.Util.grant ( project , permissionName , rule , ref ) ; r.setBlock ( ) ; return r ; }

Target:
public static com.google.gerrit.common.data.PermissionRule block ( com.google.gerrit.server.project.ProjectConfig project , java.lang.String permissionName , int min , int max , com.google.gerrit.reviewdb.client.AccountGroup.UUID group , java.lang.String ref ) { com.google.gerrit.common.data.PermissionRule rule = com.google.gerrit.server.project.testing.Util.newRule ( project , group ) ; rule.setMin ( min ) ; rule.setMax ( max ) ; com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.testing.Util.grant ( project , permissionName , rule , ref ) ; r.setBlock ( ) ; return r ; }
Source:
private com.google.gerrit.sshd.SshSession newSession ( ) { final java.net.SocketAddress peer ; if ( ( peerAddress ) == null ) { peer = session.get ( ) . getRemoteAddress ( ) ; } else { peer = peerAddress ; } return new com.google.gerrit.sshd.SshSession ( session.get ( ) , peer , userFactory.create ( AccessPath.SSH , new com.google.inject.Provider < java.net.SocketAddress > ( ) { @ java.lang.Override public java.net.SocketAddress get ( ) { return peer ; } } , accountId ) ) ; }

Target:
private com.google.gerrit.sshd.SshSession newSession ( ) { final java.net.SocketAddress peer ; if ( ( peerAddress ) == null ) { peer = session.get ( ) . getRemoteAddress ( ) ; } else { peer = peerAddress ; } return new com.google.gerrit.sshd.SshSession ( session.get ( ) , peer , userFactory.create ( AccessPath.SSH_COMMAND , new com.google.inject.Provider < java.net.SocketAddress > ( ) { @ java.lang.Override public java.net.SocketAddress get ( ) { return peer ; } } , accountId ) ) ; }
Source:
public static com.google.gerrit.common.data.PermissionRule grant ( com.google.gerrit.server.git.ProjectConfig project , java.lang.String permissionName , int min , int max , com.google.gerrit.reviewdb.client.AccountGroup.UUID group , java.lang.String ref ) { com.google.gerrit.common.data.PermissionRule rule = com.google.gerrit.server.project.Util.newRule ( project , group ) ; rule.setMin ( min ) ; rule.setMax ( max ) ; return com.google.gerrit.server.project.Util.grant ( project , permissionName , rule , ref ) ; }

Target:
public static com.google.gerrit.common.data.PermissionRule allow ( com.google.gerrit.server.git.ProjectConfig project , java.lang.String permissionName , int min , int max , com.google.gerrit.reviewdb.client.AccountGroup.UUID group , java.lang.String ref ) { com.google.gerrit.common.data.PermissionRule rule = com.google.gerrit.server.project.Util.newRule ( project , group ) ; rule.setMin ( min ) ; rule.setMax ( max ) ; return com.google.gerrit.server.project.Util.grant ( project , permissionName , rule , ref ) ; }
Source:
public com.google.gerrit.extensions.api.changes.DraftApi createDraft ( com.google.gerrit.extensions.api.changes.DraftInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { java.lang.String id = createDraft.apply ( revision , in ) . value ( ) . id ; return changes.id ( revision.getChange ( ) . getId ( ) . get ( ) ) . revision ( revision.getPatchSet ( ) . getId ( ) . get ( ) ) . draft ( id ) ; } catch ( com.google.gerrit.server.update.UpdateException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot create draft" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.changes.DraftApi createDraft ( com.google.gerrit.extensions.api.changes.DraftInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { java.lang.String id = createDraft.apply ( revision , in ) . value ( ) . id ; return changes.id ( revision.getChange ( ) . getId ( ) . get ( ) ) . revision ( revision.getPatchSet ( ) . getId ( ) . get ( ) ) . draft ( id ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot create draft" , e ) ; } }
Source:
private com.google.gerrit.server.project.ProjectControl user ( com.google.gerrit.reviewdb.AccountGroup ... memberOf ) { com.google.gerrit.server.project.RefControl.Factory refControlFactory = new com.google.gerrit.server.project.RefControl.Factory ( ) { @ java.lang.Override public com.google.gerrit.server.project.RefControl create ( final com.google.gerrit.server.project.ProjectControl projectControl , final java.lang.String ref ) { return new com.google.gerrit.server.project.RefControl ( systemConfig , projectControl , ref ) ; } } ; return new com.google.gerrit.server.project.ProjectControl ( java.util.Collections.< com.google.gerrit.reviewdb.AccountGroup.Id > emptySet ( ) , java.util.Collections.< com.google.gerrit.reviewdb.AccountGroup.Id > emptySet ( ) , refControlFactory , new com.google.gerrit.server.project.RefControlTest.MockUser ( memberOf ) , newProjectState ( ) ) ; }

Target:
private com.google.gerrit.server.project.ProjectControl user ( com.google.gerrit.reviewdb.AccountGroup ... memberOf ) { com.google.gerrit.server.project.RefControl.Factory refControlFactory = new com.google.gerrit.server.project.RefControl.Factory ( ) { @ java.lang.Override public com.google.gerrit.server.project.RefControl create ( final com.google.gerrit.server.project.ProjectControl projectControl , final java.lang.String ref ) { return new com.google.gerrit.server.project.RefControl ( projectControl , ref ) ; } } ; return new com.google.gerrit.server.project.ProjectControl ( java.util.Collections.< com.google.gerrit.reviewdb.AccountGroup.UUID > emptySet ( ) , java.util.Collections.< com.google.gerrit.reviewdb.AccountGroup.UUID > emptySet ( ) , refControlFactory , new com.google.gerrit.server.project.RefControlTest.MockUser ( memberOf ) , newProjectState ( ) ) ; }
Source:
public com.google.gitiles.GitilesView.Builder setPathPart ( java.lang.String path ) { switch ( type ) { case PATH : case DIFF : com.google.common.base.Preconditions.checkState ( ( path != null ) , "cannot set null path on %s view" , type ) ; break ; case BLAME : case ARCHIVE : case DESCRIBE : case REFS : case LOG : break ; default : com.google.common.base.Preconditions.checkState ( ( path == null ) , "cannot set path on %s view" , type ) ; break ; } this . path = ( path != null ) ? com.google.gitiles.GitilesView.maybeTrimLeadingAndTrailingSlash ( path ) : null ; return this ; }

Target:
public com.google.gitiles.GitilesView.Builder setPathPart ( java.lang.String path ) { switch ( type ) { case PATH : case DIFF : com.google.common.base.Preconditions.checkState ( ( path != null ) , "cannot set null path on %s view" , type ) ; break ; case BLAME : case ARCHIVE : case DESCRIBE : case REFS : case LOG : case DOC : break ; default : com.google.common.base.Preconditions.checkState ( ( path == null ) , "cannot set path on %s view" , type ) ; break ; } this . path = ( path != null ) ? com.google.gitiles.GitilesView.maybeTrimLeadingAndTrailingSlash ( path ) : null ; return this ; }
Source:
public com.google.gerrit.server.notedb.ChangeNotes call ( ) throws java.lang.Exception { com.google.common.base.Preconditions.checkArgument ( change.getProject ( ) . equals ( project ) , ( "passed project %s when creating ChangeNotes for %s," + " but actual project is %s" ) , project , changeId , change.getProject ( ) ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( args , change ) . load ( ) ; }

Target:
public com.google.gerrit.server.notedb.ChangeNotes createChecked ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( changeId ) ; if ( ( change == null ) || ( ! ( change.getProject ( ) . equals ( project ) ) ) ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } return new com.google.gerrit.server.notedb.ChangeNotes ( args , change ) . load ( ) ; }
Source:
private < K , V > com.google.gerrit.server.cache.UnnamedCacheBinding < K , V > core ( final com.google.inject.Key < com.google.gerrit.server.cache.Cache < K , V > > key , final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < K , V > > type ) { }

Target:
private < K , V > com.google.gerrit.server.cache.UnnamedCacheBinding < K , V > core ( final com.google.inject.Key < com.google.gerrit.server.cache.Cache < K , V > > key , final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < K , V > > type ) { final boolean disk = false ; final com.google.gerrit.server.cache.CacheProvider < K , V > b = new com.google.gerrit.server.cache.CacheProvider < K , V > ( disk , this , type ) ; bind ( key ) . toProvider ( b ) . in ( Scopes.SINGLETON ) ; return b ; }
Source:
private com.google.gerrit.extensions.common.ApprovalInfo approvalInfo ( com.google.gerrit.reviewdb.client.Account.Id id , java.lang.Integer value , java.lang.String tag , java.sql.Timestamp date ) { com.google.gerrit.extensions.common.ApprovalInfo ai = new com.google.gerrit.extensions.common.ApprovalInfo ( id.get ( ) ) ; ai.value = value ; ai.date = date ; ai.tag = tag ; accountLoader.put ( ai ) ; return ai ; }

Target:
public static com.google.gerrit.extensions.common.ApprovalInfo getApprovalInfo ( com.google.gerrit.reviewdb.client.Account.Id id , java.lang.Integer value , java.lang.String tag , java.sql.Timestamp date ) { com.google.gerrit.extensions.common.ApprovalInfo ai = new com.google.gerrit.extensions.common.ApprovalInfo ( id.get ( ) ) ; ai.value = value ; ai.date = date ; ai.tag = tag ; return ai ; }
Source:
private void setTable ( com.google.gerrit.client.change.FileTable.MyTable table ) { clear ( ) ; add ( table ) ; this . table = table ; if ( register ) { table.setRegisterKeys ( true ) ; } }

Target:
private void setTable ( com.google.gerrit.client.change.FileTable.MyTable table ) { clear ( ) ; add ( table ) ; this . table = table ; if ( register ) { table.setRegisterKeys ( true ) ; } if ( ( reviewed ) != null ) { table.markReviewed ( reviewed ) ; reviewed = null ; } }
Source:
public boolean match ( final T object ) throws com.google.gwtorm.server.OrmException { for ( final com.google.gerrit.server.query.Predicate < T > c : children ) { com.google.common.base.Preconditions.checkState ( c.isMatchable ( ) , ( "match invoked, but child predicate %s " + "doesn't implement %s" ) , c , com.google.gerrit.server.query.Matchable.class . getName ( ) ) ; if ( c.asMatchable ( ) . match ( object ) ) { return true ; } } return false ; }

Target:
public boolean match ( final T object ) throws com.google.gwtorm.server.OrmException { for ( final com.google.gerrit.server.query.Predicate < T > c : children ) { com.google.common.base.Preconditions.checkState ( c.isMatchable ( ) , "match invoked, but child predicate %s doesn't implement %s" , c , com.google.gerrit.server.query.Matchable.class . getName ( ) ) ; if ( c.asMatchable ( ) . match ( object ) ) { return true ; } } return false ; }
Source:
public void testCreateProjectHttpWithNameMismatch_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = name ( "otherName" ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( "/projects/" + ( name ( "someName" ) ) ) , in ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_BAD_REQUEST ) ; }

Target:
public void testCreateProjectHttpWithNameMismatch_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = name ( "otherName" ) ; adminSession.put ( ( "/projects/" + ( name ( "someName" ) ) ) , in ) . assertBadRequest ( ) ; }
Source:
private void add ( final com.google.gson.JsonArray a , final org.eclipse.jgit.diff.Edit src ) { a.add ( new com.google.gson.JsonPrimitive ( src.getBeginA ( ) ) ) ; a.add ( new com.google.gson.JsonPrimitive ( src.getEndA ( ) ) ) ; a.add ( new com.google.gson.JsonPrimitive ( src.getBeginB ( ) ) ) ; a.add ( new com.google.gson.JsonPrimitive ( src.getEndB ( ) ) ) ; }

Target:
private void add ( final com.google.gson.JsonArray a , final com.google.gerrit.prettify.common.BaseEdit src ) { a.add ( new com.google.gson.JsonPrimitive ( src.getBeginA ( ) ) ) ; a.add ( new com.google.gson.JsonPrimitive ( src.getEndA ( ) ) ) ; a.add ( new com.google.gson.JsonPrimitive ( src.getBeginB ( ) ) ) ; a.add ( new com.google.gson.JsonPrimitive ( src.getEndB ( ) ) ) ; }
Source:
public boolean equals ( final java.lang.Object obj ) { if ( ( ! ( super . equals ( obj ) ) ) || ( ! ( obj instanceof com.google.gerrit.common.data.AccessSection ) ) ) { return false ; } return new java.util.HashSet < com.google.gerrit.common.data.Permission > ( permissions ) . equals ( new java.util.HashSet < com.google.gerrit.common.data.Permission > ( ( ( com.google.gerrit.common.data.AccessSection ) ( obj ) ) . permissions ) ) ; }

Target:
public boolean equals ( final java.lang.Object obj ) { if ( ( ! ( super . equals ( obj ) ) ) || ( ! ( obj instanceof com.google.gerrit.common.data.AccessSection ) ) ) { return false ; } return new java.util.HashSet < com.google.gerrit.common.data.Permission > ( getPermissions ( ) ) . equals ( new java.util.HashSet < com.google.gerrit.common.data.Permission > ( ( ( com.google.gerrit.common.data.AccessSection ) ( obj ) ) . getPermissions ( ) ) ) ; }
Source:
private java.lang.String changeUrl ( ) { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; if ( ( server.getCanonicalURL ( ) ) != null ) { r.append ( server.getCanonicalURL ( ) ) ; } else { r.append ( myUrl ) ; } r.append ( change.getChangeId ( ) ) ; return r.toString ( ) ; }

Target:
private java.lang.String gerritUrl ( ) { if ( ( server.getCanonicalURL ( ) ) != null ) { return server.getCanonicalURL ( ) ; } return myUrl ; }
Source:
public void tearDown ( ) { if ( ( executor ) != null ) { executor.close ( ) ; } executor = null ; if ( ( db ) != null ) { try { db.close ( ) ; } catch ( java.sql.SQLException e ) { throw new java.lang.RuntimeException ( "Cannot close database" , e ) ; } } db = null ; }

Target:
public void tearDown ( ) { drop ( "SEQUENCE address_id" ) ; drop ( "SEQUENCE cnt" ) ; drop ( "TABLE addresses" ) ; drop ( "TABLE foo" ) ; drop ( "TABLE bar" ) ; drop ( "TABLE people" ) ; if ( ( executor ) != null ) { executor.close ( ) ; } executor = null ; if ( ( db ) != null ) { try { db.close ( ) ; } catch ( java.sql.SQLException e ) { throw new java.lang.RuntimeException ( "Cannot close database" , e ) ; } } db = null ; }
Source:
private void mergeImpl ( ) throws com.google.gerrit.server.git.MergeException { openRepository ( ) ; openBranch ( ) ; listPendingSubmits ( ) ; validateChangeList ( ) ; mergeTip = branchTip ; switch ( destProject.getSubmitType ( ) ) { case CHERRY_PICK : cherryPickChanges ( ) ; break ; case FAST_FORWARD_ONLY : case MERGE_ALWAYS : case MERGE_IF_NECESSARY : default : reduceToMinimalMerge ( ) ; mergeTopics ( ) ; markCleanMerges ( ) ; break ; } updateBranch ( ) ; updateChangeStatus ( ) ; updateSubscriptions ( ) ; }

Target:
private void preMerge ( ) throws com.google.gerrit.server.git.MergeException { openBranch ( ) ; validateChangeList ( ) ; mergeTip = branchTip ; switch ( destProject.getSubmitType ( ) ) { case CHERRY_PICK : cherryPickChanges ( ) ; break ; case FAST_FORWARD_ONLY : case MERGE_ALWAYS : case MERGE_IF_NECESSARY : default : reduceToMinimalMerge ( ) ; mergeTopics ( ) ; markCleanMerges ( ) ; break ; } }
Source:
private static javax.sql.DataSource createDataSource ( java.lang.String url ) { org.apache.commons.dbcp.BasicDataSource datasource = new org.apache.commons.dbcp.BasicDataSource ( ) ; datasource.setDriverClassName ( "org.h2.Driver" ) ; datasource.setUrl ( url ) ; datasource.setMaxActive ( 50 ) ; datasource.setMinIdle ( 4 ) ; datasource.setMaxIdle ( 16 ) ; return datasource ; }

Target:
private static javax.sql.DataSource createDataSource ( java.lang.String url ) { org.apache.commons.dbcp.BasicDataSource datasource = new org.apache.commons.dbcp.BasicDataSource ( ) ; datasource.setDriverClassName ( "org.h2.Driver" ) ; datasource.setUrl ( url ) ; datasource.setMaxActive ( 50 ) ; datasource.setMinIdle ( 4 ) ; datasource.setMaxIdle ( 16 ) ; long evictIdleTimeMs = 1000 * 60 ; datasource.setMinEvictableIdleTimeMillis ( evictIdleTimeMs ) ; datasource.setTimeBetweenEvictionRunsMillis ( ( evictIdleTimeMs / 2 ) ) ; return datasource ; }
Source:
private void migratePatchSetApprovals ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.common.data.LabelTypes labelTypes ) throws java.sql.SQLException { java.sql.PreparedStatement stmt = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . prepareStatement ( "UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?" ) ; try { for ( com.google.gerrit.common.data.LabelType type : labelTypes.getLabelTypes ( ) ) { stmt.setString ( 1 , type.getName ( ) ) ; stmt.setString ( 2 , type.getId ( ) ) ; stmt.addBatch ( ) ; } stmt.executeBatch ( ) ; } finally { stmt.close ( ) ; } }

Target:
private void migratePatchSetApprovals ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.schema.Schema_77.LegacyLabelTypes labelTypes ) throws java.sql.SQLException { java.sql.PreparedStatement stmt = ( ( com.google.gwtorm.jdbc.JdbcSchema ) ( db ) ) . getConnection ( ) . prepareStatement ( "UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?" ) ; try { for ( com.google.gerrit.server.schema.Schema_77.LegacyLabelType type : labelTypes.getLegacyLabelTypes ( ) ) { stmt.setString ( 1 , type.getName ( ) ) ; stmt.setString ( 2 , type.getId ( ) ) ; stmt.addBatch ( ) ; } stmt.executeBatch ( ) ; } finally { stmt.close ( ) ; } }
Source:
private void removeUI ( ) { if ( ( replyToBox ) != null ) { replyToBox.unregisterReplyBox ( ) ; } getPaddingWidget ( ) . clear ( ) ; removeFromParent ( ) ; getSelfWidget ( ) . clear ( ) ; }

Target:
private void removeUI ( ) { if ( ( replyToBox ) != null ) { replyToBox.unregisterReplyBox ( ) ; } com.google.gerrit.client.changes.CommentInfo info = getOriginal ( ) ; getDiffView ( ) . removeCommentBox ( info.side ( ) , ( ( info.line ( ) ) - 1 ) ) ; removeFromParent ( ) ; getSelfWidget ( ) . clear ( ) ; getPaddingWidget ( ) . clear ( ) ; }
Source:
private static void copy ( com.google.gerrit.extensions.client.Comment from , com.google.gerrit.extensions.client.Comment to ) { to.side = ( ( from.side ) == null ) ? com.google.gerrit.extensions.client.Side.REVISION : from.side ; to.parent = from.parent ; to.line = from.line ; to.message = from.message ; to.range = from.range ; to.unresolved = from.unresolved ; }

Target:
private static void copy ( com.google.gerrit.extensions.client.Comment from , com.google.gerrit.extensions.client.Comment to ) { to.side = ( ( from.side ) == null ) ? com.google.gerrit.extensions.client.Side.REVISION : from.side ; to.parent = from.parent ; to.line = from.line ; to.message = from.message ; to.range = from.range ; to.unresolved = from.unresolved ; to.inReplyTo = from.inReplyTo ; }
Source:
private com.google.gerrit.client.ui.InlineHyperlink createLink ( java.lang.String label , com.google.gerrit.reviewdb.client.PatchSet.Id id ) { assert ( other ) != null ; if ( sideA ) { assert ( other.idActive ) != null ; } com.google.gerrit.reviewdb.client.PatchSet.Id diffBase = ( sideA ) ? id : other.idActive ; com.google.gerrit.reviewdb.client.PatchSet.Id revision = ( sideA ) ? other.idActive : id ; return new com.google.gerrit.client.ui.InlineHyperlink ( label , ( ( parent.diffScreenType ) == ( com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ) ? com.google.gerrit.client.Dispatcher.toSideBySide ( diffBase , revision , path ) : com.google.gerrit.client.Dispatcher.toUnified ( diffBase , revision , path ) ) ) ; }

Target:
private com.google.gerrit.client.ui.InlineHyperlink createLink ( java.lang.String label , com.google.gerrit.reviewdb.client.PatchSet.Id id ) { assert ( other ) != null ; if ( sideA ) { assert ( other.idActive ) != null ; } com.google.gerrit.reviewdb.client.PatchSet.Id diffBase = ( sideA ) ? id : other.idActive ; com.google.gerrit.reviewdb.client.PatchSet.Id revision = ( sideA ) ? other.idActive : id ; return new com.google.gerrit.client.ui.InlineHyperlink ( label , ( parent.isSideBySide ( ) ? com.google.gerrit.client.Dispatcher.toSideBySide ( diffBase , revision , path ) : com.google.gerrit.client.Dispatcher.toUnified ( diffBase , revision , path ) ) ) ; }
Source:
public boolean canUserDelete ( ) { switch ( com.google.gerrit.client.rpc.Common.getGerritConfig ( ) . getLoginType ( ) ) { case OPENID : if ( getExternalId ( ) . startsWith ( "Google Account " ) ) { return false ; } break ; case HTTP : if ( getExternalId ( ) . startsWith ( "gerrit:" ) ) { return false ; } break ; } return true ; }

Target:
public boolean canUserDelete ( ) { switch ( com.google.gerrit.client.Gerrit.getConfig ( ) . getLoginType ( ) ) { case OPENID : if ( getExternalId ( ) . startsWith ( "Google Account " ) ) { return false ; } break ; case HTTP : if ( getExternalId ( ) . startsWith ( "gerrit:" ) ) { return false ; } break ; } return true ; }
Source:
public com.google.gerrit.reviewdb.client.Change update ( com.google.gerrit.reviewdb.client.Change change ) { if ( ( change.getStatus ( ) ) == ( Change.Status.DRAFT ) ) { change.setStatus ( Change.Status.NEW ) ; com.google.gerrit.server.ChangeUtil.updated ( change ) ; } return change ; }

Target:
public void postUpdate ( com.google.gerrit.server.git.BatchUpdate.Context ctx ) throws com.google.gwtorm.server.OrmException { hooks.doDraftPublishedHook ( change , patchSet , ctx.getDb ( ) ) ; if ( ( patchSet.isDraft ( ) ) && ( ( change.getStatus ( ) ) == ( Change.Status.DRAFT ) ) ) { return ; } try { if ( wasDraftChange ) { sendCreateChange ( ctx ) ; } else { sendReplacePatchSet ( ctx ) ; } } catch ( com.google.gerrit.common.errors.EmailException | com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.change.PublishDraftPatchSet.log.error ( ( "Cannot send email for publishing draft " + ( psId ) ) , e ) ; } }
Source:
public void doFilter ( javax.servlet.ServletRequest req , javax.servlet.ServletResponse res ) throws java.io.IOException , javax.servlet.ServletException { if ( itr.hasNext ( ) ) { itr.next ( ) . doFilter ( req , res , this ) ; } else { last.doFilter ( req , res ) ; } }

Target:
public void doFilter ( javax.servlet.ServletRequest req , javax.servlet.ServletResponse res ) throws java.io.IOException , javax.servlet.ServletException { while ( itr.hasNext ( ) ) { com.google.gerrit.httpd.AllRequestFilter filter = itr.next ( ) ; if ( ( initializedFilters.contains ( filter ) ) || ( initFilterIfNeeded ( filter ) ) ) { filter.doFilter ( req , res , this ) ; return ; } } last.doFilter ( req , res ) ; }
Source:
public void byCommitter ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo = createProject ( "repo" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( newChange ( repo , null , null , userId.get ( ) , null ) ) ; assertQuery ( "committer:jcommitter@example.com" , change1 ) ; assertQuery ( "committer:jcommitter" , change1 ) ; assertQuery ( "committer:example" , change1 ) ; assertQuery ( "committer:example.com" , change1 ) ; assertQuery ( "committer:Committer" , change1 ) ; assertQuery ( "committer:jCoMmItTeR" , change1 ) ; assertQuery ( "committer:ExAmPlE" , change1 ) ; assertQuery ( "committer:jauthor@example.com" ) ; assertQuery ( "committer:somewhere.com" ) ; assertQuery ( "committer:jauthor" ) ; assertQuery ( "committer:Author" ) ; }

Target:
public void byAuthor ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo = createProject ( "repo" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( newChangeForUser ( repo , userId ) ) ; assertQuery ( "author:jauthor@example.com" , change1 ) ; assertQuery ( "author:jauthor" , change1 ) ; assertQuery ( "author:example" , change1 ) ; assertQuery ( "author:example.com" , change1 ) ; assertQuery ( "author:Author" , change1 ) ; assertQuery ( "author:jAuThOr" , change1 ) ; assertQuery ( "author:ExAmPlE" , change1 ) ; assertQuery ( "author:jcommitter@example.com" ) ; assertQuery ( "author:somewhere.com" ) ; assertQuery ( "author:jcommitter" ) ; assertQuery ( "author:Committer" ) ; }
Source:
private java.lang.String getByAccountName ( com.google.gerrit.server.git.CodeReviewCommit codeReviewCommit ) { com.google.gerrit.server.git.Account account = getAccount ( codeReviewCommit ) ; if ( ( account != null ) && ( ( account.getFullName ( ) ) != null ) ) { return " by " + ( account.getFullName ( ) ) ; } return "" ; }

Target:
abstract com.google.gerrit.extensions.client.SubmitType submitType ( ) ;
Source:
private void logError ( java.lang.String msg ) { if ( com.google.gerrit.server.git.MergeOp.log.isErrorEnabled ( ) ) { com.google.gerrit.server.git.MergeOp.log.error ( ( ( logPrefix ) + msg ) ) ; } }

Target:
private void logError ( java.lang.String msg , java.lang.Throwable t ) { if ( com.google.gerrit.server.git.MergeOp.log.isErrorEnabled ( ) ) { if ( t != null ) { com.google.gerrit.server.git.MergeOp.log.error ( ( ( logPrefix ) + msg ) , t ) ; } else { com.google.gerrit.server.git.MergeOp.log.error ( ( ( logPrefix ) + msg ) ) ; } } }
Source:
protected java.util.List < java.lang.String > getValues ( com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken token ) { java.util.List < java.lang.String > values = new java.util.ArrayList < > ( 3 ) ; values.add ( token.operation ) ; values.add ( token.id.getName ( ) ) ; values.add ( token.expiresAt ) ; return values ; }

Target:
protected java.util.List < java.lang.String > getValues ( com.googlesource.gerrit.plugins.lfs.fs.LfsFsRequestAuthorizer.LfsFsAuthToken token ) { java.util.List < java.lang.String > values = new java.util.ArrayList < > ( 3 ) ; values.add ( token.operation ) ; values.add ( token.id.getName ( ) ) ; values.add ( com.googlesource.gerrit.plugins.lfs.LfsDateTime.format ( token.issued ) ) ; values.add ( java.lang.String.valueOf ( token.expiresIn ) ) ; return values ; }
Source:
public void assertCanDelete ( com.google.gerrit.server.project.ProjectResource rsrc , com.googlesource.gerrit.plugins.deleteproject.DeleteProject.Input input ) throws com.google.gerrit.extensions.restapi.ResourceConflictException { try { pcHandler.assertCanDelete ( rsrc ) ; dbHandler.assertCanDelete ( rsrc.getControl ( ) . getProject ( ) ) ; fsHandler.assertCanDelete ( rsrc , ( input == null ? false : input.preserve ) ) ; } catch ( com.googlesource.gerrit.plugins.deleteproject.CannotDeleteProjectException e ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( e.getMessage ( ) ) ; } }

Target:
public void assertCanDelete ( com.google.gerrit.server.project.ProjectResource rsrc , com.googlesource.gerrit.plugins.deleteproject.DeleteProject.Input input ) throws com.google.gerrit.extensions.restapi.ResourceConflictException { try { pcHandler.assertCanDelete ( rsrc ) ; dbHandler.assertCanDelete ( rsrc.getProjectState ( ) . getProject ( ) ) ; fsHandler.assertCanDelete ( rsrc , ( input == null ? false : input.preserve ) ) ; } catch ( com.googlesource.gerrit.plugins.deleteproject.CannotDeleteProjectException e ) { throw new com.google.gerrit.extensions.restapi.ResourceConflictException ( e.getMessage ( ) ) ; } }
Source:
public Account.Id createEntry ( final java.lang.String username ) throws java.lang.Exception { try { final com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.reviewdb.client.AccountExternalId extId = db.accountExternalIds ( ) . get ( new com.google.gerrit.reviewdb.client.AccountExternalId.Key ( com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_GERRIT , username ) ) ; return extId != null ? extId.getAccountId ( ) : null ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.auth.ldap.LdapRealm.log.warn ( "Cannot query for username in database" , e ) ; return null ; } }

Target:
public Account.Id lookup ( java.lang.String accountName ) { if ( com.google.common.base.Strings.isNullOrEmpty ( accountName ) ) { return null ; } try { com.google.common.base.Optional < com.google.gerrit.reviewdb.client.Account.Id > id = usernameCache.get ( accountName ) ; return id != null ? id.orNull ( ) : null ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.gerrit.server.auth.ldap.LdapRealm.log.warn ( java.lang.String.format ( "Cannot lookup account %s in LDAP" , accountName ) , e ) ; return null ; } }
Source:
public static org.joda.time.Duration getDuration ( org.eclipse.jgit.lib.Config config , java.lang.String section , java.lang.String subsection , java.lang.String name , @ javax.annotation.Nullable org.joda.time.Duration defaultValue ) { long m = config.getTimeUnit ( section , subsection , name , ( - 1 ) , java.util.concurrent.TimeUnit.MILLISECONDS ) ; return m == ( - 1 ) ? defaultValue : org.joda.time.Duration.millis ( m ) ; }

Target:
public static java.time.Duration getDuration ( org.eclipse.jgit.lib.Config config , java.lang.String section , java.lang.String subsection , java.lang.String name , @ javax.annotation.Nullable java.time.Duration defaultValue ) { long m = config.getTimeUnit ( section , subsection , name , ( - 1 ) , java.util.concurrent.TimeUnit.MILLISECONDS ) ; return m == ( - 1 ) ? defaultValue : java.time.Duration.ofMillis ( m ) ; }
Source:
public void index ( com.google.gerrit.server.query.change.ChangeData cd ) throws java.io.IOException { try { indexTask ( cd ) . call ( ) ; } catch ( java.lang.RuntimeException e ) { throw e ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.index.ChangeIndexer.MAPPER.apply ( e ) ; } }

Target:
public com.google.inject.Provider < com.google.gerrit.reviewdb.server.ReviewDb > getReviewDbProvider ( ) { com.google.inject.Provider < com.google.gerrit.reviewdb.server.ReviewDb > db = dbRef.get ( ) ; if ( db == null ) { try { db = com.google.inject.util.Providers.of ( schemaFactory.open ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.inject.ProvisionException pe = new com.google.inject.ProvisionException ( "error opening ReviewDb" ) ; pe.initCause ( e ) ; throw pe ; } dbRef.set ( db ) ; } return db ; }
Source:
public boolean isOwner ( ) { com.google.gerrit.reviewdb.client.AccountGroup accountGroup = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( group ) ; if ( accountGroup == null ) { isOwner = false ; } else if ( ( isOwner ) == null ) { com.google.gerrit.reviewdb.client.AccountGroup.UUID ownerUUID = accountGroup.getOwnerGroupUUID ( ) ; isOwner = ( getUser ( ) . getEffectiveGroups ( ) . contains ( ownerUUID ) ) || ( getUser ( ) . getCapabilities ( ) . isAdmin_DoNotUse ( ) ) ; } return isOwner ; }

Target:
public boolean isOwner ( ) { com.google.gerrit.reviewdb.client.AccountGroup accountGroup = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( group ) ; if ( accountGroup == null ) { isOwner = false ; } else if ( ( isOwner ) == null ) { com.google.gerrit.reviewdb.client.AccountGroup.UUID ownerUUID = accountGroup.getOwnerGroupUUID ( ) ; isOwner = ( getUser ( ) . getEffectiveGroups ( ) . contains ( ownerUUID ) ) || ( canAdministrateServer ( ) ) ; } return isOwner ; }
Source:
public void destroy ( ) { org.apache.sshd.server.Command cmd = atomicCmd.getAndSet ( null ) ; if ( cmd != null ) { try { cmd.destroy ( ) ; } catch ( java.lang.Exception e ) { com.google.common.base.Throwables.propagateIfPossible ( e ) ; throw new java.lang.RuntimeException ( e ) ; } } }

Target:
public void destroy ( ) { org.apache.sshd.server.Command cmd = atomicCmd.getAndSet ( null ) ; if ( cmd != null ) { try { cmd.destroy ( ) ; } catch ( java.lang.Exception e ) { com.google.common.base.Throwables.throwIfUnchecked ( e ) ; throw new java.lang.RuntimeException ( e ) ; } } }
Source:
private void rpc ( java.lang.Class < ? extends com.google.gerrit.server.GerritJsonServlet > clazz ) { java.lang.String name = clazz.getSimpleName ( ) ; if ( name.endsWith ( "Srv" ) ) { name = name.substring ( 0 , ( ( name.length ( ) ) - 3 ) ) ; } rpc ( name , clazz ) ; }

Target:
private void rpc ( java.lang.Class < ? extends com.google.gwtjsonrpc.client.RemoteJsonService > clazz ) { java.lang.String name = clazz.getSimpleName ( ) ; if ( name.endsWith ( "Impl" ) ) { name = name.substring ( 0 , ( ( name.length ( ) ) - 4 ) ) ; } rpc ( name , clazz ) ; }
Source:
public void testIsEnabledRefNoParentMatchingBranchEnforced ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/test.*" } ; setupIsEnabled ( "enforced" , null , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertTrue ( itsConfig.isEnabled ( "testProject" , "refs/heads/testBranch" ) ) ; }

Target:
public void testIsEnabledRefNoParentMatchingBranchEnforced ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/test.*" } ; setupIsEnabled ( "enforced" , null , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectNK = new com.google.gerrit.reviewdb.client.Project.NameKey ( "testProject" ) ; assertTrue ( itsConfig.isEnabled ( projectNK , "refs/heads/testBranch" ) ) ; }
Source:
public void testUnblockVisibilityByREGISTEREDUsers ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; org.junit.Assert.assertTrue ( "u can read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }

Target:
public void testUnblockInLocalVisibilityByRegisteredUsers_Fails ( ) { com.google.gerrit.server.project.Util.block ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/*" ) ; 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 read" , u.controlForRef ( "refs/heads/master" ) . isVisibleByRegisteredUsers ( ) ) ; }
Source:
public void onScreenLoad ( com.google.gerrit.client.ui.ScreenLoadEvent event ) { com.google.gerrit.client.ui.Screen screen = event.getScreen ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectKey ; if ( screen instanceof com.google.gerrit.client.admin.ProjectScreen ) { projectKey = ( ( com.google.gerrit.client.admin.ProjectScreen ) ( screen ) ) . getProjectKey ( ) ; } else { projectKey = com.google.gerrit.client.admin.ProjectScreen.getSavedKey ( ) ; } if ( projectKey != null ) { setVisible ( true ) ; setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( projectKey , panel ) ) ; } else { setVisible ( false ) ; } super . onScreenLoad ( event ) ; }

Target:
public void go ( ) { java.lang.String href = getElement ( ) . getPropertyString ( "href" ) ; if ( href.startsWith ( "#" ) ) { super . go ( ) ; } else { com.google.gwt.user.client.Window.open ( href , getElement ( ) . getPropertyString ( "target" ) , "" ) ; } }
Source:
private static org.apache.lucene.search.Query sortKeyQuery ( com.google.gerrit.server.query.change.SortKeyPredicate p ) { return org.apache.lucene.search.NumericRangeQuery.newLongRange ( p.getField ( ) . getName ( ) , p.getMinValue ( ) , p.getMaxValue ( ) , true , true ) ; }

Target:
private static org.apache.lucene.search.Query sortKeyQuery ( com.google.gerrit.server.query.change.SortKeyPredicate p ) { return org.apache.lucene.search.NumericRangeQuery.newLongRange ( p.getField ( ) . getName ( ) , ( ( p.getMinValue ( ) ) != ( java.lang.Long.MIN_VALUE ) ? p.getMinValue ( ) : null ) , ( ( p.getMaxValue ( ) ) != ( java.lang.Long.MAX_VALUE ) ? p.getMaxValue ( ) : null ) , true , true ) ; }
Source:
public static com.googlesource.gerrit.plugins.analytics.UserActivitySummary fromUserActivity ( org.gitective.core.stat.UserCommitActivity uca ) { return new com.googlesource.gerrit.plugins.analytics.UserActivitySummary ( uca.getName ( ) , uca.getEmail ( ) , uca.getCount ( ) , com.googlesource.gerrit.plugins.analytics.UserActivitySummary.getCommits ( uca.getIds ( ) , uca.getTimes ( ) , uca.getMerges ( ) ) ) ; }

Target:
public static com.googlesource.gerrit.plugins.analytics.UserActivitySummary fromUserActivity ( org.gitective.core.stat.UserCommitActivity uca ) { return new com.googlesource.gerrit.plugins.analytics.UserActivitySummary ( uca.getName ( ) , uca.getEmail ( ) , uca.getCount ( ) , com.googlesource.gerrit.plugins.analytics.UserActivitySummary.getCommits ( uca.getIds ( ) , uca.getTimes ( ) , uca.getMerges ( ) ) , uca.getLatest ( ) ) ; }
Source:
public void run ( ) { if ( cm.isScrollSetByOther ( ) ) { return ; } other.scrollToY ( cm.getScrollInfo ( ) . getTop ( ) ) ; other.setScrollSetByOther ( true ) ; com.google.gwt.core.client.Scheduler.get ( ) . scheduleFixedDelay ( new com.google.gwt.core.client.Scheduler.RepeatingCommand ( ) { @ java.lang.Override public boolean execute ( ) { other.setScrollSetByOther ( false ) ; return false ; } } , 0 ) ; }

Target:
public void handle ( final net.codemirror.lib.CodeMirror instance , final net.codemirror.lib.CodeMirror.LineHandle handle , com.google.gwt.dom.client.Element element ) { if ( lineActiveBoxMap.containsKey ( handle ) ) { lineActiveBoxMap.get ( handle ) . resizePaddingWidget ( ) ; } if ( linePaddingOnOtherSideMap.containsKey ( handle ) ) { com.google.gwt.core.client.Scheduler.get ( ) . scheduleDeferred ( new com.google.gwt.core.client.Scheduler.ScheduledCommand ( ) { @ java.lang.Override public void execute ( ) { resizePaddingOnOtherSide ( side , instance.getLineNumber ( handle ) ) ; } } ) ; } }
Source:
void display ( final java.util.List < com.google.gerrit.common.data.AccountProjectWatchInfo > result ) { while ( 2 < ( table.getRowCount ( ) ) ) table.removeRow ( ( ( table.getRowCount ( ) ) - 1 ) ) ; for ( final com.google.gerrit.common.data.AccountProjectWatchInfo k : result ) { final int row = table.getRowCount ( ) ; table.insertRow ( row ) ; applyDataRowStyle ( row ) ; populate ( row , k ) ; } }

Target:
protected void displayPopup ( ) { popingUp = true ; if ( firstPopupLoad ) { populateProjects ( ) ; } else { popup.setPopupPositionAndShow ( popupPosition ) ; com.google.gwtexpui.globalkey.client.GlobalKey.dialog ( popup ) ; com.google.gwtexpui.globalkey.client.GlobalKey.addApplication ( popup , new com.google.gwtexpui.globalkey.client.HidePopupPanelCommand ( 0 , com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE , popup ) ) ; projectsTab.setRegisterKeys ( true ) ; projectsTab.finishDisplay ( ) ; if ( ( regWindowResize ) == null ) { regWindowResize = com.google.gwt.user.client.Window.addResizeHandler ( this ) ; } popingUp = false ; } }
Source:
private java.lang.String getFilename ( com.google.gitiles.GitilesView view , com.google.gitiles.Revision rev , java.lang.String ext ) { java.lang.StringBuilder sb = new java.lang.StringBuilder ( ) . append ( com.google.gitiles.Paths.basename ( view.getRepositoryName ( ) ) ) . append ( '-' ) . append ( rev.getName ( ) ) ; if ( ( view.getPathPart ( ) ) != null ) { sb.append ( '-' ) . append ( view.getPathPart ( ) . replace ( '/' , '-' ) ) ; } return sb.append ( ext ) . toString ( ) ; }

Target:
private java.lang.String getFilename ( com.google.gitiles.GitilesView view , com.google.gitiles.Revision rev , java.lang.String ext ) { java.lang.StringBuilder sb = new java.lang.StringBuilder ( ) . append ( com.google.gitiles.PathUtil.basename ( view.getRepositoryName ( ) ) ) . append ( '-' ) . append ( rev.getName ( ) ) ; if ( ( view.getPathPart ( ) ) != null ) { sb.append ( '-' ) . append ( view.getPathPart ( ) . replace ( '/' , '-' ) ) ; } return sb.append ( ext ) . toString ( ) ; }
Source:
public void trailingSlashes ( ) { com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( mockRequest ( "/c/s/foo/bar/" , "/c" , "/s" ) ) ) . isEqualTo ( "/foo/bar/" ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( mockRequest ( "/c/s/foo/bar///" , "/c" , "/s" ) ) ) . isEqualTo ( "/foo/bar/" ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( mockRequest ( "/c/s/foo%2Fbar/" , "/c" , "/s" ) ) ) . isEqualTo ( "/foo%2Fbar/" ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( mockRequest ( "/c/s/foo%2Fbar///" , "/c" , "/s" ) ) ) . isEqualTo ( "/foo%2Fbar/" ) ; }

Target:
public void emptyPathInfo ( ) { com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( fakeRequest ( "/c" , "/s" , "" ) ) ) . isNull ( ) ; }
Source:
public com.google.gerrit.extensions.common.GroupInfo apply ( com.google.gerrit.server.group.GroupResource resource ) throws com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup group = resource.toAccountGroup ( ) ; if ( group == null ) { throw new com.google.gerrit.extensions.restapi.MethodNotAllowedException ( ) ; } try { com.google.gerrit.server.account.GroupControl c = controlFactory.validateFor ( group.getOwnerGroupUUID ( ) ) ; return json.format ( c.getGroup ( ) ) ; } catch ( com.google.gerrit.common.errors.NoSuchGroupException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } }

Target:
public com.google.gerrit.extensions.common.GroupInfo apply ( com.google.gerrit.server.group.GroupResource resource ) throws com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException { com.google.gerrit.common.data.GroupDescription.Internal group = resource.asInternalGroup ( ) . orElseThrow ( MethodNotAllowedException :: new ) ; try { com.google.gerrit.server.account.GroupControl c = controlFactory.validateFor ( group.getOwnerGroupUUID ( ) ) ; return json.format ( c.getGroup ( ) ) ; } catch ( com.google.gerrit.common.errors.NoSuchGroupException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } }
Source:
public com.google.gerrit.extensions.restapi.Response < java.util.Set < java.lang.String > > apply ( com.google.gerrit.server.change.ChangeResource req ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = control.getNotes ( ) . load ( ) ; java.util.Set < java.lang.String > hashtags = notes.getHashtags ( ) ; if ( hashtags == null ) { hashtags = com.google.common.collect.ImmutableSet.of ( ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( hashtags ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < ? extends java.util.Set < java.lang.String > > apply ( com.google.gerrit.server.change.ChangeResource req ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = control.getNotes ( ) . load ( ) ; java.util.Set < java.lang.String > hashtags = notes.getHashtags ( ) ; if ( hashtags == null ) { hashtags = com.google.common.collect.ImmutableSet.of ( ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( new java.util.TreeSet < java.lang.String > ( hashtags ) ) ; }
Source:
public java.util.List < java.lang.String > getParameterNames ( ) { final java.util.ArrayList < java.lang.String > r = new java.util.ArrayList < java.lang.String > ( parameters.size ( ) ) ; for ( com.google.gerrit.server.ParamertizedString.Parameter p : parameters ) { r.add ( p.name ) ; } return java.util.Collections.unmodifiableList ( r ) ; }

Target:
public java.util.List < java.lang.String > getParameterNames ( ) { final java.util.ArrayList < java.lang.String > r = new java.util.ArrayList < java.lang.String > ( parameters.size ( ) ) ; for ( com.google.gerrit.common.data.ParamertizedString.Parameter p : parameters ) { r.add ( p.name ) ; } return java.util.Collections.unmodifiableList ( r ) ; }
Source:
public void setMillisProvider ( ) { clockStepMs = 1 ; final java.util.concurrent.atomic.AtomicLong clockMs = new java.util.concurrent.atomic.AtomicLong ( ( ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( ChangeUtil.SORT_KEY_EPOCH_MINS , java.util.concurrent.TimeUnit.MINUTES ) ) + ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 60 , java.util.concurrent.TimeUnit.DAYS ) ) ) ) ; org.joda.time.DateTimeUtils.setCurrentMillisProvider ( new org.joda.time.DateTimeUtils.MillisProvider ( ) { @ java.lang.Override public long getMillis ( ) { return clockMs.getAndAdd ( clockStepMs ) ; } } ) ; }

Target:
public void setTimeForTesting ( ) { systemTimeZone = java.lang.System.setProperty ( "user.timezone" , "US/Eastern" ) ; clockStepMs = 1 ; final java.util.concurrent.atomic.AtomicLong clockMs = new java.util.concurrent.atomic.AtomicLong ( new org.joda.time.DateTime ( 2009 , 9 , 30 , 17 , 0 , 0 ) . getMillis ( ) ) ; org.joda.time.DateTimeUtils.setCurrentMillisProvider ( new org.joda.time.DateTimeUtils.MillisProvider ( ) { @ java.lang.Override public long getMillis ( ) { return clockMs.getAndAdd ( clockStepMs ) ; } } ) ; }
Source:
public void parsePatchSetGroups ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) + "Groups: d,e,f\n" ) ) ) ; }

Target:
public void parsePatchSetGroups ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) + "Groups: d,e,f\n" ) ) ) ; }