auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.common.collect.ImmutableMap < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.PatchSet > getPatchSets ( ) { return state.patchSets ( ) ; }

Target:
public com.google.common.collect.ImmutableSortedMap < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.PatchSet > getPatchSets ( ) { if ( ( patchSets ) == null ) { com.google.common.collect.ImmutableSortedMap.Builder < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.PatchSet > b = com.google.common.collect.ImmutableSortedMap.orderedBy ( java.util.Comparator.comparing ( com.google.gerrit.reviewdb.client.PatchSet.Id :: get ) ) ; for ( java.util.Map.Entry < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.PatchSet > e : state.patchSets ( ) ) { b.put ( e.getKey ( ) , new com.google.gerrit.reviewdb.client.PatchSet ( e.getValue ( ) ) ) ; } patchSets = b.build ( ) ; } return patchSets ; }
Source:
private boolean isSessionValid ( javax.servlet.http.HttpServletRequest req ) { com.google.gerrit.httpd.WebSession session = sessionProvider.get ( ) ; if ( session.isSignedIn ( ) ) { java.lang.String user = getRemoteUser ( req ) ; com.google.gerrit.reviewdb.client.AccountExternalId.Key id = session.getLastLoginExternalId ( ) ; return ( ( user != null ) && ( id != null ) ) && ( id.equals ( new com.google.gerrit.reviewdb.client.AccountExternalId.Key ( com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_GERRIT , user ) ) ) ; } return false ; }

Target:
private boolean isSessionValid ( javax.servlet.http.HttpServletRequest req ) { com.google.gerrit.httpd.WebSession session = sessionProvider.get ( ) ; if ( session.isSignedIn ( ) ) { java.lang.String user = getRemoteUser ( req ) ; return ( user == null ) || ( com.google.gerrit.httpd.auth.container.HttpAuthFilter.correctUser ( user , session ) ) ; } return false ; }
Source:
protected void configure ( ) { cache ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.CACHE_NAME , java.lang.String.class , new com.google.inject.TypeLiteral < java.util.Set < java.lang.String > > ( ) { } ) . expireAfterWrite ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.GROUPS_CACHE_TTL_MINS , java.util.concurrent.TimeUnit.MINUTES ) . loader ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.Loader.class ) ; bind ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.class ) ; }

Target:
protected void configure ( ) { cache ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.ORGS_CACHE_NAME , java.lang.String.class , new com.google.inject.TypeLiteral < com.google.common.collect.Multimap < java.lang.String , java.lang.String > > ( ) { } ) . expireAfterWrite ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.GROUPS_CACHE_TTL_MINS , java.util.concurrent.TimeUnit.MINUTES ) . loader ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.OrganisationLoader.class ) ; bind ( com.googlesource.gerrit.plugins.github.group.GitHubOrganisationsCache.class ) ; }
Source:
public com.google.gerrit.extensions.common.EditInfo toEditInfo ( com.google.gerrit.server.edit.ChangeEdit edit ) throws java.io.IOException { com.google.gerrit.extensions.common.EditInfo out = new com.google.gerrit.extensions.common.EditInfo ( ) ; out.commit = com.google.gerrit.server.edit.ChangeEditJson.fillCommit ( edit.getEditCommit ( ) ) ; out.actions = com.google.gerrit.server.edit.ChangeEditJson.fillActions ( edit ) ; return out ; }

Target:
public com.google.gerrit.extensions.common.EditInfo toEditInfo ( com.google.gerrit.server.edit.ChangeEdit edit , boolean downloadCommands ) throws java.io.IOException { com.google.gerrit.extensions.common.EditInfo out = new com.google.gerrit.extensions.common.EditInfo ( ) ; out.commit = com.google.gerrit.server.edit.ChangeEditJson.fillCommit ( edit.getEditCommit ( ) ) ; out.actions = com.google.gerrit.server.edit.ChangeEditJson.fillActions ( edit ) ; if ( downloadCommands ) { out.fetch = fillFetchMap ( edit ) ; } return out ; }
Source:
public void doImport ( org.eclipse.jgit.lib.ProgressMonitor progress ) throws java.lang.Exception { progress.beginTask ( "Setting up Gerrit replication" , 2 ) ; java.lang.String repositoryName = ( ( getOrganisation ( ) ) + "/" ) + ( getRepository ( ) ) ; progress.update ( 1 ) ; replicationConfig.addSecureCredentials ( getOrganisation ( ) , authUsername , authToken ) ; progress.update ( 1 ) ; replicationConfig.addReplicationRemote ( getOrganisation ( ) , ( ( GITHUB_REPOSITORY_BASE_URI ) + "/${name}.git" ) , repositoryName ) ; progress.endTask ( ) ; }

Target:
public void doImport ( org.eclipse.jgit.lib.ProgressMonitor progress ) throws java.lang.Exception { progress.beginTask ( "Setting up Gerrit replication" , 2 ) ; java.lang.String repositoryName = ( ( getOrganisation ( ) ) + "/" ) + ( getRepository ( ) ) ; progress.update ( 1 ) ; replicationConfig.addSecureCredentials ( getOrganisation ( ) , authUsername , authToken ) ; progress.update ( 1 ) ; replicationConfig.addReplicationRemote ( getOrganisation ( ) , ( ( gitHubUrl ) + "/${name}.git" ) , repositoryName ) ; progress.endTask ( ) ; }
Source:
public void run ( ) throws java.lang.Exception { parseCommandLine ( ) ; this . display ( ) ; }

Target:
public void start ( final org.apache.sshd.server.Environment env ) throws java.io.IOException { java.lang.String s = env.getEnv ( ) . get ( Environment.ENV_COLUMNS ) ; if ( ( s != null ) && ( ! ( s.isEmpty ( ) ) ) ) { try { columns = java.lang.Integer.parseInt ( s ) ; } catch ( java.lang.NumberFormatException err ) { columns = 80 ; } } super . start ( env ) ; }
Source:
public void parseSubmissionId ( ) 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" ) + "Submission-id: 1-1453387607626-96fabc25" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Submission-id: 1-1453387607626-96fabc25\n" ) + "Submission-id: 1-1453387901516-5d1e2450" ) ) ) ; }

Target:
public void parseSubmissionId ( ) 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" ) + "Submission-id: 1-1453387607626-96fabc25" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-set: 1\n" ) + "Submission-id: 1-1453387607626-96fabc25\n" ) + "Submission-id: 1-1453387901516-5d1e2450" ) ) ) ; }
Source:
void onRebase ( @ java.lang.SuppressWarnings ( value = "unused" ) com.google.gwt.event.dom.client.ClickEvent e ) { com.google.gerrit.client.change.RebaseAction.call ( rebase , project , changeInfo.branch ( ) , changeId , revision ) ; }

Target:
void onRebase ( @ java.lang.SuppressWarnings ( value = "unused" ) com.google.gwt.event.dom.client.ClickEvent e ) { boolean enabled = true ; com.google.gerrit.client.changes.ChangeInfo.RevisionInfo revInfo = changeInfo.revision ( revision ) ; if ( revInfo.has_actions ( ) ) { com.google.gerrit.client.rpc.NativeMap < com.google.gerrit.client.actions.ActionInfo > actions = revInfo.actions ( ) ; if ( actions.containsKey ( "rebase" ) ) { enabled = actions.get ( "rebase" ) . enabled ( ) ; } } com.google.gerrit.client.change.RebaseAction.call ( rebase , project , changeInfo.branch ( ) , changeId , revision , enabled ) ; }
Source:
public java.util.List < com.google.gerrit.common.data.SubmitRecord > canSubmit ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.PatchSet patchSet ) { return canSubmit ( db , patchSet , null , false ) ; }

Target:
public com.google.gerrit.server.project.ChangeControl controlFor ( com.google.gerrit.reviewdb.client.Change.Id id , com.google.gerrit.server.CurrentUser user ) throws com.google.gerrit.server.project.NoSuchChangeException { final com.google.gerrit.reviewdb.client.Change change ; try { change = db.get ( ) . changes ( ) . get ( id ) ; if ( change == null ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( id ) ; } } catch ( com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( id , e ) ; } return controlFor ( change , user ) ; }
Source:
public static void deleteSshKeys ( java.lang.String account , java.util.Set < java.lang.Integer > sequenceNumbers , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > cb ) { com.google.gerrit.client.rpc.CountingCallback ccb = new com.google.gerrit.client.rpc.CountingCallback ( sequenceNumbers.size ( ) , cb ) ; for ( int seq : sequenceNumbers ) { new com.google.gerrit.client.rpc.RestApi ( "/accounts/" ) . id ( account ) . view ( "sshkeys" ) . id ( seq ) . delete ( ccb ) ; } }

Target:
public static void deleteSshKeys ( java.lang.String account , java.util.Set < java.lang.Integer > sequenceNumbers , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > cb ) { com.google.gerrit.client.rpc.CallbackGroup group = new com.google.gerrit.client.rpc.CallbackGroup ( ) ; for ( int seq : sequenceNumbers ) { new com.google.gerrit.client.rpc.RestApi ( "/accounts/" ) . id ( account ) . view ( "sshkeys" ) . id ( seq ) . delete ( group.add ( cb ) ) ; cb = com.google.gerrit.client.rpc.CallbackGroup.emptyCallback ( ) ; } }
Source:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; Util.MANAGE_SVC.patchSetAction ( max.getId ( ) , patchSet.getId ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( com.google.gwtjsonrpc.client.VoidResult result ) { actionsPanel.remove ( b ) ; fireOnSuggestRefresh ( ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; super . onFailure ( caught ) ; } } ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; Util.MANAGE_SVC.submit ( patchSet.getId ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.data.ChangeDetail > ( ) { public void onSuccess ( com.google.gerrit.client.data.ChangeDetail result ) { onSubmitResult ( result ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; super . onFailure ( caught ) ; } } ) ; }
Source:
private void setDefaultRenderer ( javax.servlet.FilterConfig filterConfig ) { if ( ( renderer ) == null ) { renderer = new com.google.gitiles.DefaultRenderer ( ( ( filterConfig.getServletContext ( ) . getContextPath ( ) ) + ( com.google.gitiles.GitilesServlet.STATIC_PREFIX ) ) , com.google.common.collect.FluentIterable.from ( java.util.Arrays.asList ( config.getStringList ( "gitiles" , null , "customTemplates" ) ) ) . transform ( com.google.gitiles.Renderer.fileUrlMapper ( ) ) , com.google.common.base.MoreObjects.firstNonNull ( config.getString ( "gitiles" , null , "siteTitle" ) , "Gitiles" ) ) ; } }

Target:
private void setDefaultRenderer ( javax.servlet.FilterConfig filterConfig ) { if ( ( renderer ) == null ) { renderer = new com.google.gitiles.DefaultRenderer ( ( ( filterConfig.getServletContext ( ) . getContextPath ( ) ) + ( com.google.gitiles.GitilesServlet.STATIC_PREFIX ) ) , java.util.Arrays.stream ( config.getStringList ( "gitiles" , null , "customTemplates" ) ) . map ( com.google.gitiles.Renderer.fileUrlMapper ( ) ) . collect ( java.util.stream.Collectors.toList ( ) ) , com.google.common.base.MoreObjects.firstNonNull ( config.getString ( "gitiles" , null , "siteTitle" ) , "Gitiles" ) ) ; } }
Source:
public static void main ( final java.lang.String [ ] argv ) throws com.google.gwtjsonrpc.server.XsrfException , com.google.gwtorm.client.OrmException , java.net.SocketException { com.google.gerrit.server.ssh.GerritSshDaemon.startSshd ( ) ; }

Target:
private com.google.inject.Injector createSshInjector ( final com.google.inject.Injector sysInjector ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < com.google.inject.Module > ( ) ; modules.add ( new com.google.gerrit.server.ssh.SshModule ( ) ) ; if ( slave ) { modules.add ( new com.google.gerrit.server.ssh.commands.SlaveCommandModule ( ) ) ; } else { modules.add ( new com.google.gerrit.server.ssh.commands.MasterCommandModule ( ) ) ; } return sysInjector.createChildInjector ( modules ) ; }
Source:
private boolean can ( com.google.gerrit.server.permissions.ProjectPermission perm ) throws com.google.gerrit.server.permissions.PermissionBackendException { switch ( perm ) { case ACCESS : return ( ( ! ( isHidden ( ) ) ) && ( isReadable ( ) ) ) || ( isOwner ( ) ) ; case READ : return ( ( ! ( isHidden ( ) ) ) && ( allRefsAreVisible ( ) ) ) || ( isOwner ( ) ) ; } throw new com.google.gerrit.server.permissions.PermissionBackendException ( ( perm + " unsupported" ) ) ; }

Target:
private boolean can ( com.google.gerrit.server.permissions.ProjectPermission perm ) throws com.google.gerrit.server.permissions.PermissionBackendException { switch ( perm ) { case ACCESS : return ( ( ! ( isHidden ( ) ) ) && ( ( user.isInternalUser ( ) ) || ( canPerformOnAnyRef ( Permission.READ ) ) ) ) || ( isOwner ( ) ) ; case READ : return ( ( ! ( isHidden ( ) ) ) && ( allRefsAreVisible ( java.util.Collections.emptySet ( ) ) ) ) || ( isOwner ( ) ) ; } throw new com.google.gerrit.server.permissions.PermissionBackendException ( ( perm + " unsupported" ) ) ; }
Source:
private void setEnabledForUseContentMerge ( ) { if ( SubmitType.FAST_FORWARD_ONLY.equals ( Project.SubmitType.valueOf ( submitType.getValue ( submitType.getSelectedIndex ( ) ) ) ) ) { useContentMerge.setEnabled ( false ) ; useContentMerge.setValue ( false ) ; } else { useContentMerge.setEnabled ( true ) ; } }

Target:
private void setEnabledForUseContentMerge ( ) { if ( SubmitType.FAST_FORWARD_ONLY.equals ( Project.SubmitType.valueOf ( submitType.getValue ( submitType.getSelectedIndex ( ) ) ) ) ) { useContentMerge.setEnabled ( false ) ; useContentMerge.setValue ( false ) ; } else { useContentMerge.setEnabled ( submitType.isEnabled ( ) ) ; } }
Source:
protected void onLoad ( ) { super . onLoad ( ) ; addPanel.setVisible ( false ) ; com.google.gerrit.client.access.AccessMap.get ( getProjectKey ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.access.ProjectAccessInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.access.ProjectAccessInfo result ) { addPanel.setVisible ( result.canAddRefs ( ) ) ; } } ) ; query = new com.google.gerrit.client.admin.ProjectBranchesScreen.Query ( match ) . start ( start ) . run ( ) ; savedPanel = BRANCH ; }

Target:
protected void onLoad ( ) { super . onLoad ( ) ; addPanel.setVisible ( false ) ; com.google.gerrit.client.access.AccessMap.get ( getProjectKey ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.access.ProjectAccessInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.access.ProjectAccessInfo result ) { addPanel.setVisible ( result.canAddRefs ( ) ) ; } } ) ; query = new com.google.gerrit.client.admin.ProjectBranchesScreen.Query ( match ) . start ( start ) . run ( ) ; savedPanel = BRANCHES ; }
Source:
private void appendLineNumber ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx ) { m.openTd ( ) ; m.setStyleName ( "LineNumber" ) ; m.append ( ( idx + 1 ) ) ; m.closeTd ( ) ; }

Target:
private void appendLineNumber ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx ) { m.openTd ( ) ; m.setStyleName ( Gerrit.RESOURCES.css ( ) . lineNumber ( ) ) ; m.append ( ( idx + 1 ) ) ; m.closeTd ( ) ; }
Source:
public java.util.Optional < java.lang.String > permissionName ( ) { switch ( forUser ) { case SELF : return java.util.Optional.of ( com.google.gerrit.common.data.Permission.forLabel ( label ( ) ) ) ; case ON_BEHALF_OF : return java.util.Optional.of ( com.google.gerrit.common.data.Permission.forLabelAs ( label ( ) ) ) ; } return java.util.Optional.empty ( ) ; }

Target:
public java.lang.String permissionName ( ) { if ( ( forUser ) == ( com.google.gerrit.server.permissions.LabelPermission.ForUser.ON_BEHALF_OF ) ) { return com.google.gerrit.common.data.Permission.forLabelAs ( label ( ) ) ; } return com.google.gerrit.common.data.Permission.forLabel ( label ( ) ) ; }
Source:
public com.google.common.base.Optional < com.google.gerrit.server.plugins.PluginEntry > getEntry ( java.lang.String resourcePath ) throws java.io.IOException { java.nio.file.Path resourceFile = getResourceFile ( resourcePath ) ; if ( ( java.nio.file.Files.exists ( resourceFile ) ) && ( ( java.nio.file.Files.size ( resourceFile ) ) > 0 ) ) { return resourceOf ( resourcePath ) ; } else { return com.google.common.base.Optional.absent ( ) ; } }

Target:
public java.util.Optional < com.google.gerrit.server.plugins.PluginEntry > getEntry ( java.lang.String resourcePath ) throws java.io.IOException { java.nio.file.Path resourceFile = getResourceFile ( resourcePath ) ; if ( ( java.nio.file.Files.exists ( resourceFile ) ) && ( ( java.nio.file.Files.size ( resourceFile ) ) > 0 ) ) { return resourceOf ( resourcePath ) ; } else { return java.util.Optional.empty ( ) ; } }
Source:
public void testUnblockForceEditTopicName ( ) { grant ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; grant ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertTrue ( "u can edit topic name" , u.controlForRef ( "refs/heads/master" ) . canForceEditTopicName ( ) ) ; }

Target:
public void testUnblockForceEditTopicName ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertTrue ( "u can edit topic name" , u.controlForRef ( "refs/heads/master" ) . canForceEditTopicName ( ) ) ; }
Source:
public void testUpsertTwoFirstExistsing ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 , 0 ) ; java.sql.PreparedStatement insert = stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.TWO_ROWS ) ; verifyIds ( insert , 2 ) ; }

Target:
public void testUpdateOneDBException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement update = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.update ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; }
Source:
private boolean isValidReviewer ( com.google.gerrit.reviewdb.client.Account member , com.google.gerrit.server.project.ChangeControl control ) { if ( member.isActive ( ) ) { com.google.gerrit.server.IdentifiedUser user = identifiedUserFactory.create ( member.getId ( ) ) ; return control.forUser ( user ) . isRefVisible ( ) ; } return false ; }

Target:
private boolean isValidReviewer ( com.google.gerrit.reviewdb.client.Account member , com.google.gerrit.server.permissions.PermissionBackend.ForRef perm ) throws com.google.gerrit.server.permissions.PermissionBackendException { if ( member.isActive ( ) ) { com.google.gerrit.server.IdentifiedUser user = identifiedUserFactory.create ( member.getId ( ) ) ; try { perm.user ( user ) . check ( RefPermission.READ ) ; return true ; } catch ( com.google.gerrit.extensions.restapi.AuthException e ) { return false ; } } return false ; }
Source:
public java.lang.String getLabel ( ) { if ( isLabel ( ) ) { return getName ( ) . substring ( com.google.gerrit.common.data.Permission.LABEL.length ( ) ) ; } return null ; }

Target:
public static java.lang.String extractLabel ( java.lang.String varName ) { if ( com.google.gerrit.common.data.Permission.isLabel ( varName ) ) { return varName.substring ( com.google.gerrit.common.data.Permission.LABEL.length ( ) ) ; } else if ( com.google.gerrit.common.data.Permission.isLabelAs ( varName ) ) { return varName.substring ( com.google.gerrit.common.data.Permission.LABEL_AS.length ( ) ) ; } return null ; }
Source:
protected void insert ( int row , com.google.gerrit.client.projects.ProjectInfo k ) { super . insert ( row , k ) ; if ( ( com.google.gerrit.client.Gerrit.getGitwebLink ( ) ) != null ) { table.getFlexCellFormatter ( ) . addStyleName ( row , 3 , Gerrit.RESOURCES.css ( ) . dataCell ( ) ) ; } }

Target:
protected void insert ( int row , com.google.gerrit.client.projects.ProjectInfo k ) { super . insert ( row , k ) ; if ( ( com.google.gerrit.client.Gerrit.getGitwebLink ( ) ) != null ) { table.getFlexCellFormatter ( ) . addStyleName ( row , ProjectsTable.C_REPO_BROWSER , Gerrit.RESOURCES.css ( ) . dataCell ( ) ) ; } }
Source:
private org.eclipse.jgit.revwalk.RevCommit commit ( com.google.gerrit.server.notedb.ChangeUpdate update ) throws java.io.IOException { com.google.gerrit.server.git.MetaDataUpdate md = new com.google.gerrit.server.git.MetaDataUpdate ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.DISABLED , project , repo ) ; md.getCommitBuilder ( ) . setAuthor ( update.getUser ( ) . newCommitterIdent ( update.getWhen ( ) , com.google.gerrit.server.notedb.ChangeNotesTest.TZ ) ) ; return update.commit ( md ) ; }

Target:
private com.google.gerrit.server.notedb.ChangeUpdate newUpdate ( com.google.gerrit.reviewdb.client.Change c , final com.google.gerrit.server.IdentifiedUser user ) throws java.lang.Exception { return injector.createChildInjector ( new com.google.gerrit.server.config.FactoryModule ( ) { @ java.lang.Override public void configure ( ) { factory ( ChangeUpdate.Factory.class ) ; bind ( com.google.gerrit.server.IdentifiedUser.class ) . toInstance ( user ) ; } } ) . getInstance ( ChangeUpdate.Factory.class ) . create ( stubChangeControl ( c , user ) , com.google.gerrit.server.util.TimeUtil.nowTs ( ) , com.google.gerrit.server.notedb.ChangeNotesTest.LABEL_TYPES ) ; }
Source:
public void updateProjectWatch ( final com.google.gerrit.reviewdb.client.AccountProjectWatch watch , final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gwtjsonrpc.client.VoidResult > callback ) { if ( ! ( getAccountId ( ) . equals ( watch.getAccountId ( ) ) ) ) { callback.onFailure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; return ; } run ( callback , new com.google.gerrit.httpd.rpc.account.Action < com.google.gwtjsonrpc.client.VoidResult > ( ) { public com.google.gwtjsonrpc.client.VoidResult run ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { db.accountProjectWatches ( ) . update ( java.util.Collections.singleton ( watch ) ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; } } ) ; }

Target:
public void updateProjectWatch ( final com.google.gerrit.reviewdb.client.AccountProjectWatch watch , final com.google.gwtjsonrpc.common.AsyncCallback < com.google.gwtjsonrpc.common.VoidResult > callback ) { if ( ! ( getAccountId ( ) . equals ( watch.getAccountId ( ) ) ) ) { callback.onFailure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; return ; } run ( callback , new com.google.gerrit.httpd.rpc.account.Action < com.google.gwtjsonrpc.common.VoidResult > ( ) { public com.google.gwtjsonrpc.common.VoidResult run ( com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gwtorm.server.OrmException { db.accountProjectWatches ( ) . update ( java.util.Collections.singleton ( watch ) ) ; return com.google.gwtjsonrpc.common.VoidResult.INSTANCE ; } } ) ; }
Source:
public void addedFixSuggestionCanBeRetrieved ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; java.util.List < com.google.gerrit.extensions.common.RobotCommentInfo > robotCommentInfos = getRobotComments ( ) ; com.google.gerrit.acceptance.api.revision.RobotCommentInfoSubject.assertThatList ( robotCommentInfos ) . onlyElement ( ) . onlyFixSuggestion ( ) . isNotNull ( ) ; }

Target:
public void addedFixSuggestionCanBeRetrieved ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; java.util.List < com.google.gerrit.extensions.common.RobotCommentInfo > robotCommentInfos = getRobotComments ( ) ; com.google.gerrit.extensions.common.RobotCommentInfoSubject.assertThatList ( robotCommentInfos ) . onlyElement ( ) . onlyFixSuggestion ( ) . isNotNull ( ) ; }
Source:
private static com.google.gerrit.server.query.change.ChangeData change ( java.lang.String ... files ) { java.util.Arrays.sort ( files ) ; com.google.gerrit.server.query.change.ChangeData cd = new com.google.gerrit.server.query.change.ChangeData ( null , null , null , new com.google.gerrit.reviewdb.client.Change.Id ( 1 ) ) ; cd.setCurrentFilePaths ( java.util.Arrays.asList ( files ) ) ; return cd ; }

Target:
private static com.google.gerrit.server.query.change.ChangeData change ( java.lang.String ... files ) { java.util.Arrays.sort ( files ) ; com.google.gerrit.server.query.change.ChangeData cd = com.google.gerrit.server.query.change.ChangeData.createForTest ( new com.google.gerrit.reviewdb.client.Change.Id ( 1 ) ) ; cd.setCurrentFilePaths ( java.util.Arrays.asList ( files ) ) ; return cd ; }
Source:
public com.google.gerrit.server.data.PatchSetAttribute asPatchSetAttribute ( org.eclipse.jgit.revwalk.RevWalk revWalk , com.google.gerrit.reviewdb.client.PatchSet patchSet ) { try ( com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ) { return asPatchSetAttribute ( db , revWalk , patchSet ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.events.EventFactory.log.error ( "Cannot open database connection" , e ) ; return new com.google.gerrit.server.data.PatchSetAttribute ( ) ; } }

Target:
public com.google.gerrit.server.data.PatchSetAttribute asPatchSetAttribute ( org.eclipse.jgit.revwalk.RevWalk revWalk , com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.reviewdb.client.PatchSet patchSet ) { try ( com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ) { return asPatchSetAttribute ( db , revWalk , notes , patchSet ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.events.EventFactory.log.error ( "Cannot open database connection" , e ) ; return new com.google.gerrit.server.data.PatchSetAttribute ( ) ; } }
Source:
public static com.google.gerrit.client.changes.AccountInfo asInfo ( com.google.gerrit.client.changes.AccountInfo acct ) { if ( acct == null ) { return com.google.gerrit.client.changes.AccountInfo.create ( 0 , null , null ) ; } return com.google.gerrit.client.changes.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) ) ; }

Target:
public static com.google.gerrit.client.account.AccountInfo asInfo ( com.google.gerrit.client.account.AccountInfo acct ) { if ( acct == null ) { return com.google.gerrit.client.account.AccountInfo.create ( 0 , null , null ) ; } return com.google.gerrit.client.account.AccountInfo.create ( ( ( acct.getId ( ) ) != null ? acct.getId ( ) . get ( ) : 0 ) , acct.getFullName ( ) , acct.getPreferredEmail ( ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; schemaFactory = org.easymock.EasyMock.createStrictMock ( com.google.gwtorm.server.SchemaFactory.class ) ; schema = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.reviewdb.server.ReviewDb.class ) ; subscriptions = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.reviewdb.server.SubmoduleSubscriptionAccess.class ) ; urlProvider = org.easymock.EasyMock.createStrictMock ( com.google.inject.Provider.class ) ; repoManager = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.server.git.GitRepositoryManager.class ) ; gitRefUpdated = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.class ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; schemaFactory = org.easymock.EasyMock.createStrictMock ( com.google.gwtorm.server.SchemaFactory.class ) ; schema = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.reviewdb.server.ReviewDb.class ) ; subscriptions = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.reviewdb.server.SubmoduleSubscriptionAccess.class ) ; urlProvider = org.easymock.EasyMock.createStrictMock ( com.google.inject.Provider.class ) ; repoManager = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.server.git.GitRepositoryManager.class ) ; gitRefUpdated = org.easymock.EasyMock.createStrictMock ( com.google.gerrit.server.extensions.events.GitReferenceUpdated.class ) ; changeHooks = org.easymock.EasyMock.createNiceMock ( com.google.gerrit.common.ChangeHooks.class ) ; }
Source:
public void testUpdateNoPerson ( ) throws java.lang.Exception { final com.google.gwtorm.data.PhoneBookDb schema = openAndCreate ( ) ; final com.google.gwtorm.data.TestPerson bob = new com.google.gwtorm.data.TestPerson ( new com.google.gwtorm.data.TestPerson.Key ( "Bob" ) , 18 ) ; try { schema.people ( ) . update ( java.util.Collections.singleton ( bob ) ) ; fail ( "Update of missing person succeeded" ) ; } catch ( com.google.gwtorm.client.OrmConcurrencyException e ) { assertEquals ( "Concurrent modification detected" , e.getMessage ( ) ) ; } }

Target:
public void testUpdateNoPerson ( ) throws java.lang.Exception { final com.google.gwtorm.data.PhoneBookDb schema = openAndCreate ( ) ; final com.google.gwtorm.data.TestPerson bob = new com.google.gwtorm.data.TestPerson ( new com.google.gwtorm.data.TestPerson.Key ( "Bob" ) , 18 ) ; try { schema.people ( ) . update ( java.util.Collections.singleton ( bob ) ) ; fail ( "Update of missing person succeeded" ) ; } catch ( com.google.gwtorm.server.OrmConcurrencyException e ) { assertEquals ( "Concurrent modification detected" , e.getMessage ( ) ) ; } }
Source:
public void newPatchSetByOtherOnReviewableChangeNotifyOwnerReviewersInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; 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_REVIEWERS" , other ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . notTo ( sc.owner , sc.starrer , other ) . to ( sc.reviewer ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; }

Target:
public void newPatchSetByOtherOnReviewableChangeNotifyOwnerReviewersInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; pushTo ( sc , "refs/for/master%notify=OWNER_REVIEWERS" , other ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . to ( sc.reviewer ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . noOneElse ( ) ; }
Source:
java.util.Set < com.google.gerrit.client.diff.SkipBar > getSkipBars ( ) { return skipBars ; }

Target:
void remove ( com.google.gerrit.client.diff.SkipBar a , com.google.gerrit.client.diff.SkipBar b ) { skipBars.remove ( a ) ; skipBars.remove ( b ) ; if ( ( ( getLine0 ( ) ) == a ) || ( ( getLine0 ( ) ) == b ) ) { setLine0 ( null ) ; } }
Source:
public void addReviewerToReviewableChangeByOtherInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.TestAccount other = accounts.create ( "other" , "other@example.com" , "other" ) ; forAll ( ( adder ) -> { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; com.google.gerrit.acceptance.TestAccount reviewer = accounts.create ( "added" , "added@example.com" , "added" ) ; addReviewer ( adder , sc.changeId , other , reviewer.email ) ; assertThat ( sender ) . sent ( "newchange" , sc ) . to ( reviewer ) . to ( sc.reviewerByEmail ) . cc ( sc.owner , sc.reviewer ) . cc ( sc.ccerByEmail ) . notTo ( sc.starrer , other ) ; } ) ; }

Target:
public void addReviewerToReviewableChangeByOtherInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.TestAccount other = accountCreator.create ( "other" , "other@example.com" , "other" ) ; forAll ( ( adder ) -> { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; com.google.gerrit.acceptance.TestAccount reviewer = accountCreator.create ( "added" , "added@example.com" , "added" ) ; addReviewer ( adder , sc.changeId , other , reviewer.email ) ; assertThat ( sender ) . sent ( "newchange" , sc ) . to ( reviewer ) . cc ( sc.owner , sc.reviewer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( sc.starrer , other ) ; } ) ; }
Source:
private static com.google.gerrit.server.change.GetRelated.ChangeAndCommit changeAndCommit ( java.lang.String changeId , org.eclipse.jgit.lib.ObjectId commitId , int revisionNum , int currentRevisionNum ) { com.google.gerrit.server.change.GetRelated.ChangeAndCommit result = new com.google.gerrit.server.change.GetRelated.ChangeAndCommit ( ) ; result.changeId = changeId ; result.commit = new com.google.gerrit.extensions.common.CommitInfo ( ) ; result.commit.commit = commitId.name ( ) ; result._revisionNumber = revisionNum ; result._currentRevisionNumber = currentRevisionNum ; return result ; }

Target:
private static com.google.gerrit.server.change.GetRelated.ChangeAndCommit changeAndCommit ( java.lang.String changeId , org.eclipse.jgit.lib.ObjectId commitId , int revisionNum , int currentRevisionNum ) { com.google.gerrit.server.change.GetRelated.ChangeAndCommit result = new com.google.gerrit.server.change.GetRelated.ChangeAndCommit ( ) ; result.changeId = changeId ; result.commit = new com.google.gerrit.extensions.common.CommitInfo ( ) ; result.commit.commit = commitId.name ( ) ; result._revisionNumber = revisionNum ; result._currentRevisionNumber = currentRevisionNum ; result.status = "NEW" ; return result ; }
Source:
private void onOpen ( ) { if ( ( 0 <= ( currentRow ) ) && ( ( currentRow ) < ( table.getRowCount ( ) ) ) ) { final RowItem item = com.google.gerrit.client.ui.NavigationTable.getRowItem ( currentRow ) ; if ( item != null ) { onOpenItem ( item ) ; } } }

Target:
private void onOpen ( ) { if ( ( 0 <= ( currentRow ) ) && ( ( currentRow ) < ( table.getRowCount ( ) ) ) ) { if ( ( com.google.gerrit.client.ui.NavigationTable.getRowItem ( currentRow ) ) != null ) { onOpenRow ( currentRow ) ; } } }
Source:
public com.google.gerrit.server.change.ConsistencyChecker.Result check ( com.google.gerrit.reviewdb.client.Change c ) { reset ( ) ; change = c ; try { checkImpl ( ) ; return com.google.gerrit.server.change.ConsistencyChecker.Result.create ( c , problems ) ; } finally { if ( ( rw ) != null ) { rw.release ( ) ; } if ( ( repo ) != null ) { repo.close ( ) ; } } }

Target:
public com.google.gerrit.server.change.ConsistencyChecker.Result check ( com.google.gerrit.reviewdb.client.Change c , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput f ) { reset ( ) ; fix = f ; change = c ; try { checkImpl ( ) ; return com.google.gerrit.server.change.ConsistencyChecker.Result.create ( c , problems ) ; } finally { if ( ( rw ) != null ) { rw.release ( ) ; } if ( ( repo ) != null ) { repo.close ( ) ; } } }
Source:
private void initUI ( ) { historyTable = new com.google.gerrit.client.patches.PatchSideBySideScreen.HistoryTable ( ) ; historyPanel = new com.google.gwt.user.client.ui.DisclosurePanel ( PatchUtil.C.patchHistoryTitle ( ) ) ; historyPanel.setContent ( historyTable ) ; historyPanel.setVisible ( false ) ; add ( historyPanel ) ; sbsPanel = new com.google.gwt.user.client.ui.FlowPanel ( ) ; sbsPanel.setStyleName ( "gerrit-SideBySideScreen-SideBySideTable" ) ; sbsTable = new com.google.gerrit.client.patches.SideBySideTable ( ) ; sbsPanel.add ( sbsTable ) ; add ( sbsPanel ) ; }

Target:
protected void onInitUI ( ) { super . onInitUI ( ) ; historyTable = new com.google.gerrit.client.patches.PatchSideBySideScreen.HistoryTable ( ) ; historyPanel = new com.google.gwt.user.client.ui.DisclosurePanel ( PatchUtil.C.patchHistoryTitle ( ) ) ; historyPanel.setContent ( historyTable ) ; historyPanel.setVisible ( false ) ; add ( historyPanel ) ; sbsPanel = new com.google.gwt.user.client.ui.FlowPanel ( ) ; sbsPanel.setStyleName ( "gerrit-SideBySideScreen-SideBySideTable" ) ; sbsTable = new com.google.gerrit.client.patches.SideBySideTable ( ) ; sbsPanel.add ( sbsTable ) ; add ( sbsPanel ) ; }
Source:
public void inheritRead_SingleBranchDeniesUpload ( ) { com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/for/refs/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/foobar" ) ; com.google.gerrit.server.project.Util.doNotInherit ( local , com.google.gerrit.common.data.Permission.READ , "refs/heads/foobar" ) ; com.google.gerrit.server.project.Util.doNotInherit ( local , com.google.gerrit.common.data.Permission.PUSH , "refs/for/refs/heads/foobar" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertCanUpload ( u ) ; assertCreateChange ( "refs/heads/master" , u ) ; assertCannotCreateChange ( "refs/heads/foobar" , u ) ; }

Target:
public void inheritRead_SingleBranchDeniesUpload ( ) { com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/for/refs/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/foobar" ) ; com.google.gerrit.server.project.testing.Util.doNotInherit ( local , com.google.gerrit.common.data.Permission.READ , "refs/heads/foobar" ) ; com.google.gerrit.server.project.testing.Util.doNotInherit ( local , com.google.gerrit.common.data.Permission.PUSH , "refs/for/refs/heads/foobar" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; assertCanUpload ( u ) ; assertCreateChange ( "refs/heads/master" , u ) ; assertCannotCreateChange ( "refs/heads/foobar" , u ) ; }
Source:
void stop ( ) throws java.lang.Exception { com.google.gerrit.lifecycle.LifecycleManager manager = com.google.gerrit.acceptance.GerritServer.get ( daemon , "manager" ) ; java.lang.System.out.println ( "Gerrit Server Shutdown" ) ; manager.stop ( ) ; daemonService.shutdownNow ( ) ; daemonService.awaitTermination ( java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; }

Target:
void stop ( ) throws java.lang.Exception { com.google.gerrit.lifecycle.LifecycleManager manager = com.google.gerrit.acceptance.GerritServer.get ( daemon , "manager" ) ; java.lang.System.out.println ( "Gerrit Server Shutdown" ) ; manager.stop ( ) ; daemonService.shutdownNow ( ) ; daemonService.awaitTermination ( java.lang.Long.MAX_VALUE , java.util.concurrent.TimeUnit.SECONDS ) ; com.google.gerrit.acceptance.TempFileUtil.recursivelyDelete ( sitePath ) ; }
Source:
public void generatesExpectedMessageForLongComment ( ) throws java.lang.Exception { mockEvent.change = mockChange ; mockEvent.author = mockAccount ; mockEvent.comment = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + ( ( "Integer tristique ligula nec dapibus lobortis. Nulla venenatis, lacus quis vulputate volutpat, " + "sem neque ornare eros, vel sodales magna risus et diam. Maecenas ultricies justo dictum orci " ) + "scelerisque consequat a vel purus." ) ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = ( ( ( "{\"text\": \"Unit Tester commented\\n>>>" + "testproject (master): " ) + ( mockEvent.comment.substring ( 0 , 197 ) ) ) + "... (https://change/)\"," ) + "\"channel\": \"#testchannel\",\"username\": \"testuser\"}\n" ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }

Target:
public void generatesExpectedMessageForLongComment ( ) throws java.lang.Exception { mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.author = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockEvent.comment = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + ( ( "Integer tristique ligula nec dapibus lobortis. Nulla venenatis, lacus quis vulputate volutpat, " + "sem neque ornare eros, vel sodales magna risus et diam. Maecenas ultricies justo dictum orci " ) + "scelerisque consequat a vel purus." ) ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = ( ( ( "{\"text\": \"Unit Tester commented\\n>>>" + "testproject (master): " ) + ( mockEvent.comment.substring ( 0 , 197 ) ) ) + "... (https://change/)\"," ) + "\"channel\": \"#testchannel\",\"username\": \"testuser\"}\n" ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }
Source:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.server.change.Mute.Input input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.StarredChangesUtil.IllegalLabelException , com.google.gwtorm.server.OrmException { if ( ( rsrc.isUserOwner ( ) ) || ( isMuted ( rsrc ) ) ) { return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; } stars.mute ( rsrc ) ; return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.server.change.Mute.Input input ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.StarredChangesUtil.IllegalLabelException , com.google.gwtorm.server.OrmException { if ( rsrc.isUserOwner ( ) ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "cannot mute own change" ) ; } if ( ! ( isMuted ( rsrc ) ) ) { stars.mute ( rsrc ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; }
Source:
public void run ( ) { try { final com.google.gerrit.server.mail.MergedSender cm = mergedSenderFactory.create ( id ) ; cm.setFrom ( user.getAccountId ( ) ) ; cm.setPatchSet ( result.newPatchSet , result.info ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { final com.google.gerrit.reviewdb.client.PatchSet.Id psi = result.newPatchSet.getId ( ) ; com.google.gerrit.server.git.ReceiveCommits.log.error ( ( "Cannot send email for submitted patch set " + psi ) , e ) ; } }

Target:
public void run ( ) { try { com.google.gerrit.server.mail.MergedSender cm = mergedSenderFactory.create ( project.getNameKey ( ) , ps.getId ( ) . getParentKey ( ) ) ; cm.setFrom ( user.getAccountId ( ) ) ; cm.setPatchSet ( ps , info ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.git.ReceiveCommits.log.error ( ( "Cannot send email for submitted patch set " + ( ps.getId ( ) ) ) , e ) ; } }
Source:
public void testCarriageReturn ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit c = makeCommit ( ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator.performValidation ( repo , c , com.google.common.collect.Sets.newHashSet ( new java.lang.String [ ] { "" } ) ) ; com.google.common.truth.Truth.assertThat ( m ) . hasSize ( 1 ) ; java.util.List < com.googlesource.gerrit.plugins.uploadvalidator.ComparableCommitValidationMessage > expected = new java.util.ArrayList < > ( ) ; expected.add ( new com.googlesource.gerrit.plugins.uploadvalidator.ComparableCommitValidationMessage ( "found carriage return (CR) character in file: foo.txt" , true ) ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsAllIn ( expected ) ; }

Target:
public void testCarriageReturn ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit c = makeCommit ( ) ; com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator validator = new com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator ( null , new com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.PATTERN_CACHE ) , null , null ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = validator.performValidation ( repo , c , com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.EMPTY_PLUGIN_CONFIG ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactlyElementsIn ( com.google.common.collect.ImmutableSet.of ( "ERROR: found carriage return (CR) character in file: foo.txt" ) ) ; }