auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static java.lang.String shortestExample ( java.lang.String refPattern ) { if ( com.google.gerrit.server.project.RefPattern.isRE ( refPattern ) ) { return com.google.gerrit.server.project.RefPattern.toRegExp ( refPattern ) . toAutomaton ( ) . getShortestExample ( true ) . replace ( '' , '-' ) ; } else if ( refPattern.endsWith ( "/*" ) ) { return ( refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return refPattern ; } }

Target:
public static java.lang.String shortestExample ( java.lang.String refPattern ) { if ( com.google.gerrit.server.project.RefPattern.isRE ( refPattern ) ) { try { return com.google.gerrit.server.project.RefPattern.exampleCache.get ( refPattern ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.common.base.Throwables.propagateIfPossible ( e.getCause ( ) ) ; throw new java.lang.RuntimeException ( e ) ; } } else if ( refPattern.endsWith ( "/*" ) ) { return ( refPattern.substring ( 0 , ( ( refPattern.length ( ) ) - 1 ) ) ) + '1' ; } else { return refPattern ; } }
Source:
private com.google.gerrit.acceptance.rest.change.ChangeInfo getChange ( java.lang.String changeId , boolean includeMessages ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = session.get ( ( ( "/changes/?q=" + changeId ) + ( includeMessages ? "&o=MESSAGES" : "" ) ) ) ; java.util.List < com.google.gerrit.acceptance.rest.change.ChangeInfo > c = new com.google.gson.Gson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.acceptance.rest.change.ChangeInfo > > ( ) { } . getType ( ) ) ; return c.get ( 0 ) ; }

Target:
private com.google.gerrit.server.change.ChangeJson.ChangeInfo getChange ( java.lang.String changeId , boolean includeMessages ) throws java.io.IOException { com.google.gerrit.acceptance.RestResponse r = session.get ( ( ( "/changes/?q=" + changeId ) + ( includeMessages ? "&o=MESSAGES" : "" ) ) ) ; java.util.List < com.google.gerrit.server.change.ChangeJson.ChangeInfo > c = newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.server.change.ChangeJson.ChangeInfo > > ( ) { } . getType ( ) ) ; return c.get ( 0 ) ; }
Source:
private void writeFile ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { res.setStatus ( HttpServletResponse.SC_NO_CONTENT ) ; java.io.InputStream in = req.getInputStream ( ) ; java.io.OutputStream out = new java.io.FileOutputStream ( configFile ( req ) ) ; try { com.google.common.io.ByteStreams.copy ( in , out ) ; } finally { out.close ( ) ; } }

Target:
private void streamRequestToFile ( javax.servlet.http.HttpServletRequest req , java.io.File file ) throws java.io.FileNotFoundException , java.io.IOException { java.io.InputStream in = req.getInputStream ( ) ; java.io.OutputStream out = new java.io.FileOutputStream ( file ) ; try { com.google.common.io.ByteStreams.copy ( in , out ) ; } finally { out.close ( ) ; } }
Source:
public void fire ( com.google.gerrit.extensions.common.ChangeInfo change , com.google.gerrit.extensions.common.ChangeInfo revertChange ) { if ( ! ( listeners.iterator ( ) . hasNext ( ) ) ) { return ; } com.google.gerrit.server.extensions.events.ChangeReverted.Event event = new com.google.gerrit.server.extensions.events.ChangeReverted.Event ( change , revertChange ) ; for ( com.google.gerrit.extensions.events.ChangeRevertedListener l : listeners ) { try { l.onChangeReverted ( event ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.extensions.events.ChangeReverted.log.warn ( "Error in event listener" , e ) ; } } }

Target:
public void fire ( com.google.gerrit.extensions.common.ChangeInfo change , com.google.gerrit.extensions.common.ChangeInfo revertChange , java.sql.Timestamp when ) { if ( ! ( listeners.iterator ( ) . hasNext ( ) ) ) { return ; } com.google.gerrit.server.extensions.events.ChangeReverted.Event event = new com.google.gerrit.server.extensions.events.ChangeReverted.Event ( change , revertChange , when ) ; for ( com.google.gerrit.extensions.events.ChangeRevertedListener l : listeners ) { try { l.onChangeReverted ( event ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.extensions.events.ChangeReverted.log.warn ( "Error in event listener" , e ) ; } } }
Source:
public static PermissionRange.WithDefaults getRange ( java.lang.String varName ) { if ( com.google.gerrit.common.data.GlobalCapability.QUERY_LIMIT.equalsIgnoreCase ( varName ) ) { return new com.google.gerrit.common.data.PermissionRange.WithDefaults ( varName , 0 , java.lang.Integer.MAX_VALUE , 0 , com.google.gerrit.common.data.GlobalCapability.DEFAULT_MAX_QUERY_LIMIT ) ; } return null ; }

Target:
public static PermissionRange.WithDefaults getRange ( java.lang.String varName ) { if ( com.google.gerrit.common.data.GlobalCapability.QUERY_LIMIT.equalsIgnoreCase ( varName ) ) { return new com.google.gerrit.common.data.PermissionRange.WithDefaults ( varName , 0 , java.lang.Integer.MAX_VALUE , 0 , com.google.gerrit.common.data.GlobalCapability.DEFAULT_MAX_QUERY_LIMIT ) ; } if ( com.google.gerrit.common.data.GlobalCapability.BATCH_CHANGES_LIMIT.equalsIgnoreCase ( varName ) ) { return new com.google.gerrit.common.data.PermissionRange.WithDefaults ( varName , 0 , java.lang.Integer.MAX_VALUE , 0 , com.google.gerrit.common.data.GlobalCapability.DEFAULT_MAX_BATCH_CHANGES ) ; } return null ; }
Source:
private boolean canRebase ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { return ( ( ( isOwner ( ) ) || ( getRefControl ( ) . canSubmit ( isOwner ( ) ) ) ) || ( getRefControl ( ) . canRebase ( ) ) ) && ( ! ( isPatchSetLocked ( db ) ) ) ; }

Target:
private boolean canRebase ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { return ( ( ( ( isOwner ( ) ) || ( getRefControl ( ) . canSubmit ( isOwner ( ) ) ) ) || ( getRefControl ( ) . canRebase ( ) ) ) && ( refControl.asForRef ( ) . testOrFalse ( RefPermission.CREATE_CHANGE ) ) ) && ( ! ( isPatchSetLocked ( db ) ) ) ; }
Source:
private static void jar ( java.io.File jar , java.io.File classes ) throws java.io.IOException { java.io.File tmp = java.io.File.createTempFile ( "prolog" , ".jar" , BuckPrologCompiler.tmpdir ) ; try { try ( java.util.jar.JarOutputStream out = new java.util.jar.JarOutputStream ( new java.io.FileOutputStream ( tmp ) ) ) { BuckPrologCompiler.add ( out , classes , "" ) ; } if ( ! ( tmp.renameTo ( jar ) ) ) { throw new java.io.IOException ( ( "Cannot create " + jar ) ) ; } } finally { tmp.delete ( ) ; } }

Target:
private static void jar ( java.io.File jar , java.io.File classes ) throws java.io.IOException { java.io.File tmp = java.io.File.createTempFile ( "prolog" , ".jar" , BuckPrologCompiler.tmpdir ) ; try { try ( java.util.jar.JarOutputStream out = new java.util.jar.JarOutputStream ( java.nio.file.Files.newOutputStream ( tmp.toPath ( ) ) ) ) { BuckPrologCompiler.add ( out , classes , "" ) ; } if ( ! ( tmp.renameTo ( jar ) ) ) { throw new java.io.IOException ( ( "Cannot create " + jar ) ) ; } } finally { tmp.delete ( ) ; } }
Source:
public void onSuccess ( com.google.gerrit.client.changes.CommentInfo result ) { enableEdit ( true ) ; set ( result ) ; if ( ( result.message ( ) . length ( ) ) < 70 ) { com.google.gwt.user.client.ui.UIObject.setVisible ( p_edit , false ) ; setOpen ( false ) ; } else { setEdit ( false ) ; } }

Target:
public void onSuccess ( com.google.gerrit.client.changes.CommentInfo result ) { enableEdit ( true ) ; set ( result ) ; setEdit ( false ) ; if ( autoClosed ) { setOpen ( false ) ; } }
Source:
public final java.lang.String getCommand ( com.google.gerrit.extensions.config.DownloadScheme scheme , java.lang.String project , java.lang.String ref ) { if ( ( commandAllowed ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isRecognizedScheme ( scheme ) ) ) { java.lang.String url = scheme.getUrl ( project ) ; if ( url != null ) { return getCommand ( url , ref ) ; } } return null ; }

Target:
public final java.lang.String getCommand ( com.google.gerrit.extensions.config.DownloadScheme scheme , java.lang.String project , java.lang.String ref ) { if ( ( commandAllowed ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isRecognizedScheme ( scheme ) ) ) { java.lang.String url = scheme.getUrl ( project ) ; if ( ( url != null ) && ( com.googlesource.gerrit.plugins.download.command.GitDownloadCommand.isValidUrl ( url ) ) ) { return getCommand ( url , ref ) ; } } return null ; }
Source:
void resizePaddingWidget ( ) { paddingWidgetEle.getStyle ( ) . setHeight ( getOffsetHeight ( ) , Unit.PX ) ; }

Target:
void resizePaddingWidget ( ) { com.google.gwt.core.client.Scheduler.get ( ) . scheduleDeferred ( new com.google.gwt.core.client.Scheduler.ScheduledCommand ( ) { @ java.lang.Override public void execute ( ) { paddingWidgetEle.getStyle ( ) . setHeight ( getOffsetHeight ( ) , Unit.PX ) ; paddingWidget.changed ( ) ; selfWidget.changed ( ) ; } } ) ; }
Source:
static java.lang.String get ( java.lang.String refName ) { if ( ( refName.startsWith ( org.eclipse.jgit.lib.Constants.R_HEADS ) ) || ( refName.startsWith ( org.eclipse.jgit.lib.Constants.R_TAGS ) ) ) { return java.lang.String.format ( "%s-%s" , ( ( com.googlesource.gerrit.plugins.refprotection.BackupRef.R_BACKUPS ) + ( refName.replaceFirst ( org.eclipse.jgit.lib.Constants.R_REFS , "" ) ) ) , new java.text.SimpleDateFormat ( "YYYYMMdd-HHmmss" ) . format ( new java.util.Date ( ) ) ) ; } return refName ; }

Target:
private static java.lang.String getTimestampBranch ( java.lang.String refName ) { if ( ( refName.startsWith ( org.eclipse.jgit.lib.Constants.R_HEADS ) ) || ( refName.startsWith ( org.eclipse.jgit.lib.Constants.R_TAGS ) ) ) { return java.lang.String.format ( "%s-%s" , ( ( com.googlesource.gerrit.plugins.refprotection.BackupRef.R_BACKUPS ) + ( refName.replaceFirst ( org.eclipse.jgit.lib.Constants.R_REFS , "" ) ) ) , new java.text.SimpleDateFormat ( "YYYYMMdd-HHmmss" ) . format ( new java.util.Date ( ) ) ) ; } return refName ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.ssh.Sshd.class ) . toProvider ( sshInjector.getProvider ( com.google.gerrit.server.ssh.Sshd.class ) ) ; bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; install ( com.google.gerrit.server.GerritServletConfig.createServletModule ( ) ) ; install ( new com.google.gerrit.server.rpc.UiRpcModule ( ) ) ; factory ( RegisterNewEmailSender.Factory.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.ssh.SshInfo.class ) . toProvider ( sshInjector.getProvider ( com.google.gerrit.server.ssh.SshInfo.class ) ) ; bind ( com.google.gerrit.client.data.GerritConfig.class ) . toProvider ( com.google.gerrit.server.config.GerritConfigProvider.class ) . in ( com.google.inject.Scopes.SINGLETON ) ; install ( com.google.gerrit.server.GerritServletConfig.createServletModule ( ) ) ; install ( new com.google.gerrit.server.rpc.UiRpcModule ( ) ) ; factory ( RegisterNewEmailSender.Factory.class ) ; }
Source:
public static com.google.gerrit.extensions.client.GeneralPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo p = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; p.changesPerPage = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE ; p.showSiteHeader = true ; p.useFlashClipboard = true ; p.emailStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ; p.reviewCategoryStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy.NONE ; p.downloadScheme = null ; p.downloadCommand = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand.CHECKOUT ; p.dateFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat.STD ; p.timeFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat.HHMM_12 ; p.relativeDateInChangeTable = false ; p.diffView = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ; p.sizeBarInChangeTable = true ; p.legacycidInChangeTable = false ; p.muteCommonPathPrefixes = true ; p.signedOffBy = false ; p.defaultBaseForMerges = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DefaultBase.FIRST_PARENT ; return p ; }

Target:
public static com.google.gerrit.extensions.client.GeneralPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo p = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; p.changesPerPage = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE ; p.showSiteHeader = true ; p.useFlashClipboard = true ; p.emailStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ; p.reviewCategoryStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy.NONE ; p.downloadScheme = null ; p.downloadCommand = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand.CHECKOUT ; p.dateFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat.STD ; p.timeFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat.HHMM_12 ; p.highlightAssigneeInChangeTable = true ; p.relativeDateInChangeTable = false ; p.diffView = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ; p.sizeBarInChangeTable = true ; p.legacycidInChangeTable = false ; p.muteCommonPathPrefixes = true ; p.signedOffBy = false ; p.defaultBaseForMerges = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DefaultBase.FIRST_PARENT ; return p ; }
Source:
private void refresh ( ) { final java.lang.String mySubname = subname ; com.google.gerrit.client.projects.ProjectMap.match ( subname , new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.projects.ProjectMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.projects.ProjectMap result ) { if ( ( ( mySubname == null ) && ( ( subname ) == null ) ) || ( ( mySubname != null ) && ( mySubname.equals ( subname ) ) ) ) { projects.display ( result ) ; } } } ) ; }

Target:
private void refresh ( ) { com.google.gerrit.client.projects.ProjectMap.match ( subname , new com.google.gerrit.client.ui.IgnoreOutdatedFilterResultsCallbackWrapper < com.google.gerrit.client.projects.ProjectMap > ( this , new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.projects.ProjectMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.projects.ProjectMap result ) { projects.display ( result ) ; } } ) ) ; }
Source:
public void createChangeWithPrivateByDefaultEnabled ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInput input = new com.google.gerrit.extensions.common.ChangeInput ( project.get ( ) , "master" , "empty change" ) ; com.google.common.truth.Truth.assertThat ( gApi.changes ( ) . create ( input ) . get ( ) . isPrivate ) . isEqualTo ( true ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { project1 = createProject ( "project-1" ) ; project2 = createProject ( "project-2" , project1 ) ; setPrivateByDefault ( project1 , InheritableBoolean.FALSE ) ; }
Source:
public com.google.gerrit.server.data.AccountAttribute asAccountAttribute ( com.google.gerrit.server.account.AccountState accountState ) { if ( accountState == null ) { return null ; } com.google.gerrit.server.data.AccountAttribute who = new com.google.gerrit.server.data.AccountAttribute ( ) ; who.name = accountState.getAccount ( ) . getFullName ( ) ; who.email = accountState.getAccount ( ) . getPreferredEmail ( ) ; who.username = accountState.getUserName ( ) ; return who ; }

Target:
public com.google.gerrit.server.data.AccountAttribute asAccountAttribute ( com.google.gerrit.server.account.AccountState accountState ) { if ( accountState == null ) { return null ; } com.google.gerrit.server.data.AccountAttribute who = new com.google.gerrit.server.data.AccountAttribute ( ) ; who.name = accountState.getAccount ( ) . getFullName ( ) ; who.email = accountState.getAccount ( ) . getPreferredEmail ( ) ; who.username = accountState.getUserName ( ) . orElse ( null ) ; return who ; }
Source:
public void run ( ) { int height = ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - ( ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + 18 ) ; cmA.setHeight ( height ) ; cmB.setHeight ( height ) ; render ( diff ) ; commentManager.render ( comments ) ; if ( prefs.expandAllComments ( ) ) { commentManager.setExpandAllComments ( true ) ; } renderSkips ( prefs.context ( ) ) ; }

Target:
public void run ( ) { int height = ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - ( ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + 18 ) ; cmA.setHeight ( height ) ; cmB.setHeight ( height ) ; render ( diff ) ; commentManager.render ( comments ) ; if ( prefs.expandAllComments ( ) ) { commentManager.setExpandAllComments ( true ) ; } skipManager.render ( prefs.context ( ) , diff ) ; }
Source:
private java.lang.String healthCheckSysinfo ( ) throws java.io.IOException { com.atlassian.jira.rest.client.api.domain.ServerInfo info = client ( ) . sysInfo ( ) ; final java.lang.String result = ( ( ( ( ( "{\"status\"=\"ok\",\"system\"=\"Jira\",\"version\"=\"" + ( info.getVersion ( ) ) ) + "\",\"url\"=\"" ) + ( getUrl ( ) ) ) + "\",\"build\"=\"" ) + ( info.getBuildNumber ( ) ) ) + "\"}" ; log.debug ( "Healtheck on sysinfo result: {}" , result ) ; return result ; }

Target:
private java.lang.String healthCheckSysinfo ( ) throws java.io.IOException { com.googlesource.gerrit.plugins.its.jira.restapi.JiraServerInfo info = client ( ) . sysInfo ( ) ; final java.lang.String result = ( ( ( ( ( "{\"status\"=\"ok\",\"system\"=\"Jira\",\"version\"=\"" + ( info.getVersion ( ) ) ) + "\",\"url\"=\"" ) + ( getUrl ( ) ) ) + "\",\"build\"=\"" ) + ( info.getBuildNumber ( ) ) ) + "\"}" ; log.debug ( "Healtheck on sysinfo result: {}" , result ) ; return result ; }
Source:
private static boolean isChangeScreen2 ( ) { com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen ui = null ; if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { ui = com.google.gerrit.client.Gerrit.getUserAccount ( ) . getGeneralPreferences ( ) . getChangeScreen ( ) ; } if ( ui == null ) { ui = com.google.gerrit.client.Gerrit.getConfig ( ) . getChangeScreen ( ) ; } return ui == ( com.google.gerrit.client.changes.ChangeScreen.CHANGE_SCREEN2 ) ; }

Target:
private static boolean isChangeScreen2 ( ) { if ( com.google.gerrit.client.Dispatcher.changeScreen2 ) { return true ; } com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen ui = null ; if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { ui = com.google.gerrit.client.Gerrit.getUserAccount ( ) . getGeneralPreferences ( ) . getChangeScreen ( ) ; } if ( ui == null ) { ui = com.google.gerrit.client.Gerrit.getConfig ( ) . getChangeScreen ( ) ; } return ui == ( com.google.gerrit.client.changes.ChangeScreen.CHANGE_SCREEN2 ) ; }
Source:
public java.lang.String getSqlType ( final com.google.gwtorm.schema.ColumnModel column ) { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "CHAR(1)" ) ; r.append ( " DEFAULT ' '" ) ; r.append ( " NOT NULL" ) ; return r.toString ( ) ; }

Target:
public java.lang.String getSqlType ( final com.google.gwtorm.schema.ColumnModel column , final com.google.gwtorm.schema.sql.SqlDialect dialect ) { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "CHAR(1)" ) ; r.append ( " DEFAULT ' '" ) ; r.append ( " NOT NULL" ) ; return r.toString ( ) ; }
Source:
public void run ( ) { if ( cm.hasActiveLine ( ) ) { com.google.gerrit.client.diff.CommentGroup w = map ( cm.side ( ) ) . get ( ( ( cm.getLineNumber ( cm.getActiveLine ( ) ) ) + 1 ) ) ; if ( w != null ) { w.openCloseLast ( ) ; } } }

Target:
public void run ( ) { if ( cm.hasActiveLine ( ) ) { com.google.gerrit.client.diff.CommentGroup w = map ( cm.side ( ) ) . get ( ( ( cm.getLineNumber ( cm.activeLine ( ) ) ) + 1 ) ) ; if ( w != null ) { w.openCloseLast ( ) ; } } }
Source:
private com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Change.Id > getChangesByProject ( ) throws com.google.gwtorm.server.OrmException { com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Change.Id > changesByProject = com.google.common.collect.ArrayListMultimap.create ( ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { for ( com.google.gerrit.reviewdb.client.Change c : com.google.gerrit.pgm.RebuildNotedb.unwrap ( db ) . changes ( ) . all ( ) ) { changesByProject.put ( c.getProject ( ) , c.getId ( ) ) ; } return changesByProject ; } }

Target:
private com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Change.Id > getChangesByProject ( ) throws com.google.gwtorm.server.OrmException { com.google.common.collect.Multimap < com.google.gerrit.reviewdb.client.Project.NameKey , com.google.gerrit.reviewdb.client.Change.Id > changesByProject = com.google.common.collect.ArrayListMultimap.create ( ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { for ( com.google.gerrit.reviewdb.client.Change c : com.google.gerrit.pgm.RebuildNoteDb.unwrap ( db ) . changes ( ) . all ( ) ) { changesByProject.put ( c.getProject ( ) , c.getId ( ) ) ; } return changesByProject ; } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.index.ChangeIndexer.class ) . to ( com.google.gerrit.server.index.ChangeIndexerImpl.class ) ; bind ( com.google.gerrit.server.query.change.IndexRewrite.class ) . to ( com.google.gerrit.server.query.change.IndexRewriteImpl.class ) ; bind ( com.google.gerrit.server.index.IndexCollection.class ) ; listener ( ) . to ( com.google.gerrit.server.index.IndexCollection.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.query.change.ChangeQueryRewriter.class ) . to ( com.google.gerrit.server.index.IndexRewriteImpl.class ) ; bind ( IndexRewriteImpl.BasicRewritesImpl.class ) ; bind ( com.google.gerrit.server.index.IndexCollection.class ) ; listener ( ) . to ( com.google.gerrit.server.index.IndexCollection.class ) ; install ( new com.google.inject.assistedinject.FactoryModuleBuilder ( ) . implement ( com.google.gerrit.server.index.ChangeIndexer.class , com.google.gerrit.server.index.ChangeIndexerImpl.class ) . build ( ChangeIndexer.Factory.class ) ) ; }
Source:
public void testIsEnabledEventMultiBranchMixedMatchRegExp ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "refs/heads/foo" , "^refs/heads/test.*" } ; setupIsEnabled ( "true" , null , branches ) ; com.google.gerrit.server.events.PatchSetCreatedEvent event = new com.google.gerrit.server.events.PatchSetCreatedEvent ( ) ; event.change = new com.google.gerrit.server.data.ChangeAttribute ( ) ; event.change.project = "testProject" ; event.change.branch = "testBranch" ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertTrue ( itsConfig.isEnabled ( event ) ) ; }

Target:
public void testIsEnabledEventMultiBranchRegExp ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/foo.*" , "^refs/heads/test.*" } ; setupIsEnabled ( "true" , null , branches ) ; com.google.gerrit.server.events.PatchSetCreatedEvent event = new com.google.gerrit.server.events.PatchSetCreatedEvent ( ) ; com.google.gerrit.server.data.ChangeAttribute changeAttribute = new com.google.gerrit.server.data.ChangeAttribute ( ) ; changeAttribute.project = "testProject" ; changeAttribute.branch = "testBranch" ; event.change = com.google.common.base.Suppliers.ofInstance ( changeAttribute ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertTrue ( itsConfig.isEnabled ( event ) ) ; }
Source:
public void run ( ) { try { for ( com.google.gerrit.reviewdb.client.Project.NameKey nameKey : projectCache.all ( ) ) { if ( filter.matches ( nameKey ) ) { replication.scheduleFullSync ( nameKey , urlMatch , state ) ; } } } catch ( java.lang.Exception e ) { com.googlesource.gerrit.plugins.replication.PushAll.stateLog.error ( "Cannot enumerate known projects" , e , state ) ; } state.markAllPushTasksScheduled ( ) ; }

Target:
public void run ( ) { try { for ( com.google.gerrit.reviewdb.client.Project.NameKey nameKey : projectCache.all ( ) ) { if ( filter.matches ( nameKey ) ) { replication.scheduleFullSync ( nameKey , urlMatch , state ) ; } } } catch ( java.lang.Exception e ) { stateLog.error ( "Cannot enumerate known projects" , e , state ) ; } state.markAllPushTasksScheduled ( ) ; }
Source:
private synchronized void processPendingCleanups ( ) { com.google.gerrit.server.plugins.CleanupHandle h ; while ( ( h = ( ( com.google.gerrit.server.plugins.CleanupHandle ) ( cleanupQueue.poll ( ) ) ) ) != null ) { h.cleanup ( ) ; cleanupHandles.remove ( h ) ; } }

Target:
synchronized int processPendingCleanups ( ) { com.google.gerrit.server.plugins.CleanupHandle h ; while ( ( h = ( ( com.google.gerrit.server.plugins.CleanupHandle ) ( cleanupQueue.poll ( ) ) ) ) != null ) { h.cleanup ( ) ; cleanupHandles.remove ( h ) ; } return java.lang.Math.max ( 0 , ( ( cleanupHandles.size ( ) ) - ( running.size ( ) ) ) ) ; }
Source:
public void parsePatchSetId ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-Set: 1\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + "\n" ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Patch-Set: 1\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-Set: 1\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( "\n" + "Patch-Set: x\n" ) ) ) ; }

Target:
public void parsePatchSetId ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-set: 1\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + "\n" ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-set: 1\n" ) + "Patch-set: 1\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-set: 1\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( "\n" + "Patch-set: x\n" ) ) ) ; }
Source:
public void run ( ) throws java.lang.Exception { parseCommandLine ( ) ; try { performCreateGroupFactory.create ( ) . createGroup ( groupName , groupDescription , visibleToAll , ownerGroupId , initialMembers , initialGroups ) ; } catch ( com.google.gerrit.common.errors.PermissionDeniedException e ) { throw die ( e ) ; } catch ( com.google.gerrit.common.errors.NameAlreadyUsedException e ) { throw die ( e ) ; } }

Target:
protected void run ( ) throws com.google.gerrit.sshd.commands.Failure , com.google.gwtorm.server.OrmException { try { performCreateGroupFactory.create ( ) . createGroup ( groupName , groupDescription , visibleToAll , ownerGroupId , initialMembers , initialGroups ) ; } catch ( com.google.gerrit.common.errors.PermissionDeniedException e ) { throw die ( e ) ; } catch ( com.google.gerrit.common.errors.NameAlreadyUsedException e ) { throw die ( e ) ; } }
Source:
protected boolean shouldSendMessage ( ) { if ( ( body.length ( ) ) == 0 ) { return false ; } HEAD ( 7.0F ) ; }

Target:
protected boolean shouldSendMessage ( ) { if ( ( body.length ( ) ) == 0 ) { return false ; } if ( smtpRcptTo.isEmpty ( ) ) { return false ; } if ( ( ( ( smtpRcptTo.size ( ) ) == 1 ) && ( ( rcptTo.size ( ) ) == 1 ) ) && ( rcptTo.contains ( fromId ) ) ) { return false ; } return true ; }
Source:
private java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > addCcs ( com.google.gerrit.server.notedb.ChangeUpdate update , java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > wantCCs , com.google.gerrit.server.ReviewerSet existingReviewers ) { java.util.Set < com.google.gerrit.reviewdb.client.Account.Id > need = new java.util.LinkedHashSet ( wantCCs ) ; need.removeAll ( existingReviewers.all ( ) ) ; for ( com.google.gerrit.reviewdb.client.Account.Id account : need ) { update.putReviewer ( account , com.google.gerrit.server.notedb.ReviewerStateInternal.CC ) ; } return need ; }

Target:
private java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > addCcs ( com.google.gerrit.server.notedb.ChangeUpdate update , java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > wantCCs , com.google.gerrit.server.ReviewerSet existingReviewers ) { java.util.Set < com.google.gerrit.reviewdb.client.Account.Id > need = new java.util.LinkedHashSet ( wantCCs ) ; need.removeAll ( existingReviewers.all ( ) ) ; need.removeAll ( update.getReviewers ( ) . keySet ( ) ) ; for ( com.google.gerrit.reviewdb.client.Account.Id account : need ) { update.putReviewer ( account , com.google.gerrit.server.notedb.ReviewerStateInternal.CC ) ; } return need ; }
Source:
com.google.gerrit.server.notedb.ChangeNotes createWithAutoRebuildingDisabled ( com.google.gerrit.reviewdb.client.Change change ) throws com.google.gwtorm.server.OrmException { return new com.google.gerrit.server.notedb.ChangeNotes ( args , change.getProject ( ) , change , false ) . load ( ) ; }

Target:
private com.google.gerrit.server.notedb.ChangeNotes createFromChangeOnlyWhenNoteDbDisabled ( com.google.gerrit.reviewdb.client.Change change ) throws com.google.gwtorm.server.OrmException { com.google.common.base.Preconditions.checkState ( ( ! ( args.migration.readChanges ( ) ) ) , ( "do not call" + " createFromChangeWhenNoteDbDisabled when NoteDb is enabled" ) ) ; return new com.google.gerrit.server.notedb.ChangeNotes ( args , change.getProject ( ) , change ) . load ( ) ; }
Source:
public void setSearchIndex ( com.google.gerrit.server.index.ChangeIndex index ) { com.google.gerrit.server.index.ChangeIndex old = searchIndex.getAndSet ( index ) ; if ( ( ( old != null ) && ( old != index ) ) && ( ! ( writeIndexes.contains ( old ) ) ) ) { old.close ( ) ; } }

Target:
public void setSearchIndex ( com.google.gerrit.server.index.change.ChangeIndex index ) { com.google.gerrit.server.index.change.ChangeIndex old = searchIndex.getAndSet ( index ) ; if ( ( ( old != null ) && ( old != index ) ) && ( ! ( writeIndexes.contains ( old ) ) ) ) { old.close ( ) ; } }
Source:
public com.google.gerrit.server.update.BatchUpdate insertChange ( com.google.gerrit.server.update.BatchUpdate.InsertChangeOp op ) { com.google.gerrit.server.update.BatchUpdate.ContextImpl ctx = new com.google.gerrit.server.update.BatchUpdate.ContextImpl ( ) ; com.google.gerrit.reviewdb.client.Change c = op.createChange ( ctx ) ; com.google.common.base.Preconditions.checkArgument ( ( ! ( newChanges.containsKey ( c.getId ( ) ) ) ) , "only one op allowed to create change %s" , c.getId ( ) ) ; newChanges.put ( c.getId ( ) , c ) ; ops.get ( c.getId ( ) ) . add ( 0 , op ) ; return this ; }

Target:
public com.google.gerrit.server.update.BatchUpdate insertChange ( com.google.gerrit.server.update.InsertChangeOp op ) { com.google.gerrit.server.update.BatchUpdate.ContextImpl ctx = new com.google.gerrit.server.update.BatchUpdate.ContextImpl ( ) ; com.google.gerrit.reviewdb.client.Change c = op.createChange ( ctx ) ; com.google.common.base.Preconditions.checkArgument ( ( ! ( newChanges.containsKey ( c.getId ( ) ) ) ) , "only one op allowed to create change %s" , c.getId ( ) ) ; newChanges.put ( c.getId ( ) , c ) ; ops.get ( c.getId ( ) ) . add ( 0 , op ) ; return this ; }
Source:
public int compare ( com.google.gerrit.client.changes.ChangeInfo a , com.google.gerrit.client.changes.ChangeInfo b ) { int cmp = a.created ( ) . compareTo ( b.created ( ) ) ; if ( cmp != 0 ) { return cmp ; } return ( a._number ( ) ) - ( b._number ( ) ) ; }

Target:
public int compare ( com.google.gerrit.client.info.ChangeInfo a , com.google.gerrit.client.info.ChangeInfo b ) { int cmp = a.created ( ) . compareTo ( b.created ( ) ) ; if ( cmp != 0 ) { return cmp ; } return ( a._number ( ) ) - ( b._number ( ) ) ; }
Source:
public void validatePreMerge ( org.eclipse.jgit.lib.Repository repo , com.google.gerrit.server.git.CodeReviewCommit commit , com.google.gerrit.server.project.ProjectState destProject , com.google.gerrit.reviewdb.client.Branch.NameKey destBranch , com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId , com.google.gerrit.server.IdentifiedUser caller ) throws com.google.gerrit.server.git.validators.MergeValidationException { java.util.List < com.google.gerrit.server.git.validators.MergeValidationListener > validators = new java.util.LinkedList < > ( ) ; validators.add ( new com.google.gerrit.server.git.validators.MergeValidators.PluginMergeValidationListener ( mergeValidationListeners ) ) ; validators.add ( projectConfigValidatorFactory.create ( ) ) ; for ( com.google.gerrit.server.git.validators.MergeValidationListener validator : validators ) { validator.onPreMerge ( repo , commit , destProject , destBranch , patchSetId , caller ) ; } }

Target:
public void validatePreMerge ( org.eclipse.jgit.lib.Repository repo , com.google.gerrit.server.git.CodeReviewCommit commit , com.google.gerrit.server.project.ProjectState destProject , com.google.gerrit.reviewdb.client.Branch.NameKey destBranch , com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId , com.google.gerrit.server.IdentifiedUser caller ) throws com.google.gerrit.server.git.validators.MergeValidationException { java.util.List < com.google.gerrit.server.git.validators.MergeValidationListener > validators = com.google.common.collect.ImmutableList.of ( new com.google.gerrit.server.git.validators.MergeValidators.PluginMergeValidationListener ( mergeValidationListeners ) , projectConfigValidatorFactory.create ( ) ) ; for ( com.google.gerrit.server.git.validators.MergeValidationListener validator : validators ) { validator.onPreMerge ( repo , commit , destProject , destBranch , patchSetId , caller ) ; } }
Source:
private java.lang.String createChange ( com.google.gerrit.extensions.client.ChangeKind kind ) throws java.lang.Exception { switch ( kind ) { case com.google.gerrit.extensions.client.ChangeKind.NO_CODE_CHANGE : case com.google.gerrit.extensions.client.ChangeKind.REWORK : case com.google.gerrit.extensions.client.ChangeKind.TRIVIAL_REBASE : case NO_CHANGE : return createChange ( ) . getChangeId ( ) ; case com.google.gerrit.extensions.client.ChangeKind.MERGE_FIRST_PARENT_UPDATE : return createChangeForMergeCommit ( ) ; default : throw new java.lang.IllegalStateException ( ( "unexpected change kind: " + kind ) ) ; } }

Target:
private java.lang.String createChange ( com.google.gerrit.extensions.client.ChangeKind kind ) throws java.lang.Exception { switch ( kind ) { case com.google.gerrit.extensions.client.ChangeKind.NO_CODE_CHANGE : case com.google.gerrit.extensions.client.ChangeKind.REWORK : case com.google.gerrit.extensions.client.ChangeKind.TRIVIAL_REBASE : case com.google.gerrit.extensions.client.ChangeKind.NO_CHANGE : return createChange ( ) . getChangeId ( ) ; case com.google.gerrit.extensions.client.ChangeKind.MERGE_FIRST_PARENT_UPDATE : return createChangeForMergeCommit ( ) ; default : throw new java.lang.IllegalStateException ( ( "unexpected change kind: " + kind ) ) ; } }
Source:
public static java.lang.String name ( final com.google.gerrit.common.data.AccountInfo ai ) { if ( ( ai.getFullName ( ) ) != null ) { return ai.getFullName ( ) ; } if ( ( ai.getPreferredEmail ( ) ) != null ) { return ai.getPreferredEmail ( ) ; } return com.google.gerrit.client.FormatUtil.nameEmail ( ai ) ; }

Target:
public static java.lang.String name ( com.google.gerrit.client.changes.AccountInfo ai ) { if ( ( ai.name ( ) ) != null ) { return ai.name ( ) ; } java.lang.String email = ai.email ( ) ; if ( email != null ) { int at = email.indexOf ( '@' ) ; return 0 < at ? email.substring ( 0 , at ) : email ; } return com.google.gerrit.client.FormatUtil.nameEmail ( ai ) ; }
Source:
private static boolean isTag ( final org.eclipse.jgit.transport.ReceiveCommand cmd ) { return cmd.getRefName ( ) . startsWith ( Constants.R_TAGS ) ; }

Target:
private void parseCommands ( final java.util.Collection < org.eclipse.jgit.transport.ReceiveCommand > commands ) { for ( final org.eclipse.jgit.transport.ReceiveCommand cmd : commands ) { if ( ( cmd.getResult ( ) ) != ( org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED ) ) { continue ; } if ( ( ! ( org.eclipse.jgit.lib.Repository.isValidRefName ( cmd.getRefName ( ) ) ) ) || ( cmd.getRefName ( ) . contains ( "//" ) ) ) { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd , "not valid ref" ) ; continue ; } if ( cmd.getRefName ( ) . startsWith ( com.google.gerrit.server.git.ReceiveCommits.NEW_CHANGE ) ) { parseNewChangeCommand ( cmd ) ; continue ; } final java.util.regex.Matcher m = com.google.gerrit.server.git.ReceiveCommits.NEW_PATCHSET.matcher ( cmd.getRefName ( ) ) ; if ( m.matches ( ) ) { final com.google.gerrit.reviewdb.Change.Id changeId = Change.Id.parse ( m.group ( 1 ) ) ; parseReplaceCommand ( cmd , changeId ) ; continue ; } switch ( cmd.getType ( ) ) { case CREATE : parseCreate ( cmd ) ; break ; case UPDATE : parseUpdate ( cmd ) ; break ; case DELETE : parseDelete ( cmd ) ; break ; case UPDATE_NONFASTFORWARD : parseRewind ( cmd ) ; break ; default : com.google.gerrit.server.git.ReceiveCommits.reject ( cmd ) ; continue ; } if ( ( cmd.getResult ( ) ) != ( org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED ) ) { continue ; } if ( GitRepositoryManager.REF_CONFIG.equals ( cmd.getRefName ( ) ) ) { if ( ! ( projectControl.isOwner ( ) ) ) { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd , "not project owner" ) ; continue ; } switch ( cmd.getType ( ) ) { case CREATE : case UPDATE : case UPDATE_NONFASTFORWARD : try { com.google.gerrit.server.git.ProjectConfig cfg = new com.google.gerrit.server.git.ProjectConfig ( project.getNameKey ( ) ) ; cfg.load ( repo , cmd.getNewId ( ) ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.git.ReceiveCommits.reject ( cmd , "invalid project configuration" ) ; com.google.gerrit.server.git.ReceiveCommits.log.error ( ( ( ( ( ( "User " + ( currentUser.getUserName ( ) ) ) + " tried to push invalid project configuration " ) + ( cmd.getNewId ( ) . name ( ) ) ) + " for " ) + ( project.getName ( ) ) ) , e ) ; continue ; } break ; case DELETE : break ; default : com.google.gerrit.server.git.ReceiveCommits.reject ( cmd ) ; continue ; } } } }
Source:
public static boolean isOAuthFinalForOthers ( javax.servlet.http.HttpServletRequest request ) { java.lang.String targetUrl = com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.getTargetUrl ( request ) ; if ( targetUrl.equals ( request.getRequestURI ( ) ) ) { return false ; } return ( com.google.common.base.Strings.emptyToNull ( request.getParameter ( "code" ) ) ) != null ; }

Target:
public static boolean isOAuthFinalForOthers ( javax.servlet.http.HttpServletRequest request ) { java.lang.String targetUrl = com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.getTargetUrl ( request ) ; if ( targetUrl.equals ( request.getRequestURI ( ) ) ) { return false ; } return ( ( com.google.common.base.Strings.emptyToNull ( request.getParameter ( "code" ) ) ) != null ) && ( ( request.getParameter ( com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.FINAL_URL_PARAM ) ) == null ) ; }
Source:
protected void preDisplay ( final com.google.gerrit.client.projects.ProjectMap result ) { if ( mySubname.equals ( subname ) ) { display ( result ) ; } }

Target:
private void refresh ( ) { final java.lang.String mySubname = subname ; com.google.gerrit.client.projects.ProjectMap.match ( subname , new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.projects.ProjectMap > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.projects.ProjectMap result ) { if ( ( ( mySubname == null ) && ( ( subname ) == null ) ) || ( ( mySubname != null ) && ( mySubname.equals ( subname ) ) ) ) { display ( result ) ; } } } ) ; }
Source:
public T get ( com.googlecode.prolog_cafe.lang.Prolog engine ) { T obj = getOrNull ( engine ) ; if ( obj == null ) { obj = createValue ( engine ) ; if ( obj == null ) { throw new com.googlecode.prolog_cafe.lang.SystemException ( ( ( "No " + ( key ) ) + " available" ) ) ; } set ( engine , obj ) ; } return obj ; }

Target:
public T get ( com.googlecode.prolog_cafe.lang.Prolog engine ) { T obj = getOrNull ( engine ) ; if ( obj == null ) { obj = createValue ( engine ) ; if ( obj == null ) { throw new com.googlecode.prolog_cafe.exceptions.SystemException ( ( ( "No " + ( key ) ) + " available" ) ) ; } set ( engine , obj ) ; } return obj ; }
Source:
protected org.eclipse.jgit.revwalk.RevCommit getRemoteHead ( com.google.gerrit.reviewdb.client.Project ... projects ) throws java.io.IOException { com.google.common.truth.Truth.assertThat ( projects.length ) . isLessThan ( 2 ) ; com.google.gerrit.reviewdb.client.Project.NameKey project = this . project ; if ( ( projects.length ) > 0 ) { project = projects [ 0 ] ; } try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( project ) ) { return getHead ( repo , "refs/heads/master" ) ; } }

Target:
protected org.eclipse.jgit.revwalk.RevCommit getRemoteHead ( ) throws java.io.IOException { return getRemoteHead ( project , "master" ) ; }
Source:
public java.lang.String encode ( com.google.gerrit.reviewdb.client.Account.Id accountId , java.lang.String emailAddress ) { try { java.lang.String payload = java.lang.String.format ( "%s:%s" , accountId , emailAddress ) ; byte [ ] utf8 = payload.getBytes ( "UTF-8" ) ; java.lang.String base64 = org.eclipse.jgit.util.Base64.encodeBytes ( utf8 ) ; return emailRegistrationToken.newToken ( base64 ) ; } catch ( com.google.gwtjsonrpc.server.XsrfException | java.io.UnsupportedEncodingException e ) { throw new java.lang.IllegalArgumentException ( e ) ; } }

Target:
public java.lang.String encode ( com.google.gerrit.reviewdb.client.Account.Id accountId , java.lang.String emailAddress ) { try { java.lang.String payload = java.lang.String.format ( "%s:%s" , accountId , emailAddress ) ; byte [ ] utf8 = payload.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ; java.lang.String base64 = org.eclipse.jgit.util.Base64.encodeBytes ( utf8 ) ; return emailRegistrationToken.newToken ( base64 ) ; } catch ( com.google.gwtjsonrpc.server.XsrfException e ) { throw new java.lang.IllegalArgumentException ( e ) ; } }
Source:
public void convertsPrologToSubmitRecord ( ) { com.google.gerrit.server.project.SubmitRuleEvaluator evaluator = makeEvaluator ( ) ; com.googlecode.prolog_cafe.lang.StructureTerm verifiedLabel = com.google.gerrit.acceptance.server.project.SubmitRulesEvaluatorIT.makeLabel ( "Verified" , "may" ) ; com.googlecode.prolog_cafe.lang.StructureTerm labels = new com.googlecode.prolog_cafe.lang.StructureTerm ( "label" , verifiedLabel ) ; java.util.List < com.googlecode.prolog_cafe.lang.Term > terms = com.google.common.collect.ImmutableList.of ( com.google.gerrit.acceptance.server.project.SubmitRulesEvaluatorIT.makeTerm ( "ok" , labels ) ) ; java.util.Collection < com.google.gerrit.common.data.SubmitRecord > records = evaluator.resultsToSubmitRecord ( null , terms ) ; com.google.common.truth.Truth.assertThat ( records ) . hasSize ( 1 ) ; }

Target:
public void convertsPrologToSubmitRecord ( ) { com.google.gerrit.server.project.SubmitRuleEvaluator evaluator = makeEvaluator ( ) ; com.google.gerrit.server.query.change.ChangeData cd = makeChangeData ( ) ; com.googlecode.prolog_cafe.lang.StructureTerm verifiedLabel = com.google.gerrit.acceptance.server.project.SubmitRulesEvaluatorIT.makeLabel ( "Verified" , "may" ) ; com.googlecode.prolog_cafe.lang.StructureTerm labels = new com.googlecode.prolog_cafe.lang.StructureTerm ( "label" , verifiedLabel ) ; java.util.List < com.googlecode.prolog_cafe.lang.Term > terms = com.google.common.collect.ImmutableList.of ( com.google.gerrit.acceptance.server.project.SubmitRulesEvaluatorIT.makeTerm ( "ok" , labels ) ) ; java.util.Collection < com.google.gerrit.common.data.SubmitRecord > records = evaluator.resultsToSubmitRecord ( null , terms , cd ) ; com.google.common.truth.Truth.assertThat ( records ) . hasSize ( 1 ) ; }
Source:
public void missingRepo ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "otherproject" ) , userId ) ; db.changes ( ) . insert ( java.util.Collections.singleton ( c ) ) ; com.google.gerrit.reviewdb.client.PatchSet ps = com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , org.eclipse.jgit.lib.ObjectId.fromString ( "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) , userId ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( ps ) ) ; assertProblems ( c , "Destination repository not found: otherproject" ) ; }

Target:
private com.google.gerrit.reviewdb.client.PatchSet insertPatchSet ( com.google.gerrit.reviewdb.client.Change c ) throws java.lang.Exception { db.changes ( ) . upsert ( java.util.Collections.singleton ( c ) ) ; org.eclipse.jgit.revwalk.RevCommit commit = repo.branch ( c.currentPatchSetId ( ) . toRefName ( ) ) . commit ( ) . parent ( tip ) . create ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , commit , userId ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( ps ) ) ; return ps ; }
Source:
public void testErrorDuringTransitionToHealty ( ) throws java.io.IOException { java.nio.file.Files.createFile ( tempFolder.newFolder ( "unhealthy.txt" ) . toPath ( ) . resolve ( "child" ) ) ; javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doPost ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }

Target:
public void testErrorDuringTransitionToHealthy ( ) throws java.io.IOException { java.nio.file.Files.createFile ( tempFolder.newFolder ( "unhealthy.txt" ) . toPath ( ) . resolve ( "child" ) ) ; javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doPost ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }
Source:
public void createTagNotAllowed ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.TagInput input = new com.google.gerrit.extensions.api.projects.TagInput ( ) ; input.ref = "test" ; exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( ( ( "Cannot create tag \"" + ( org.eclipse.jgit.lib.Constants.R_TAGS ) ) + "test\"" ) ) ; tag ( input.ref ) . create ( input ) ; }

Target:
public void createTagNotAllowed ( ) throws java.lang.Exception { block ( Permission.CREATE , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , ( ( org.eclipse.jgit.lib.Constants.R_TAGS ) + "*" ) ) ; com.google.gerrit.extensions.api.projects.TagInput input = new com.google.gerrit.extensions.api.projects.TagInput ( ) ; input.ref = "test" ; exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( ( ( "Cannot create tag \"" + ( org.eclipse.jgit.lib.Constants.R_TAGS ) ) + "test\"" ) ) ; tag ( input.ref ) . create ( input ) ; }