auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gerrit.server.group.GroupJson.GroupInfo apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddIncludedGroups.PutIncludedGroup.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gerrit.extensions.restapi.UnprocessableEntityException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddIncludedGroups.Input in = new com.google.gerrit.server.group.AddIncludedGroups.Input ( ) ; in.groups = com.google.common.collect.ImmutableList.of ( id ) ; java.util.List < com.google.gerrit.server.group.GroupJson.GroupInfo > list = put.get ( ) . apply ( resource , in ) ; if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } throw new java.lang.IllegalStateException ( ) ; }

Target:
public com.google.gerrit.server.group.GroupJson.GroupInfo apply ( com.google.gerrit.server.group.GroupResource resource , com.google.gerrit.server.group.AddIncludedGroups.PutIncludedGroup.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.MethodNotAllowedException , com.google.gerrit.extensions.restapi.UnprocessableEntityException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.group.AddIncludedGroups.Input in = new com.google.gerrit.server.group.AddIncludedGroups.Input ( ) ; in.groups = com.google.common.collect.ImmutableList.of ( id ) ; java.util.List < com.google.gerrit.server.group.GroupJson.GroupInfo > list = put.apply ( resource , in ) ; if ( ( list.size ( ) ) == 1 ) { return list.get ( 0 ) ; } throw new java.lang.IllegalStateException ( ) ; }
Source:
protected void setUp ( ) throws java.lang.Exception { repo = new org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.DfsRepository > ( new org.eclipse.jgit.internal.storage.dfs.InMemoryRepository ( new org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription ( "test" ) ) ) ; servlet = new com.google.gitiles.RepositoryIndexServlet ( new com.google.gitiles.TestGitilesAccess ( repo.getRepository ( ) ) , new com.google.gitiles.DefaultRenderer ( ) , new com.google.gitiles.TimeCache ( ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { repo = new org.eclipse.jgit.junit.TestRepository < org.eclipse.jgit.internal.storage.dfs.DfsRepository > ( new org.eclipse.jgit.internal.storage.dfs.InMemoryRepository ( new org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription ( "test" ) ) ) ; servlet = new com.google.gitiles.RepositoryIndexServlet ( new com.google.gitiles.TestGitilesAccess ( repo.getRepository ( ) ) , new com.google.gitiles.DefaultRenderer ( ) , new com.google.gitiles.TimeCache ( ) ) ; }
Source:
static int toMask ( final com.google.gwt.event.dom.client.KeyPressEvent event ) { int mask = event.getUnicodeCharCode ( ) ; if ( mask == 0 ) { mask = event.getNativeEvent ( ) . getKeyCode ( ) ; } if ( event.isAltKeyDown ( ) ) { mask |= KeyCommand.M_ALT ; } if ( event.isControlKeyDown ( ) ) { mask |= KeyCommand.M_CTRL ; } if ( event.isMetaKeyDown ( ) ) { mask |= KeyCommand.M_META ; } return mask ; }

Target:
static int toMask ( final com.google.gwt.event.dom.client.KeyPressEvent event ) { int mask = event.getUnicodeCharCode ( ) ; if ( mask == 0 ) { mask = event.getNativeEvent ( ) . getKeyCode ( ) ; } return mask ; }
Source:
private org.eclipse.jetty.server.Connector [ ] connectors ( org.eclipse.jgit.lib.Config cfg ) { org.eclipse.jetty.server.Connector c = new org.eclipse.jetty.server.nio.SelectChannelConnector ( ) ; c.setHost ( null ) ; c.setPort ( cfg.getInt ( "gitiles" , null , "port" , 8080 ) ) ; c.setStatsOn ( false ) ; return new org.eclipse.jetty.server.Connector [ ] { c } ; }

Target:
private org.eclipse.jetty.server.Connector [ ] connectors ( ) { org.eclipse.jetty.server.Connector c = new org.eclipse.jetty.server.nio.SelectChannelConnector ( ) ; c.setHost ( null ) ; c.setPort ( cfg.getInt ( "gitiles" , null , "port" , 8080 ) ) ; c.setStatsOn ( false ) ; return new org.eclipse.jetty.server.Connector [ ] { c } ; }
Source:
private com.google.gerrit.sshd.SshSession newSession ( ) { final java.net.SocketAddress peer ; if ( ( peerAddress ) == null ) { peer = session.get ( ) . getRemoteAddress ( ) ; } else { peer = peerAddress ; } com.google.gerrit.server.CurrentUser self = caller.get ( ) ; if ( self instanceof com.google.gerrit.server.PeerDaemonUser ) { self = null ; } return new com.google.gerrit.sshd.SshSession ( session.get ( ) , peer , userFactory.runAs ( peer , accountId , self ) ) ; }

Target:
private com.google.gerrit.sshd.SshSession newSession ( ) { final java.net.SocketAddress peer ; if ( ( peerAddress ) == null ) { peer = session.getRemoteAddress ( ) ; } else { peer = peerAddress ; } if ( ( caller ) instanceof com.google.gerrit.server.PeerDaemonUser ) { caller = null ; } return new com.google.gerrit.sshd.SshSession ( session , peer , userFactory.runAs ( peer , accountId , caller ) ) ; }
Source:
public boolean canReadCommit ( com.google.gerrit.reviewdb.server.ReviewDb db , org.eclipse.jgit.revwalk.RevWalk rw , org.eclipse.jgit.revwalk.RevCommit commit ) { try { org.eclipse.jgit.lib.Repository repo = openRepository ( ) ; try { return isMergedIntoVisibleRef ( repo , db , rw , commit , repo.getAllRefs ( ) ) ; } finally { repo.close ( ) ; } } catch ( java.io.IOException e ) { java.lang.String msg = java.lang.String.format ( "Cannot verify permissions to commit object %s in repository %s" , commit.name ( ) , getProject ( ) . getNameKey ( ) ) ; com.google.gerrit.server.project.ProjectControl.log.error ( msg , e ) ; return false ; } }

Target:
public boolean canReadCommit ( com.google.gerrit.reviewdb.server.ReviewDb db , org.eclipse.jgit.revwalk.RevWalk rw , org.eclipse.jgit.revwalk.RevCommit commit ) { try { org.eclipse.jgit.lib.Repository repo = openRepository ( ) ; try { return isMergedIntoVisibleRef ( repo , db , rw , commit , repo.getAllRefs ( ) . values ( ) ) ; } finally { repo.close ( ) ; } } catch ( java.io.IOException e ) { java.lang.String msg = java.lang.String.format ( "Cannot verify permissions to commit object %s in repository %s" , commit.name ( ) , getProject ( ) . getNameKey ( ) ) ; com.google.gerrit.server.project.ProjectControl.log.error ( msg , e ) ; return false ; } }
Source:
private void addDiffChunk ( net.codemirror.lib.CodeMirror cmToPad , int lineToPad , int lineOnOther , int chunkSize , boolean edit ) { chunks.add ( new com.google.gerrit.client.diff.DiffChunkInfo ( host.otherCm ( cmToPad ) . side ( ) , ( ( lineOnOther - chunkSize ) + 1 ) , lineOnOther , edit ) ) ; }

Target:
private void addDiffChunk ( net.codemirror.lib.CodeMirror cmToPad , int lineOnOther , int chunkSize , boolean edit ) { chunks.add ( new com.google.gerrit.client.diff.DiffChunkInfo ( host.otherCm ( cmToPad ) . side ( ) , ( ( lineOnOther - chunkSize ) + 1 ) , lineOnOther , edit ) ) ; }
Source:
public static void incrementPatchSet ( com.google.gerrit.reviewdb.client.Change change ) { com.google.gerrit.reviewdb.client.PatchSet.Id curr = change.currentPatchSetId ( ) ; com.google.gerrit.reviewdb.client.PatchSetInfo ps = new com.google.gerrit.reviewdb.client.PatchSetInfo ( new com.google.gerrit.reviewdb.client.PatchSet.Id ( change.getId ( ) , ( curr != null ? ( curr.get ( ) ) + 1 : 1 ) ) ) ; ps.setSubject ( "Change subject" ) ; change.setCurrentPatchSet ( ps ) ; com.google.gerrit.server.ChangeUtil.computeSortKey ( change ) ; }

Target:
public static void incrementPatchSet ( com.google.gerrit.reviewdb.client.Change change ) { com.google.gerrit.reviewdb.client.PatchSet.Id curr = change.currentPatchSetId ( ) ; com.google.gerrit.reviewdb.client.PatchSetInfo ps = new com.google.gerrit.reviewdb.client.PatchSetInfo ( new com.google.gerrit.reviewdb.client.PatchSet.Id ( change.getId ( ) , ( curr != null ? ( curr.get ( ) ) + 1 : 1 ) ) ) ; ps.setSubject ( "Change subject" ) ; change.setCurrentPatchSet ( ps ) ; }
Source:
public void onScreenLoad ( com.google.gerrit.client.ui.ScreenLoadEvent event ) { com.google.gerrit.client.ui.Screen screen = event.getScreen ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectKey ; if ( screen instanceof com.google.gerrit.client.admin.ProjectScreen ) { projectKey = ( ( com.google.gerrit.client.admin.ProjectScreen ) ( screen ) ) . getProjectKey ( ) ; } else { projectKey = com.google.gerrit.client.admin.ProjectScreen.getSavedKey ( ) ; } if ( projectKey != null ) { setVisible ( true ) ; setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( projectKey , panel ) ) ; } else { setVisible ( false ) ; } super . onScreenLoad ( event ) ; }

Target:
protected void onScreenLoad ( com.google.gerrit.reviewdb.client.Project.NameKey project ) { setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( project , panel ) ) ; }
Source:
protected void onRequestSuggestions ( com.google.gerrit.client.ui.Request request , com.google.gerrit.client.ui.Callback done ) { java.util.LinkedList < com.google.gerrit.client.ui.CherryPickDialog.BranchSuggestion > suggestions = new java.util.LinkedList < com.google.gerrit.client.ui.CherryPickDialog.BranchSuggestion > ( ) ; for ( final com.google.gerrit.client.projects.BranchInfo b : branches ) { if ( ( b.ref ( ) . indexOf ( request.getQuery ( ) ) ) >= 0 ) { suggestions.add ( new com.google.gerrit.client.ui.CherryPickDialog.BranchSuggestion ( b ) ) ; } } done.onSuggestionsReady ( request , new com.google.gerrit.client.ui.Response ( suggestions ) ) ; }

Target:
protected void onRequestSuggestions ( com.google.gerrit.client.ui.Request request , com.google.gerrit.client.ui.Callback done ) { java.util.LinkedList < com.google.gerrit.client.ui.CherryPickDialog.BranchSuggestion > suggestions = new java.util.LinkedList < com.google.gerrit.client.ui.CherryPickDialog.BranchSuggestion > ( ) ; for ( final com.google.gerrit.client.projects.BranchInfo b : branches ) { if ( b.ref ( ) . contains ( request.getQuery ( ) ) ) { suggestions.add ( new com.google.gerrit.client.ui.CherryPickDialog.BranchSuggestion ( b ) ) ; } } done.onSuggestionsReady ( request , new com.google.gerrit.client.ui.Response ( suggestions ) ) ; }
Source:
public java.lang.Object apply ( com.google.gerrit.extensions.restapi.TopLevelResource resource ) throws com.google.gerrit.extensions.restapi.BadRequestException { if ( ( format ) == ( com.google.gerrit.server.OutputFormat.TEXT ) ) { java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream ( ) ; display ( buf ) ; return com.google.gerrit.extensions.restapi.BinaryResult.create ( buf.toByteArray ( ) ) . setContentType ( "text/plain" ) . setCharacterEncoding ( java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ; } return apply ( ) ; }

Target:
public java.lang.Object apply ( com.google.gerrit.extensions.restapi.TopLevelResource resource ) throws com.google.gerrit.extensions.restapi.BadRequestException { if ( ( format ) == ( com.google.gerrit.server.OutputFormat.TEXT ) ) { java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream ( ) ; display ( buf ) ; return com.google.gerrit.extensions.restapi.BinaryResult.create ( buf.toByteArray ( ) ) . setContentType ( "text/plain" ) . setCharacterEncoding ( java.nio.charset.StandardCharsets.UTF_8 ) ; } return apply ( ) ; }
Source:
private static java.lang.String nameOf ( java.io.File jar ) { java.lang.String name = jar.getName ( ) ; if ( name.endsWith ( ".disabled" ) ) { name = name.substring ( 0 , name.lastIndexOf ( '.' ) ) ; } int ext = name.lastIndexOf ( '.' ) ; return 0 < ext ? name.substring ( 0 , ext ) : name ; }

Target:
private static java.lang.String nameOf ( java.lang.String name ) { if ( name.endsWith ( ".disabled" ) ) { name = name.substring ( 0 , name.lastIndexOf ( '.' ) ) ; } int ext = name.lastIndexOf ( '.' ) ; return 0 < ext ? name.substring ( 0 , ext ) : name ; }
Source:
public void createTableIfNotExists ( ) throws com.google.gwtorm.server.OrmException { try ( java.sql.Connection con = ds.getConnection ( ) ; java.sql.Statement stmt = con.createStatement ( ) ) { com.google.gerrit.server.schema.JdbcAccountPatchReviewStore.doCreateTable ( stmt ) ; } catch ( java.sql.SQLException e ) { throw convertError ( "create" , e ) ; } }

Target:
public void createTableIfNotExists ( ) throws com.google.gwtorm.server.OrmException { try ( java.sql.Connection con = ds.getConnection ( ) ; java.sql.Statement stmt = con.createStatement ( ) ) { doCreateTable ( stmt ) ; } catch ( java.sql.SQLException e ) { throw convertError ( "create" , e ) ; } }
Source:
public void testCreateSchema_LabelTypes ( ) throws java.lang.Exception { java.util.List < java.lang.String > labels = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.common.data.LabelType label : getLabelTypes ( ) . getLabelTypes ( ) ) { labels.add ( label.getName ( ) ) ; } org.junit.Assert.assertEquals ( com.google.common.collect.ImmutableList.of ( "Code-Review" ) , labels ) ; }

Target:
public void testCreateSchema_LabelTypes ( ) throws java.lang.Exception { java.util.List < java.lang.String > labels = new java.util.ArrayList < > ( ) ; for ( com.google.gerrit.common.data.LabelType label : getLabelTypes ( ) . getLabelTypes ( ) ) { labels.add ( label.getName ( ) ) ; } org.junit.Assert.assertEquals ( com.google.common.collect.ImmutableList.of ( "Code-Review" ) , labels ) ; }
Source:
public static java.lang.String getRemoteUser ( javax.servlet.http.HttpServletRequest req , java.lang.String loginHeader ) { if ( com.google.common.net.HttpHeaders.AUTHORIZATION.equals ( loginHeader ) ) { java.lang.String user = com.google.common.base.Strings.emptyToNull ( req.getRemoteUser ( ) ) ; if ( user != null ) { return user ; } java.lang.String auth = req.getHeader ( com.google.common.net.HttpHeaders.AUTHORIZATION ) ; return com.google.gerrit.httpd.RemoteUserUtil.extractUsername ( auth ) ; } else { return com.google.common.base.Strings.emptyToNull ( req.getHeader ( loginHeader ) ) ; } }

Target:
public static java.lang.String getRemoteUser ( javax.servlet.http.HttpServletRequest req , java.lang.String loginHeader ) { if ( com.google.common.net.HttpHeaders.AUTHORIZATION.equals ( loginHeader ) ) { java.lang.String user = com.google.common.base.Strings.emptyToNull ( req.getRemoteUser ( ) ) ; if ( user != null ) { return user ; } java.lang.String auth = req.getHeader ( com.google.common.net.HttpHeaders.AUTHORIZATION ) ; return com.google.gerrit.httpd.RemoteUserUtil.extractUsername ( auth ) ; } return com.google.common.base.Strings.emptyToNull ( req.getHeader ( loginHeader ) ) ; }
Source:
public com.google.gerrit.server.git.WorkQueue.Task.State getState ( ) { if ( isCancelled ( ) ) { return com.google.gerrit.server.git.WorkQueue.Task.State.CANCELLED ; } else if ( ( isDone ( ) ) && ( ! ( isPeriodic ( ) ) ) ) { return com.google.gerrit.server.git.WorkQueue.Task.State.DONE ; } else if ( running.get ( ) ) { return com.google.gerrit.server.git.WorkQueue.Task.State.RUNNING ; } final long delay = getDelay ( java.util.concurrent.TimeUnit.MILLISECONDS ) ; if ( delay <= 0 ) { return com.google.gerrit.server.git.WorkQueue.Task.State.READY ; } else if ( 0 < delay ) { return com.google.gerrit.server.git.WorkQueue.Task.State.SLEEPING ; } return com.google.gerrit.server.git.WorkQueue.Task.State.OTHER ; }

Target:
public com.google.gerrit.server.git.WorkQueue.Task.State getState ( ) { if ( isCancelled ( ) ) { return com.google.gerrit.server.git.WorkQueue.Task.State.CANCELLED ; } else if ( ( isDone ( ) ) && ( ! ( isPeriodic ( ) ) ) ) { return com.google.gerrit.server.git.WorkQueue.Task.State.DONE ; } else if ( running.get ( ) ) { return com.google.gerrit.server.git.WorkQueue.Task.State.RUNNING ; } final long delay = getDelay ( java.util.concurrent.TimeUnit.MILLISECONDS ) ; if ( delay <= 0 ) { return com.google.gerrit.server.git.WorkQueue.Task.State.READY ; } else { return com.google.gerrit.server.git.WorkQueue.Task.State.SLEEPING ; } }
Source:
private void appendLineText ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int lineNumberMinusOne , final com.google.gerrit.client.patches.PatchLine.Type type , final com.google.gerrit.prettify.common.SparseHtmlFile src , final int i , final boolean fullBlock ) { appendLineText ( m , lineNumberMinusOne , type , src.getSafeHtmlLine ( i ) , src.hasTrailingEdit ( i ) , fullBlock ) ; }

Target:
private void appendLineText ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final com.google.gerrit.client.patches.PatchLine.Type type , final com.google.gerrit.prettify.common.SparseHtmlFile src , final int i , final boolean fullBlock ) { appendLineText ( m , type , src.getSafeHtmlLine ( i ) , src.hasTrailingEdit ( i ) , fullBlock ) ; }
Source:
private static void onEdit ( com.google.gwt.dom.client.NativeEvent e , int idx ) { com.google.gerrit.client.change.FileTable.MyTable t = com.google.gerrit.client.change.FileTable.getMyTable ( e ) ; if ( t != null ) { t.onEdit ( com.google.gwt.dom.client.InputElement.as ( com.google.gwt.dom.client.Element.as ( e.getEventTarget ( ) ) ) , idx ) ; } }

Target:
private static void onEdit ( com.google.gwt.dom.client.NativeEvent e , int idx ) { com.google.gerrit.client.change.FileTable.MyTable t = com.google.gerrit.client.change.FileTable.getMyTable ( e ) ; if ( t != null ) { t.onEdit ( idx ) ; } }
Source:
private java.util.List < com.google.gerrit.server.change.GetRelated.ChangeAndCommit > getRelated ( com.google.gerrit.reviewdb.client.PatchSet.Id ps ) throws java.io.IOException { java.lang.String url = java.lang.String.format ( "/changes/%d/revisions/%d/related" , ps.getParentKey ( ) . get ( ) , ps.get ( ) ) ; return newGson ( ) . fromJson ( adminSession.get ( url ) . getReader ( ) , com.google.gerrit.server.change.GetRelated.RelatedInfo.class ) . changes ; }

Target:
private java.util.List < com.google.gerrit.server.change.GetRelated.ChangeAndCommit > getRelated ( com.google.gerrit.reviewdb.client.Change.Id changeId , int ps ) throws java.io.IOException { java.lang.String url = java.lang.String.format ( "/changes/%d/revisions/%d/related" , changeId.get ( ) , ps ) ; return newGson ( ) . fromJson ( adminSession.get ( url ) . getReader ( ) , com.google.gerrit.server.change.GetRelated.RelatedInfo.class ) . changes ; }
Source:
private final void deleteFromPatchSets ( final com.google.gwtorm.server.ResultSet < com.google.gerrit.reviewdb.client.PatchSet > patchSets , final com.google.gerrit.reviewdb.client.Change change ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.reviewdb.client.PatchSet patchSet : patchSets ) { db.patchSetAncestors ( ) . delete ( db.patchSetAncestors ( ) . byPatchSet ( patchSet.getId ( ) ) ) ; db.accountPatchReviews ( ) . delete ( db.accountPatchReviews ( ) . byPatchSet ( patchSet.getId ( ) ) ) ; db.patchSets ( ) . delete ( java.util.Collections.singleton ( patchSet ) ) ; } }

Target:
private final void deleteFromPatchSets ( final com.google.gwtorm.server.ResultSet < com.google.gerrit.reviewdb.client.PatchSet > patchSets ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.reviewdb.client.PatchSet patchSet : patchSets ) { db.patchSetAncestors ( ) . delete ( db.patchSetAncestors ( ) . byPatchSet ( patchSet.getId ( ) ) ) ; db.accountPatchReviews ( ) . delete ( db.accountPatchReviews ( ) . byPatchSet ( patchSet.getId ( ) ) ) ; db.patchSets ( ) . delete ( java.util.Collections.singleton ( patchSet ) ) ; } }
Source:
private com.google.gerrit.server.change.PostReviewers.Addition addAssigneeAsCC ( com.google.gerrit.server.change.ChangeResource rsrc , java.lang.String assignee ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.extensions.api.changes.AddReviewerInput reviewerInput = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; reviewerInput.reviewer = assignee ; reviewerInput.state = com.google.gerrit.extensions.client.ReviewerState.CC ; reviewerInput.confirmed = true ; reviewerInput.notify = com.google.gerrit.extensions.api.changes.NotifyHandling.NONE ; return postReviewers.prepareApplication ( rsrc , reviewerInput ) ; }

Target:
private com.google.gerrit.server.change.PostReviewers.Addition addAssigneeAsCC ( com.google.gerrit.server.change.ChangeResource rsrc , java.lang.String assignee ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException { com.google.gerrit.extensions.api.changes.AddReviewerInput reviewerInput = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; reviewerInput.reviewer = assignee ; reviewerInput.state = com.google.gerrit.extensions.client.ReviewerState.CC ; reviewerInput.confirmed = true ; reviewerInput.notify = com.google.gerrit.extensions.api.changes.NotifyHandling.NONE ; return postReviewers.prepareApplication ( rsrc , reviewerInput , false ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.GerritApi.class ) . to ( com.google.gerrit.server.api.GerritApiImpl.class ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.extensions.api.GerritApi.class ) . to ( com.google.gerrit.server.api.GerritApiImpl.class ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; install ( new com.google.gerrit.server.api.Module ( ) ) ; }
Source:
private boolean shouldGet ( ) { if ( console.isBatch ( ) ) { return required ; } else { final java.lang.StringBuilder msg = new java.lang.StringBuilder ( ) ; msg.append ( "\n" ) ; msg.append ( "Gerrit Code Review is not shipped with %s\n" ) ; if ( required ) { msg.append ( "** This library is required for your configuration. **\n" ) ; } else { msg.append ( " If available, Gerrit can take advantage of features\n" ) ; msg.append ( " in the library, but will also function without it.\n" ) ; } msg.append ( "Download and install it now" ) ; return console.yesno ( true , msg.toString ( ) , name ) ; } }

Target:
private boolean shouldGet ( ) { if ( ui.isBatch ( ) ) { return required ; } else { final java.lang.StringBuilder msg = new java.lang.StringBuilder ( ) ; msg.append ( "\n" ) ; msg.append ( "Gerrit Code Review is not shipped with %s\n" ) ; if ( required ) { msg.append ( "** This library is required for your configuration. **\n" ) ; } else { msg.append ( " If available, Gerrit can take advantage of features\n" ) ; msg.append ( " in the library, but will also function without it.\n" ) ; } msg.append ( "Download and install it now" ) ; return ui.yesno ( true , msg.toString ( ) , name ) ; } }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.Project.NameKey > getNameKeys ( ) throws com.google.gerrit.server.project.NoSuchProjectException , com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.reviewdb.client.Project > pList = getProjects ( ) ; final java.util.List < com.google.gerrit.reviewdb.client.Project.NameKey > nameKeys = new java.util.ArrayList < com.google.gerrit.reviewdb.client.Project.NameKey > ( pList.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Project p : pList ) { nameKeys.add ( p.getNameKey ( ) ) ; } return nameKeys ; }

Target:
public java.util.List < com.google.gerrit.reviewdb.client.Project.NameKey > getNameKeys ( ) throws com.google.gerrit.server.project.NoSuchProjectException , com.google.gwtorm.server.OrmException { java.util.List < com.google.gerrit.reviewdb.client.Project > pList = getProjects ( ) ; final java.util.List < com.google.gerrit.reviewdb.client.Project.NameKey > nameKeys = new java.util.ArrayList ( pList.size ( ) ) ; for ( com.google.gerrit.reviewdb.client.Project p : pList ) { nameKeys.add ( p.getNameKey ( ) ) ; } return nameKeys ; }
Source:
private void ccApprovals ( final boolean includeZero ) { try { for ( com.google.gerrit.reviewdb.PatchSetApproval ap : args.db.get ( ) . patchSetApprovals ( ) . byChange ( change.getId ( ) ) ) { if ( ( ! includeZero ) && ( ( ap.getValue ( ) ) == 0 ) ) { continue ; } add ( RecipientType.CC , ap.getAccountId ( ) ) ; } } catch ( com.google.gwtorm.client.OrmException err ) { } }

Target:
private void ccApprovals ( final boolean includeZero ) { try { for ( com.google.gerrit.reviewdb.client.PatchSetApproval ap : args.db.get ( ) . patchSetApprovals ( ) . byChange ( change.getId ( ) ) ) { if ( ( ! includeZero ) && ( ( ap.getValue ( ) ) == 0 ) ) { continue ; } add ( RecipientType.CC , ap.getAccountId ( ) ) ; } } catch ( com.google.gwtorm.server.OrmException err ) { } }
Source:
void onTabWidth ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.String > e ) { java.lang.String v = e.getValue ( ) ; if ( ( v != null ) && ( ( v.length ( ) ) > 0 ) ) { prefs.tabSize ( java.lang.Math.max ( 1 , java.lang.Integer.parseInt ( v ) ) ) ; if ( ( view ) != null ) { view.getEditor ( ) . setOption ( "tabSize" , v ) ; } } }

Target:
void onTabWidth ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.String > e ) { java.lang.String v = e.getValue ( ) ; if ( ( v != null ) && ( ( v.length ( ) ) > 0 ) ) { prefs.tabSize ( java.lang.Math.max ( 1 , java.lang.Integer.parseInt ( v ) ) ) ; if ( ( view ) != null ) { view.setOption ( "tabSize" , v ) ; } } }
Source:
public void setUp ( ) throws java.lang.Exception { results = com.google.common.collect.Lists.newArrayList ( ) ; results.add ( push ( "file contents" , null ) ) ; changeId = results.get ( 0 ) . getChangeId ( ) ; results.add ( push ( "new contents 1" , changeId ) ) ; results.add ( push ( "new contents 2" , changeId ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { results = new java.util.ArrayList < > ( ) ; results.add ( push ( "file contents" , null ) ) ; changeId = results.get ( 0 ) . getChangeId ( ) ; results.add ( push ( "new contents 1" , changeId ) ) ; results.add ( push ( "new contents 2" , changeId ) ) ; }
Source:
protected void onUnload ( ) { super . onUnload ( ) ; removeKeyHandlerRegs ( ) ; if ( ( resizeHandler ) != null ) { resizeHandler.removeHandler ( ) ; resizeHandler = null ; } if ( ( cmA ) != null ) { cmA.getWrapperElement ( ) . removeFromParent ( ) ; cmA = null ; } if ( ( cmB ) != null ) { cmB.getWrapperElement ( ) . removeFromParent ( ) ; cmB = null ; } com.google.gwt.user.client.Window.enableScrolling ( true ) ; com.google.gerrit.client.Gerrit.setHeaderVisible ( true ) ; }

Target:
protected void onUnload ( ) { super . onUnload ( ) ; removeKeyHandlerRegs ( ) ; if ( ( resizeHandler ) != null ) { resizeHandler.removeHandler ( ) ; resizeHandler = null ; } cmA.getWrapperElement ( ) . removeFromParent ( ) ; cmB.getWrapperElement ( ) . removeFromParent ( ) ; com.google.gwt.user.client.Window.enableScrolling ( true ) ; com.google.gerrit.client.Gerrit.setHeaderVisible ( true ) ; }
Source:
public void setGroups ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeUpdate update , com.google.gerrit.reviewdb.client.PatchSet ps , java.lang.Iterable < java.lang.String > groups ) throws com.google.gwtorm.server.OrmException { ps.setGroups ( groups ) ; update.setGroups ( groups ) ; db.patchSets ( ) . update ( java.util.Collections.singleton ( ps ) ) ; }

Target:
public void setGroups ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeUpdate update , com.google.gerrit.reviewdb.client.PatchSet ps , java.util.List < java.lang.String > groups ) throws com.google.gwtorm.server.OrmException { ps.setGroups ( groups ) ; update.setGroups ( groups ) ; db.patchSets ( ) . update ( java.util.Collections.singleton ( ps ) ) ; }
Source:
public boolean updateChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException { user = ctx.getUser ( ) . asIdentifiedUser ( ) ; notes = ctx.getNotes ( ) ; ps = psUtil.get ( ctx.getDb ( ) , ctx.getNotes ( ) , psId ) ; boolean dirty = false ; dirty |= insertComments ( ctx ) ; dirty |= updateLabels ( ctx ) ; dirty |= insertMessage ( ctx ) ; if ( dirty ) { ctx.saveChange ( ) ; } return dirty ; }

Target:
public boolean updateChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) throws com.google.gerrit.extensions.restapi.ResourceConflictException , com.google.gwtorm.server.OrmException { user = ctx.getUser ( ) . asIdentifiedUser ( ) ; notes = ctx.getNotes ( ) ; ps = psUtil.get ( ctx.getDb ( ) , ctx.getNotes ( ) , psId ) ; boolean dirty = false ; dirty |= insertComments ( ctx ) ; dirty |= updateLabels ( ctx ) ; dirty |= insertMessage ( ctx ) ; return dirty ; }
Source:
protected void configureServlets ( ) { install ( new com.google.gerrit.server.config.FactoryModule ( ) { @ java.lang.Override protected void configure ( ) { factory ( EditCommitMessageHandler.Factory.class ) ; factory ( RebaseChangeHandler.Factory.class ) ; factory ( ChangeDetailFactory.Factory.class ) ; factory ( PatchSetDetailFactory.Factory.class ) ; factory ( PatchSetPublishDetailFactory.Factory.class ) ; factory ( PublishAction.Factory.class ) ; factory ( DeleteDraftChange.Factory.class ) ; } } ) ; rpc ( com.google.gerrit.httpd.rpc.changedetail.ChangeDetailServiceImpl.class ) ; rpc ( com.google.gerrit.httpd.rpc.changedetail.ChangeManageServiceImpl.class ) ; }

Target:
protected void configureServlets ( ) { install ( new com.google.gerrit.server.config.FactoryModule ( ) { @ java.lang.Override protected void configure ( ) { factory ( PatchSetDetailFactory.Factory.class ) ; } } ) ; rpc ( com.google.gerrit.httpd.rpc.changedetail.ChangeDetailServiceImpl.class ) ; }
Source:
public void testSingleLineMessages ( ) throws java.lang.Exception { assertEquals ( ( "a\n" + ( "\n" + "Change-Id: I7fc3876fee63c766a2063df97fbe04a2dddd8d7c\n" ) ) , call ( "a\n" ) ) ; assertEquals ( ( "fix: this thing\n" + ( "\n" + "Change-Id: I0f13d0e6c739ca3ae399a05a93792e80feb97f37\n" ) ) , call ( "fix: this thing\n" ) ) ; assertEquals ( ( "fix-a-widget: this thing\n" + ( "\n" + "Change-Id: I1a1a0c751e4273d532e4046a501a612b9b8a775e\n" ) ) , call ( "fix-a-widget: this thing\n" ) ) ; assertEquals ( ( "FIX: this thing\n" + ( "\n" + "Change-Id: If816d944c57d3893b60cf10c65931fead1290d97\n" ) ) , call ( "FIX: this thing\n" ) ) ; assertEquals ( ( "Fix-A-Widget: this thing\n" + ( "\n" + "Change-Id: I3e18d00cbda2ba1f73aeb63ed8c7d57d7fd16c76\n" ) ) , call ( "Fix-A-Widget: this thing\n" ) ) ; }

Target:
public void testSingleLineMessages ( ) throws java.lang.Exception { org.junit.Assert.assertEquals ( ( "a\n" + ( "\n" + "Change-Id: I7fc3876fee63c766a2063df97fbe04a2dddd8d7c\n" ) ) , call ( "a\n" ) ) ; org.junit.Assert.assertEquals ( ( "fix: this thing\n" + ( "\n" + "Change-Id: I0f13d0e6c739ca3ae399a05a93792e80feb97f37\n" ) ) , call ( "fix: this thing\n" ) ) ; org.junit.Assert.assertEquals ( ( "fix-a-widget: this thing\n" + ( "\n" + "Change-Id: I1a1a0c751e4273d532e4046a501a612b9b8a775e\n" ) ) , call ( "fix-a-widget: this thing\n" ) ) ; org.junit.Assert.assertEquals ( ( "FIX: this thing\n" + ( "\n" + "Change-Id: If816d944c57d3893b60cf10c65931fead1290d97\n" ) ) , call ( "FIX: this thing\n" ) ) ; org.junit.Assert.assertEquals ( ( "Fix-A-Widget: this thing\n" + ( "\n" + "Change-Id: I3e18d00cbda2ba1f73aeb63ed8c7d57d7fd16c76\n" ) ) , call ( "Fix-A-Widget: this thing\n" ) ) ; }
Source:
public void missingRepo ( ) throws java.lang.Exception { assumeNoteDbDisabled ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = insertChange ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey name = notes.getProjectName ( ) ; com.google.gerrit.server.project.ChangeControl ctl = controlForNotes ( notes ) ; ( ( com.google.gerrit.testutil.InMemoryRepositoryManager ) ( repoManager ) ) . deleteRepository ( name ) ; com.google.common.truth.Truth.assertThat ( checker.check ( ctl , null ) . problems ( ) ) . containsExactly ( com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Destination repository not found: " + name ) ) ) ; }

Target:
public void missingRepo ( ) throws java.lang.Exception { assumeNoteDbDisabled ( ) ; com.google.gerrit.server.notedb.ChangeNotes notes = insertChange ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey name = notes.getProjectName ( ) ; ( ( com.google.gerrit.testutil.InMemoryRepositoryManager ) ( repoManager ) ) . deleteRepository ( name ) ; com.google.common.truth.Truth.assertThat ( checker.check ( notes , null ) . problems ( ) ) . containsExactly ( com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Destination repository not found: " + name ) ) ) ; }
Source:
public void testWithSymlink ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit c = makeCommitWithSymlink ( ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = com.googlesource.gerrit.plugins.uploadvalidator.SymlinkValidator.performValidation ( repo , c ) ; java.util.Set < java.lang.String > expected = com.google.common.collect.ImmutableSet.of ( "ERROR: Symbolic links are not allowed: foo.txt" , "ERROR: Symbolic links are not allowed: symbolicFolder" ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactlyElementsIn ( expected ) ; }

Target:
public void testWithSymlink ( ) throws java.lang.Exception { try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { org.eclipse.jgit.revwalk.RevCommit c = makeCommitWithSymlink ( rw ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = com.googlesource.gerrit.plugins.uploadvalidator.SymlinkValidator.performValidation ( repo , rw.parseCommit ( c ) , rw ) ; java.util.Set < java.lang.String > expected = com.google.common.collect.ImmutableSet.of ( "ERROR: Symbolic links are not allowed: foo.txt" , "ERROR: Symbolic links are not allowed: symbolicFolder" ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactlyElementsIn ( expected ) ; } }
Source:
private java.util.List < com.google.gerrit.client.ui.InlineHyperlink > getSideBySideDiffLink ( ) { com.google.gerrit.client.ui.InlineHyperlink toSideBySideDiffLink = new com.google.gerrit.client.ui.InlineHyperlink ( ) ; toSideBySideDiffLink.setHTML ( new com.google.gwt.user.client.ui.ImageResourceRenderer ( ) . render ( Gerrit.RESOURCES.sideBySideDiff ( ) ) ) ; toSideBySideDiffLink.setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toSideBySide ( getBase ( ) , getRevision ( ) , getPath ( ) ) ) ; toSideBySideDiffLink.setTitle ( PatchUtil.C.sideBySideDiff ( ) ) ; return java.util.Collections.singletonList ( toSideBySideDiffLink ) ; }

Target:
private java.util.List < com.google.gerrit.client.ui.InlineHyperlink > getSideBySideDiffLink ( ) { com.google.gerrit.client.ui.InlineHyperlink toSideBySideDiffLink = new com.google.gerrit.client.ui.InlineHyperlink ( ) ; toSideBySideDiffLink.setHTML ( new com.google.gwt.user.client.ui.ImageResourceRenderer ( ) . render ( Gerrit.RESOURCES.sideBySideDiff ( ) ) ) ; toSideBySideDiffLink.setTargetHistoryToken ( com.google.gerrit.client.Dispatcher.toSideBySide ( base , revision , path ) ) ; toSideBySideDiffLink.setTitle ( PatchUtil.C.sideBySideDiff ( ) ) ; return java.util.Collections.singletonList ( toSideBySideDiffLink ) ; }
Source:
private java.util.List < java.lang.String > scan ( com.google.gerrit.reviewdb.client.Account.Id userId , com.google.gerrit.reviewdb.client.PatchSet.Id psId ) throws com.google.gwtorm.server.OrmException { java.util.List < java.lang.String > r = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.reviewdb.client.AccountPatchReview w : db.get ( ) . accountPatchReviews ( ) . byReviewer ( userId , psId ) ) { r.add ( w.getKey ( ) . getPatchKey ( ) . getFileName ( ) ) ; } return r ; }

Target:
private java.util.List < java.lang.String > scan ( com.google.gerrit.reviewdb.client.Account.Id userId , com.google.gerrit.reviewdb.client.PatchSet.Id psId ) throws com.google.gwtorm.server.OrmException { java.util.List < java.lang.String > r = new java.util.ArrayList < > ( ) ; for ( com.google.gerrit.reviewdb.client.AccountPatchReview w : db.get ( ) . accountPatchReviews ( ) . byReviewer ( userId , psId ) ) { r.add ( w.getKey ( ) . getPatchKey ( ) . getFileName ( ) ) ; } return r ; }
Source:
public void createChangeOnInvisibleBranchFails ( ) throws java.lang.Exception { changeInTwoBranches ( "invisible-branch" , "a.txt" , "branchB" , "b.txt" ) ; block ( com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/invisible-branch" , project ) ; com.google.gerrit.extensions.common.ChangeInput in = newChangeInput ( ChangeStatus.NEW ) ; in.branch = "invisible-branch" ; assertCreateFails ( in , com.google.gerrit.extensions.restapi.AuthException.class , "cannot upload review" ) ; }

Target:
public void createChangeOnInvisibleBranchFails ( ) throws java.lang.Exception { changeInTwoBranches ( "invisible-branch" , "a.txt" , "branchB" , "b.txt" ) ; block ( project , "refs/heads/invisible-branch" , com.google.gerrit.common.data.Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; com.google.gerrit.extensions.common.ChangeInput in = newChangeInput ( ChangeStatus.NEW ) ; in.branch = "invisible-branch" ; assertCreateFails ( in , com.google.gerrit.extensions.restapi.AuthException.class , "cannot upload review" ) ; }
Source:
protected void configure ( ) { factory ( ChangeProjectAccess.Factory.class ) ; factory ( ReviewProjectAccess.Factory.class ) ; factory ( ChangeProjectSettings.Factory.class ) ; factory ( VisibleProjectDetails.Factory.class ) ; factory ( ProjectAccessFactory.Factory.class ) ; factory ( ProjectDetailFactory.Factory.class ) ; }

Target:
protected void configure ( ) { factory ( ChangeProjectAccess.Factory.class ) ; factory ( ReviewProjectAccess.Factory.class ) ; factory ( ProjectAccessFactory.Factory.class ) ; }
Source:
public boolean accept ( java.io.File pathname ) { java.lang.String n = pathname.getName ( ) ; return ( ( ( ( com.google.gerrit.server.plugins.PluginLoader.isJarPlugin ( n ) ) || ( com.google.gerrit.server.plugins.PluginLoader.isJsPlugin ( n ) ) ) || ( externalPluginFactory.handles ( pathname ) ) ) && ( ! ( n.startsWith ( ".last_" ) ) ) ) && ( ! ( n.startsWith ( ".next_" ) ) ) ; }

Target:
public boolean accept ( java.io.File pathname ) { java.lang.String n = pathname.getName ( ) ; return ( ! ( n.startsWith ( ".last_" ) ) ) && ( ! ( n.startsWith ( ".next_" ) ) ) ; }
Source:
public void testErrorWhileSendingUnhealthyResponse ( ) throws java.io.IOException { javax.servlet.http.HttpServletResponse responseMock = mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; responseMock = mock ( javax.servlet.http.HttpServletResponse.class ) ; doThrow ( new java.io.IOException ( "someError" ) ) . when ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE ) ; servlet.doGet ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }

Target:
public void testErrorWhileSendingUnhealthyResponse ( ) throws java.io.IOException { javax.servlet.http.HttpServletResponse responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; servlet.doDelete ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_NO_CONTENT ) ; responseMock = org.mockito.Mockito.mock ( javax.servlet.http.HttpServletResponse.class ) ; org.mockito.Mockito.doThrow ( new java.io.IOException ( "someError" ) ) . when ( responseMock ) . sendError ( javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE ) ; servlet.doGet ( null , responseMock ) ; org.mockito.Mockito.verify ( responseMock ) . setStatus ( javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR ) ; }
Source:
public void changeMessageCommitFormatSimple ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( project , changeOwner.getAccountId ( ) , 1 ) ; com.google.gerrit.server.notedb.ChangeUpdate update = newUpdate ( c , changeOwner ) ; update.setChangeMessage ( ( "Just a little code change.\n" + "How about a new line" ) ) ; update.commit ( ) ; org.junit.Assert.assertEquals ( "refs/changes/01/1/meta" , update.getRefName ( ) ) ; assertBodyEquals ( ( "Update patch set 1\n" + ( ( ( ( "\n" + "Just a little code change.\n" ) + "How about a new line\n" ) + "\n" ) + "Patch-set: 1\n" ) ) , update.getRevision ( ) ) ; }

Target:
public void changeMessageCommitFormatSimple ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( project , changeOwner.getAccountId ( ) , 1 ) ; com.google.gerrit.server.notedb.ChangeUpdate update = newUpdate ( c , changeOwner ) ; update.setChangeMessage ( ( "Just a little code change.\n" + "How about a new line" ) ) ; update.commit ( ) ; com.google.common.truth.Truth.assertThat ( update.getRefName ( ) ) . isEqualTo ( "refs/changes/01/1/meta" ) ; assertBodyEquals ( ( "Update patch set 1\n" + ( ( ( ( "\n" + "Just a little code change.\n" ) + "How about a new line\n" ) + "\n" ) + "Patch-set: 1\n" ) ) , update.getRevision ( ) ) ; }
Source:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.extensions.common.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION ) ; org.junit.Assert.assertEquals ( expectedId.name ( ) , c.currentRevision ) ; org.junit.Assert.assertEquals ( expectedNum , c.revisions.get ( expectedId.name ( ) ) . _number ) ; }

Target:
protected void assertCurrentRevision ( java.lang.String changeId , int expectedNum , org.eclipse.jgit.lib.ObjectId expectedId ) throws java.io.IOException { com.google.gerrit.extensions.common.ChangeInfo c = getChange ( changeId , com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION ) ; com.google.common.truth.Truth.assertThat ( c.currentRevision ) . isEqualTo ( expectedId.name ( ) ) ; com.google.common.truth.Truth.assertThat ( c.revisions.get ( expectedId.name ( ) ) . _number ) . isEqualTo ( expectedNum ) ; }
Source:
public void setParentForAllProjects_Conflict ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/projects/" + ( allProjects.get ( ) ) ) + "/parent" ) , newParentInput ( project.get ( ) ) ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_CONFLICT , r.getStatusCode ( ) ) ; r.consume ( ) ; }

Target:
public void setParentForAllProjects_Conflict ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = adminSession.put ( ( ( "/projects/" + ( allProjects.get ( ) ) ) + "/parent" ) , newParentInput ( project.get ( ) ) ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_CONFLICT ) ; r.consume ( ) ; }
Source:
private com.google.gerrit.common.data.LabelTypes getLabelTypes ( ) throws java.lang.Exception { db.create ( ) ; com.google.gerrit.server.git.ProjectConfig c = new com.google.gerrit.server.git.ProjectConfig ( allProjects ) ; org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allProjects ) ; try { c.load ( repo ) ; return new com.google.gerrit.common.data.LabelTypes ( com.google.common.collect.ImmutableList.copyOf ( c.getLabelSections ( ) . values ( ) ) ) ; } finally { repo.close ( ) ; } }

Target:
private com.google.gerrit.common.data.LabelTypes getLabelTypes ( ) throws java.lang.Exception { db.create ( ) ; com.google.gerrit.server.git.ProjectConfig c = new com.google.gerrit.server.git.ProjectConfig ( allProjects ) ; try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( allProjects ) ) { c.load ( repo ) ; return new com.google.gerrit.common.data.LabelTypes ( com.google.common.collect.ImmutableList.copyOf ( c.getLabelSections ( ) . values ( ) ) ) ; } }
Source:
protected java.lang.String getChangeUrl ( ) { if ( ( ( change ) != null ) && ( ( getGerritUrl ( ) ) != null ) ) { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( getGerritUrl ( ) ) ; r.append ( change.getChangeId ( ) ) ; return r.toString ( ) ; } return null ; }

Target:
public java.lang.String getChangeUrl ( ) { if ( ( ( change ) != null ) && ( ( getGerritUrl ( ) ) != null ) ) { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( getGerritUrl ( ) ) ; r.append ( change.getChangeId ( ) ) ; return r.toString ( ) ; } return null ; }
Source:
protected void configureServlets ( ) { rpc ( com.google.gerrit.httpd.rpc.ChangeListServiceImpl.class ) ; rpc ( com.google.gerrit.httpd.rpc.SuggestServiceImpl.class ) ; rpc ( com.google.gerrit.httpd.rpc.SystemInfoServiceImpl.class ) ; install ( new com.google.gerrit.httpd.rpc.account.AccountModule ( ) ) ; install ( new com.google.gerrit.httpd.rpc.changedetail.ChangeModule ( ) ) ; install ( new com.google.gerrit.httpd.rpc.patch.PatchModule ( ) ) ; install ( new com.google.gerrit.httpd.rpc.project.ProjectModule ( ) ) ; }

Target:
protected void configureServlets ( ) { rpc ( com.google.gerrit.httpd.rpc.SuggestServiceImpl.class ) ; rpc ( com.google.gerrit.httpd.rpc.SystemInfoServiceImpl.class ) ; install ( new com.google.gerrit.httpd.rpc.account.AccountModule ( ) ) ; install ( new com.google.gerrit.httpd.rpc.changedetail.ChangeModule ( ) ) ; install ( new com.google.gerrit.httpd.rpc.patch.PatchModule ( ) ) ; install ( new com.google.gerrit.httpd.rpc.project.ProjectModule ( ) ) ; }
Source:
public void receivePackRespectsVisibilityOfOpenChanges ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; setApiUser ( user ) ; com.google.common.truth.Truth.assertThat ( getReceivePackRefs ( ) . additionalHaves ( ) ) . containsExactly ( com.google.gerrit.acceptance.git.RefAdvertisementIT.obj ( c3 , 1 ) ) ; }

Target:
public void receivePackRespectsVisibilityOfOpenChanges ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; deny ( "refs/heads/branch" , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) ; setApiUser ( user ) ; com.google.common.truth.Truth.assertThat ( getReceivePackRefs ( ) . additionalHaves ( ) ) . containsExactly ( com.google.gerrit.acceptance.git.RefAdvertisementIT.obj ( c3 , 1 ) ) ; }
Source:
public static void replyError ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , int statusCode , java.lang.String msg , com.google.gerrit.extensions.restapi.CacheControl c , @ com.google.gerrit.common.Nullable java.lang.Throwable err ) throws java.io.IOException { if ( err != null ) { com.google.gerrit.util.http.RequestUtil.setErrorTraceAttribute ( req , err ) ; } com.google.gerrit.httpd.restapi.RestApiServlet.configureCaching ( req , res , null , null , c ) ; res.setStatus ( statusCode ) ; com.google.gerrit.httpd.restapi.RestApiServlet.replyText ( req , res , msg ) ; }

Target:
public static long replyError ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , int statusCode , java.lang.String msg , com.google.gerrit.extensions.restapi.CacheControl c , @ com.google.gerrit.common.Nullable java.lang.Throwable err ) throws java.io.IOException { if ( err != null ) { com.google.gerrit.util.http.RequestUtil.setErrorTraceAttribute ( req , err ) ; } com.google.gerrit.httpd.restapi.RestApiServlet.configureCaching ( req , res , null , null , c ) ; res.setStatus ( statusCode ) ; return com.google.gerrit.httpd.restapi.RestApiServlet.replyText ( req , res , msg ) ; }