auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void pathOfFixReplacementIsMandatory ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; fixReplacementInfo.path = null ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( java.lang.String.format ( ( "A file path must be given for the " + "replacement of the robot comment on %s" ) , withFixRobotCommentInput.path ) ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; }

Target:
public void pathOfFixReplacementIsMandatory ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; fixReplacementInfo.path = null ; exception.expect ( com.google.gerrit.extensions.restapi.BadRequestException.class ) ; exception.expectMessage ( java.lang.String.format ( "A file path must be given for the replacement of the robot comment on %s" , withFixRobotCommentInput.path ) ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; }
Source:
com.google.common.hash.Funnel < K > funnel ( ) { return new com.google.common.hash.Funnel < K > ( ) { @ java.lang.Override public void funnel ( K from , com.google.common.hash.PrimitiveSink into ) { try { java.io.ObjectOutputStream ser = new java.io.ObjectOutputStream ( new com.google.gerrit.server.cache.h2.H2CacheImpl.SinkOutputStream ( into ) ) ; ser.writeObject ( from ) ; ser.flush ( ) ; } catch ( java.io.IOException err ) { throw new java.lang.RuntimeException ( "Cannot hash as Serializable" , err ) ; } } } ; }

Target:
com.google.common.hash.Funnel < K > funnel ( ) { return new com.google.common.hash.Funnel < K > ( ) { private static final long serialVersionUID = 1L ; @ java.lang.Override public void funnel ( K from , com.google.common.hash.PrimitiveSink into ) { try { java.io.ObjectOutputStream ser = new java.io.ObjectOutputStream ( new com.google.gerrit.server.cache.h2.H2CacheImpl.SinkOutputStream ( into ) ) ; ser.writeObject ( from ) ; ser.flush ( ) ; } catch ( java.io.IOException err ) { throw new java.lang.RuntimeException ( "Cannot hash as Serializable" , err ) ; } } } ; }
Source:
public boolean execute ( ) { if ( ( prefs.syntaxHighlighting ( ) ) && ( isAttached ( ) ) ) { setSyntaxHighlighting ( prefs.syntaxHighlighting ( ) ) ; } return false ; }

Target:
public void onSuccess ( java.lang.Void result ) { if ( prefs.syntaxHighlighting ( ) ) { cmA.setOption ( "mode" , getContentType ( diff.meta_a ( ) ) ) ; cmB.setOption ( "mode" , getContentType ( diff.meta_b ( ) ) ) ; } }
Source:
private synchronized com.google.gerrit.testutil.InMemoryRepositoryManager.Repo get ( com.google.gerrit.reviewdb.client.Project.NameKey name ) throws org.eclipse.jgit.errors.RepositoryNotFoundException { com.google.gerrit.testutil.InMemoryRepositoryManager.Repo repo = repos.get ( name.get ( ) . toLowerCase ( ) ) ; if ( repo != null ) { return repo ; } throw new org.eclipse.jgit.errors.RepositoryNotFoundException ( name.get ( ) ) ; }

Target:
public synchronized void deleteRepository ( com.google.gerrit.reviewdb.client.Project.NameKey name ) { repos.remove ( com.google.gerrit.testutil.InMemoryRepositoryManager.normalize ( name ) ) ; }
Source:
public org.parboiled.Rule typeOfNote ( ) { return firstOf ( sequence ( string ( "note" ) , push ( DivNode.Style.NOTE ) ) , sequence ( string ( "promo" ) , push ( DivNode.Style.PROMO ) ) , sequence ( string ( "aside" ) , push ( DivNode.Style.ASIDE ) ) ) ; }

Target:
public org.parboiled.Rule typeOfNote ( ) { return firstOf ( sequence ( string ( "note" ) , push ( match ( ) ) ) , sequence ( string ( "promo" ) , push ( match ( ) ) ) , sequence ( string ( "aside" ) , push ( match ( ) ) ) ) ; }
Source:
public void listOneIncludeMember ( ) throws java.lang.Exception { java.lang.String gx = group ( "gx" , "Administrators" ) ; java.lang.String gy = group ( "gy" , "Administrators" ) ; PUT ( ( ( ( "/groups/" + gx ) + "/groups/" ) + gy ) ) ; com.google.common.truth.Truth.assertThat ( GET_ONE ( ( ( ( "/groups/" + gx ) + "/groups/" ) + gy ) ) . name ) . isEqualTo ( gy ) ; }

Target:
public void listOneIncludeMember ( ) throws java.lang.Exception { java.lang.String gx = group ( "gx" ) ; java.lang.String gy = group ( "gy" ) ; gApi.groups ( ) . id ( gx ) . addGroups ( gy ) ; assertIncludes ( gApi.groups ( ) . id ( gx ) . includedGroups ( ) , gy ) ; }
Source:
public java.lang.String get ( ) { java.lang.String canonicalUrl = super . get ( ) ; if ( canonicalUrl != null ) { return canonicalUrl ; } if ( ( requestProvider ) != null ) { final javax.servlet.http.HttpServletRequest req ; try { req = requestProvider.get ( ) ; } catch ( com.google.inject.ProvisionException noWeb ) { if ( ( noWeb.getCause ( ) ) instanceof com.google.inject.OutOfScopeException ) { return null ; } throw noWeb ; } return com.google.gerrit.httpd.CanonicalWebUrl.computeFromRequest ( req ) ; } return null ; }

Target:
public java.lang.String get ( ) { java.lang.String canonicalUrl = super . get ( ) ; if ( canonicalUrl != null ) { return canonicalUrl ; } return guessUrlFromHttpRequest ( ) . orElseGet ( ( ) -> ( "http://" + ( org.eclipse.jgit.util.SystemReader.getInstance ( ) . getHostname ( ) ) ) + '/' ) ; }
Source:
public java.lang.Object apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.PutMembers.PutMember.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.PutMembers.Input in = new com.google.gerrit.server.group.PutMembers.Input ( ) ; in._oneMember = id ; java.util.List < com.google.gerrit.server.group.MembersCollection.MemberInfo > list = put.get ( ) . apply ( resource , in ) ; if ( list.isEmpty ( ) ) { return com.google.gerrit.extensions.restapi.Response.none ( ) ; } else if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } else { throw new java.lang.IllegalStateException ( ) ; } }

Target:
public java.lang.Object apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddMembers.PutMember.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddMembers.Input in = new com.google.gerrit.server.group.AddMembers.Input ( ) ; in._oneMember = id ; java.util.List < com.google.gerrit.server.group.MembersCollection.MemberInfo > list = put.get ( ) . apply ( resource , in ) ; if ( list.isEmpty ( ) ) { return com.google.gerrit.extensions.restapi.Response.none ( ) ; } else if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } else { throw new java.lang.IllegalStateException ( ) ; } }
Source:
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 ( ) ; htmlBuf.append ( "</" ) . append ( tag ) . append ( '>' ) ; return this ; }

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:
private static com.google.gerrit.client.reviewdb.AccountExternalId lookupGoogleAccount ( final com.google.gerrit.client.reviewdb.AccountExternalIdAccess extAccess , final java.lang.String email ) throws com.google.gwtorm.client.OrmException { final java.util.List < com.google.gerrit.client.reviewdb.AccountExternalId > m = new java.util.ArrayList < com.google.gerrit.client.reviewdb.AccountExternalId > ( ) ; for ( final com.google.gerrit.client.reviewdb.AccountExternalId e : extAccess.byEmailAddress ( email ) ) { if ( e.getExternalId ( ) . equals ( OpenIdUtil.URL_GOOGLE ) ) { m.add ( e ) ; } } return ( m.size ( ) ) == 1 ? m.get ( 0 ) : null ; }

Target:
private static com.google.gerrit.client.reviewdb.AccountExternalId lookupGoogleAccount ( final com.google.gerrit.client.reviewdb.AccountExternalIdAccess extAccess , final java.lang.String email ) throws com.google.gwtorm.client.OrmException { final java.util.List < com.google.gerrit.client.reviewdb.AccountExternalId > m = new java.util.ArrayList < com.google.gerrit.client.reviewdb.AccountExternalId > ( ) ; for ( final com.google.gerrit.client.reviewdb.AccountExternalId e : extAccess.byEmailAddress ( email ) ) { if ( e.getExternalId ( ) . equals ( ( "Google Account " + email ) ) ) { m.add ( e ) ; } } return ( m.size ( ) ) == 1 ? m.get ( 0 ) : null ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.cache.h2.DefaultCacheFactory.class ) ; bind ( com.google.gerrit.server.cache.MemoryCacheFactory.class ) . to ( com.google.gerrit.server.cache.h2.DefaultCacheFactory.class ) ; bind ( com.google.gerrit.server.cache.PersistentCacheFactory.class ) . to ( com.google.gerrit.server.cache.h2.H2CacheFactory.class ) ; listener ( ) . to ( com.google.gerrit.server.cache.h2.H2CacheFactory.class ) ; }

Target:
protected void configure ( ) { install ( new com.google.gerrit.server.config.FactoryModule ( ) { @ java.lang.Override protected void configure ( ) { factory ( ForwardingRemovalListener.Factory.class ) ; } } ) ; bind ( com.google.gerrit.server.cache.h2.DefaultCacheFactory.class ) ; bind ( com.google.gerrit.server.cache.MemoryCacheFactory.class ) . to ( com.google.gerrit.server.cache.h2.DefaultCacheFactory.class ) ; bind ( com.google.gerrit.server.cache.PersistentCacheFactory.class ) . to ( com.google.gerrit.server.cache.h2.H2CacheFactory.class ) ; listener ( ) . to ( com.google.gerrit.server.cache.h2.H2CacheFactory.class ) ; }
Source:
public boolean isReviewer ( com.google.gerrit.reviewdb.server.ReviewDb db , @ com.google.gerrit.common.Nullable com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( getCurrentUser ( ) . isIdentifiedUser ( ) ) { java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > results = ( cd != null ) ? cd.reviewers ( ) . values ( ) : approvalsUtil.getReviewers ( db , change.getId ( ) ) . values ( ) ; com.google.gerrit.server.IdentifiedUser user = ( ( com.google.gerrit.server.IdentifiedUser ) ( getCurrentUser ( ) ) ) ; return results.contains ( user.getAccountId ( ) ) ; } return false ; }

Target:
public boolean isReviewer ( com.google.gerrit.reviewdb.server.ReviewDb db , @ com.google.gerrit.common.Nullable com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( getCurrentUser ( ) . isIdentifiedUser ( ) ) { java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > results = changeData ( db , cd ) . reviewers ( ) . values ( ) ; com.google.gerrit.server.IdentifiedUser user = ( ( com.google.gerrit.server.IdentifiedUser ) ( getCurrentUser ( ) ) ) ; return results.contains ( user.getAccountId ( ) ) ; } return false ; }
Source:
private static java.util.List < java.lang.reflect.Method > getConfigs ( java.lang.Class < ? > clazz ) { java.util.List < java.lang.reflect.Method > result = com.google.common.collect.Lists.newArrayListWithExpectedSize ( 3 ) ; for ( java.lang.reflect.Method m : clazz.getMethods ( ) ) { com.google.gerrit.testutil.ConfigSuite.Config ann = m.getAnnotation ( com.google.gerrit.testutil.ConfigSuite.Config.class ) ; if ( ann != null ) { com.google.common.base.Preconditions.checkArgument ( ( ! ( m.getName ( ) . equals ( com.google.gerrit.testutil.ConfigSuite.DEFAULT ) ) ) , "@ConfigSuite.Config cannot be named %s" , com.google.gerrit.testutil.ConfigSuite.DEFAULT ) ; result.add ( m ) ; } } return result ; }

Target:
private static java.util.List < java.lang.reflect.Method > getConfigs ( java.lang.Class < ? > clazz ) { java.util.List < java.lang.reflect.Method > result = com.google.common.collect.Lists.newArrayListWithExpectedSize ( 3 ) ; for ( java.lang.reflect.Method m : clazz.getMethods ( ) ) { com.google.gerrit.testutil.ConfigSuite.Config ann = m.getAnnotation ( com.google.gerrit.testutil.ConfigSuite.Config.class ) ; if ( ann != null ) { com.google.common.base.Preconditions.checkArgument ( ( ! ( m.getName ( ) . equals ( com.google.gerrit.testutil.ConfigSuite.DEFAULT ) ) ) , "%s cannot be named %s" , ann , com.google.gerrit.testutil.ConfigSuite.DEFAULT ) ; result.add ( m ) ; } } return result ; }
Source:
protected java.lang.String getNameFor ( final com.google.gerrit.reviewdb.client.Account.Id accountId ) { if ( accountId == null ) { return args.anonymousCowardName ; } final com.google.gerrit.reviewdb.client.Account userAccount = args.accountCache.get ( accountId ) . getAccount ( ) ; java.lang.String name = userAccount.getFullName ( ) ; if ( name == null ) { name = userAccount.getPreferredEmail ( ) ; } if ( name == null ) { name = ( ( args.anonymousCowardName ) + " #" ) + accountId ; } return name ; }

Target:
protected java.lang.String getNameFor ( final com.google.gerrit.reviewdb.client.Account.Id accountId ) { if ( accountId == null ) { return args.gerritPersonIdent.getName ( ) ; } final com.google.gerrit.reviewdb.client.Account userAccount = args.accountCache.get ( accountId ) . getAccount ( ) ; java.lang.String name = userAccount.getFullName ( ) ; if ( name == null ) { name = userAccount.getPreferredEmail ( ) ; } if ( name == null ) { name = ( ( args.anonymousCowardName ) + " #" ) + accountId ; } return name ; }
Source:
private org.apache.lucene.index.Term idTerm ( com.google.gerrit.server.query.change.ChangeData cd ) { return intTerm ( com.google.gerrit.server.query.change.ChangeQueryBuilder.FIELD_CHANGE , cd.getId ( ) . get ( ) ) ; }

Target:
public void markReady ( ) throws java.io.IOException { try { org.eclipse.jgit.storage.file.FileBasedConfig cfg = com.google.gerrit.lucene.LuceneVersionManager.loadGerritIndexConfig ( sitePaths ) ; cfg.setBoolean ( "index" , java.lang.Integer.toString ( schema.getVersion ( ) ) , "ready" , true ) ; cfg.save ( ) ; } catch ( org.eclipse.jgit.errors.ConfigInvalidException e ) { throw new java.io.IOException ( e ) ; } }
Source:
private org.kohsuke.args4j.spi.OptionHandler findHandler ( java.lang.String name ) { for ( org.kohsuke.args4j.spi.OptionHandler handler : parser.options ) { if ( ( handler.option ) instanceof org.kohsuke.args4j.NamedOptionDef ) { org.kohsuke.args4j.NamedOptionDef def = ( ( org.kohsuke.args4j.NamedOptionDef ) ( handler.option ) ) ; if ( name.equals ( def.name ( ) ) ) { return handler ; } for ( java.lang.String alias : def.aliases ( ) ) { if ( name.equals ( alias ) ) { return handler ; } } } } return null ; }

Target:
private org.kohsuke.args4j.spi.OptionHandler findHandler ( java.lang.String name ) { if ( ( options ) == null ) { options = com.google.gerrit.util.cli.CmdLineParser.index ( parser.options ) ; } return options.get ( name ) ; }
Source:
java.util.List < java.lang.String > getValues ( int row ) { java.util.List < java.lang.String > v = new java.util.ArrayList < > ( ) ; for ( int i = 0 ; i < ( inputs.size ( ) ) ; i ++ ) { v.add ( table.getText ( row , ( i + 1 ) ) ) ; } return v ; }

Target:
protected java.util.List < java.lang.String > getRowItem ( int row ) { java.util.List < java.lang.String > v = new java.util.ArrayList < > ( ) ; for ( int i = 0 ; i < ( inputs.size ( ) ) ; i ++ ) { v.add ( table.getText ( row , ( i + 1 ) ) ) ; } return v ; }
Source:
public final java.util.List < com.google.gerrit.reviewdb.client.Account.FieldName > editableAccountFields ( ) { java.util.List < com.google.gerrit.reviewdb.client.Account.FieldName > fields = new java.util.ArrayList < > ( ) ; for ( com.google.gerrit.client.config.AuthInfo.AccountFieldNameInfo f : com.google.gerrit.client.rpc.Natives.asList ( _editableAccountFields ( ) ) ) { fields.add ( f.get ( ) ) ; } return fields ; }

Target:
public final java.util.List < com.google.gerrit.reviewdb.client.Account.FieldName > editableAccountFields ( ) { java.util.List < com.google.gerrit.reviewdb.client.Account.FieldName > fields = new java.util.ArrayList < > ( ) ; for ( java.lang.String f : com.google.gerrit.client.rpc.Natives.asList ( _editableAccountFields ( ) ) ) { fields.add ( Account.FieldName.valueOf ( f ) ) ; } return fields ; }
Source:
private void insertNoneRow ( final int row ) { insertRow ( row ) ; table.setText ( row , 0 , Util.C.changeTableNone ( ) ) ; final com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter fmt = table.getFlexCellFormatter ( ) ; fmt.setColSpan ( row , 0 , com.google.gerrit.client.changes.ChangeTable.COLUMNS ) ; fmt.setStyleName ( row , 0 , com.google.gerrit.client.changes.ChangeTable.S_EMPTY_SECTION ) ; }

Target:
private void insertNoneRow ( final int row ) { insertRow ( row ) ; table.setText ( row , 0 , Util.C.changeTableNone ( ) ) ; final com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter fmt = table.getFlexCellFormatter ( ) ; fmt.setColSpan ( row , 0 , columns ) ; fmt.setStyleName ( row , 0 , com.google.gerrit.client.changes.ChangeTable.S_EMPTY_SECTION ) ; }
Source:
public com.google.gerrit.extensions.registration.RegistrationHandle put ( java.lang.String pluginName , java.lang.String exportName , final T item ) { final com.google.gerrit.extensions.registration.NamePair key = new com.google.gerrit.extensions.registration.NamePair ( pluginName , exportName ) ; items.put ( key , item ) ; return new com.google.gerrit.extensions.registration.RegistrationHandle ( ) { @ java.lang.Override public void remove ( ) { items.remove ( key , item ) ; } } ; }

Target:
public com.google.gerrit.extensions.registration.RegistrationHandle put ( java.lang.String pluginName , java.lang.String exportName , final com.google.inject.Provider < T > item ) { final com.google.gerrit.extensions.registration.NamePair key = new com.google.gerrit.extensions.registration.NamePair ( pluginName , exportName ) ; items.put ( key , item ) ; return new com.google.gerrit.extensions.registration.RegistrationHandle ( ) { @ java.lang.Override public void remove ( ) { items.remove ( key , item ) ; } } ; }
Source:
public java.util.List < com.google.gerrit.server.update.BatchUpdate > batchUpdates ( com.google.gerrit.server.update.BatchUpdate.Factory batchUpdateFactory , java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException { java.util.List < com.google.gerrit.server.update.BatchUpdate > updates = new java.util.ArrayList ( projects.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { updates.add ( getRepo ( project ) . getUpdate ( batchUpdateFactory ) ) ; } return updates ; }

Target:
public java.util.List < com.google.gerrit.server.update.BatchUpdate > batchUpdates ( java.util.Collection < com.google.gerrit.reviewdb.client.Project.NameKey > projects ) throws com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException { java.util.List < com.google.gerrit.server.update.BatchUpdate > updates = new java.util.ArrayList ( projects.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Project.NameKey project : projects ) { updates.add ( getRepo ( project ) . getUpdate ( ) . setRefLogMessage ( "merged" ) ) ; } return updates ; }
Source:
public void commentOnReviewableChangeByReviewer ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; review ( sc.reviewer , sc.changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ) ; assertThat ( sender ) . sent ( "comment" , sc ) . notTo ( sc.reviewer ) . to ( sc.owner ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; }

Target:
public void commentOnReviewableChangeByReviewer ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; review ( sc.reviewer , sc.changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ) ; assertThat ( sender ) . sent ( "comment" , sc ) . to ( sc.owner ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) . noOneElse ( ) ; }
Source:
public void testUpsertOneNotExisting ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; verifyIds ( insert , 1 ) ; }

Target:
public void testUpsertOneNotExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( oneRow ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertExpectedIdsUsed ( insert , 1 ) ; }
Source:
private com.google.gerrit.common.data.LabelTypes getLabelTypes ( ) throws java.lang.Exception { db.create ( ) ; com.google.gerrit.server.config.AllProjectsName allProjects = db.getInstance ( com.google.gerrit.server.config.AllProjectsName.class ) ; com.google.gerrit.server.git.ProjectConfig c = new com.google.gerrit.server.git.ProjectConfig ( allProjects ) ; org.eclipse.jgit.lib.Repository repo = db.getInstance ( com.google.gerrit.server.git.GitRepositoryManager.class ) . openRepository ( allProjects ) ; try { c.load ( repo ) ; return new com.google.gerrit.common.data.LabelTypes ( com.google.common.collect.ImmutableList.copyOf ( c.getLabelSections ( ) . values ( ) ) ) ; } finally { repo.close ( ) ; } }

Target:
private com.google.gerrit.common.data.LabelTypes getLabelTypes ( ) throws java.lang.Exception { db.create ( ) ; com.google.gerrit.server.git.ProjectConfig c = new com.google.gerrit.server.git.ProjectConfig ( allProjects ) ; org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allProjects ) ; try { c.load ( repo ) ; return new com.google.gerrit.common.data.LabelTypes ( com.google.common.collect.ImmutableList.copyOf ( c.getLabelSections ( ) . values ( ) ) ) ; } finally { repo.close ( ) ; } }
Source:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.config.CacheResource rsrc , com.google.gerrit.server.config.FlushCache.Input input ) throws com.google.gerrit.extensions.restapi.AuthException { if ( ( com.google.gerrit.server.config.FlushCache.WEB_SESSIONS.equals ( rsrc.getName ( ) ) ) && ( ! ( self.get ( ) . getCapabilities ( ) . canMaintainServer ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( java.lang.String.format ( "only site maintainers can flush %s" , com.google.gerrit.server.config.FlushCache.WEB_SESSIONS ) ) ; } rsrc.getCache ( ) . invalidateAll ( ) ; return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.config.CacheResource rsrc , com.google.gerrit.server.config.FlushCache.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.server.permissions.PermissionBackendException { if ( com.google.gerrit.server.config.FlushCache.WEB_SESSIONS.equals ( rsrc.getName ( ) ) ) { permissionBackend.user ( self ) . check ( GlobalPermission.MAINTAIN_SERVER ) ; } rsrc.getCache ( ) . invalidateAll ( ) ; return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; }
Source:
private org.eclipse.jgit.revwalk.RevCommit makeCommit ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException , org.eclipse.jgit.api.errors.NoFilepatternException { java.util.Map < java.io.File , byte [ ] > files = new java.util.HashMap < > ( ) ; java.lang.String content = "http://foo.bar.tld/?pw=myp4ssw0rdTefoobarstline2\n" ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foo.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "$Id$\n" + ( ( ( "$Header$\n" + "$Author$\n" ) + "processXFile($File::Find::name, $Config{$type});\n" ) + "$Id: bla bla bla$\n" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "bar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "Testline1\n" + ( ( "Testline2\n" + "Testline3\n" ) + "Testline4" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foobar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; return com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.makeCommit ( repo , "Commit with test files." , files ) ; }

Target:
private org.eclipse.jgit.revwalk.RevCommit makeCommit ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException , org.eclipse.jgit.api.errors.NoFilepatternException { java.util.Map < java.io.File , byte [ ] > files = new java.util.HashMap < > ( ) ; java.lang.String content = "http://foo.bar.tld/?pw=myp4ssw0rdTefoobarstline2\n" ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foo.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "$Id$\n" + ( ( ( "$Header$\n" + "$Author$\n" ) + "processXFile($File::Find::name, $Config{$type});\n" ) + "$Id: foo bar$\n" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "bar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; content = "Testline1\n" + ( ( "Testline2\n" + "Testline3\n" ) + "Testline4" ) ; files.put ( new java.io.File ( repo.getDirectory ( ) . getParent ( ) , "foobar.txt" ) , content.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; return com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.makeCommit ( repo , "Commit with test files." , files ) ; }
Source:
private void approve ( java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = adminSession.post ( ( ( "/changes/" + changeId ) + "/revisions/current/review" ) , new com.google.gerrit.extensions.api.changes.ReviewInput ( ) . label ( "Code-Review" , 2 ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; r.consume ( ) ; }

Target:
static void approve ( com.google.gerrit.acceptance.RestSession adminSession , java.lang.String changeId ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = adminSession.post ( ( ( "/changes/" + changeId ) + "/revisions/current/review" ) , new com.google.gerrit.extensions.api.changes.ReviewInput ( ) . label ( "Code-Review" , 2 ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; r.consume ( ) ; }
Source:
private static java.util.Collection < com.google.gerrit.reviewdb.client.AccountSshKey > toAccountSshKey ( com.google.gerrit.server.account.AccountState a , java.util.List < com.google.gerrit.extensions.common.SshKeyInfo > sshKeys ) { java.util.Collection < com.google.gerrit.reviewdb.client.AccountSshKey > result = new java.util.HashSet < > ( ) ; int index = 1 ; for ( com.google.gerrit.extensions.common.SshKeyInfo sshKeyInfo : sshKeys ) { result.add ( new com.google.gerrit.reviewdb.client.AccountSshKey ( new com.google.gerrit.reviewdb.client.AccountSshKey.Id ( a.getAccount ( ) . getId ( ) , ( index ++ ) ) , sshKeyInfo.sshPublicKey ) ) ; } return result ; }

Target:
private void addSshKeys ( com.googlesource.gerrit.plugins.importer.GerritApi api , com.google.gerrit.extensions.common.AccountInfo acc ) throws com.google.gerrit.common.errors.InvalidSshKeyException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { java.util.List < com.google.gerrit.extensions.common.SshKeyInfo > sshKeys = api.getSshKeys ( acc.username ) ; com.google.gerrit.server.account.AccountState a = accountCache.getByUsername ( acc.username ) ; for ( com.google.gerrit.extensions.common.SshKeyInfo sshKeyInfo : sshKeys ) { authorizedKeys.addKey ( a.getAccount ( ) . getId ( ) , sshKeyInfo.sshPublicKey ) ; } }
Source:
public com.google.gerrit.extensions.common.ChangeInfo apply ( com.google.gerrit.server.change.ChangeResource req , com.google.gerrit.extensions.api.changes.AbandonInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; if ( ! ( control.canAbandon ( dbProvider.get ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "abandon not permitted" ) ; } com.google.gerrit.reviewdb.client.Change change = abandon ( control , input.message , input.notify ) ; return json.create ( ChangeJson.NO_OPTIONS ) . format ( change ) ; }

Target:
public com.google.gerrit.extensions.common.ChangeInfo apply ( com.google.gerrit.server.change.ChangeResource req , com.google.gerrit.extensions.api.changes.AbandonInput input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.UpdateException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl control = req.getControl ( ) ; if ( ! ( control.canAbandon ( dbProvider.get ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "abandon not permitted" ) ; } com.google.gerrit.reviewdb.client.Change change = abandon ( control , input.message , input.notify , notifyUtil.resolveAccounts ( input.notifyDetails ) ) ; return json.create ( ChangeJson.NO_OPTIONS ) . format ( change ) ; }
Source:
public void mergeByReviewer ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; merge ( sc.changeId , sc.reviewer ) ; assertThat ( sender ) . sent ( "merged" , sc ) . notTo ( sc.reviewer ) . to ( sc.owner ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; }

Target:
public void mergeByReviewer ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageChange ( ) ; merge ( sc.changeId , sc.reviewer ) ; assertThat ( sender ) . sent ( "merged" , sc ) . to ( sc.owner ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) . noOneElse ( ) ; }
Source:
private java.lang.String getPullUrl ( ) { final java.util.List < com.jcraft.jsch.HostKey > hostKeys = sshInfo.getHostKeys ( ) ; if ( hostKeys.isEmpty ( ) ) { return "" ; } final java.lang.String host = hostKeys.get ( 0 ) . getHost ( ) ; final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "git pull ssh://" ) ; if ( host.startsWith ( "*:" ) ) { r.append ( getGerritHost ( ) ) ; r.append ( host.substring ( 1 ) ) ; } else { r.append ( host ) ; } r.append ( "/" ) ; r.append ( projectName ) ; r.append ( " " ) ; r.append ( patchSet.getRefName ( ) ) ; return r.toString ( ) ; }

Target:
private java.lang.String getPullUrl ( ) { final java.lang.String host = getSshHost ( ) ; if ( host == null ) { return "" ; } final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "git pull ssh://" ) ; r.append ( host ) ; r.append ( "/" ) ; r.append ( projectName ) ; r.append ( " " ) ; r.append ( patchSet.getRefName ( ) ) ; return r.toString ( ) ; }
Source:
private void openlink ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int colspan ) { m.openTd ( ) ; m.addStyleName ( com.google.gerrit.client.changes.S_DATA_CELL ) ; m.addStyleName ( "DiffLinkCell" ) ; m.setAttribute ( "colspan" , colspan ) ; }

Target:
private void emptycell ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int colspan ) { m.openTd ( ) ; m.addStyleName ( Gerrit.RESOURCES.css ( ) . dataCell ( ) ) ; m.addStyleName ( Gerrit.RESOURCES.css ( ) . diffLinkCell ( ) ) ; m.setAttribute ( "colspan" , colspan ) ; m.nbsp ( ) ; m.closeTd ( ) ; }
Source:
private java.lang.String deserializerFor ( com.google.gwt.core.ext.typeinfo.JArrayType targetType ) { final com.google.gwt.core.ext.typeinfo.JType componentType = targetType.getComponentType ( ) ; if ( com.google.gwtjsonrpc.rebind.SerializerCreator.isBoxedPrimitive ( componentType ) ) return ( ( ( com.google.gwtjsonrpc.client.PrimitiveArrayResultDeserializers.class . getCanonicalName ( ) ) + "." ) + ( componentType.getSimpleSourceName ( ) . toUpperCase ( ) ) ) + "_INSTANCE" ; final java.lang.String name = generatedDeserializers.get ( targetType.getQualifiedSourceName ( ) ) ; return name == null ? null : name + ".INSTANCE" ; }

Target:
private java.lang.String deserializerFor ( com.google.gwt.core.ext.typeinfo.JArrayType targetType ) { final com.google.gwt.core.ext.typeinfo.JType componentType = targetType.getComponentType ( ) ; if ( com.google.gwtjsonrpc.rebind.SerializerCreator.isBoxedPrimitive ( componentType ) ) return ( ( ( com.google.gwtjsonrpc.client.impl.ser.PrimitiveArrayResultDeserializers.class . getCanonicalName ( ) ) + "." ) + ( componentType.getSimpleSourceName ( ) . toUpperCase ( ) ) ) + "_INSTANCE" ; final java.lang.String name = generatedDeserializers.get ( targetType.getQualifiedSourceName ( ) ) ; return name == null ? null : name + ".INSTANCE" ; }
Source:
private < K , V > java.util.Map < K , V > limitToExistingPatchSets ( java.util.Map < K , V > in , final com.google.common.base.Function < K , com.google.gerrit.reviewdb.client.PatchSet.Id > func ) { return com.google.common.collect.Maps.filterKeys ( in , new com.google.common.base.Predicate < K > ( ) { @ java.lang.Override public boolean apply ( K in ) { return patchSets.containsKey ( func.apply ( in ) ) ; } } ) ; }

Target:
private < K , V > java.util.Map < K , V > limitToValidPatchSets ( java.util.Map < K , V > in , final com.google.common.base.Function < K , com.google.gerrit.reviewdb.client.PatchSet.Id > func ) { final com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.PatchSet.Id > upToCurrent = upToCurrentPredicate ( ) ; return com.google.common.collect.Maps.filterKeys ( in , new com.google.common.base.Predicate < K > ( ) { @ java.lang.Override public boolean apply ( K in ) { com.google.gerrit.reviewdb.client.PatchSet.Id psId = func.apply ( in ) ; return ( upToCurrent.apply ( psId ) ) && ( patchSets.containsKey ( psId ) ) ; } } ) ; }
Source:
public void groupNameNoteIsMissing ( ) throws java.lang.Exception { updateGroupNamesRef ( "g-2" , "[group]\n\tuuid = uuid-2\n\tname = g-2\n" ) ; java.util.List < com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo > problems = com.google.gerrit.server.group.db.GroupsNoteDbConsistencyChecker.checkWithGroupNameNotes ( allUsersRepo , "g-1" , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( "uuid-1" ) ) ; com.google.common.truth.Truth.assertThat ( problems ) . containsExactly ( com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo.warning ( "Group with name 'g-1' doesn't exist in the list of all names" ) ) ; }

Target:
public void groupNameNoteIsMissing ( ) throws java.lang.Exception { updateGroupNamesRef ( "g-2" , "[group]\n\tuuid = uuid-2\n\tname = g-2\n" ) ; java.util.List < com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo > problems = com.google.gerrit.server.group.db.GroupsNoteDbConsistencyChecker.checkWithGroupNameNotes ( allUsersRepo , new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( "g-1" ) , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( "uuid-1" ) ) ; com.google.common.truth.Truth.assertThat ( problems ) . containsExactly ( com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo.warning ( "Group with name 'g-1' doesn't exist in the list of all names" ) ) ; }
Source:
private boolean canEditTopicName ( ) { if ( getChange ( ) . getStatus ( ) . isOpen ( ) ) { return ( ( ( ( isOwner ( ) ) || ( getRefControl ( ) . isOwner ( ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ) || ( getRefControl ( ) . canEditTopicName ( ) ) ) || ( getProjectControl ( ) . isAdmin ( ) ) ; } return getRefControl ( ) . canForceEditTopicName ( ) ; }

Target:
private boolean canEditTopicName ( ) { if ( getChange ( ) . getStatus ( ) . isOpen ( ) ) { return ( ( ( ( isOwner ( ) ) || ( refControl.isOwner ( ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ) || ( refControl.canEditTopicName ( ) ) ) || ( getProjectControl ( ) . isAdmin ( ) ) ; } return refControl.canForceEditTopicName ( ) ; }
Source:
public void newPatchSetByOtherOnReviewableChangeNotifyOwnerInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%notify=OWNER" , other ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . to ( sc.reviewer , sc.ccer ) . notTo ( sc.owner , sc.starrer , other ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; }

Target:
public void newPatchSetOnReviewableWipChange ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%wip" , sc.owner ) ; assertThat ( sender ) . notSent ( ) ; }
Source:
private void grantApproveToChangeOwner ( ) throws java.lang.Exception { grantLabel ( ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) , ( - 2 ) , 2 , project , "refs/heads/*" , false , SystemGroupBackend.CHANGE_OWNER ) ; }

Target:
public void testChangeOwner_BlockedOnParentProject ( ) throws java.lang.Exception { setApiUser ( admin ) ; blockApproveForChangeOwner ( project ) ; com.google.gerrit.reviewdb.client.Project.NameKey child = createProject ( "child" , project ) ; setApiUser ( user ) ; grantApproveToAll ( child ) ; org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.InMemoryRepository > childRepo = cloneProject ( child , user ) ; java.lang.String changeId = createMyChange ( childRepo ) ; assertApproveFails ( user , changeId ) ; approve ( user2 , changeId ) ; }
Source:
public void testExecuteItem ( ) throws java.io.IOException { com.googlesource.gerrit.plugins.hooks.workflow.ActionRequest actionRequest = createMock ( com.googlesource.gerrit.plugins.hooks.workflow.ActionRequest.class ) ; org.easymock.EasyMock.expect ( actionRequest.getUnparsed ( ) ) . andReturn ( "unparsed action 1" ) ; its.performAction ( "4711" , "unparsed action 1" ) ; replayMocks ( ) ; com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor actionExecutor = createActionExecutor ( ) ; actionExecutor.execute ( "4711" , actionRequest ) ; }

Target:
public void testExecuteItem ( ) throws java.io.IOException { com.googlesource.gerrit.plugins.hooks.workflow.ActionRequest actionRequest = createMock ( com.googlesource.gerrit.plugins.hooks.workflow.ActionRequest.class ) ; org.easymock.EasyMock.expect ( actionRequest.getName ( ) ) . andReturn ( "unparsed" ) ; org.easymock.EasyMock.expect ( actionRequest.getUnparsed ( ) ) . andReturn ( "unparsed action 1" ) ; java.util.Set < com.googlesource.gerrit.plugins.hooks.workflow.Property > properties = java.util.Collections.emptySet ( ) ; its.performAction ( "4711" , "unparsed action 1" ) ; replayMocks ( ) ; com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor actionExecutor = createActionExecutor ( ) ; actionExecutor.execute ( "4711" , actionRequest , properties ) ; }
Source:
public com.google.gerrit.acceptance.RestResponse post ( java.lang.String endPoint , java.lang.Object content ) throws java.io.IOException { org.apache.http.client.fluent.Request post = org.apache.http.client.fluent.Request.Post ( ( ( ( url ) + "/a" ) + endPoint ) ) ; if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.body ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; } return execute ( post ) ; }

Target:
public com.google.gerrit.acceptance.RestResponse postWithHeader ( java.lang.String endPoint , java.lang.Object content , org.apache.http.Header header ) throws java.io.IOException { org.apache.http.client.fluent.Request post = org.apache.http.client.fluent.Request.Post ( getUrl ( endPoint ) ) ; if ( header != null ) { post.addHeader ( header ) ; } if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.body ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; } return execute ( post ) ; }
Source:
protected com.google.gerrit.acceptance.PushOneCommit.Result pushTo ( java.lang.String ref ) throws com.google.gerrit.acceptance.GitAPIException , java.io.IOException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) ) ; return push.to ( git , ref ) ; BRANCH ( 4 ) ; com.google.gerrit.acceptance.bc067 Show ; com.google.gerrit.acceptance.change status ; draft ( sets ) ; }

Target:
public void evaluate ( ) throws java.lang.Throwable { beforeTest ( description ) ; try { base.evaluate ( ) ; } finally { afterTest ( ) ; } }
Source:
public void shouldFailWithFilesWithoutPatchSetsOrCurrentPatchSetsOption ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; sshSession.exec ( ( "gerrit query --files " + changeId ) ) ; com.google.common.truth.Truth.assertThat ( sshSession.hasError ( ) ) . isTrue ( ) ; com.google.common.truth.Truth.assertThat ( sshSession.getError ( ) ) . contains ( "needs --patch-sets or --current-patch-set" ) ; }

Target:
public void shouldFailWithFilesWithoutPatchSetsOrCurrentPatchSetsOption ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; adminSshSession.exec ( ( "gerrit query --files " + changeId ) ) ; com.google.common.truth.Truth.assertThat ( adminSshSession.hasError ( ) ) . isTrue ( ) ; com.google.common.truth.Truth.assertThat ( adminSshSession.getError ( ) ) . contains ( "needs --patch-sets or --current-patch-set" ) ; }
Source:
public void testUnblockRangeForNotChangeOwner ( ) { com.google.gerrit.server.project.Util.grant ( local , ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) , ( - 2 ) , ( + 2 ) , com.google.gerrit.server.project.Util.CHANGE_OWNER , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.common.data.PermissionRange range = u.controlForRef ( "refs/heads/master" ) . getRange ( ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) ) ; org.junit.Assert.assertFalse ( "u can vote -2" , range.contains ( ( - 2 ) ) ) ; org.junit.Assert.assertFalse ( "u can vote +2" , range.contains ( 2 ) ) ; }

Target:
public void testUnblockRangeForNotChangeOwner ( ) { com.google.gerrit.server.project.Util.grant ( local , ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) , ( - 2 ) , ( + 2 ) , com.google.gerrit.server.group.SystemGroupBackend.CHANGE_OWNER , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.common.data.PermissionRange range = u.controlForRef ( "refs/heads/master" ) . getRange ( ( ( com.google.gerrit.common.data.Permission.LABEL ) + "Code-Review" ) ) ; org.junit.Assert.assertFalse ( "u can vote -2" , range.contains ( ( - 2 ) ) ) ; org.junit.Assert.assertFalse ( "u can vote +2" , range.contains ( 2 ) ) ; }
Source:
void onKeyDownInput ( com.google.gwt.event.dom.client.KeyDownEvent e ) { if ( ( e.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE ) ) { onCancel ( null ) ; } else if ( ( e.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { onSave ( null ) ; } }

Target:
void onKeyDownInput ( com.google.gwt.event.dom.client.KeyDownEvent e ) { if ( ( e.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE ) ) { onCancel ( null ) ; } else if ( ( e.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { e.stopPropagation ( ) ; onSave ( null ) ; } }
Source:
public static org.eclipse.jgit.transport.PushResult deleteRef ( org.eclipse.jgit.junit.TestRepository < ? > testRepo , java.lang.String ref ) throws org.eclipse.jgit.api.errors.GitAPIException { return com.google.gerrit.acceptance.GitUtil.pushOne ( testRepo , "" , ref , false , true , null ) ; }

Target:
public static org.eclipse.jgit.lib.Ref updateAnnotatedTag ( org.eclipse.jgit.junit.TestRepository < ? > testRepo , java.lang.String name , org.eclipse.jgit.lib.PersonIdent tagger ) throws org.eclipse.jgit.api.errors.GitAPIException { org.eclipse.jgit.api.TagCommand tc = testRepo.git ( ) . tag ( ) . setName ( name ) ; return tc.setAnnotated ( true ) . setMessage ( name ) . setTagger ( tagger ) . setForceUpdate ( true ) . call ( ) ; }
Source:
public static java.lang.String shortestExample ( java.lang.String pattern ) { if ( pattern.startsWith ( RefRight.REGEX_PREFIX ) ) { return com.google.gerrit.server.project.RefControl.toRegExp ( pattern ) . toAutomaton ( ) . getShortestExample ( true ) ; } else if ( pattern.endsWith ( "/*" ) ) { return ( pattern.substring ( 0 , ( ( pattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return pattern ; } }

Target:
public static java.lang.String shortestExample ( java.lang.String pattern ) { if ( com.google.gerrit.server.project.RefControl.isRE ( pattern ) ) { return com.google.gerrit.server.project.RefControl.toRegExp ( pattern ) . toAutomaton ( ) . getShortestExample ( true ) ; } else if ( pattern.endsWith ( "/*" ) ) { return ( pattern.substring ( 0 , ( ( pattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return pattern ; } }
Source:
void onDiscard ( com.google.gwt.event.dom.client.ClickEvent e ) { e.stopPropagation ( ) ; if ( isNew ( ) ) { removeUI ( ) ; } else { setEdit ( false ) ; com.google.gerrit.client.changes.CommentApi.deleteDraft ( psId , comment.id ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwt.core.client.JavaScriptObject > ( ) { @ java.lang.Override public void onSuccess ( com.google.gwt.core.client.JavaScriptObject result ) { removeUI ( ) ; } } ) ; } }

Target:
void onDiscard ( com.google.gwt.event.dom.client.ClickEvent e ) { e.stopPropagation ( ) ; if ( isNew ( ) ) { removeUI ( ) ; restoreSelection ( ) ; } else { setEdit ( false ) ; com.google.gerrit.client.changes.CommentApi.deleteDraft ( psId , comment.id ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwt.core.client.JavaScriptObject > ( ) { @ java.lang.Override public void onSuccess ( com.google.gwt.core.client.JavaScriptObject result ) { removeUI ( ) ; } } ) ; } }