auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void createGroupInReviewDb ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.AccountGroup group ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroupName gn = new com.google.gerrit.reviewdb.client.AccountGroupName ( group ) ; db.accountGroupNames ( ) . insert ( com.google.common.collect.ImmutableList.of ( gn ) ) ; db.accountGroups ( ) . insert ( com.google.common.collect.ImmutableList.of ( group ) ) ; }

Target:
private static com.google.gerrit.server.group.InternalGroup createGroupInReviewDb ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.group.db.InternalGroupCreation groupCreation , com.google.gerrit.server.group.db.InternalGroupUpdate groupUpdate ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup group = com.google.gerrit.server.group.db.GroupsUpdate.createAccountGroup ( groupCreation , groupUpdate ) ; db.accountGroupNames ( ) . insert ( com.google.common.collect.ImmutableList.of ( new com.google.gerrit.reviewdb.client.AccountGroupName ( group ) ) ) ; db.accountGroups ( ) . insert ( com.google.common.collect.ImmutableList.of ( group ) ) ; return com.google.gerrit.server.group.InternalGroup.create ( group , com.google.common.collect.ImmutableSet.of ( ) , com.google.common.collect.ImmutableSet.of ( ) ) ; }
Source:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent e ) { e.stopPropagation ( ) ; if ( ( ( ( e.getCharCode ( ) ) == '\n' ) || ( ( e.getCharCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) ) && ( e.isControlKeyDown ( ) ) ) { e.preventDefault ( ) ; onSend ( null ) ; } }

Target:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent e ) { e.stopPropagation ( ) ; if ( ( ( ( e.getCharCode ( ) ) == '\n' ) || ( ( e.getCharCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) ) && ( e.isControlKeyDown ( ) ) ) { e.preventDefault ( ) ; onPost ( null ) ; } }
Source:
public void setUp ( ) throws java.lang.Exception { java.lang.Class.forName ( com.mysql.jdbc.Driver.class . getName ( ) ) ; final java.lang.String host = "localhost" ; final java.lang.String database = "gwtorm" ; final java.lang.String user = "gwtorm" ; final java.lang.String pass = "gwtorm" ; final java.lang.String url = ( ( "jdbc:mysql://" + host ) + "/" ) + database ; try { db = java.sql.DriverManager.getConnection ( url , user , pass ) ; } catch ( java.lang.Throwable t ) { org.junit.Assume.assumeNoException ( t ) ; } executor = new com.google.gwtorm.jdbc.JdbcExecutor ( db ) ; dialect = new com.google.gwtorm.schema.sql.DialectMySQL ( ) . refine ( db ) ; final java.util.Properties p = new java.util.Properties ( ) ; p.setProperty ( "driver" , com.mysql.jdbc.Driver.class . getName ( ) ) ; p.setProperty ( "url" , db.getMetaData ( ) . getURL ( ) ) ; p.setProperty ( "user" , user ) ; p.setProperty ( "password" , pass ) ; phoneBook = new com.google.gwtorm.jdbc.Database ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb.class ) ; phoneBook2 = new com.google.gwtorm.jdbc.Database ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb2.class ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { java.lang.Class.forName ( com.mysql.jdbc.Driver.class . getName ( ) ) ; final java.lang.String host = "localhost" ; final java.lang.String database = "gwtorm" ; final java.lang.String user = "gwtorm" ; final java.lang.String pass = "gwtorm" ; final java.lang.String url = ( ( "jdbc:mysql://" + host ) + "/" ) + database ; try { db = java.sql.DriverManager.getConnection ( url , user , pass ) ; } catch ( java.lang.Throwable t ) { org.junit.Assume.assumeNoException ( t ) ; } executor = new com.google.gwtorm.jdbc.JdbcExecutor ( db ) ; dialect = new com.google.gwtorm.schema.sql.DialectMySQL ( ) . refine ( db ) ; final java.util.Properties p = new java.util.Properties ( ) ; p.setProperty ( "driver" , com.mysql.cj.jdbc.Driver.class . getName ( ) ) ; p.setProperty ( "url" , db.getMetaData ( ) . getURL ( ) ) ; p.setProperty ( "user" , user ) ; p.setProperty ( "password" , pass ) ; phoneBook = new com.google.gwtorm.jdbc.Database ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb.class ) ; phoneBook2 = new com.google.gwtorm.jdbc.Database ( new com.google.gwtorm.jdbc.SimpleDataSource ( p ) , com.google.gwtorm.data.PhoneBookDb2.class ) ; }
Source:
public void configureServlets ( ) { serveRegex ( "^/gerrit_ui/(?!rpc/)(.*)$" ) . with ( com.google.inject.Key.get ( javax.servlet.http.HttpServlet.class , com.google.inject.name.Names.named ( com.google.gerrit.httpd.raw.StaticModule.GWT_UI_SERVLET ) ) ) ; com.google.gerrit.httpd.raw.Paths p = getPaths ( ) ; if ( ( ( p.warFs ) == null ) && ( ( p.buckOut ) != null ) ) { filter ( "/" ) . through ( new com.google.gerrit.httpd.raw.RecompileGwtUiFilter ( p.buckOut , p.unpackedWar ) ) ; } }

Target:
public void configureServlets ( ) { serveRegex ( "^/gerrit_ui/(?!rpc/)(.*)$" ) . with ( com.google.inject.Key.get ( javax.servlet.http.HttpServlet.class , com.google.inject.name.Names.named ( com.google.gerrit.httpd.raw.StaticModule.GWT_UI_SERVLET ) ) ) ; com.google.gerrit.httpd.raw.StaticModule.Paths p = getPaths ( ) ; if ( ( ( p.warFs ) == null ) && ( ( p.buckOut ) != null ) ) { filter ( "/" ) . through ( new com.google.gerrit.httpd.raw.RecompileGwtUiFilter ( p.buckOut , p.unpackedWar ) ) ; } }
Source:
public void allRefsVisibleNoRefsMetaConfig ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.PROJECT_OWNERS , "refs/meta/config" ) ; com.google.gerrit.server.project.Util.doNotInherit ( cfg , Permission.READ , "refs/meta/config" ) ; saveProjectConfig ( project , cfg ) ; assertRefs ( "HEAD" , "refs/changes/01/1/1" , "refs/changes/01/1/meta" , "refs/changes/02/2/1" , "refs/changes/02/2/meta" , "refs/heads/branch" , "refs/heads/master" ) ; }

Target:
public void allRefsVisibleNoRefsMetaConfig ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , admins , "refs/meta/config" ) ; com.google.gerrit.server.project.Util.doNotInherit ( cfg , Permission.READ , "refs/meta/config" ) ; saveProjectConfig ( project , cfg ) ; assertRefs ( "HEAD" , "refs/changes/01/1/1" , "refs/changes/01/1/meta" , "refs/changes/02/2/1" , "refs/changes/02/2/meta" , "refs/heads/branch" , "refs/heads/master" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }
Source:
private static org.bouncycastle.bcpg.sig.RevocationReason getRevocationReason ( org.bouncycastle.openpgp.PGPSignature sig ) { org.bouncycastle.bcpg.SignatureSubpacket sub = sig.getHashedSubPackets ( ) . getSubpacket ( org.bouncycastle.bcpg.SignatureSubpacketTags.REVOCATION_REASON ) ; if ( sub == null ) { return null ; } return new org.bouncycastle.bcpg.sig.RevocationReason ( sub.isCritical ( ) , sub.getData ( ) ) ; }

Target:
private static org.bouncycastle.bcpg.sig.RevocationReason getRevocationReason ( org.bouncycastle.openpgp.PGPSignature sig ) { if ( ( sig.getSignatureType ( ) ) != ( org.bouncycastle.openpgp.PGPSignature.KEY_REVOCATION ) ) { throw new java.lang.IllegalArgumentException ( ( "Expected KEY_REVOCATION signature, got " + ( sig.getSignatureType ( ) ) ) ) ; } org.bouncycastle.bcpg.SignatureSubpacket sub = sig.getHashedSubPackets ( ) . getSubpacket ( org.bouncycastle.bcpg.SignatureSubpacketTags.REVOCATION_REASON ) ; if ( sub == null ) { return null ; } return new org.bouncycastle.bcpg.sig.RevocationReason ( sub.isCritical ( ) , sub.getData ( ) ) ; }
Source:
protected void setMessageText ( java.lang.String message ) { if ( message == null ) { message = "" ; } else { message = message.trim ( ) ; } messageSummary.setText ( com.google.gerrit.client.ui.CommentPanel.summarize ( message ) ) ; com.google.gwtexpui.safehtml.client.SafeHtml.set ( messageText , new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( message ) . wikify ( ) ) ; }

Target:
protected void setMessageText ( java.lang.String message ) { if ( message == null ) { message = "" ; } else { message = message.trim ( ) ; } messageSummary.setText ( com.google.gerrit.client.ui.CommentPanel.summarize ( message ) ) ; com.google.gwtexpui.safehtml.client.SafeHtml.set ( messageText , new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( message ) . wikify ( ) . replaceAll ( com.google.gerrit.client.Gerrit.getConfig ( ) . getCommentLinks ( ) ) ) ; }
Source:
public static net.codemirror.lib.TextMarker.FromTo create ( com.google.gerrit.client.diff.CommentRange range ) { return net.codemirror.lib.TextMarker.FromTo.create ( net.codemirror.lib.Pos.create ( ( ( range.start_line ( ) ) - 1 ) , range.start_character ( ) ) , net.codemirror.lib.Pos.create ( ( ( range.end_line ( ) ) - 1 ) , range.end_character ( ) ) ) ; }

Target:
public static net.codemirror.lib.TextMarker.FromTo create ( com.google.gerrit.client.diff.CommentRange range ) { return net.codemirror.lib.TextMarker.FromTo.create ( net.codemirror.lib.Pos.create ( ( ( range.startLine ( ) ) - 1 ) , range.startCharacter ( ) ) , net.codemirror.lib.Pos.create ( ( ( range.endLine ( ) ) - 1 ) , range.endCharacter ( ) ) ) ; }
Source:
private void streamFile ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { java.io.File f = resolveFile ( req ) ; res.setStatus ( HttpServletResponse.SC_OK ) ; res.setContentType ( "application/octet-stream" ) ; res.setContentLength ( ( ( int ) ( f.length ( ) ) ) ) ; java.io.OutputStream out = res.getOutputStream ( ) ; try ( java.io.InputStream in = new java.io.FileInputStream ( f ) ) { com.google.common.io.ByteStreams.copy ( in , out ) ; } }

Target:
private void writeFile ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { res.setStatus ( HttpServletResponse.SC_NO_CONTENT ) ; streamRequestToFile ( req , resolvePath ( req ) . toFile ( ) ) ; }
Source:
private void update ( org.eclipse.jgit.revwalk.RevCommit rev ) throws java.lang.Exception { org.eclipse.jgit.lib.RefUpdate u = db.updateRef ( GitRepositoryManager.REF_CONFIG ) ; u.disableRefLog ( ) ; u.setNewObjectId ( rev ) ; switch ( u.forceUpdate ( ) ) { case FAST_FORWARD : case FORCED : case NEW : case NO_CHANGE : break ; default : org.junit.Assert.fail ( ( "Cannot update ref for test: " + ( u.getResult ( ) ) ) ) ; } }

Target:
private void update ( org.eclipse.jgit.revwalk.RevCommit rev ) throws java.lang.Exception { org.eclipse.jgit.lib.RefUpdate u = db.updateRef ( RefNames.REFS_CONFIG ) ; u.disableRefLog ( ) ; u.setNewObjectId ( rev ) ; switch ( u.forceUpdate ( ) ) { case FAST_FORWARD : case FORCED : case NEW : case NO_CHANGE : break ; default : org.junit.Assert.fail ( ( "Cannot update ref for test: " + ( u.getResult ( ) ) ) ) ; } }
Source:
static java.nio.file.Path getDir ( com.google.gerrit.server.config.SitePaths sitePaths , java.lang.String prefix , com.google.gerrit.index.Schema < ? > schema ) { return sitePaths.index_dir.resolve ( java.lang.String.format ( "%s%04d" , prefix , schema.getVersion ( ) ) ) ; BRANCH ( ( 8 ? ElasticTestUtils : also ) ) ; com.google.gerrit.lucene.reuse index ; com.google.gerrit.lucene.name constants ; }

Target:
static java.nio.file.Path getDir ( com.google.gerrit.server.config.SitePaths sitePaths , java.lang.String name , com.google.gerrit.index.Schema < ? > schema ) { return sitePaths.index_dir.resolve ( java.lang.String.format ( "%s_%04d" , name , schema.getVersion ( ) ) ) ; }
Source:
com.google.gerrit.server.account.IncludingGroupMembership create ( java.lang.Iterable < com.google.gerrit.reviewdb.client.AccountGroup.UUID > groupIds ) ;

Target:
public java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > intersection ( java.lang.Iterable < com.google.gerrit.reviewdb.client.AccountGroup.UUID > groupIds ) { java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > r = com.google.common.collect.Sets.newHashSet ( ) ; for ( com.google.gerrit.reviewdb.client.AccountGroup.UUID id : groupIds ) { if ( contains ( id ) ) { r.add ( id ) ; } } return r ; }
Source:
private void loadOrganisations ( java.lang.String username , com.googlesource.gerrit.plugins.github.group.GitHubGroupsCache.OrganizationStructure orgsTeams , com.googlesource.gerrit.plugins.github.oauth.GitHubLogin ghLogin ) throws java.io.IOException { com.googlesource.gerrit.plugins.github.group.GitHubGroupsCache.OrganisationLoader.logger.debug ( "Getting list of public organisations for user '{}'" , username ) ; java.util.Set < java.lang.String > organisations = ghLogin.getMyOrganisationsLogins ( ) ; for ( java.lang.String org : organisations ) { orgsTeams.put ( org , com.googlesource.gerrit.plugins.github.group.GitHubGroupsCache.EVERYONE_TEAM_NAME ) ; } }

Target:
private void loadOrganisations ( java.lang.String username , com.googlesource.gerrit.plugins.github.groups.OrganizationStructure orgsTeams , com.googlesource.gerrit.plugins.github.oauth.GitHubLogin ghLogin ) throws java.io.IOException { com.googlesource.gerrit.plugins.github.group.GitHubGroupsCache.OrganisationLoader.logger.debug ( "Getting list of public organisations for user '{}'" , username ) ; java.util.Set < java.lang.String > organisations = ghLogin.getMyOrganisationsLogins ( ) ; for ( java.lang.String org : organisations ) { orgsTeams.put ( org , com.googlesource.gerrit.plugins.github.group.GitHubGroupsCache.EVERYONE_TEAM_NAME ) ; } }
Source:
public static com.google.gerrit.server.mail.MailUtil.MailRecipients getRecipientsFromApprovals ( final java.util.List < com.google.gerrit.reviewdb.client.PatchSetApproval > approvals ) { final com.google.gerrit.server.mail.MailUtil.MailRecipients recipients = new com.google.gerrit.server.mail.MailUtil.MailRecipients ( ) ; for ( com.google.gerrit.reviewdb.client.PatchSetApproval a : approvals ) { if ( ( a.getValue ( ) ) != 0 ) { recipients.reviewers.add ( a.getAccountId ( ) ) ; } else { recipients.cc.add ( a.getAccountId ( ) ) ; } } return recipients ; }

Target:
public static com.google.gerrit.server.mail.MailUtil.MailRecipients getRecipientsFromReviewers ( com.google.common.collect.Multimap < com.google.gerrit.server.ApprovalsUtil.ReviewerState , com.google.gerrit.reviewdb.client.Account.Id > reviewers ) { com.google.gerrit.server.mail.MailUtil.MailRecipients recipients = new com.google.gerrit.server.mail.MailUtil.MailRecipients ( ) ; recipients.reviewers.addAll ( reviewers.get ( ReviewerState.REVIEWER ) ) ; recipients.cc.addAll ( reviewers.get ( ReviewerState.CC ) ) ; return recipients ; }
Source:
private static java.lang.String imgSrc ( java.lang.String val ) { if ( ( ( val.startsWith ( "http:" ) ) || ( val.startsWith ( "https:" ) ) ) && ( com.google.gitiles.doc.html.HtmlBuilder.URI.getValueFilter ( ) . matcher ( val ) . find ( ) ) ) { return com.google.gitiles.doc.html.HtmlBuilder.URI.escape ( val ) ; } if ( com.google.gitiles.doc.html.HtmlBuilder.isImageDataUri ( val ) ) { return val ; } return com.google.gitiles.doc.html.HtmlBuilder.IMAGE_DATA.getInnocuousOutput ( ) ; }

Target:
public static boolean isValidHttpUri ( java.lang.String val ) { return ( ( ( val.startsWith ( "https://" ) ) || ( val.startsWith ( "http://" ) ) ) || ( val.startsWith ( "//" ) ) ) && ( com.google.gitiles.doc.html.HtmlBuilder.URI.getValueFilter ( ) . matcher ( val ) . find ( ) ) ; }
Source:
public void testParseMultiLineQuote ( ) { java.lang.String comment = "> Quote line 1\n> Quote line 2\n > Quote line 3\n" ; java.util.List < com.google.gerrit.server.mail.send.CommentFormatter.Block > result = com.google.gerrit.server.mail.send.CommentFormatter.parse ( comment ) ; com.google.common.truth.Truth.assertThat ( result ) . hasSize ( 1 ) ; assertBlock ( result , 0 , BlockType.QUOTE , "Quote line 1\nQuote line 2\nQuote line 3" ) ; }

Target:
public void testParseQuoteLeadSpace ( ) { java.lang.String comment = " > Quote text" ; java.util.List < com.google.gerrit.server.mail.send.CommentFormatter.Block > result = com.google.gerrit.server.mail.send.CommentFormatter.parse ( comment ) ; com.google.common.truth.Truth.assertThat ( result ) . hasSize ( 1 ) ; assertQuoteBlock ( result , 0 , 1 ) ; assertBlock ( result.get ( 0 ) . quotedBlocks , 0 , BlockType.PARAGRAPH , "Quote text" ) ; }
Source:
public void run ( ) { view.getCmFromSide ( DisplaySide.A ) . setOption ( "mode" , m ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "mode" , m ) ; }

Target:
public void run ( ) { java.lang.String mode = ( ( m != null ) && ( ! ( m.isEmpty ( ) ) ) ) ? m : null ; view.getCmFromSide ( DisplaySide.A ) . setOption ( "mode" , mode ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "mode" , mode ) ; }
Source:
private static void recursiveDelete ( java.io.File path ) { java.io.File [ ] entries = path.listFiles ( ) ; if ( entries != null ) { for ( java.io.File e : entries ) { com.google.gerrit.pgm.init.BaseInit.recursiveDelete ( e ) ; } } if ( ( ! ( path.delete ( ) ) ) && ( path.exists ( ) ) ) { java.lang.System.err.println ( ( "warn: Cannot remove " + path ) ) ; } }

Target:
public java.nio.file.FileVisitResult visitFile ( java.nio.file.Path f , java.nio.file.attribute.BasicFileAttributes attrs ) throws java.io.IOException { try { java.nio.file.Files.delete ( f ) ; } catch ( java.io.IOException e ) { java.lang.System.err.println ( ( msg + f ) ) ; } return java.nio.file.FileVisitResult.CONTINUE ; }
Source:
private void testGetAccount ( java.lang.String url , com.google.gerrit.acceptance.TestAccount expectedAccount ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = adminSession.get ( url ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; com.google.gerrit.acceptance.rest.account.AccountAssert.assertAccountInfo ( expectedAccount , newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.extensions.common.AccountInfo.class ) ) ; }

Target:
private void testGetAccount ( java.lang.String id , com.google.gerrit.acceptance.TestAccount expectedAccount ) throws java.lang.Exception { com.google.gerrit.acceptance.rest.account.AccountAssert.assertAccountInfo ( expectedAccount , gApi.accounts ( ) . id ( id ) . get ( ) ) ; }
Source:
private static void addPublicKey ( final java.util.Collection < java.security.PublicKey > out , final org.apache.sshd.common.KeyPairProvider p , final java.lang.String type ) { final java.security.KeyPair pair = p.loadKey ( type ) ; if ( ( pair != null ) && ( ( pair.getPublic ( ) ) != null ) ) { out.add ( pair.getPublic ( ) ) ; } }

Target:
private static void addPublicKey ( final java.util.Collection < java.security.PublicKey > out , final org.apache.sshd.common.keyprovider.KeyPairProvider p , final java.lang.String type ) { final java.security.KeyPair pair = p.loadKey ( type ) ; if ( ( pair != null ) && ( ( pair.getPublic ( ) ) != null ) ) { out.add ( pair.getPublic ( ) ) ; } }
Source:
private com.google.inject.Injector createWebInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; if ( sshd ) { modules.add ( sshInjector.getInstance ( com.google.inject.Module.class ) ) ; } modules.add ( sshInjector.getInstance ( com.google.gerrit.httpd.WebModule.class ) ) ; modules.add ( sshInjector.getInstance ( com.google.gerrit.httpd.WebSshGlueModule.class ) ) ; return sysInjector.createChildInjector ( modules ) ; }

Target:
private com.google.inject.Injector createWebInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; if ( sshd ) { modules.add ( sshInjector.getInstance ( com.google.inject.Module.class ) ) ; } modules.add ( sshInjector.getInstance ( com.google.gerrit.httpd.WebModule.class ) ) ; modules.add ( sshInjector.getInstance ( com.google.gerrit.httpd.WebSshGlueModule.class ) ) ; if ( ! ( slave ) ) { modules.add ( new com.google.gerrit.httpd.SessionCacheCleaner.Module ( ) ) ; } return sysInjector.createChildInjector ( modules ) ; }
Source:
public void submitOnPushSuccessfulMerge ( ) throws java.lang.Exception { java.lang.String master = "refs/heads/master" ; org.eclipse.jgit.lib.ObjectId objectId = repo ( ) . getRef ( "HEAD" ) . getObjectId ( ) ; push ( master , "one change" , "a.txt" , "some content" ) ; testRepo.reset ( objectId ) ; grant ( Permission.SUBMIT , project , "refs/for/refs/heads/master" ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = push ( "refs/for/master%submit" , "other change" , "b.txt" , "other content" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.MERGED , null , admin ) ; assertMergeCommit ( master , "other change" ) ; }

Target:
public void submitOnPushSuccessfulMerge ( ) throws java.lang.Exception { java.lang.String master = "refs/heads/master" ; org.eclipse.jgit.lib.ObjectId objectId = repo ( ) . exactRef ( "HEAD" ) . getObjectId ( ) ; push ( master , "one change" , "a.txt" , "some content" ) ; testRepo.reset ( objectId ) ; grant ( Permission.SUBMIT , project , "refs/for/refs/heads/master" ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = push ( "refs/for/master%submit" , "other change" , "b.txt" , "other content" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.MERGED , null , admin ) ; assertMergeCommit ( master , "other change" ) ; }
Source:
public com.google.gitiles.doc.html.HtmlBuilder appendAndEscape ( java.lang.CharSequence in ) { try { finishActiveTag ( ) ; textBuf.append ( in ) ; return this ; } catch ( java.io.IOException e ) { throw new java.lang.IllegalStateException ( e ) ; } }

Target:
public com.google.gitiles.doc.html.HtmlBuilder close ( java.lang.String tag ) { com.google.common.base.Preconditions.checkArgument ( ( ( com.google.gitiles.doc.html.HtmlBuilder.ALLOWED_TAGS.contains ( tag ) ) && ( ! ( com.google.gitiles.doc.html.HtmlBuilder.SELF_CLOSING_TAGS.contains ( tag ) ) ) ) , "invalid HTML tag %s" , tag ) ; finishActiveTag ( ) ; try { htmlBuf.append ( "</" ) . append ( tag ) . append ( '>' ) ; } catch ( java.io.IOException e ) { throw new com.google.gitiles.doc.RuntimeIOException ( e ) ; } return this ; }
Source:
public boolean apply ( com.google.gerrit.server.project.ListBranches.BranchInfo in ) { if ( ! ( in.ref.startsWith ( Constants.R_HEADS ) ) ) { return in.ref.toLowerCase ( java.util.Locale.US ) . contains ( matchSubstring.toLowerCase ( java.util.Locale.US ) ) ; } else { return in.ref.substring ( Constants.R_HEADS.length ( ) ) . toLowerCase ( java.util.Locale.US ) . contains ( matchSubstring.toLowerCase ( java.util.Locale.US ) ) ; } }

Target:
public boolean apply ( com.google.gerrit.server.project.ListBranches.BranchInfo in ) { java.lang.String ref = in.ref ; if ( ref.startsWith ( Constants.R_HEADS ) ) { ref = ref.substring ( Constants.R_HEADS.length ( ) ) ; } ref = ref.toLowerCase ( java.util.Locale.US ) ; return ref.contains ( substring ) ; }
Source:
private void refresh ( ) { final java.lang.String mySubname = subname ; com.google.gerrit.client.groups.GroupMap.match ( subname , new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.groups.GroupMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.groups.GroupMap result ) { if ( ( ( mySubname == null ) && ( ( subname ) == null ) ) || ( ( mySubname != null ) && ( mySubname.equals ( subname ) ) ) ) { display ( result ) ; } } } ) ; }

Target:
private void refresh ( ) { com.google.gerrit.client.groups.GroupMap.match ( subname , new com.google.gerrit.client.ui.IgnoreOutdatedFilterResultsCallbackWrapper < com.google.gerrit.client.groups.GroupMap > ( this , new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.groups.GroupMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.groups.GroupMap result ) { groups.display ( result , subname ) ; groups.finishDisplay ( ) ; } } ) ) ; }
Source:
public void storeLocalOffline ( ) throws java.lang.Exception { setUpClientMock ( ) ; org.mockito.Mockito.doThrow ( new java.sql.SQLException ( new java.net.ConnectException ( ) ) ) . when ( eventsDb ) . createDBIfNotCreated ( ) ; org.mockito.Mockito.doThrow ( new java.sql.SQLException ( ) ) . when ( eventsDb ) . queryOne ( ) ; }

Target:
public void offlineUponStart ( ) throws java.lang.Exception { setUpClientMock ( ) ; org.mockito.Mockito.doThrow ( new java.sql.SQLException ( new java.net.ConnectException ( ) ) ) . when ( eventsDb ) . createDBIfNotCreated ( ) ; org.mockito.Mockito.doThrow ( new java.sql.SQLException ( ) ) . when ( eventsDb ) . queryOne ( ) ; store = new com.ericsson.gerrit.plugins.eventslog.sql.SQLStore ( userProviderMock , cfgMock , eventsDb , localEventsDb , poolMock , permissionBackendMock ) ; store.start ( ) ; org.mockito.Mockito.verify ( localEventsDb ) . createDBIfNotCreated ( ) ; }
Source:
public static void storeMyMenus ( com.google.gerrit.server.account.VersionedAccountPreferences prefs , java.util.List < com.google.gerrit.extensions.client.MenuItem > my ) { org.eclipse.jgit.lib.Config cfg = prefs.getConfig ( ) ; if ( my != null ) { com.google.gerrit.server.account.SetPreferences.unsetSection ( cfg , UserConfigSections.MY ) ; for ( com.google.gerrit.extensions.client.MenuItem item : my ) { com.google.gerrit.server.account.SetPreferences.set ( cfg , item.name , com.google.gerrit.server.account.GetPreferences.KEY_URL , item.url ) ; com.google.gerrit.server.account.SetPreferences.set ( cfg , item.name , com.google.gerrit.server.account.GetPreferences.KEY_TARGET , item.target ) ; com.google.gerrit.server.account.SetPreferences.set ( cfg , item.name , com.google.gerrit.server.account.GetPreferences.KEY_ID , item.id ) ; } } }

Target:
public static void storeMyMenus ( com.google.gerrit.server.account.VersionedAccountPreferences prefs , java.util.List < com.google.gerrit.extensions.client.MenuItem > my ) { org.eclipse.jgit.lib.Config cfg = prefs.getConfig ( ) ; if ( my != null ) { com.google.gerrit.server.account.SetPreferences.unsetSection ( cfg , UserConfigSections.MY ) ; for ( com.google.gerrit.extensions.client.MenuItem item : my ) { com.google.gerrit.server.account.SetPreferences.set ( cfg , item.name , com.google.gerrit.server.git.UserConfigSections.KEY_URL , item.url ) ; com.google.gerrit.server.account.SetPreferences.set ( cfg , item.name , com.google.gerrit.server.git.UserConfigSections.KEY_TARGET , item.target ) ; com.google.gerrit.server.account.SetPreferences.set ( cfg , item.name , com.google.gerrit.server.git.UserConfigSections.KEY_ID , item.id ) ; } } }
Source:
public boolean xsrfValidate ( ) { final java.lang.String keyIn = getXsrfKeyIn ( ) ; if ( ( keyIn == null ) || ( "" . equals ( keyIn ) ) ) { return ! ( session.isSignedIn ( ) ) ; } else { return ( session.isSignedIn ( ) ) && ( keyIn.equals ( session.getAuthorization ( ) ) ) ; } }

Target:
public boolean xsrfValidate ( ) { final java.lang.String keyIn = getXsrfKeyIn ( ) ; if ( ( keyIn == null ) || ( "" . equals ( keyIn ) ) ) { return ! ( session.isSignedIn ( ) ) ; } else { return ( session.isSignedIn ( ) ) && ( session.isValidAuthorization ( keyIn ) ) ; } }
Source:
public java.lang.String toString ( ) { return ( ( ( ( ( ( ( ( ( ( "ChangeMessage{" + "key=" ) + ( key ) ) + ", author=" ) + ( author ) ) + ", writtenOn=" ) + ( writtenOn ) ) + ", patchset=" ) + ( patchset ) ) + ", message=[" ) + ( message ) ) + "]}" ; }

Target:
public java.lang.String toString ( ) { return ( ( ( ( ( ( ( ( ( ( ( ( "ChangeMessage{" + "key=" ) + ( key ) ) + ", author=" ) + ( author ) ) + ", writtenOn=" ) + ( writtenOn ) ) + ", patchset=" ) + ( patchset ) ) + ", tag=" ) + ( tag ) ) + ", message=[" ) + ( message ) ) + "]}" ; }
Source:
public void createProject ( ) throws java.lang.Exception { java.lang.String name = name ( "foo" ) ; com.google.common.truth.Truth.assertThat ( name ) . isEqualTo ( gApi.projects ( ) . create ( name ) . get ( ) . name ) ; }

Target:
public void createProject ( ) throws java.lang.Exception { java.lang.String name = name ( "foo" ) ; com.google.common.truth.Truth.assertThat ( name ) . isEqualTo ( gApi.projects ( ) . create ( name ) . get ( ) . name ) ; org.eclipse.jgit.revwalk.RevCommit head = getRemoteHead ( name , "refs/meta/config" ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/meta/config" , null , head ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/heads/master" , new java.lang.String [ ] { } ) ; }
Source:
public java.util.List < java.lang.String > getFooterLineValues ( org.eclipse.jgit.revwalk.FooterKey key ) { if ( ( footerLines ) == null ) { java.util.List < org.eclipse.jgit.revwalk.FooterLine > src = getFooterLines ( ) ; footerLines = com.google.common.collect.ArrayListMultimap.create ( src.size ( ) , 1 ) ; for ( org.eclipse.jgit.revwalk.FooterLine fl : src ) { footerLines.put ( fl.getKey ( ) . toLowerCase ( ) , fl.getValue ( ) ) ; } } return footerLines.get ( key.getName ( ) . toLowerCase ( ) ) ; }

Target:
public java.util.List < java.lang.String > getFooterLineValues ( org.eclipse.jgit.revwalk.FooterKey key ) { if ( ( footerLines ) == null ) { java.util.List < org.eclipse.jgit.revwalk.FooterLine > src = getFooterLines ( ) ; footerLines = com.google.common.collect.MultimapBuilder.hashKeys ( src.size ( ) ) . arrayListValues ( 1 ) . build ( ) ; for ( org.eclipse.jgit.revwalk.FooterLine fl : src ) { footerLines.put ( fl.getKey ( ) . toLowerCase ( ) , fl.getValue ( ) ) ; } } return footerLines.get ( key.getName ( ) . toLowerCase ( ) ) ; }
Source:
private com.google.gwt.user.client.ui.FlowPanel createAdminMenu ( ) { final com.google.gwt.user.client.ui.FlowPanel menu = new com.google.gwt.user.client.ui.FlowPanel ( ) ; menu.setStyleName ( "gerrit-MenuList" ) ; menu.add ( new com.google.gwt.user.client.ui.Hyperlink ( com.google.gerrit.client.Gerrit.C.menuPeople ( ) , Link.ADMIN_PEOPLE ) ) ; menu.add ( new com.google.gwt.user.client.ui.Hyperlink ( com.google.gerrit.client.Gerrit.C.menuGroups ( ) , Link.ADMIN_GROUPS ) ) ; menu.add ( new com.google.gwt.user.client.ui.Hyperlink ( com.google.gerrit.client.Gerrit.C.menuProjects ( ) , Link.ADMIN_PROJECTS ) ) ; return menu ; }

Target:
private static com.google.gwt.user.client.ui.FlowPanel createAdminMenu ( ) { final com.google.gwt.user.client.ui.FlowPanel m = com.google.gerrit.client.Gerrit.createMenuList ( ) ; m.add ( new com.google.gwt.user.client.ui.Hyperlink ( com.google.gerrit.client.Gerrit.C.menuPeople ( ) , Link.ADMIN_PEOPLE ) ) ; m.add ( new com.google.gwt.user.client.ui.Hyperlink ( com.google.gerrit.client.Gerrit.C.menuGroups ( ) , Link.ADMIN_GROUPS ) ) ; m.add ( new com.google.gwt.user.client.ui.Hyperlink ( com.google.gerrit.client.Gerrit.C.menuProjects ( ) , Link.ADMIN_PROJECTS ) ) ; return m ; }
Source:
public com.google.gwtjsonrpc.client.VoidResult call ( ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.client.OrmException , java.io.IOException { final com.google.gerrit.reviewdb.Change.Id changeId = patchSetId.getParentKey ( ) ; final com.google.gerrit.server.project.ChangeControl control = changeControlFactory.validateFor ( changeId ) ; if ( ! ( control.isOwner ( ) ) ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } com.google.gerrit.server.ChangeUtil.deleteDraftChange ( patchSetId , gitManager , replication , db ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; }

Target:
public com.google.gwtjsonrpc.client.VoidResult call ( ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.client.OrmException , java.io.IOException { final com.google.gerrit.reviewdb.Change.Id changeId = patchSetId.getParentKey ( ) ; final com.google.gerrit.server.project.ChangeControl control = changeControlFactory.validateFor ( changeId ) ; if ( ! ( control.canDelete ( db ) ) ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } com.google.gerrit.server.ChangeUtil.deleteDraftChange ( patchSetId , gitManager , replication , db ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; }
Source:
public void parseReviewer ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Reviewer: Change Owner <1@gerrit>\n" ) + "CC: Other Account <2@gerrit>\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Reviewer: 1@gerrit\n" ) ) ) ; }

Target:
public void parseSubmissionId ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Patch-Set: 1\n" ) + "Submission-id: 1-1453387607626-96fabc25" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Submission-id: 1-1453387607626-96fabc25\n" ) + "Submission-id: 1-1453387901516-5d1e2450" ) ) ) ; }
Source:
public void setNotify ( final com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType type , final boolean v ) { switch ( type ) { case NEW_CHANGES : notifyNewChanges = v ; break ; case ALL_COMMENTS : notifyAllComments = v ; break ; case SUBMITTED_CHANGES : notifySubmittedChanges = v ; break ; case ALL : notifyNewChanges = v ; notifyAllComments = v ; notifySubmittedChanges = v ; break ; } }

Target:
public void setNotify ( final com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType type , final boolean v ) { switch ( type ) { case NEW_CHANGES : notifyNewChanges = v ; break ; case NEW_PATCHSETS : notifyNewPatchSets = v ; break ; case ALL_COMMENTS : notifyAllComments = v ; break ; case SUBMITTED_CHANGES : notifySubmittedChanges = v ; break ; case ALL : notifyNewChanges = v ; notifyNewPatchSets = v ; notifyAllComments = v ; notifySubmittedChanges = v ; break ; } }
Source:
public void testOwnerGroupsForSpecificFilter ( ) { java.lang.String [ ] ownerGroups = new java.lang.String [ ] { "group1" , "group2" } ; configureOwnerGroups ( "someProject" , com.google.common.collect.Lists.newArrayList ( ownerGroups ) ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getOwnerGroups ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someOtherProject" ) ) ) . isEqualTo ( new java.lang.String [ ] { } ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getOwnerGroups ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someProject" ) ) ) . isEqualTo ( ownerGroups ) ; }

Target:
public void testOwnerGroupsForSpecificFilter ( ) { com.google.common.collect.ImmutableList < java.lang.String > ownerGroups = com.google.common.collect.ImmutableList.of ( "group1" , "group2" ) ; configureOwnerGroups ( "someProject" , ownerGroups ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getOwnerGroups ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someOtherProject" ) ) ) . isEmpty ( ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getOwnerGroups ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someProject" ) ) ) . containsExactlyElementsIn ( ownerGroups ) ; }
Source:
private static java.util.List < com.google.gerrit.server.project.ListBranches.BranchInfo > toBranchInfoList ( com.google.gerrit.acceptance.RestResponse r ) throws java.io.IOException { java.util.List < com.google.gerrit.server.project.ListBranches.BranchInfo > result = newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.server.project.ListBranches.BranchInfo > > ( ) { } . getType ( ) ) ; return result ; }

Target:
private static com.google.gerrit.extensions.api.projects.BranchInfo branch ( java.lang.String ref , java.lang.String revision , boolean canDelete ) { com.google.gerrit.extensions.api.projects.BranchInfo info = new com.google.gerrit.extensions.api.projects.BranchInfo ( ) ; info.ref = ref ; info.revision = revision ; info.canDelete = ( canDelete ) ? true : null ; return info ; }
Source:
private void allowCodeReviewOnBehalfOf ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.common.data.LabelType codeReviewType = com.google.gerrit.server.project.Util.codeReview ( ) ; java.lang.String forCodeReviewAs = com.google.gerrit.common.data.Permission.forLabelAs ( codeReviewType.getName ( ) ) ; java.lang.String heads = "refs/heads/*" ; com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid = systemGroupBackend.getGroup ( com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) . getUUID ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , forCodeReviewAs , ( - 1 ) , 1 , uuid , heads ) ; saveProjectConfig ( project , cfg ) ; }

Target:
private void allowCodeReviewOnBehalfOf ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.common.data.LabelType codeReviewType = com.google.gerrit.server.project.testing.Util.codeReview ( ) ; java.lang.String forCodeReviewAs = com.google.gerrit.common.data.Permission.forLabelAs ( codeReviewType.getName ( ) ) ; java.lang.String heads = "refs/heads/*" ; com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid = systemGroupBackend.getGroup ( com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) . getUUID ( ) ; com.google.gerrit.server.project.testing.Util.allow ( cfg , forCodeReviewAs , ( - 1 ) , 1 , uuid , heads ) ; saveProjectConfig ( project , cfg ) ; }
Source:
private com.google.gerrit.server.account.AccountState makeUser ( java.lang.String name , java.lang.String email ) { final com.google.gerrit.reviewdb.client.Account.Id userId = new com.google.gerrit.reviewdb.client.Account.Id ( 42 ) ; final com.google.gerrit.reviewdb.client.Account account = new com.google.gerrit.reviewdb.client.Account ( userId , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; account.setFullName ( name ) ; account.setPreferredEmail ( email ) ; return new com.google.gerrit.server.account.AccountState ( new com.google.gerrit.server.config.AllUsersName ( com.google.gerrit.server.config.AllUsersNameProvider.DEFAULT ) , account , java.util.Collections.emptySet ( ) , new java.util.HashMap < > ( ) , com.google.gerrit.extensions.client.GeneralPreferencesInfo.defaults ( ) ) ; }

Target:
private com.google.gerrit.server.account.AccountState makeUser ( java.lang.String name , java.lang.String email ) { final com.google.gerrit.reviewdb.client.Account.Id userId = new com.google.gerrit.reviewdb.client.Account.Id ( 42 ) ; final com.google.gerrit.reviewdb.client.Account account = new com.google.gerrit.reviewdb.client.Account ( userId , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; account.setFullName ( name ) ; account.setPreferredEmail ( email ) ; return new com.google.gerrit.server.account.AccountState ( new com.google.gerrit.server.config.AllUsersName ( com.google.gerrit.server.config.AllUsersNameProvider.DEFAULT ) , account , com.google.common.collect.ImmutableSet.of ( ) , com.google.common.collect.ImmutableMap.of ( ) , com.google.gerrit.extensions.client.GeneralPreferencesInfo.defaults ( ) ) ; }
Source:
private org.apache.lucene.search.Query or ( com.google.gerrit.server.query.Predicate < V > p ) throws com.google.gerrit.index.query.QueryParseException { try { org.apache.lucene.search.BooleanQuery.Builder q = new org.apache.lucene.search.BooleanQuery.Builder ( ) ; for ( int i = 0 ; i < ( p.getChildCount ( ) ) ; i ++ ) { q.add ( toQuery ( p.getChild ( i ) ) , org.apache.lucene.search.BooleanClause.Occur.SHOULD ) ; } return q.build ( ) ; } catch ( org.apache.lucene.search.BooleanQuery e ) { throw new com.google.gerrit.index.query.QueryParseException ( ( "cannot create query for index: " + p ) , e ) ; } }

Target:
private org.apache.lucene.search.Query or ( com.google.gerrit.index.query.Predicate < V > p ) throws com.google.gerrit.index.query.QueryParseException { try { org.apache.lucene.search.BooleanQuery.Builder q = new org.apache.lucene.search.BooleanQuery.Builder ( ) ; for ( int i = 0 ; i < ( p.getChildCount ( ) ) ; i ++ ) { q.add ( toQuery ( p.getChild ( i ) ) , org.apache.lucene.search.BooleanClause.Occur.SHOULD ) ; } return q.build ( ) ; } catch ( org.apache.lucene.search.BooleanQuery e ) { throw new com.google.gerrit.index.query.QueryParseException ( ( "cannot create query for index: " + p ) , e ) ; } }
Source:
private < K , V > com.google.gerrit.server.cache.UnnamedCacheBinding disk ( final com.google.inject.Key < com.google.gerrit.server.cache.Cache < K , V > > key ) { final boolean disk = true ; final com.google.gerrit.server.cache.CacheProvider < K , V > b = new com.google.gerrit.server.cache.CacheProvider < K , V > ( disk ) ; bind ( key ) . toProvider ( b ) ; return b ; }

Target:
private < K , V > com.google.gerrit.server.cache.UnnamedCacheBinding < K , V > disk ( final com.google.inject.Key < com.google.gerrit.server.cache.Cache < K , V > > key ) { final boolean disk = true ; final com.google.gerrit.server.cache.CacheProvider < K , V > b = new com.google.gerrit.server.cache.CacheProvider < K , V > ( disk , this ) ; bind ( key ) . toProvider ( b ) . in ( Scopes.SINGLETON ) ; return b ; }
Source:
public boolean shouldSkipField ( com.google.gson.FieldAttributes field ) { java.lang.String name = names.get ( field.getName ( ) ) ; if ( name == null ) { try { name = com.google.gerrit.httpd.restapi.RestApiServlet.NAMING.translateName ( field.getDeclaringClass ( ) . getDeclaredField ( field.getName ( ) ) ) ; names.put ( field.getName ( ) , name ) ; } catch ( java.lang.SecurityException e ) { return true ; } catch ( java.lang.NoSuchFieldException e ) { return true ; } } return ! ( want.contains ( name ) ) ; }

Target:
public boolean shouldSkipField ( com.google.gson.FieldAttributes field ) { java.lang.String name = names.get ( field.getName ( ) ) ; if ( name == null ) { try { name = com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES.translateName ( field.getDeclaringClass ( ) . getDeclaredField ( field.getName ( ) ) ) ; names.put ( field.getName ( ) , name ) ; } catch ( java.lang.SecurityException e ) { return true ; } catch ( java.lang.NoSuchFieldException e ) { return true ; } } return ! ( want.contains ( name ) ) ; }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.PatchSetApproval > byPatchSet ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.PatchSet.Id psId ) throws com.google.gwtorm.server.OrmException { return com.google.gerrit.server.ApprovalsUtil.sortApprovals ( db.patchSetApprovals ( ) . byPatchSet ( psId ) ) ; }

Target:
public java.util.List < com.google.gerrit.reviewdb.client.PatchSetApproval > byPatchSet ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.reviewdb.client.PatchSet.Id psId ) throws com.google.gwtorm.server.OrmException { if ( ! ( migration.readPatchSetApprovals ( ) ) ) { return com.google.gerrit.server.ApprovalsUtil.sortApprovals ( db.patchSetApprovals ( ) . byPatchSet ( psId ) ) ; } return notes.load ( ) . getApprovals ( ) . get ( psId ) ; }
Source:
public void addChangeMessage ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeUpdate update , com.google.gerrit.reviewdb.client.ChangeMessage changeMessage ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( java.util.Objects.equals ( changeMessage.getAuthor ( ) , update.getUser ( ) . getAccountId ( ) ) , "cannot store change message of %s in update of %s" , changeMessage.getAuthor ( ) , update.getUser ( ) . getAccountId ( ) ) ; update.setChangeMessage ( changeMessage.getMessage ( ) ) ; db.changeMessages ( ) . insert ( java.util.Collections.singleton ( changeMessage ) ) ; }

Target:
public void addChangeMessage ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeUpdate update , com.google.gerrit.reviewdb.client.ChangeMessage changeMessage ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( java.util.Objects.equals ( changeMessage.getAuthor ( ) , update.getAccountId ( ) ) , "cannot store change message by %s in update by %s" , changeMessage.getAuthor ( ) , update.getAccountId ( ) ) ; update.setChangeMessage ( changeMessage.getMessage ( ) ) ; update.setTag ( changeMessage.getTag ( ) ) ; db.changeMessages ( ) . insert ( java.util.Collections.singleton ( changeMessage ) ) ; }
Source:
public void testHeadRefReplicated ( ) throws java.net.URISyntaxException { org.easymock.EasyMock.reset ( dispatcherMock ) ; com.googlesource.gerrit.plugins.replication.RefReplicatedEvent expectedEvent = new com.googlesource.gerrit.plugins.replication.RefReplicatedEvent ( "someProject" , "refs/heads/master" , "someHost" , com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult.SUCCEEDED , RemoteRefUpdate.Status.OK ) ; dispatcherMock.postEvent ( org.easymock.EasyMock.anyObject ( Branch.NameKey.class ) , com.googlesource.gerrit.plugins.replication.RefReplicatedEventEquals.eqEvent ( expectedEvent ) ) ; org.easymock.EasyMock.expectLastCall ( ) . once ( ) ; org.easymock.EasyMock.replay ( dispatcherMock ) ; gitUpdateProcessing.onRefReplicatedToOneNode ( "someProject" , "refs/heads/master" , new org.eclipse.jgit.transport.URIish ( "git://someHost/someProject.git" ) , RefPushResult.SUCCEEDED , RemoteRefUpdate.Status.OK ) ; org.easymock.EasyMock.verify ( dispatcherMock ) ; }

Target:
public void testHeadRefReplicated ( ) throws com.google.gwtorm.server.OrmException , java.net.URISyntaxException { org.easymock.EasyMock.reset ( dispatcherMock ) ; com.googlesource.gerrit.plugins.replication.RefReplicatedEvent expectedEvent = new com.googlesource.gerrit.plugins.replication.RefReplicatedEvent ( "someProject" , "refs/heads/master" , "someHost" , com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult.SUCCEEDED , RemoteRefUpdate.Status.OK ) ; dispatcherMock.postEvent ( com.googlesource.gerrit.plugins.replication.RefReplicatedEventEquals.eqEvent ( expectedEvent ) , org.easymock.EasyMock.anyObject ( com.google.gerrit.reviewdb.server.ReviewDb.class ) ) ; org.easymock.EasyMock.expectLastCall ( ) . once ( ) ; org.easymock.EasyMock.replay ( dispatcherMock ) ; gitUpdateProcessing.onRefReplicatedToOneNode ( "someProject" , "refs/heads/master" , new org.eclipse.jgit.transport.URIish ( "git://someHost/someProject.git" ) , RefPushResult.SUCCEEDED , RemoteRefUpdate.Status.OK ) ; org.easymock.EasyMock.verify ( dispatcherMock ) ; }
Source:
private com.google.gwtorm.client.OrmException convertError ( final java.lang.String op , final java.sql.SQLException err ) { if ( ( ( err.getCause ( ) ) == null ) && ( ( err.getNextException ( ) ) != null ) ) { err.initCause ( err.getNextException ( ) ) ; } return schema.getDialect ( ) . convertError ( op , getRelationName ( ) , err ) ; }

Target:
private com.google.gwtorm.client.OrmException convertError ( final java.lang.String op , final java.sql.SQLException err ) { if ( ( ( err.getCause ( ) ) == null ) && ( ( err.getNextException ( ) ) != null ) ) { err.initCause ( err.getNextException ( ) ) ; } return schema.getDialect ( ) . convertError ( op , com.google.gwtorm.jdbc.JdbcAccess.getRelationName ( ) , err ) ; }
Source:
public java.lang.String toString ( ) { final com.google.gerrit.client.reviewdb.Branch.NameKey branch = e.dest ; final com.google.gerrit.client.reviewdb.Project.NameKey project = branch.getParentKey ( ) ; return ( ( "submit " + ( project.get ( ) ) ) + " " ) + ( branch.getShortName ( ) ) ; }

Target:
public java.lang.String toString ( ) { final com.google.gerrit.client.reviewdb.Project.NameKey project = dest.getParentKey ( ) ; return ( ( "submit " + ( project.get ( ) ) ) + " " ) + ( dest.getShortName ( ) ) ; }
Source:
public void setupLogging ( ) { captor = org.easymock.EasyMock.EasyMock.newCapture ( ) ; appender = createMock ( org.apache.log4j.Appender.class ) ; appender.doAppend ( capture ( captor ) ) ; expectLastCall ( ) . anyTimes ( ) ; org.apache.log4j.Logger.getRootLogger ( ) . addAppender ( appender ) ; }

Target:
public void setupLogging ( ) { captor = new org.easymock.Capture ( ) ; appender = createMock ( org.apache.log4j.Appender.class ) ; appender.doAppend ( capture ( captor ) ) ; expectLastCall ( ) . anyTimes ( ) ; org.apache.log4j.Logger.getRootLogger ( ) . addAppender ( appender ) ; }