auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void configure ( ) { bind ( com.google.gerrit.httpd.ProjectServlet.Resolver.class ) ; bind ( com.google.gerrit.httpd.ProjectServlet.Upload.class ) ; bind ( com.google.gerrit.httpd.ProjectServlet.Receive.class ) ; }

Target:
protected void configure ( ) { com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.httpd.AdvertisedObjectsCacheKey , java.util.Set < org.eclipse.jgit.lib.ObjectId > > > cache = new com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.httpd.AdvertisedObjectsCacheKey , java.util.Set < org.eclipse.jgit.lib.ObjectId > > > ( ) { } ; core ( cache , com.google.gerrit.httpd.ProjectServlet.ID_CACHE ) . memoryLimit ( 4096 ) . maxAge ( 10 , java.util.concurrent.TimeUnit.MINUTES ) ; }
Source:
public void onSuccess ( final java.util.Set < com.google.gerrit.client.reviewdb.Change.Id > result ) { if ( result != null ) { final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final com.google.gerrit.client.data.ChangeInfo c = getChangeInfo ( row ) ; if ( c != null ) { c.setStarred ( result.contains ( c.getId ( ) ) ) ; setStar ( row , c ) ; } } } }

Target:
public void onSuccess ( final java.util.Set < com.google.gerrit.client.reviewdb.Change.Id > result ) { final com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter fmt = table.getFlexCellFormatter ( ) ; final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final com.google.gerrit.client.data.ChangeInfo c = getChangeInfo ( row ) ; if ( c != null ) { c.setStarred ( result.contains ( c.getId ( ) ) ) ; setStar ( row , c ) ; } } }
Source:
private java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo > getVerifications ( com.google.gerrit.acceptance.PushOneCommit.Result c ) throws java.lang.Exception { java.lang.String endPoint = url ( c ) ; com.google.gerrit.acceptance.RestResponse r = adminRestSession.get ( endPoint ) ; r.assertOK ( ) ; return newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo > > ( ) { } . getType ( ) ) ; }

Target:
private java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo > getVerifications ( com.google.gerrit.acceptance.PushOneCommit.Result c , java.lang.String filter ) throws java.lang.Exception { java.lang.String endPoint = url ( c ) ; if ( filter != null ) { endPoint += "/?filter=" + filter ; } com.google.gerrit.acceptance.RestResponse r = adminRestSession.get ( endPoint ) ; r.assertOK ( ) ; return newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.googlesource.gerrit.plugins.verifystatus.common.VerificationInfo > > ( ) { } . getType ( ) ) ; }
Source:
public boolean equals ( java.lang.Object obj ) { if ( obj instanceof com.google.gerrit.server.account.WatchConfig.ProjectWatchKey ) { com.google.gerrit.server.account.WatchConfig.ProjectWatchKey o = ( ( com.google.gerrit.server.account.WatchConfig.ProjectWatchKey ) ( obj ) ) ; return ( java.util.Objects.equals ( project ( ) . get ( ) , o.project ( ) . get ( ) ) ) && ( java.util.Objects.equals ( filter ( ) , o.filter ( ) ) ) ; } return false ; }

Target:
public void error ( com.google.gerrit.server.git.ValidationError error ) { if ( ( validationErrors ) == null ) { validationErrors = new java.util.ArrayList < > ( 4 ) ; } validationErrors.add ( error ) ; }
Source:
void onChangeRevision ( @ java.lang.SuppressWarnings ( value = "unused" ) com.google.gwt.event.dom.client.ChangeEvent e ) { int idx = diffBase.getSelectedIndex ( ) ; if ( 0 <= idx ) { java.lang.String n = diffBase.getValue ( idx ) ; loadConfigInfo ( changeInfo , ( ! ( n.isEmpty ( ) ) ? n : null ) ) ; } }

Target:
private void updatePatchSetsTextStyle ( boolean isPatchSetCurrent ) { if ( isPatchSetCurrent ) { patchSetsText.removeClassName ( style.notCurrentPatchSet ( ) ) ; } else { patchSetsText.addClassName ( style.notCurrentPatchSet ( ) ) ; } }
Source:
public T getOrNull ( com.googlecode.prolog_cafe.lang.Prolog engine ) { com.googlecode.prolog_cafe.lang.Term r = engine.getHashManager ( ) . get ( key ) ; return ( r != null ) && ( r.isJavaObject ( ) ) ? ( ( T ) ( r.toJava ( ) ) ) : null ; }

Target:
public T getOrNull ( com.googlecode.prolog_cafe.lang.Prolog engine ) { return get ( ( ( com.google.gerrit.rules.PrologEnvironment ) ( engine.control ) ) ) ; }
Source:
public void missingGroupNameRef ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( RefNames.REFS_GROUPNAMES ) ; ru.setForceUpdate ( true ) ; org.eclipse.jgit.lib.RefUpdate.Result result = ru.delete ( ) ; com.google.common.truth.Truth.assertThat ( result ) . isEqualTo ( Result.FORCED ) ; } assertError ( "refs/meta/group-names does not exist" ) ; }

Target:
public void missingGroupNameRef ( ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allUsers ) ) { org.eclipse.jgit.lib.RefUpdate ru = repo.updateRef ( RefNames.REFS_GROUPNAMES ) ; ru.setForceUpdate ( true ) ; org.eclipse.jgit.lib.RefUpdate.Result result = ru.delete ( ) ; com.google.common.truth.Truth.assertThat ( result ) . isEqualTo ( Result.FORCED ) ; } assertConsistency ( "refs/meta/group-names does not exist" , ( groupsMigration.readFromNoteDb ( ) ? ConsistencyProblemInfo.Status.ERROR : ConsistencyProblemInfo.Status.WARNING ) ) ; }
Source:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { new com.google.gerrit.client.changes.AbandonChangeDialog ( patchSet.getId ( ) , new com.google.gwt.user.client.rpc.AsyncCallback < java.lang.Object > ( ) { public void onSuccess ( java.lang.Object result ) { actionsPanel.remove ( b ) ; fireOnSuggestRefresh ( ) ; } public void onFailure ( java.lang.Throwable caught ) { } } ) . center ( ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { new com.google.gerrit.client.changes.AbandonChangeDialog ( patchSet.getId ( ) , new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.data.ChangeDetail > ( ) { public void onSuccess ( com.google.gerrit.client.data.ChangeDetail result ) { changeScreen.display ( result ) ; } public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; } } ) . center ( ) ; }
Source:
public void unblockForceEditTopicName ( ) { com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.common.truth.Truth.assertThat ( u.controlForRef ( "refs/heads/master" ) . canForceEditTopicName ( ) ) . named ( "u can edit topic name" ) . isTrue ( ) ; }

Target:
public void unblockForceEditTopicName ( ) { com.google.gerrit.server.project.testing.Util.block ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; com.google.common.truth.Truth.assertThat ( u.controlForRef ( "refs/heads/master" ) . canForceEditTopicName ( ) ) . named ( "u can edit topic name" ) . isTrue ( ) ; }
Source:
private void verifyCommandLine ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure { if ( ( processor.getIncludeFiles ( ) ) && ( ! ( ( processor.getIncludePatchSets ( ) ) || ( processor.getIncludeCurrentPatchSet ( ) ) ) ) ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( 1 , "--files option needs --patch-sets or --current-patch-set" ) ; } }

Target:
protected void parseCommandLine ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure { processor.setOutput ( out , QueryProcessor.OutputFormat.TEXT ) ; super . parseCommandLine ( ) ; if ( ( processor.getIncludeFiles ( ) ) && ( ! ( ( processor.getIncludePatchSets ( ) ) || ( processor.getIncludeCurrentPatchSet ( ) ) ) ) ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( 1 , "--files option needs --patch-sets or --current-patch-set" ) ; } }
Source:
private static com.google.gerrit.client.reviewdb.Account one ( final com.google.gwtorm.client.ResultSet < com.google.gerrit.client.reviewdb.Account > rs ) { final java.util.List < com.google.gerrit.client.reviewdb.Account > r = rs.toList ( ) ; return ( r.size ( ) ) == 1 ? r.get ( 0 ) : null ; }

Target:
private static com.google.gerrit.client.reviewdb.Account oneAccount ( com.google.gwtorm.client.ResultSet < com.google.gerrit.client.reviewdb.Account > rs ) { final java.util.List < com.google.gerrit.client.reviewdb.Account > r = rs.toList ( ) ; return ( r.size ( ) ) == 1 ? r.get ( 0 ) : null ; }
Source:
private static com.google.gerrit.common.data.GroupReference groupReference ( com.google.gerrit.server.auth.ldap.LdapQuery.Result res ) throws javax.naming.NamingException { return new com.google.gerrit.common.data.GroupReference ( new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( ( ( com.google.gerrit.server.auth.ldap.Helper.LDAP_UUID ) + ( res.getDN ( ) ) ) ) , ( ( com.google.gerrit.server.auth.ldap.LdapGroupBackend.LDAP_NAME ) + ( com.google.gerrit.server.auth.ldap.LdapGroupBackend.cnFor ( res.getDN ( ) ) ) ) ) ; }

Target:
private static com.google.gerrit.common.data.GroupReference groupReference ( com.google.gerrit.common.data.ParameterizedString p , com.google.gerrit.server.auth.ldap.LdapQuery.Result res ) throws javax.naming.NamingException { return new com.google.gerrit.common.data.GroupReference ( new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( ( ( com.google.gerrit.server.auth.ldap.Helper.LDAP_UUID ) + ( res.getDN ( ) ) ) ) , ( ( com.google.gerrit.server.auth.ldap.LdapGroupBackend.LDAP_NAME ) + ( com.google.gerrit.server.auth.ldap.LdapRealm.apply ( p , res ) ) ) ) ; }
Source:
private synchronized void recheck ( final com.google.gerrit.server.git.ChangeMergeQueue.RecheckJob e ) { final long remainingDelay = ( e.recheckAt ) - ( java.lang.System.currentTimeMillis ( ) ) ; if ( ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 10 , java.util.concurrent.TimeUnit.SECONDS ) ) < remainingDelay ) { workQueue.getDefaultQueue ( ) . schedule ( e , remainingDelay , java.util.concurrent.TimeUnit.MILLISECONDS ) ; } else { schedule ( e.dest ) ; } }

Target:
private synchronized void recheck ( final com.google.gerrit.server.git.ChangeMergeQueue.RecheckJob e ) { final long remainingDelay = ( e.recheckAt ) - ( com.google.gerrit.server.util.TimeUtil.nowMs ( ) ) ; if ( ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 10 , java.util.concurrent.TimeUnit.SECONDS ) ) < remainingDelay ) { workQueue.getDefaultQueue ( ) . schedule ( e , remainingDelay , java.util.concurrent.TimeUnit.MILLISECONDS ) ; } else { schedule ( e.dest ) ; } }
Source:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { try { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setTitle ( java.lang.String.format ( "Delete draft change %d" , rsrc.getChange ( ) . getChangeId ( ) ) ) . setVisible ( ( ( ( allowDrafts ) && ( ( rsrc.getChange ( ) . getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.DRAFT ) ) ) && ( rsrc.getControl ( ) . canDeleteDraft ( dbProvider.get ( ) ) ) ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.lang.IllegalStateException ( e ) ; } }

Target:
public UiAction.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { try { return new com.google.gerrit.extensions.webui.UiAction.Description ( ) . setTitle ( ( "Delete draft change " + ( rsrc.getId ( ) ) ) ) . setVisible ( ( ( ( allowDrafts ) && ( ( rsrc.getChange ( ) . getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.DRAFT ) ) ) && ( rsrc.getControl ( ) . canDeleteDraft ( dbProvider.get ( ) ) ) ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.lang.IllegalStateException ( e ) ; } }
Source:
private java.util.Map < com.google.gerrit.reviewdb.ApprovalCategory.Id , com.google.gerrit.reviewdb.PatchSetApproval > mine ( java.util.Collection < com.google.gerrit.reviewdb.PatchSetApproval > all ) { java.util.Map < com.google.gerrit.reviewdb.ApprovalCategory.Id , com.google.gerrit.reviewdb.PatchSetApproval > r = new java.util.HashMap < com.google.gerrit.reviewdb.ApprovalCategory.Id , com.google.gerrit.reviewdb.PatchSetApproval > ( ) ; for ( com.google.gerrit.reviewdb.PatchSetApproval a : all ) { if ( user.getAccountId ( ) . equals ( a.getAccountId ( ) ) ) { r.put ( a.getCategoryId ( ) , a ) ; } } return r ; }

Target:
private java.util.Map < com.google.gerrit.reviewdb.client.ApprovalCategory.Id , com.google.gerrit.reviewdb.client.PatchSetApproval > mine ( java.util.Collection < com.google.gerrit.reviewdb.client.PatchSetApproval > all ) { java.util.Map < com.google.gerrit.reviewdb.client.ApprovalCategory.Id , com.google.gerrit.reviewdb.client.PatchSetApproval > r = new java.util.HashMap < com.google.gerrit.reviewdb.client.ApprovalCategory.Id , com.google.gerrit.reviewdb.client.PatchSetApproval > ( ) ; for ( com.google.gerrit.reviewdb.client.PatchSetApproval a : all ) { if ( user.getAccountId ( ) . equals ( a.getAccountId ( ) ) ) { r.put ( a.getCategoryId ( ) , a ) ; } } return r ; }
Source:
private boolean messageIsForChange ( ) { return ( ( changeMessage ) != null ) && ( changeMessage.getKey ( ) . getParentKey ( ) . equals ( change.getKey ( ) ) ) ; }

Target:
private boolean messageIsForChange ( ) { if ( ( changeMessage ) == null ) { return false ; } com.google.gerrit.reviewdb.client.Change.Id id = change.getId ( ) ; com.google.gerrit.reviewdb.client.Change.Id msgId = changeMessage.getKey ( ) . getParentKey ( ) ; return msgId.equals ( id ) ; }
Source:
protected boolean isVisibleTo ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.server.CurrentUser user , com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { if ( change == null ) { return false ; } com.google.gerrit.server.project.ProjectState pe = projectCache.get ( change.getProject ( ) ) ; if ( pe == null ) { return false ; } com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; return pc.controlFor ( db , change ) . isVisible ( db ) ; }

Target:
protected boolean isVisibleTo ( com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.server.CurrentUser user ) throws com.google.gwtorm.server.OrmException { if ( change == null ) { return false ; } com.google.gerrit.server.project.ProjectState pe = projectCache.get ( change.getProject ( ) ) ; if ( pe == null ) { return false ; } com.google.gerrit.server.project.ProjectControl pc = pe.controlFor ( user ) ; com.google.gerrit.reviewdb.server.ReviewDb db = dbProvider.get ( ) ; return pc.controlFor ( db , change ) . isVisible ( db ) ; }
Source:
public com.google.gitiles.GitilesView.Builder copyFrom ( com.google.gitiles.GitilesView other ) { hostName = other.hostName ; servletPath = other.servletPath ; switch ( type ) { case LOG : case DIFF : oldRevision = other.oldRevision ; case PATH : path = other.path ; case REVISION : case TAR : case ZIP : revision = other.revision ; case DESCRIBE : case REFS : case REPOSITORY_INDEX : repositoryName = other.repositoryName ; default : break ; } return this ; }

Target:
public com.google.gitiles.GitilesView.Builder copyFrom ( com.google.gitiles.GitilesView other ) { hostName = other.hostName ; servletPath = other.servletPath ; switch ( type ) { case LOG : case DIFF : oldRevision = other.oldRevision ; case PATH : path = other.path ; case REVISION : case ARCHIVE : revision = other.revision ; case DESCRIBE : case REFS : case REPOSITORY_INDEX : repositoryName = other.repositoryName ; default : break ; } if ( ( type ) == ( com.google.gitiles.GitilesView.Type.ARCHIVE ) ) { extension = other.extension ; } return this ; }
Source:
protected void configure ( ) { bind ( com.codahale.metrics.MetricRegistry.class ) . in ( Scopes.SINGLETON ) ; bind ( com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker.class ) . in ( Scopes.SINGLETON ) ; bind ( com.google.gerrit.metrics.MetricMaker.class ) . to ( com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker.class ) ; install ( new com.google.gerrit.metrics.proc.ProcMetricModule ( ) ) ; install ( new com.google.gerrit.metrics.proc.JGitMetricModule ( ) ) ; bind ( com.google.gerrit.server.cache.CacheMetrics.class ) ; }

Target:
protected void configure ( ) { com.google.gerrit.extensions.registration.DynamicMap.mapOf ( binder ( ) , com.google.gerrit.metrics.dropwizard.MetricResource.METRIC_KIND ) ; child ( com.google.gerrit.server.config.ConfigResource.CONFIG_KIND , "metrics" ) . to ( com.google.gerrit.metrics.dropwizard.MetricsCollection.class ) ; get ( com.google.gerrit.metrics.dropwizard.MetricResource.METRIC_KIND ) . to ( com.google.gerrit.metrics.dropwizard.GetMetric.class ) ; bind ( com.google.gerrit.server.cache.CacheMetrics.class ) ; }
Source:
public void testUpdateOneException ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchException ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , new java.sql.BatchUpdateException ( ) ) ; try { createClassUnderTest ( ) . update ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.client.OrmException e ) { } }

Target:
public void testUpdateOneDBException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement update = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.update ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; }
Source:
public java.util.List < com.googlesource.gerrit.plugins.xdocs.MenuEntry > getEntries ( ) { java.lang.StringBuilder url = new java.lang.StringBuilder ( ) ; url.append ( "/plugins/" ) ; url.append ( pluginName ) ; url.append ( XDocServlet.PATH_PREFIX ) ; url.append ( "${projectName}" ) ; return com.google.common.collect.Lists.newArrayList ( new com.googlesource.gerrit.plugins.xdocs.MenuEntry ( com.google.gerrit.extensions.client.GerritTopMenu.PROJECTS , com.google.common.collect.Lists.newArrayList ( new com.googlesource.gerrit.plugins.xdocs.MenuItem ( "Readme" , url.toString ( ) ) ) ) ) ; }

Target:
public java.util.List < com.googlesource.gerrit.plugins.xdocs.MenuEntry > getEntries ( ) { java.lang.StringBuilder url = new java.lang.StringBuilder ( ) ; url.append ( "/plugins/" ) ; url.append ( pluginName ) ; url.append ( XDocServlet.PATH_PREFIX ) ; url.append ( "${projectName}" ) ; return com.google.common.collect.Lists.newArrayList ( new com.googlesource.gerrit.plugins.xdocs.MenuEntry ( com.google.gerrit.extensions.client.GerritTopMenu.PROJECTS , com.google.common.collect.Lists.newArrayList ( new com.google.gerrit.extensions.client.MenuItem ( "Readme" , url.toString ( ) ) ) ) ) ; }
Source:
void addPatchSetId ( java.lang.String token ) { try { com.google.gerrit.reviewdb.client.PatchSet ps = psParser.parsePatchSet ( token , projectControl , branch ) ; patchSets.add ( ps ) ; } catch ( com.googlesource.gerrit.plugins.verifystatus.commands.UnloggedFailure e ) { throw new java.lang.IllegalArgumentException ( e.getMessage ( ) , e ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.lang.IllegalArgumentException ( "database error" , e ) ; } }

Target:
void addPatchSetId ( java.lang.String token ) { try { com.google.gerrit.reviewdb.client.PatchSet ps = psParser.parsePatchSet ( token , projectControl , branch ) ; patchSets.add ( ps ) ; } catch ( com.googlesource.gerrit.plugins.verifystatus.UnloggedFailure e ) { throw new java.lang.IllegalArgumentException ( e.getMessage ( ) , e ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new java.lang.IllegalArgumentException ( "database error" , e ) ; } }
Source:
private < V , K > com.google.gerrit.server.cache.h2.H2CacheImpl.SqlStore < K , V > newSqlStore ( java.lang.String name , com.google.inject.TypeLiteral < K > keyType , long maxSize , java.lang.Long expireAfterWrite ) { java.io.File db = new java.io.File ( cacheDir , name ) . getAbsoluteFile ( ) ; java.lang.String url = "jdbc:h2:" + ( db.toURI ( ) . toString ( ) ) ; return new com.google.gerrit.server.cache.h2.H2CacheImpl.SqlStore ( url , keyType , maxSize , ( expireAfterWrite == null ? 0 : expireAfterWrite.longValue ( ) ) ) ; }

Target:
private < V , K > com.google.gerrit.server.cache.h2.H2CacheImpl.SqlStore < K , V > newSqlStore ( java.lang.String name , com.google.inject.TypeLiteral < K > keyType , long maxSize , java.lang.Long expireAfterWrite ) { java.lang.String url = "jdbc:h2:" + ( cacheDir.resolve ( name ) . toUri ( ) ) ; return new com.google.gerrit.server.cache.h2.H2CacheImpl.SqlStore ( url , keyType , maxSize , ( expireAfterWrite == null ? 0 : expireAfterWrite.longValue ( ) ) ) ; }
Source:
private void initProviderBouncyCastle ( ) { setKeyExchangeFactories ( java.util.Arrays.< org.apache.sshd.common.NamedFactory < org.apache.sshd.common.KeyExchange > > asList ( new org.apache.sshd.server.kex.DHG14.Factory ( ) , new org.apache.sshd.server.kex.DHG1.Factory ( ) ) ) ; setRandomFactory ( new org.apache.sshd.common.random.SingletonRandomFactory ( new org.apache.sshd.common.random.BouncyCastleRandom.Factory ( ) ) ) ; }

Target:
private void initProviderBouncyCastle ( org.eclipse.jgit.lib.Config cfg ) { setKeyExchangeFactories ( java.util.Arrays.< org.apache.sshd.common.NamedFactory < org.apache.sshd.common.KeyExchange > > asList ( new org.apache.sshd.server.kex.DHG14.Factory ( ) , new org.apache.sshd.server.kex.DHG1.Factory ( ) ) ) ; org.apache.sshd.common.NamedFactory < org.apache.sshd.common.Random > factory ; if ( cfg.getBoolean ( "sshd" , null , "testUseInsecureRandom" , false ) ) { factory = new com.google.gerrit.sshd.SshDaemon.InsecureBouncyCastleRandom.Factory ( ) ; } else { factory = new org.apache.sshd.common.random.BouncyCastleRandom.Factory ( ) ; } setRandomFactory ( new org.apache.sshd.common.random.SingletonRandomFactory ( factory ) ) ; }
Source:
public byte [ ] getHtmlFromMarkdown ( byte [ ] data , java.lang.String charEnc ) throws java.io.UnsupportedEncodingException { return new org.pegdown.PegDownProcessor ( ( ( org.pegdown.Extensions.ALL ) & ( ~ ( org.pegdown.Extensions.HARDWRAPS ) ) ) ) . markdownToHtml ( org.eclipse.jgit.util.RawParseUtils.decode ( java.nio.charset.Charset.forName ( charEnc ) , data ) ) . getBytes ( charEnc ) ; }

Target:
private org.pegdown.ast.RootNode parseMarkdown ( java.lang.String md ) { return new org.pegdown.PegDownProcessor ( ( ( org.pegdown.Extensions.ALL ) & ( ~ ( org.pegdown.Extensions.HARDWRAPS ) ) ) ) . parseMarkdown ( md.toCharArray ( ) ) ; }
Source:
private void verifyProjectVisible ( final java.lang.String type , final java.util.Set < com.google.gerrit.reviewdb.client.Account.Id > who ) throws com.google.gerrit.sshd.commands.UnloggedFailure { for ( final com.google.gerrit.reviewdb.client.Account.Id id : who ) { final com.google.gerrit.server.IdentifiedUser user = identifiedUserFactory.create ( id ) ; if ( ! ( projectControl.forUser ( user ) . isVisible ( ) ) ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( 1 , ( ( ( type + " " ) + ( user.getAccount ( ) . getFullName ( ) ) ) + " cannot access the project" ) ) ; } } }

Target:
private void verifyProjectVisible ( final java.lang.String type , final java.util.Set < com.google.gerrit.reviewdb.client.Account.Id > who ) throws com.google.gerrit.sshd.commands.UnloggedFailure { for ( final com.google.gerrit.reviewdb.client.Account.Id id : who ) { final com.google.gerrit.server.IdentifiedUser user = identifiedUserFactory.create ( id ) ; if ( ! ( projectControl.forUser ( user ) . isVisible ( ) ) ) { throw die ( ( ( ( type + " " ) + ( user.getAccount ( ) . getFullName ( ) ) ) + " cannot access the project" ) ) ; } } }
Source:
private boolean isEmpty ( ) { return ( ( ( approvals.isEmpty ( ) ) && ( reviewers.isEmpty ( ) ) ) && ( ( status ) == null ) ) && ( ( submitRecords ) == null ) ; }

Target:
private boolean isEmpty ( ) { return ( ( ( ( approvals.isEmpty ( ) ) && ( reviewers.isEmpty ( ) ) ) && ( ( status ) == null ) ) && ( ( submitRecords ) == null ) ) && ( ( changeMessage ) == null ) ; }
Source:
private java.lang.String getFilename ( com.google.gitiles.GitilesView view , com.google.gitiles.Revision rev , java.lang.String ext ) { return new java.lang.StringBuilder ( ) . append ( com.google.gitiles.Paths.basename ( view.getRepositoryName ( ) ) ) . append ( '-' ) . append ( rev.getName ( ) ) . 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.Paths.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 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:
javax.servlet.http.HttpServlet getGwtUiServlet ( @ com.google.inject.name.Named ( value = com.google.gerrit.httpd.raw.StaticModule.CACHE ) com.google.common.cache.Cache < java.nio.file.Path , com.google.gerrit.httpd.raw.ResourceServlet.Resource > cache ) throws java.io.IOException { com.google.gerrit.httpd.raw.StaticModule.Paths p = getPaths ( ) ; if ( ( p.warFs ) != null ) { return new com.google.gerrit.httpd.raw.WarGwtUiServlet ( cache , p.warFs ) ; } else { return new com.google.gerrit.httpd.raw.DeveloperGwtUiServlet ( cache , p.unpackedWar ) ; } }
Source:
public static void query ( com.google.gwt.user.client.rpc.AsyncCallback < com.google.gwt.core.client.JsArray < com.google.gerrit.client.changes.ChangeList > > callback , java.lang.String ... queries ) { assert ( queries.length ) >= 2 ; com.google.gerrit.client.rpc.RestApi call = new com.google.gerrit.client.rpc.RestApi ( com.google.gerrit.client.changes.ChangeList.URI ) ; for ( java.lang.String q : queries ) { call.addParameterRaw ( "q" , com.google.gwtorm.client.KeyUtil.encode ( q ) ) ; } com.google.gerrit.client.changes.ChangeList.addOptions ( call , ListChangesOption.LABELS ) ; call.get ( callback ) ; }

Target:
public static void query ( com.google.gwt.user.client.rpc.AsyncCallback < com.google.gwt.core.client.JsArray < com.google.gerrit.client.changes.ChangeList > > callback , java.lang.String ... queries ) { assert ( queries.length ) >= 2 ; com.google.gerrit.client.rpc.RestApi call = new com.google.gerrit.client.rpc.RestApi ( com.google.gerrit.client.changes.ChangeList.URI ) ; for ( java.lang.String q : queries ) { call.addParameterRaw ( "q" , com.google.gwtorm.client.KeyUtil.encode ( q ) ) ; } com.google.gerrit.client.changes.ChangeList.addOptions ( call , java.util.EnumSet.of ( ListChangesOption.LABELS ) ) ; call.get ( callback ) ; }
Source:
public void deleteVoteFromReviewableChangeNotifyOwner ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; deleteVote ( sc , voter , NotifyHandling.OWNER ) ; assertThat ( sender ) . sent ( "deleteVote" , sc ) . notTo ( voter ) . to ( sc.owner ) . notTo ( sc.reviewer , sc.ccer ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( sc.starrer ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; }

Target:
public void deleteVoteFromReviewableChangeNotifyOwner ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; deleteVote ( sc , voter , NotifyHandling.OWNER ) ; assertThat ( sender ) . sent ( "deleteVote" , sc ) . to ( sc.owner ) . noOneElse ( ) ; }
Source:
private void assertProblems ( com.google.gerrit.gpg.CheckResult result , com.google.gerrit.extensions.common.GpgKeyInfo.Status expectedStatus , java.lang.String ... expectedProblems ) throws java.lang.Exception { com.google.common.base.Preconditions.checkArgument ( ( ( expectedProblems.length ) > 0 ) ) ; com.google.common.truth.Truth.assertThat ( result.getStatus ( ) ) . isEqualTo ( expectedStatus ) ; com.google.common.truth.Truth.assertThat ( result.getProblems ( ) ) . containsExactly ( ( ( java.lang.Object [ ] ) ( expectedProblems ) ) ) . inOrder ( ) ; }

Target:
private void assertProblems ( com.google.gerrit.gpg.CheckResult result , com.google.gerrit.extensions.common.GpgKeyInfo.Status expectedStatus , java.lang.String first , java.lang.String ... rest ) throws java.lang.Exception { java.util.List < java.lang.String > expectedProblems = new java.util.ArrayList < > ( ) ; expectedProblems.add ( first ) ; expectedProblems.addAll ( java.util.Arrays.asList ( rest ) ) ; com.google.common.truth.Truth.assertThat ( result.getStatus ( ) ) . isEqualTo ( expectedStatus ) ; com.google.common.truth.Truth.assertThat ( result.getProblems ( ) ) . containsExactlyElementsIn ( expectedProblems ) . inOrder ( ) ; }
Source:
private org.eclipse.jgit.lib.RefUpdate createRefUpdate ( org.eclipse.jgit.lib.ObjectId newObjectId , org.eclipse.jgit.lib.ObjectId expectedOldObjectId ) throws java.io.IOException { org.eclipse.jgit.lib.RefUpdate refUpdate = db.updateRef ( com.google.gerrit.server.git.CreateCodeReviewNotes.REFS_NOTES_REVIEW ) ; refUpdate.setNewObjectId ( newObjectId ) ; if ( expectedOldObjectId == null ) { refUpdate.setExpectedOldObjectId ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) ) ; } else { refUpdate.setExpectedOldObjectId ( expectedOldObjectId ) ; } return refUpdate ; }

Target:
private org.eclipse.jgit.lib.RefUpdate createRefUpdate ( org.eclipse.jgit.lib.ObjectId newObjectId , org.eclipse.jgit.lib.ObjectId expectedOldObjectId ) throws java.io.IOException { org.eclipse.jgit.lib.RefUpdate refUpdate = db.updateRef ( com.google.gerrit.server.git.GitRepositoryManager.REFS_NOTES_REVIEW ) ; refUpdate.setNewObjectId ( newObjectId ) ; if ( expectedOldObjectId == null ) { refUpdate.setExpectedOldObjectId ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) ) ; } else { refUpdate.setExpectedOldObjectId ( expectedOldObjectId ) ; } return refUpdate ; }
Source:
public void shouldNotCallRemoteWhenEventIsForwarded ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.syncindex.Context.setForwardedEvent ( true ) ; indexEventHandler.onChangeIndexed ( id.get ( ) ) ; indexEventHandler.onChangeDeleted ( id.get ( ) ) ; com.ericsson.gerrit.plugins.syncindex.Context.unsetForwardedEvent ( ) ; org.mockito.Mockito.verifyZeroInteractions ( restSessionMock ) ; }

Target:
public void shouldNotCallRemoteWhenEventIsForwarded ( ) throws java.lang.Exception { com.ericsson.gerrit.plugins.multimaster.Context.setForwardedEvent ( true ) ; indexEventHandler.onChangeIndexed ( id.get ( ) ) ; indexEventHandler.onChangeDeleted ( id.get ( ) ) ; com.ericsson.gerrit.plugins.multimaster.Context.unsetForwardedEvent ( ) ; org.mockito.Mockito.verifyZeroInteractions ( restSessionMock ) ; }
Source:
public void rescheduleOnError ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.HEADERS , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.BODY ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.ERR_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verify ( executor , org.mockito.Mockito.times ( 1 ) ) . schedule ( task , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.RETRY_INTERVAL , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }

Target:
public void noRescheduleOnSuccess ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( remote ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.OK_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verifyZeroInteractions ( executor ) ; }
Source:
public void copy ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.project.ChangeControl ctl , com.google.gerrit.reviewdb.client.PatchSet ps , java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > dontCopy ) throws com.google.gwtorm.server.OrmException { db.patchSetApprovals ( ) . insert ( getForPatchSet ( db , ctl , ps , dontCopy ) ) ; }

Target:
public void copyInReviewDb ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.project.ChangeControl ctl , com.google.gerrit.reviewdb.client.PatchSet ps , @ com.google.gerrit.common.Nullable org.eclipse.jgit.revwalk.RevWalk rw , @ com.google.gerrit.common.Nullable org.eclipse.jgit.lib.Config repoConfig , java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > dontCopy ) throws com.google.gwtorm.server.OrmException { if ( ( com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage.of ( ctl.getChange ( ) ) ) == ( com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage.REVIEW_DB ) ) { db.patchSetApprovals ( ) . insert ( getForPatchSet ( db , ctl , ps , rw , repoConfig , dontCopy ) ) ; } }
Source:
public com.google.gerrit.extensions.api.changes.ReviewerInfo format ( com.google.gerrit.extensions.api.changes.ReviewerInfo out , com.google.gerrit.server.permissions.PermissionBackend.ForChange perm , com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gerrit.server.permissions.PermissionBackendException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSet.Id psId = cd.change ( ) . currentPatchSetId ( ) ; com.google.gerrit.server.project.ChangeControl ctl = cd.changeControl ( ) . forUser ( perm.user ( ) ) ; return format ( out , perm , cd , approvalsUtil.byPatchSetUser ( db.get ( ) , ctl , psId , new com.google.gerrit.reviewdb.client.Account.Id ( out._accountId ) , null , null ) ) ; }

Target:
public com.google.gerrit.extensions.api.changes.ReviewerInfo format ( com.google.gerrit.extensions.api.changes.ReviewerInfo out , com.google.gerrit.server.permissions.PermissionBackend.ForChange perm , com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gerrit.server.permissions.PermissionBackendException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSet.Id psId = cd.change ( ) . currentPatchSetId ( ) ; com.google.gerrit.server.project.ChangeControl ctl = cd.changeControl ( ) . forUser ( perm.user ( ) ) ; return format ( out , perm , cd , approvalsUtil.byPatchSetUser ( db.get ( ) , cd.notes ( ) , ctl.getUser ( ) , psId , new com.google.gerrit.reviewdb.client.Account.Id ( out._accountId ) , null , null ) ) ; }
Source:
public void display ( final com.google.gerrit.client.reviewdb.Patch.Key k , final com.google.gerrit.client.reviewdb.PatchSet.Id a , final com.google.gerrit.client.reviewdb.PatchSet.Id b , final com.google.gerrit.client.data.PatchScript s ) { patchKey = k ; idSideA = a ; idSideB = b ; render ( s ) ; }

Target:
public void display ( final com.google.gerrit.client.reviewdb.Patch.Key k , final com.google.gerrit.client.reviewdb.PatchSet.Id a , final com.google.gerrit.client.reviewdb.PatchSet.Id b , final com.google.gerrit.client.data.PatchScript s ) { patchKey = k ; idSideA = a ; idSideB = b ; final java.lang.String pathName = patchKey.get ( ) ; int ext = pathName.lastIndexOf ( '.' ) ; formatLanguage = ( ext > 0 ) ? pathName.substring ( ( ext + 1 ) ) . toLowerCase ( ) : null ; render ( s ) ; }
Source:
private java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.PatchLineComment > changeDrafts ( com.google.gerrit.server.change.RevisionResource rsrc ) throws com.google.gwtorm.server.OrmException { java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.PatchLineComment > drafts = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.google.gerrit.reviewdb.client.PatchLineComment c : plcUtil.draftByChangeAuthor ( db.get ( ) , rsrc.getNotes ( ) , rsrc.getAccountId ( ) ) ) { drafts.put ( c.getKey ( ) . get ( ) , c ) ; } return drafts ; }

Target:
private java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.PatchLineComment > patchSetDrafts ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws com.google.gwtorm.server.OrmException { java.util.Map < java.lang.String , com.google.gerrit.reviewdb.client.PatchLineComment > drafts = com.google.common.collect.Maps.newHashMap ( ) ; for ( com.google.gerrit.reviewdb.client.PatchLineComment c : plcUtil.draftByPatchSetAuthor ( ctx.getDb ( ) , psId , user.getAccountId ( ) , ctx.getNotes ( ) ) ) { drafts.put ( c.getKey ( ) . get ( ) , c ) ; } return drafts ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.HostPageData result ) { com.google.gwt.dom.client.Document.get ( ) . getElementById ( "gerrit_hostpagedata" ) . removeFromParent ( ) ; com.google.gerrit.client.Gerrit.myTheme = result.theme ; com.google.gerrit.client.Gerrit.isNoteDbEnabled = result.isNoteDbEnabled ; if ( ( result.account ) != null ) { com.google.gerrit.client.Gerrit.myAccount = result.account ; com.google.gerrit.client.Gerrit.xGerritAuth = result.xGerritAuth ; } if ( ( result.accountDiffPref ) != null ) { com.google.gerrit.client.Gerrit.myAccountDiffPref = result.accountDiffPref ; com.google.gerrit.client.Gerrit.applyUserPreferences ( ) ; } onModuleLoad2 ( result ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.info.AccountInfo result ) { com.google.gerrit.client.Gerrit.myAccount = result ; }
Source:
protected TestRepository < ? > . CommitBuilder amendBuilder ( ) throws java.lang.Exception { org.eclipse.jgit.lib.ObjectId head = testRepo.getRepository ( ) . getRef ( "HEAD" ) . getObjectId ( ) ; TestRepository < ? > . CommitBuilder b = testRepo.amendRef ( "HEAD" ) ; com.google.common.base.Optional < java.lang.String > id = com.google.gerrit.acceptance.GitUtil.getChangeId ( testRepo , head ) ; if ( id.isPresent ( ) ) { b.insertChangeId ( id.get ( ) . substring ( 1 ) ) ; } else { b.insertChangeId ( ) ; } return b ; }

Target:
protected org.eclipse.jgit.internal.storage.dfs.InMemoryRepository repo ( ) { return testRepo.getRepository ( ) ; }
Source:
public void testSubscriptionToEmptyRepo ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; createSubscription ( superRepo , "master" , "subscribed-to-project" , "master" ) ; org.eclipse.jgit.lib.ObjectId subHEAD = pushChangeTo ( subRepo , "master" ) ; expectToHaveSubmoduleState ( superRepo , "master" , "subscribed-to-project" , subHEAD ) ; }

Target:
public void testSubscriptionToEmptyRepo ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; createSubmoduleSubscription ( superRepo , "master" , "subscribed-to-project" , "master" ) ; org.eclipse.jgit.lib.ObjectId subHEAD = pushChangeTo ( subRepo , "master" ) ; expectToHaveSubmoduleState ( superRepo , "master" , "subscribed-to-project" , subHEAD ) ; }
Source:
private void buildPluginJar ( ) throws java.io.IOException , java.lang.InterruptedException { java.util.Properties properties = loadBuckProperties ( ) ; java.lang.String buck = com.google.common.base.MoreObjects.firstNonNull ( properties.getProperty ( com.google.gerrit.acceptance.PluginDaemonTest.BUCKLC ) , com.google.gerrit.acceptance.PluginDaemonTest.BUCKLC ) ; java.lang.String target ; if ( standalone ) { target = "//:" + ( pluginName ) ; } else { target = pluginSubPath.toString ( ) ; } java.lang.ProcessBuilder processBuilder = new java.lang.ProcessBuilder ( buck , com.google.gerrit.acceptance.PluginDaemonTest.BUILD , target ) . directory ( pluginRoot.toFile ( ) ) . redirectErrorStream ( true ) ; java.nio.file.Path forceJar = pluginSource.resolve ( com.google.gerrit.acceptance.PluginDaemonTest.EMPTY ) ; java.nio.file.Files.createFile ( forceJar ) ; try { processBuilder.start ( ) . waitFor ( ) ; } finally { java.nio.file.Files.delete ( forceJar ) ; processBuilder.start ( ) . waitFor ( ) ; } }

Target:
private void buildPluginJar ( ) throws java.io.IOException , java.lang.InterruptedException { java.util.Properties properties = loadBuckProperties ( ) ; java.lang.String buck = com.google.common.base.MoreObjects.firstNonNull ( properties.getProperty ( com.google.gerrit.acceptance.PluginDaemonTest.BUCKLC ) , com.google.gerrit.acceptance.PluginDaemonTest.BUCKLC ) ; java.lang.String target ; if ( standalone ) { target = "//:" + ( pluginName ) ; } else { target = pluginSubPath.toString ( ) ; } java.lang.ProcessBuilder processBuilder = new java.lang.ProcessBuilder ( buck , "build" , target ) . directory ( pluginRoot.toFile ( ) ) . redirectErrorStream ( true ) ; processBuilder.environment ( ) . put ( "NO_BUCKD" , "1" ) ; java.nio.file.Path forceJar = pluginSource.resolve ( "src/main/java/ForceJarIfMissing.java" ) ; java.nio.file.Files.deleteIfExists ( forceJar ) ; java.nio.file.Files.createFile ( forceJar ) ; testSite = tempSiteDir.getRoot ( ) . toPath ( ) ; java.nio.file.Path log = testSite.resolve ( "log" ) ; processBuilder.redirectErrorStream ( true ) ; processBuilder.redirectOutput ( java.lang.ProcessBuilder.Redirect.appendTo ( log.toFile ( ) ) ) ; try { processBuilder.start ( ) . waitFor ( ) ; } finally { java.nio.file.Files.delete ( forceJar ) ; processBuilder.start ( ) . waitFor ( ) ; } }
Source:
public void testErrorDuringTransitionToUnhealty ( ) throws java.io.IOException { tempFolder.delete ( ) ; javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }

Target:
public void testErrorDuringTransitionToUnhealthy ( ) throws java.io.IOException { tempFolder.delete ( ) ; javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }
Source:
private AccountGroup.Id owner ( com.google.gerrit.server.group.CreateGroup.Input input ) throws com.google.gerrit.extensions.restapi.BadRequestException { if ( ( input.ownerId ) != null ) { try { com.google.gerrit.server.group.GroupResource rsrc = groups.parse ( input.ownerId ) ; com.google.gerrit.reviewdb.client.AccountGroup owner = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( rsrc.getGroup ( ) ) ; if ( owner == null ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "ownerId must be internal group" ) ; } return owner.getId ( ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException e ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "ownerId cannot be resolved" ) ; } } return null ; }

Target:
private AccountGroup.Id owner ( com.google.gerrit.server.group.CreateGroup.Input input ) throws com.google.gerrit.extensions.restapi.BadRequestException { if ( ( input.ownerId ) != null ) { try { com.google.gerrit.server.group.GroupResource rsrc = groups.parse ( com.google.gerrit.extensions.restapi.Url.decode ( input.ownerId ) ) ; com.google.gerrit.reviewdb.client.AccountGroup owner = com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( rsrc.getGroup ( ) ) ; if ( owner == null ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "ownerId must be internal group" ) ; } return owner.getId ( ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException e ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "ownerId cannot be resolved" ) ; } } return null ; }
Source:
public java.lang.String getOrSetTopic ( int sourceId , java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException { if ( com.google.common.base.Strings.isNullOrEmpty ( topic ) ) { topic = "am-" + ( java.util.UUID.randomUUID ( ) ) ; com.googlesource.gerrit.plugins.automerger.DownstreamCreator.log.debug ( "Setting original change topic to {}" , sourceId , topic ) ; gApi.changes ( ) . id ( sourceId ) . topic ( topic ) ; } return topic ; }

Target:
public java.lang.String getOrSetTopic ( int sourceId , java.lang.String topic ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , org.eclipse.jgit.errors.ConfigInvalidException { try ( com.google.gerrit.server.util.ManualRequestContext ctx = oneOffRequestContext.openAs ( config.getContextUserId ( ) ) ) { if ( com.google.common.base.Strings.isNullOrEmpty ( topic ) ) { topic = "am-" + ( java.util.UUID.randomUUID ( ) ) ; com.googlesource.gerrit.plugins.automerger.DownstreamCreator.log.debug ( "Setting original change topic to {}" , sourceId , topic ) ; gApi.changes ( ) . id ( sourceId ) . topic ( topic ) ; } return topic ; } }
Source:
public java.lang.String toBranch ( final com.google.gerrit.reviewdb.Branch.NameKey branch ) { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; com.google.gerrit.common.data.GitwebLink.p ( r , branch.getParentKey ( ) ) ; com.google.gerrit.common.data.GitwebLink.h ( r , branch ) ; com.google.gerrit.common.data.GitwebLink.a ( r , "shortlog" ) ; return ( baseUrl ) + r ; }

Target:
public java.lang.String toBranch ( final com.google.gerrit.reviewdb.Branch.NameKey branch ) { com.google.gerrit.common.data.ParamertizedString pattern = new com.google.gerrit.common.data.ParamertizedString ( type.getBranch ( ) ) ; final java.util.Map < java.lang.String , java.lang.String > p = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; p.put ( "project" , com.google.gwt.http.client.URL.encodeComponent ( branch.getParentKey ( ) . get ( ) ) ) ; p.put ( "branch" , com.google.gwt.http.client.URL.encodeComponent ( branch.get ( ) ) ) ; return ( baseUrl ) + ( pattern.replace ( p ) ) ; }