auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void basicGroupProperties ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.GroupInfo createdGroup = gApi.groups ( ) . create ( name ( "group" ) ) . get ( ) ; try ( com.google.gerrit.acceptance.api.group.GroupRebuilderIT.BlockReviewDbUpdatesForGroups ctx = new com.google.gerrit.acceptance.api.group.GroupRebuilderIT.BlockReviewDbUpdatesForGroups ( ) ) { com.google.gerrit.server.group.db.GroupBundle reviewDbBundle = bundleFactory.fromReviewDb ( db , new com.google.gerrit.reviewdb.client.AccountGroup.Id ( createdGroup.groupId ) ) ; deleteGroupRefs ( reviewDbBundle ) ; com.google.common.truth.Truth.assertThat ( rebuild ( reviewDbBundle ) ) . isEqualTo ( reviewDbBundle.roundToSecond ( ) ) ; } }

Target:
public void basicGroupProperties ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.GroupInfo createdGroup = gApi.groups ( ) . create ( name ( "group" ) ) . get ( ) ; try ( com.google.gerrit.acceptance.api.group.GroupRebuilderIT.BlockReviewDbUpdatesForGroups ctx = new com.google.gerrit.acceptance.api.group.GroupRebuilderIT.BlockReviewDbUpdatesForGroups ( ) ) { com.google.gerrit.server.group.db.GroupBundle reviewDbBundle = bundleFactory.fromReviewDb ( db , new com.google.gerrit.reviewdb.client.AccountGroup.Id ( createdGroup.groupId ) ) ; deleteGroupRefs ( reviewDbBundle ) ; com.google.common.truth.Truth.assertThat ( rebuild ( reviewDbBundle ) ) . isEqualTo ( reviewDbBundle.truncateToSecond ( ) ) ; } }
Source:
private java.lang.String getPullUrl ( ) { final java.lang.String host = getSshHost ( ) ; if ( host == null ) { return "" ; } final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "git pull ssh://" ) ; r.append ( host ) ; r.append ( "/" ) ; r.append ( projectName ) ; r.append ( " " ) ; r.append ( patchSet.getRefName ( ) ) ; return r.toString ( ) ; }

Target:
public java.util.List < java.lang.String > getReviewerNames ( ) { if ( reviewers.isEmpty ( ) ) { return null ; } java.util.List < java.lang.String > names = new java.util.ArrayList < java.lang.String > ( ) ; for ( com.google.gerrit.reviewdb.Account.Id id : reviewers ) { names.add ( getNameFor ( id ) ) ; } return names ; }
Source:
public com.google.gerrit.server.notedb.ChangeNotes createChecked ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( changeId ) ; if ( ( change == null ) || ( ! ( change.getProject ( ) . equals ( project ) ) ) ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } return new com.google.gerrit.server.notedb.ChangeNotes ( args , change ) . load ( ) ; }

Target:
public static com.google.gerrit.reviewdb.client.Change readOneReviewDbChange ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change.Id id ) throws com.google.gwtorm.server.OrmException { return com.google.gerrit.server.notedb.ChangeNotes.checkNoteDbState ( com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( id ) ) ; }
Source:
public void run ( ) { ui.header ( "Git Repositories" ) ; java.io.File d = gerrit.path ( "Location of Git repositories" , "basePath" , "git" ) ; if ( d == null ) { throw com.google.gerrit.pgm.init.InitUtil.die ( "gerrit.basePath is required" ) ; } if ( ( ! ( d.exists ( ) ) ) && ( ! ( d.mkdirs ( ) ) ) ) { throw com.google.gerrit.pgm.init.InitUtil.die ( ( "Cannot create " + d ) ) ; } }

Target:
public void run ( ) { ui.header ( "Git Repositories" ) ; java.nio.file.Path d = gerrit.path ( "Location of Git repositories" , "basePath" , "git" ) ; if ( d == null ) { throw com.google.gerrit.pgm.init.api.InitUtil.die ( "gerrit.basePath is required" ) ; } com.google.gerrit.common.FileUtil.mkdirsOrDie ( d , "Cannot create" ) ; }
Source:
public void testReplaceInOrder1 ( ) { final com.google.gwtexpui.safehtml.client.RawFindReplace [ ] repl = new com.google.gwtexpui.safehtml.client.RawFindReplace [ ] { new com.google.gwtexpui.safehtml.client.RawFindReplace ( "(GWTEXPUI-(\\d+))" , "<a href=\"gwtexpui-bug?$2\">$1</a>" ) , new com.google.gwtexpui.safehtml.client.RawFindReplace ( "(issue\\s+(\\d+))" , "<a href=\"generic-bug?$2\">$1</a>" ) } ; final com.google.gwtexpui.safehtml.client.SafeHtml o = com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.html ( "A\nissue 42\nReally GWTEXPUI-9918 is better\nB" ) ; final com.google.gwtexpui.safehtml.client.SafeHtml n = o.replaceAll ( java.util.Arrays.asList ( repl ) ) ; assertNotSame ( o , n ) ; assertEquals ( ( "A\n" + ( ( "<a href=\"generic-bug?42\">issue 42</a>\n" + "Really <a href=\"gwtexpui-bug?9918\">GWTEXPUI-9918</a> is better\n" ) + "B" ) ) , n.asString ( ) ) ; }

Target:
public void testReplaceInOrder ( ) { com.google.gwtexpui.safehtml.client.SafeHtml o = com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.html ( "A\nissue 42\nReally GWTEXPUI-9918 is better\nB" ) ; com.google.gwtexpui.safehtml.client.SafeHtml n = o.replaceAll ( com.google.gwtexpui.safehtml.client.SafeHtml_ReplaceTest.repls ( new com.google.gwtexpui.safehtml.client.RegexFindReplace ( "(GWTEXPUI-(\\d+))" , "<a href=\"gwtexpui-bug?$2\">$1</a>" ) , new com.google.gwtexpui.safehtml.client.RegexFindReplace ( "(issue\\s+(\\d+))" , "<a href=\"generic-bug?$2\">$1</a>" ) ) ) ; assertNotSame ( o , n ) ; assertEquals ( ( "A\n" + ( ( "<a href=\"generic-bug?42\">issue 42</a>\n" + "Really <a href=\"gwtexpui-bug?9918\">GWTEXPUI-9918</a> is better\n" ) + "B" ) ) , n.asString ( ) ) ; }
Source:
public void testUSER_NullUser ( ) { setFrom ( "USER" ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( null ) ; org.junit.Assert.assertNotNull ( r ) ; org.junit.Assert.assertEquals ( ident.getName ( ) , r.name ) ; org.junit.Assert.assertEquals ( ident.getEmailAddress ( ) , r.email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }

Target:
public void testUSER_NullUser ( ) { setFrom ( "USER" ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( null ) ; com.google.common.truth.Truth.assertThat ( r ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( r.name ) . isEqualTo ( ident.getName ( ) ) ; com.google.common.truth.Truth.assertThat ( r.email ) . isEqualTo ( ident.getEmailAddress ( ) ) ; org.easymock.EasyMock.verify ( accountCache ) ; }
Source:
public com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > read ( ) throws com.google.gwtorm.server.OrmException { java.lang.Thread.currentThread ( ) . interrupt ( ) ; HEAD ( 880 ) ; com.google.gerrit.lucene.a9b Merge ; }

Target:
public com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > read ( ) throws com.google.gwtorm.server.OrmException { if ( java.lang.Thread.interrupted ( ) ) { java.lang.Thread.currentThread ( ) . interrupt ( ) ; throw new com.google.gwtorm.server.OrmException ( "interrupted" ) ; } final java.util.Set < java.lang.String > fields = fields ( opts ) ; return new com.google.gerrit.lucene.LuceneChangeIndex.ChangeDataResults ( executor.submit ( new java.util.concurrent.Callable < java.util.List < org.apache.lucene.document.Document > > ( ) { @ java.lang.Override public java.util.List < org.apache.lucene.document.Document > call ( ) throws java.io.IOException { return doRead ( fields ) ; } } ) , fields ) ; }
Source:
public void doFilter ( javax.servlet.ServletRequest request , javax.servlet.ServletResponse res , javax.servlet.FilterChain chain ) throws java.io.IOException , javax.servlet.ServletException { java.lang.String pkg = "gerrit-gwtui" ; java.lang.String target = "ui_" + ( rule.select ( ( ( javax.servlet.http.HttpServletRequest ) ( request ) ) ) ) ; java.lang.String rule = ( ( "//" + pkg ) + ":" ) + target ; java.lang.String child = java.lang.String.format ( "%s/__gwt_binary_%s__" , pkg , target ) ; java.io.File zip = new java.io.File ( new java.io.File ( gen , child ) , ( target + ".zip" ) ) ; synchronized ( this ) { try { com.google.gerrit.pgm.http.jetty.JettyServer.build ( root , gen , rule ) ; } catch ( com.google.gerrit.pgm.http.jetty.JettyServer.BuildFailureException e ) { displayFailure ( rule , e.why , ( ( javax.servlet.http.HttpServletResponse ) ( res ) ) ) ; return ; } if ( ( ! ( target.equals ( lastTarget ) ) ) || ( ( lastTime ) != ( zip.lastModified ( ) ) ) ) { lastTarget = target ; lastTime = zip.lastModified ( ) ; com.google.gerrit.pgm.http.jetty.JettyServer.unpack ( zip , dstwar ) ; } } chain.doFilter ( request , res ) ; }

Target:
public void doFilter ( javax.servlet.ServletRequest request , javax.servlet.ServletResponse res , javax.servlet.FilterChain chain ) throws java.io.IOException , javax.servlet.ServletException { java.lang.String pkg = "gerrit-gwtui" ; java.lang.String target = "ui_" + ( rule.select ( ( ( javax.servlet.http.HttpServletRequest ) ( request ) ) ) ) ; if ( ( gwtuiRecompile ) || ( ! ( uaInitialized.contains ( target ) ) ) ) { java.lang.String rule = ( ( "//" + pkg ) + ":" ) + target ; java.lang.String child = java.lang.String.format ( "%s/__gwt_binary_%s__" , pkg , target ) ; java.io.File zip = new java.io.File ( new java.io.File ( gen , child ) , ( target + ".zip" ) ) ; synchronized ( this ) { try { com.google.gerrit.pgm.http.jetty.JettyServer.build ( root , gen , rule ) ; } catch ( com.google.gerrit.pgm.http.jetty.JettyServer.BuildFailureException e ) { displayFailure ( rule , e.why , ( ( javax.servlet.http.HttpServletResponse ) ( res ) ) ) ; return ; } if ( ( ! ( target.equals ( lastTarget ) ) ) || ( ( lastTime ) != ( zip.lastModified ( ) ) ) ) { lastTarget = target ; lastTime = zip.lastModified ( ) ; com.google.gerrit.pgm.http.jetty.JettyServer.unpack ( zip , dstwar ) ; } } uaInitialized.add ( target ) ; } chain.doFilter ( request , res ) ; }
Source:
private void setOpen ( boolean open ) { com.google.gwt.user.client.ui.UIObject.setVisible ( summary , ( ! open ) ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( contentPanel , open ) ; }

Target:
private void setOpen ( boolean open ) { if ( open ) { removeStyleName ( style.close ( ) ) ; addStyleName ( style.open ( ) ) ; } else { removeStyleName ( style.open ( ) ) ; addStyleName ( style.close ( ) ) ; } }
Source:
protected void preInvoke ( final com.google.gerrit.server.GerritCall call ) { super . preInvoke ( call ) ; if ( ( ( ! ( call.isComplete ( ) ) ) && ( ( call.getMethod ( ) . getAnnotation ( com.google.gerrit.client.rpc.SignInRequired.class ) ) != null ) ) && ( ( call.getAccountId ( ) ) == null ) ) { call.onFailure ( new com.google.gerrit.client.rpc.NotSignedInException ( ) ) ; } }

Target:
protected void preInvoke ( final com.google.gerrit.server.GerritCall call ) { super . preInvoke ( call ) ; if ( call.isComplete ( ) ) { return ; } if ( ( call.getMethod ( ) . getAnnotation ( com.google.gerrit.client.rpc.SignInRequired.class ) ) != null ) { if ( ! ( call.requireXsrfValid ( ) ) ) { return ; } if ( ( call.getAccountId ( ) ) == null ) { call.onFailure ( new com.google.gerrit.client.rpc.NotSignedInException ( ) ) ; return ; } } }
Source:
private static java.lang.String extractName ( javax.servlet.http.HttpServletRequest req ) { java.lang.String path = req.getPathInfo ( ) ; if ( ( com.google.common.base.Strings.isNullOrEmpty ( path ) ) || ( "/" . equals ( path ) ) ) { return "" ; } int s = path.indexOf ( '/' , 1 ) ; return 0 <= s ? path.substring ( 1 , s ) : path.substring ( 1 ) ; }

Target:
private static boolean isApiCall ( javax.servlet.http.HttpServletRequest req , java.util.List < java.lang.String > parts ) { java.lang.String method = req.getMethod ( ) ; int cnt = parts.size ( ) ; return ( ( cnt == 0 ) || ( ( cnt == 1 ) && ( ( "PUT" . equals ( method ) ) || ( "DELETE" . equals ( method ) ) ) ) ) || ( ( cnt == 2 ) && ( parts.get ( 1 ) . startsWith ( "gerrit~" ) ) ) ; }
Source:
public void testPushForMasterWithTopic ( ) throws java.lang.Exception { java.lang.String topic = "my/topic" ; com.google.gerrit.acceptance.PushOneCommit.Result r = pushTo ( ( "refs/for/master/" + topic ) ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.NEW , topic ) ; r = pushTo ( ( "refs/for/master%topic=" + topic ) ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.NEW , topic ) ; }

Target:
public void pushForMasterWithTopic ( ) throws java.lang.Exception { java.lang.String topic = "my/topic" ; com.google.gerrit.acceptance.PushOneCommit.Result r = pushTo ( ( "refs/for/master/" + topic ) ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.NEW , topic ) ; r = pushTo ( ( "refs/for/master%topic=" + topic ) ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.NEW , topic ) ; }
Source:
private void refresh ( ) { Util.ACCOUNT_SEC.myExternalIds ( new com.google.gerrit.client.rpc.GerritCallback < java.util.List < com.google.gerrit.reviewdb.AccountExternalId > > ( ) { public void onSuccess ( final java.util.List < com.google.gerrit.reviewdb.AccountExternalId > result ) { identites.display ( result ) ; } } ) ; }

Target:
protected void onLoad ( ) { super . onLoad ( ) ; Util.ACCOUNT_SEC.myExternalIds ( new com.google.gerrit.client.rpc.GerritCallback < java.util.List < com.google.gerrit.reviewdb.AccountExternalId > > ( ) { public void onSuccess ( final java.util.List < com.google.gerrit.reviewdb.AccountExternalId > result ) { identites.display ( result ) ; } } ) ; }
Source:
public com.googlecode.prolog_cafe.lang.Operation exec ( com.googlecode.prolog_cafe.lang.Prolog engine ) throws com.googlecode.prolog_cafe.lang.PrologException { engine.setB0 ( ) ; com.googlecode.prolog_cafe.lang.Term a1 = arg1.dereference ( ) ; com.google.gerrit.reviewdb.client.Change change = StoredValues.CHANGE.get ( engine ) ; com.google.gerrit.reviewdb.client.Account.Id ownerId = change.getOwner ( ) ; if ( ! ( a1.unify ( new com.googlecode.prolog_cafe.lang.StructureTerm ( gerrit.PRED_change_owner_1.user , new com.googlecode.prolog_cafe.lang.IntegerTerm ( ownerId.get ( ) ) ) , engine.trail ) ) ) { return engine.fail ( ) ; } return cont ; }

Target:
public com.googlecode.prolog_cafe.lang.Operation exec ( com.googlecode.prolog_cafe.lang.Prolog engine ) throws com.googlecode.prolog_cafe.lang.PrologException { engine.setB0 ( ) ; com.googlecode.prolog_cafe.lang.Term a1 = arg1.dereference ( ) ; com.google.gerrit.reviewdb.client.Change change = StoredValues.CHANGE_DATA.get ( engine ) . getChange ( ) ; com.google.gerrit.reviewdb.client.Account.Id ownerId = change.getOwner ( ) ; if ( ! ( a1.unify ( new com.googlecode.prolog_cafe.lang.StructureTerm ( gerrit.PRED_change_owner_1.user , new com.googlecode.prolog_cafe.lang.IntegerTerm ( ownerId.get ( ) ) ) , engine.trail ) ) ) { return engine.fail ( ) ; } return cont ; }
Source:
public void testCreateProjectHttpWithNameMismatch_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = "otherName" ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( "/projects/someName" , in ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_BAD_REQUEST ) ; }

Target:
public void testCreateProjectHttpWithNameMismatch_BadRequest ( ) throws java.lang.Exception { com.google.gerrit.extensions.api.projects.ProjectInput in = new com.google.gerrit.extensions.api.projects.ProjectInput ( ) ; in.name = name ( "otherName" ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( "/projects/" + ( name ( "someName" ) ) ) , in ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_BAD_REQUEST ) ; }
Source:
public java.lang.String getLine ( final int i ) { final int s = lines.get ( ( i + 1 ) ) ; int e = lines.get ( ( i + 2 ) ) ; if ( ( content [ ( e - 1 ) ] ) == '\n' ) { e -- ; } return org.eclipse.jgit.util.RawParseUtils.decode ( Constants.CHARSET , content , s , e ) ; }

Target:
private java.lang.String decode ( final int s , int e ) { if ( ( charset ) == null ) { charset = com.google.gerrit.server.patch.Text.charset ( content , null ) ; } return org.eclipse.jgit.util.RawParseUtils.decode ( charset , content , s , e ) ; }
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { if ( ( ( action.confirmation_message ( ) ) != null ) && ( ! ( action.confirmation_message ( ) . isEmpty ( ) ) ) ) { new com.google.gerrit.client.ConfirmationDialog ( action.title ( ) , new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( action.confirmation_message ( ) ) , new com.google.gerrit.client.ConfirmationCallback ( ) { @ java.lang.Override public void onOk ( ) { send ( ) ; } } ) . center ( ) ; } else { send ( ) ; } }

Target:
public void onSuccess ( com.google.gerrit.client.rpc.NativeString msg ) { setEnabled ( true ) ; if ( ( msg != null ) && ( ! ( msg.asString ( ) . isEmpty ( ) ) ) ) { com.google.gwt.user.client.Window.alert ( msg.asString ( ) ) ; } com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange2 ( changeId ) ) ; }
Source:
private void assertReviewers ( com.google.gerrit.reviewdb.client.Change c , com.google.gerrit.acceptance.TestAccount ... expectedReviewers ) throws com.google.gwtorm.server.OrmException { java.lang.Iterable < com.google.gerrit.reviewdb.client.Account.Id > actualIds = approvalsUtil.getReviewers ( db , notesFactory.createChecked ( db , c ) ) . all ( ) ; com.google.common.truth.Truth.assertThat ( actualIds ) . containsExactlyElementsIn ( com.google.common.collect.Sets.newHashSet ( com.google.gerrit.acceptance.TestAccount.ids ( expectedReviewers ) ) ) ; }

Target:
private void assertReviewers ( com.google.gerrit.reviewdb.client.Change c , com.google.gerrit.server.notedb.ReviewerStateInternal state , java.util.List < com.google.gerrit.acceptance.TestAccount > expectedReviewers ) throws com.google.gwtorm.server.OrmException { java.lang.Iterable < com.google.gerrit.reviewdb.client.Account.Id > actualIds = approvalsUtil.getReviewers ( db , notesFactory.createChecked ( db , c ) ) . byState ( state ) ; com.google.common.truth.Truth.assertThat ( actualIds ) . containsExactlyElementsIn ( com.google.common.collect.Sets.newHashSet ( com.google.gerrit.acceptance.TestAccount.ids ( expectedReviewers ) ) ) ; }
Source:
public java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > getOwners ( ) { com.google.gerrit.reviewdb.client.Project.NameKey parentName = getProject ( ) . getParent ( ) ; if ( ( ( ! ( localOwners.isEmpty ( ) ) ) || ( parentName == null ) ) || ( isAllProjects ) ) { return localOwners ; } com.google.gerrit.server.project.ProjectState parent = projectCache.get ( parentName ) ; if ( parent != null ) { return parent.getOwners ( ) ; } return java.util.Collections.emptySet ( ) ; }

Target:
public java.lang.Iterable < com.google.gerrit.server.project.ProjectState > parents ( ) { return com.google.common.collect.Iterables.skip ( tree ( ) , 1 ) ; }
Source:
public void doPut ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { if ( ! ( isValidFile ( req ) ) ) { res.setStatus ( HttpServletResponse.SC_FORBIDDEN ) ; return ; } if ( isGerritConfig ( req ) ) { writeFileAndFireAuditEvent ( req , res ) ; } else { writeFile ( req , res ) ; } }

Target:
public void doGet ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { if ( ! ( isValidPath ( req ) ) ) { res.setStatus ( HttpServletResponse.SC_FORBIDDEN ) ; return ; } streamFile ( req , res ) ; }
Source:
private static com.google.gerrit.client.reviewdb.Account one ( final com.google.gwtorm.client.ResultSet < com.google.gerrit.client.reviewdb.Account > rs ) { final java.util.List < com.google.gerrit.client.reviewdb.Account > r = rs.toList ( ) ; return ( r.size ( ) ) == 1 ? r.get ( 0 ) : null ; }

Target:
private static com.google.gerrit.client.reviewdb.Account findByEmail ( final com.google.gerrit.client.reviewdb.ReviewDb db , final java.lang.String email ) throws com.google.gwtorm.client.OrmException { com.google.gerrit.client.reviewdb.Account a = com.google.gerrit.client.reviewdb.Account.oneAccount ( db.accounts ( ) . byPreferredEmail ( email ) ) ; if ( a == null ) { a = com.google.gerrit.client.reviewdb.Account.oneAccountExternalId ( db.accountExternalIds ( ) . byEmailAddress ( email ) ) ; } return a ; }
Source:
void removeDraft ( com.google.gerrit.common.changes.Side side , int line ) { net.codemirror.lib.CodeMirror.LineHandle handle = getCmFromSide ( side ) . getLineHandle ( line ) ; lineActiveBoxMap.remove ( handle ) ; if ( lineLastPublishedBoxMap.containsKey ( handle ) ) { lineActiveBoxMap.put ( handle , lineLastPublishedBoxMap.get ( handle ) ) ; } }

Target:
void removeDraft ( com.google.gerrit.client.diff.DraftBox box , com.google.gerrit.common.changes.Side side , int line ) { net.codemirror.lib.CodeMirror.LineHandle handle = getCmFromSide ( side ) . getLineHandle ( line ) ; lineActiveBoxMap.remove ( handle ) ; if ( lineLastPublishedBoxMap.containsKey ( handle ) ) { lineActiveBoxMap.put ( handle , lineLastPublishedBoxMap.get ( handle ) ) ; } allBoxes.remove ( box ) ; }
Source:
public static java.lang.String loginRedirect ( java.lang.String token ) { if ( token == null ) { token = "" ; } else if ( token.startsWith ( "/" ) ) { token = token.substring ( 1 ) ; } return com.google.gerrit.client.Gerrit.selfRedirect ( ( "/login/" + token ) ) ; }

Target:
public static java.lang.String loginRedirect ( java.lang.String token ) { if ( token == null ) { token = "" ; } else if ( token.startsWith ( "/" ) ) { token = token.substring ( 1 ) ; } return ( com.google.gerrit.client.Gerrit.selfRedirect ( "login/" ) ) + ( com.google.gwt.http.client.URL.encodePathSegment ( ( "#/" + token ) ) ) ; }
Source:
void setFocus ( final boolean take ) { if ( text.isVisible ( ) ) { text.setFocus ( take ) ; } else if ( take ) { edit ( ) ; } }

Target:
void setFocus ( final boolean take ) { if ( take && ( ! ( isOpen ( ) ) ) ) { setOpen ( true ) ; } if ( text.isVisible ( ) ) { text.setFocus ( take ) ; } else if ( take ) { edit ( ) ; } }
Source:
public void moveChange_shortRef ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.reviewdb.client.Branch.NameKey newBranch = new com.google.gerrit.reviewdb.client.Branch.NameKey ( r.getChange ( ) . change ( ) . getProject ( ) , "moveTest" ) ; createBranch ( newBranch ) ; move ( r.getChangeId ( ) , newBranch.getShortName ( ) ) ; com.google.common.truth.Truth.assertThat ( r.getChange ( ) . change ( ) . getDest ( ) ) . isEqualTo ( newBranch ) ; }

Target:
public void moveChangeWithShortRef ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.reviewdb.client.Branch.NameKey newBranch = new com.google.gerrit.reviewdb.client.Branch.NameKey ( r.getChange ( ) . change ( ) . getProject ( ) , "moveTest" ) ; createBranch ( newBranch ) ; move ( r.getChangeId ( ) , newBranch.getShortName ( ) ) ; com.google.common.truth.Truth.assertThat ( r.getChange ( ) . change ( ) . getDest ( ) ) . isEqualTo ( newBranch ) ; }
Source:
private AccountGroup.Id owner ( com.google.gerrit.extensions.api.groups.GroupInput input ) throws com.google.gerrit.extensions.restapi.UnprocessableEntityException { if ( ( input.ownerId ) != null ) { com.google.gerrit.common.data.GroupDescription.Basic d = groups.parseInternal ( com.google.gerrit.extensions.restapi.Url.decode ( input.ownerId ) ) ; return com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( d ) . getId ( ) ; } return null ; }

Target:
private AccountGroup.Id owner ( com.google.gerrit.extensions.api.groups.GroupInput input ) throws com.google.gerrit.extensions.restapi.UnprocessableEntityException { if ( ( input.ownerId ) != null ) { com.google.gerrit.common.data.GroupDescription.Internal d = groups.parseInternal ( com.google.gerrit.extensions.restapi.Url.decode ( input.ownerId ) ) ; return d.getId ( ) ; } return null ; }
Source:
public void testVerifyAuthInfo ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.lfs.AuthInfo info = auth.generateAuthInfo ( "o" , org.eclipse.jgit.lfs.lib.LongObjectId.zeroId ( ) , 1 ) ; com.google.common.truth.Truth.assertThat ( auth.verifyAuthInfo ( info.authToken , "o" , org.eclipse.jgit.lfs.lib.LongObjectId.zeroId ( ) ) ) . isTrue ( ) ; }

Target:
public void testVerifyAuthInfo ( ) throws java.lang.Exception { com.googlesource.gerrit.plugins.lfs.AuthInfo info = auth.generateAuthInfo ( "o" , org.eclipse.jgit.lfs.lib.LongObjectId.zeroId ( ) , java.time.Instant.now ( ) , 1L ) ; com.google.common.truth.Truth.assertThat ( auth.verifyAuthInfo ( info.authToken ( ) , "o" , org.eclipse.jgit.lfs.lib.LongObjectId.zeroId ( ) ) ) . isTrue ( ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.VoidResult result ) { for ( int row = 1 ; row < ( table.getRowCount ( ) ) ; ) { com.google.gerrit.client.projects.BranchInfo k = getRowItem ( row ) ; if ( ( k != null ) && ( branches.contains ( k.ref ( ) ) ) ) { table.removeRow ( row ) ; } else { row ++ ; } } updateDeleteButton ( ) ; delBranch.setVisible ( branchTable.hasBranchCanDelete ( ) ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.VoidResult result ) { query = new com.google.gerrit.client.admin.ProjectBranchesScreen.Query ( match ) . start ( start ) . run ( ) ; }
Source:
public void testCannotUploadToAnyRef ( ) { 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 ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/for/refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local ) ; org.junit.Assert.assertFalse ( "cannot upload" , ( ( u.canPushToAtLeastOneRef ( ) ) == ( com.google.gerrit.common.data.Capable.OK ) ) ) ; org.junit.Assert.assertFalse ( "cannot upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; }

Target:
public void testCannotUploadToAnyRef ( ) { 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 ( local , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/for/refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local ) ; assertCannotUpload ( u ) ; assertCannotUpload ( "refs/heads/master" , u ) ; }
Source:
public com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > byChange ( com.google.gerrit.reviewdb.client.Change change ) throws com.google.gerrit.extensions.restapi.AuthException , java.io.IOException { com.google.gerrit.server.CurrentUser currentUser = user.get ( ) ; if ( ! ( currentUser.isIdentifiedUser ( ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "Authentication required" ) ; } return byChange ( change , ( ( com.google.gerrit.server.IdentifiedUser ) ( currentUser ) ) ) ; }

Target:
public com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > byChange ( com.google.gerrit.reviewdb.client.Change change ) throws com.google.gerrit.extensions.restapi.AuthException , java.io.IOException { com.google.gerrit.server.CurrentUser currentUser = user.get ( ) ; if ( ! ( currentUser.isIdentifiedUser ( ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "Authentication required" ) ; } return byChange ( change , currentUser.asIdentifiedUser ( ) ) ; }
Source:
private void updateSubmissionId ( com.google.gerrit.reviewdb.client.Change change ) { com.google.common.hash.Hasher h = com.google.common.hash.Hashing.sha1 ( ) . newHasher ( ) ; h.putLong ( java.lang.Thread.currentThread ( ) . getId ( ) ) . putUnencodedChars ( com.google.gerrit.server.git.MergeOp.MACHINE_ID ) ; ts = com.google.gerrit.common.TimeUtil.nowTs ( ) ; submissionId = ( ( ( ( change.getId ( ) . get ( ) ) + "-" ) + ( ts.getTime ( ) ) ) + "-" ) + ( h.hash ( ) . toString ( ) . substring ( 0 , 8 ) ) ; }

Target:
public com.google.gerrit.server.git.MergeOpRepoManager getMergeOpRepoManager ( ) { return orm ; }
Source:
public com.google.gerrit.server.account.AccountState get ( com.google.gerrit.reviewdb.client.Account.Id accountId ) { try { return byId.get ( accountId ) . orElse ( missing ( accountId ) ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.gerrit.server.account.AccountCacheImpl.log.warn ( ( "Cannot load AccountState for " + accountId ) , e ) ; return missing ( accountId ) ; } }

Target:
public com.google.gerrit.server.account.AccountState getEvenIfMissing ( com.google.gerrit.reviewdb.client.Account.Id accountId ) { try { return byId.get ( accountId ) . orElse ( missing ( accountId ) ) ; } catch ( java.util.concurrent.ExecutionException e ) { com.google.gerrit.server.account.AccountCacheImpl.log.warn ( ( "Cannot load AccountState for " + accountId ) , e ) ; return missing ( accountId ) ; } }
Source:
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 ) ; }

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 ( "create not permitted" ) ; tag ( input.ref ) . create ( input ) ; }
Source:
protected void configure ( ) { bind ( GitilesAccess.Factory.class ) . to ( GerritGitilesAccess.Factory.class ) ; bind ( new com.google.inject.TypeLiteral < org.eclipse.jgit.transport.resolver.RepositoryResolver < javax.servlet.http.HttpServletRequest > > ( ) { } ) . to ( com.googlesource.gerrit.plugins.gitiles.Resolver.class ) ; bind ( com.google.gerrit.server.config.AllProjectsName.class ) . toProvider ( com.google.gerrit.server.config.AllProjectsNameProvider.class ) ; }

Target:
protected void configure ( ) { bind ( GitilesAccess.Factory.class ) . to ( GerritGitilesAccess.Factory.class ) ; bind ( new com.google.inject.TypeLiteral < org.eclipse.jgit.transport.resolver.RepositoryResolver < javax.servlet.http.HttpServletRequest > > ( ) { } ) . to ( com.googlesource.gerrit.plugins.gitiles.Resolver.class ) ; bind ( com.google.gerrit.server.config.AllProjectsName.class ) . toProvider ( com.google.gerrit.server.config.AllProjectsNameProvider.class ) ; listener ( ) . to ( com.googlesource.gerrit.plugins.gitiles.Module.Lifecycle.class ) ; }
Source:
private static java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > addCommentsInFile ( java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > commentsOnFile , java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > allComments , java.lang.String file ) { for ( com.google.gerrit.reviewdb.client.PatchLineComment c : allComments ) { java.lang.String currentFilename = c.getKey ( ) . getParentKey ( ) . getFileName ( ) ; if ( currentFilename.equals ( file ) ) { commentsOnFile.add ( c ) ; } } return commentsOnFile ; }

Target:
private static java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > addCommentsOnFile ( java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > commentsOnFile , java.util.Collection < com.google.gerrit.reviewdb.client.PatchLineComment > allComments , java.lang.String file ) { for ( com.google.gerrit.reviewdb.client.PatchLineComment c : allComments ) { java.lang.String currentFilename = c.getKey ( ) . getParentKey ( ) . getFileName ( ) ; if ( currentFilename.equals ( file ) ) { commentsOnFile.add ( c ) ; } } return commentsOnFile ; }
Source:
private java.util.Map < com.google.gerrit.reviewdb.client.AccountGroup.UUID , com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid > getIncludedGroups ( final com.google.gerrit.reviewdb.client.AccountGroup.Id groupId ) throws com.google.gwtorm.server.OrmException { final java.util.Map < com.google.gerrit.reviewdb.client.AccountGroup.UUID , com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid > groups = com.google.common.collect.Maps.newHashMap ( ) ; for ( final com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid g : db.accountGroupIncludesByUuid ( ) . byGroup ( groupId ) ) { groups.put ( g.getIncludeUUID ( ) , g ) ; } return groups ; }

Target:
private java.util.Map < com.google.gerrit.reviewdb.client.AccountGroup.UUID , com.google.gerrit.reviewdb.client.AccountGroupById > getIncludedGroups ( final com.google.gerrit.reviewdb.client.AccountGroup.Id groupId ) throws com.google.gwtorm.server.OrmException { final java.util.Map < com.google.gerrit.reviewdb.client.AccountGroup.UUID , com.google.gerrit.reviewdb.client.AccountGroupById > groups = com.google.common.collect.Maps.newHashMap ( ) ; for ( final com.google.gerrit.reviewdb.client.AccountGroupById g : db.accountGroupById ( ) . byGroup ( groupId ) ) { groups.put ( g.getIncludeUUID ( ) , g ) ; } return groups ; }
Source:
private boolean markKeyInvalid ( int seq ) { checkLoaded ( ) ; com.google.gerrit.reviewdb.client.AccountSshKey key = getKey ( seq ) ; if ( ( key != null ) && ( key.isValid ( ) ) ) { key.setInvalid ( ) ; return true ; } return false ; }

Target:
private boolean markKeyInvalid ( int seq ) { checkLoaded ( ) ; com.google.gerrit.server.account.AccountSshKey key = getKey ( seq ) ; if ( ( key != null ) && ( key.isValid ( ) ) ) { key.setInvalid ( ) ; return true ; } return false ; }
Source:
private void initEditMode ( ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { editMode.setVisible ( ( ( fileTableMode ) == ( FileTable.Mode.REVIEW ) ) ) ; reviewMode.setVisible ( ( ! ( editMode.isVisible ( ) ) ) ) ; } }

Target:
private void initEditMode ( com.google.gerrit.client.changes.ChangeInfo info ) { if ( ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) && ( ( info.status ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) ) { editMode.setVisible ( ( ( fileTableMode ) == ( FileTable.Mode.REVIEW ) ) ) ; reviewMode.setVisible ( ( ! ( editMode.isVisible ( ) ) ) ) ; } }
Source:
private java.util.List < org.eclipse.jgit.dircache.DirCacheEditor.PathEdit > getPathEdits ( org.eclipse.jgit.lib.Repository repository ) throws java.io.IOException { java.util.List < org.eclipse.jgit.dircache.DirCacheEditor.PathEdit > pathEdits = new java.util.LinkedList < > ( ) ; for ( com.google.gerrit.server.edit.tree.TreeModification treeModification : treeModifications ) { pathEdits.addAll ( treeModification.getPathEdits ( repository ) ) ; } return pathEdits ; }

Target:
private java.util.List < org.eclipse.jgit.dircache.DirCacheEditor.PathEdit > getPathEdits ( org.eclipse.jgit.lib.Repository repository ) throws java.io.IOException { java.util.List < org.eclipse.jgit.dircache.DirCacheEditor.PathEdit > pathEdits = new java.util.LinkedList < > ( ) ; for ( com.google.gerrit.server.edit.tree.TreeModification treeModification : treeModifications ) { pathEdits.addAll ( treeModification.getPathEdits ( repository , baseCommit ) ) ; } return pathEdits ; }
Source:
public void onResize ( com.google.gwt.event.logical.shared.ResizeEvent event ) { resizeCodeMirror ( ) ; }

Target:
public void onSuccess ( java.lang.Void result ) { if ( prefs.syntaxHighlighting ( ) ) { cmA.setOption ( "mode" , getContentType ( diff.meta_a ( ) ) ) ; cmB.setOption ( "mode" , getContentType ( diff.meta_b ( ) ) ) ; } }
Source:
private ReviewInput.CommentInput newCommentInfo ( java.lang.String path , com.google.gerrit.extensions.client.Side side , int line , java.lang.String message ) { com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput input = new com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput ( ) ; input.path = path ; input.side = side ; input.line = ( line != 0 ) ? line : null ; input.message = message ; if ( line != 0 ) { com.google.gerrit.extensions.client.Comment.Range range = new com.google.gerrit.extensions.client.Comment.Range ( ) ; range.startLine = 1 ; range.startCharacter = 1 ; range.endLine = 1 ; range.endCharacter = 5 ; input.range = range ; } return input ; }

Target:
private static < C extends com.google.gerrit.extensions.client.Comment > C populate ( C c , java.lang.String path , com.google.gerrit.extensions.client.Side side , int line , java.lang.String message ) { c.path = path ; c.side = side ; c.line = ( line != 0 ) ? line : null ; c.message = message ; if ( line != 0 ) { com.google.gerrit.extensions.client.Comment.Range range = new com.google.gerrit.extensions.client.Comment.Range ( ) ; range.startLine = 1 ; range.startCharacter = 1 ; range.endLine = 1 ; range.endCharacter = 5 ; c.range = range ; } return c ; }
Source:
public void testDirCacheAltersId ( ) throws java.lang.Exception { assertEquals ( ( "a\n" + ( "\n" + "Change-Id: I7fc3876fee63c766a2063df97fbe04a2dddd8d7c\n" ) ) , call ( "a\n" ) ) ; final org.eclipse.jgit.dircache.DirCacheBuilder builder = org.eclipse.jgit.dircache.DirCache.lock ( repository ) . builder ( ) ; builder.add ( file ( "A" ) ) ; assertTrue ( builder.commit ( ) ) ; assertEquals ( ( "a\n" + ( "\n" + "Change-Id: If56597ea9759f23b070677ea6f064c60c38da631\n" ) ) , call ( "a\n" ) ) ; }

Target:
public void testDirCacheAltersId ( ) throws java.lang.Exception { assertEquals ( ( "a\n" + ( "\n" + "Change-Id: I7fc3876fee63c766a2063df97fbe04a2dddd8d7c\n" ) ) , call ( "a\n" ) ) ; final org.eclipse.jgit.dircache.DirCacheBuilder builder = repository.lockDirCache ( ) . builder ( ) ; builder.add ( file ( "A" ) ) ; assertTrue ( builder.commit ( ) ) ; assertEquals ( ( "a\n" + ( "\n" + "Change-Id: If56597ea9759f23b070677ea6f064c60c38da631\n" ) ) , call ( "a\n" ) ) ; }
Source:
private static java.lang.String format ( final com.google.gerrit.server.git.WorkQueue.Task.State state ) { switch ( state ) { case DONE : return "D" ; case CANCELLED : return "C" ; case RUNNING : return "R" ; case READY : return "W" ; case SLEEPING : return "S" ; default : return " " ; } }

Target:
private static java.lang.String format ( final com.google.gerrit.server.git.WorkQueue.Task.State state ) { switch ( state ) { case DONE : return "....... done" ; case CANCELLED : return "..... killed" ; case RUNNING : return "" ; case READY : return "waiting ...." ; case SLEEPING : return "sleeping" ; default : return state.toString ( ) ; } }
Source:
private java.util.List < java.lang.String > getOrganisations ( java.util.List < com.googlesource.gerrit.plugins.github.replication.Destination > destinations ) { java.util.ArrayList < java.lang.String > result = new java.util.ArrayList < > ( ) ; for ( com.googlesource.gerrit.plugins.github.replication.Destination destination : destinations ) { for ( org.eclipse.jgit.transport.URIish urish : destination.getRemote ( ) . getURIs ( ) ) { java.lang.String [ ] uriPathParts = urish.getPath ( ) . split ( "/" ) ; result.add ( uriPathParts [ 0 ] ) ; } } return result ; }

Target:
private java.util.List < java.lang.String > getOrganisations ( java.util.List < com.googlesource.gerrit.plugins.github.replication.Destination > destinations ) { java.util.ArrayList < java.lang.String > organisations = new java.util.ArrayList < > ( ) ; for ( com.googlesource.gerrit.plugins.github.replication.Destination destination : destinations ) { for ( org.eclipse.jgit.transport.URIish urish : destination.getRemote ( ) . getURIs ( ) ) { java.lang.String [ ] uriPathParts = urish.getPath ( ) . split ( "/" ) ; organisations.add ( uriPathParts [ 0 ] ) ; } } return organisations ; }
Source:
public void doPut ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { if ( ! ( isValidFile ( req ) ) ) { res.setStatus ( HttpServletResponse.SC_FORBIDDEN ) ; return ; } writeFile ( req , res ) ; }

Target:
public void doPut ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res ) throws java.io.IOException { if ( ! ( isValidFile ( req ) ) ) { res.setStatus ( HttpServletResponse.SC_FORBIDDEN ) ; return ; } if ( isGerritConfig ( req ) ) { writeFileAndFireAuditEvent ( req , res ) ; } else { writeFile ( req , res ) ; } }
Source:
private void ensureAuthenticated ( ) throws com.google.gerrit.extensions.restapi.AuthException { if ( ! ( currentUser.get ( ) . isIdentifiedUser ( ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "Authentication required" ) ; } }

Target:
private void assertCanEdit ( com.google.gerrit.server.project.ChangeControl changeControl ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.server.permissions.PermissionBackendException { if ( ! ( currentUser.get ( ) . isIdentifiedUser ( ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "Authentication required" ) ; } try { permissionBackend.user ( currentUser ) . database ( reviewDb ) . change ( changeControl.getNotes ( ) ) . check ( ChangePermission.ADD_PATCH_SET ) ; } catch ( com.google.gerrit.extensions.restapi.AuthException denied ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "edit not permitted" , denied ) ; } }
Source:
public static com.google.gerrit.client.changes.CommentInfo create ( java.lang.String path , com.google.gerrit.common.changes.Side side , int line , java.lang.String in_reply_to , java.lang.String message ) { com.google.gerrit.client.changes.CommentInfo info = createObject ( ) . cast ( ) ; info.setPath ( path ) ; info.setSide ( side ) ; info.setLine ( line ) ; info.setInReplyTo ( in_reply_to ) ; info.setMessage ( message ) ; return info ; }

Target:
public static com.google.gerrit.client.changes.CommentInfo createLine ( java.lang.String path , com.google.gerrit.common.changes.Side side , int line , java.lang.String in_reply_to , java.lang.String message ) { com.google.gerrit.client.changes.CommentInfo info = com.google.gerrit.client.changes.CommentInfo.createFile ( path , side , in_reply_to , message ) ; info.setLine ( line ) ; return info ; }
Source:
public com.google.gwtjsonrpc.client.VoidResult run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gerrit.httpd.rpc.account.Failure , com.google.gwtorm.server.OrmException { final com.google.gerrit.reviewdb.client.Account a = db.accounts ( ) . get ( getAccountId ( ) ) ; if ( a == null ) { throw new com.google.gerrit.httpd.rpc.account.Failure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; } a.setGeneralPreferences ( pref ) ; db.accounts ( ) . update ( java.util.Collections.singleton ( a ) ) ; accountCache.evict ( a.getId ( ) ) ; return com.google.gwtjsonrpc.client.VoidResult.INSTANCE ; }

Target:
public com.google.gwtjsonrpc.common.VoidResult run ( final com.google.gerrit.reviewdb.server.ReviewDb db ) throws com.google.gerrit.httpd.rpc.account.Failure , com.google.gwtorm.server.OrmException { final com.google.gerrit.reviewdb.client.Account a = db.accounts ( ) . get ( getAccountId ( ) ) ; if ( a == null ) { throw new com.google.gerrit.httpd.rpc.account.Failure ( new com.google.gerrit.common.errors.NoSuchEntityException ( ) ) ; } a.setGeneralPreferences ( pref ) ; db.accounts ( ) . update ( java.util.Collections.singleton ( a ) ) ; accountCache.evict ( a.getId ( ) ) ; return com.google.gwtjsonrpc.common.VoidResult.INSTANCE ; }
Source:
public void testUSER_NoPreferredEmailUser ( ) { setFrom ( "USER" ) ; final java.lang.String name = "A U. Thor" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( name , null ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; com.google.common.truth.Truth.assertThat ( r ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( r.name ) . isEqualTo ( name ) ; com.google.common.truth.Truth.assertThat ( r.email ) . isEqualTo ( ident.getEmailAddress ( ) ) ; org.easymock.EasyMock.verify ( accountCache ) ; }

Target:
public void testUSER_NoPreferredEmailUser ( ) { setFrom ( "USER" ) ; final java.lang.String name = "A U. Thor" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( name , null ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; com.google.common.truth.Truth.assertThat ( r ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( r.name ) . isEqualTo ( ( name + " (Code Review)" ) ) ; com.google.common.truth.Truth.assertThat ( r.email ) . isEqualTo ( ident.getEmailAddress ( ) ) ; org.easymock.EasyMock.verify ( accountCache ) ; }
Source:
public java.util.List < com.google.gerrit.server.project.ChangeControl > find ( com.google.gerrit.reviewdb.client.Change.Id id , com.google.gerrit.server.CurrentUser user ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.InternalChangeQuery query = queryProvider.get ( ) . setRequestedFields ( com.google.common.collect.ImmutableSet.< java.lang.String > of ( ) ) ; return asChangeControls ( query.byLegacyChangeId ( id ) , user ) ; }

Target:
public java.util.List < com.google.gerrit.server.project.ChangeControl > find ( com.google.gerrit.reviewdb.client.Change.Id id , com.google.gerrit.server.CurrentUser user ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.InternalChangeQuery query = queryProvider.get ( ) . noFields ( ) ; return asChangeControls ( query.byLegacyChangeId ( id ) , user ) ; }
Source:
protected void run ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure { try { if ( versionManager.activateLatestIndex ( name ) ) { stdout.println ( "Activated latest index version" ) ; } else { stdout.println ( "Not activating index, already using latest version" ) ; } } catch ( com.google.gerrit.server.index.ReindexerAlreadyRunningException e ) { throw die ( ( "Failed to activate latest index: " + ( e.getMessage ( ) ) ) ) ; } }

Target:
protected void run ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure { try { if ( versionManager.isKnownIndex ( name ) ) { if ( versionManager.activateLatestIndex ( name ) ) { stdout.println ( "Activated latest index version" ) ; } else { stdout.println ( "Not activating index, already using latest version" ) ; } } else { stderr.println ( "Cannot activate index, unknown based on this name" ) ; } } catch ( com.google.gerrit.server.index.ReindexerAlreadyRunningException e ) { throw die ( ( "Failed to activate latest index: " + ( e.getMessage ( ) ) ) ) ; } }