auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gitiles.GitilesView.Builder setPathPart ( java.lang.String path ) { switch ( type ) { case PATH : case DIFF : this . path = com.google.gitiles.GitilesView.maybeTrimLeadingAndTrailingSlash ( com.google.common.base.Preconditions.checkNotNull ( path ) ) ; return this ; case DESCRIBE : case REFS : case LOG : this . path = ( path != null ) ? com.google.gitiles.GitilesView.maybeTrimLeadingAndTrailingSlash ( path ) : null ; return this ; default : throw new java.lang.IllegalStateException ( java.lang.String.format ( "cannot set path on %s view" , type ) ) ; } }

Target:
public com.google.gitiles.GitilesView.Builder setExtension ( java.lang.String extension ) { switch ( type ) { default : com.google.common.base.Preconditions.checkState ( ( extension == null ) , "cannot set path on %s view" , type ) ; case ARCHIVE : this . extension = extension ; break ; } return this ; }
Source:
private synchronized com.google.gerrit.testutil.InMemoryRepositoryManager.Repo get ( com.google.gerrit.reviewdb.client.Project.NameKey name ) throws org.eclipse.jgit.errors.RepositoryNotFoundException { com.google.gerrit.testutil.InMemoryRepositoryManager.Repo repo = repos.get ( name.get ( ) . toLowerCase ( ) ) ; if ( repo != null ) { return repo ; } throw new org.eclipse.jgit.errors.RepositoryNotFoundException ( name.get ( ) ) ; }

Target:
private synchronized com.google.gerrit.testutil.InMemoryRepositoryManager.Repo get ( com.google.gerrit.reviewdb.client.Project.NameKey name ) throws org.eclipse.jgit.errors.RepositoryNotFoundException { com.google.gerrit.testutil.InMemoryRepositoryManager.Repo repo = repos.get ( com.google.gerrit.testutil.InMemoryRepositoryManager.normalize ( name ) ) ; if ( repo != null ) { return repo ; } throw new org.eclipse.jgit.errors.RepositoryNotFoundException ( name.get ( ) ) ; }
Source:
net.codemirror.lib.LineWidget addLineWidget ( net.codemirror.lib.CodeMirror cm , int line , final com.google.gwt.user.client.ui.Widget widget , net.codemirror.lib.Configuration options ) { widget.setVisible ( false ) ; net.codemirror.lib.LineWidget lineWidget = cm.addLineWidget ( line , widget.getElement ( ) , options ) ; lineWidget.onFirstRedraw ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { widget.setVisible ( true ) ; } } ) ; return lineWidget ; }

Target:
com.google.gerrit.client.diff.SkipManager getSkipManager ( ) { return skipManager ; }
Source:
public void testCopy ( ) { final com.google.gerrit.server.query.OperatorPredicate < java.lang.String > f = f ( "author" , "alice" ) ; org.junit.Assert.assertSame ( f , f.copy ( java.util.Collections.< com.google.gerrit.server.query.Predicate < java.lang.String > > emptyList ( ) ) ) ; org.junit.Assert.assertSame ( f , f.copy ( f.getChildren ( ) ) ) ; try { f.copy ( java.util.Collections.singleton ( f ( "owner" , "bob" ) ) ) ; } catch ( java.lang.IllegalArgumentException e ) { org.junit.Assert.assertEquals ( "Expected 0 children" , e.getMessage ( ) ) ; } }

Target:
public void testCopy ( ) { final com.google.gerrit.server.query.OperatorPredicate < java.lang.String > f = f ( "author" , "alice" ) ; org.junit.Assert.assertSame ( f , f.copy ( java.util.Collections.< com.google.gerrit.server.query.Predicate < java.lang.String > > emptyList ( ) ) ) ; org.junit.Assert.assertSame ( f , f.copy ( f.getChildren ( ) ) ) ; exception.expect ( java.lang.IllegalArgumentException.class ) ; exception.expectMessage ( "Expected 0 children" ) ; f.copy ( java.util.Collections.singleton ( f ( "owner" , "bob" ) ) ) ; }
Source:
public com.google.gerrit.server.patch.IntraLineDiff getIntraLineDiff ( com.google.gerrit.server.patch.IntraLineDiffKey key ) { if ( computeIntraline ) { try { return intraCache.get ( key ) ; } catch ( java.util.concurrent.ExecutionException e ) { IntraLineLoader.log.warn ( ( "Error computing " + key ) , e ) ; return new com.google.gerrit.server.patch.IntraLineDiff ( IntraLineDiff.Status.ERROR ) ; } } else { return new com.google.gerrit.server.patch.IntraLineDiff ( IntraLineDiff.Status.DISABLED ) ; } }

Target:
public com.google.gerrit.server.patch.IntraLineDiff getIntraLineDiff ( com.google.gerrit.server.patch.IntraLineDiffKey key ) { if ( computeIntraline ) { try { return intraCache.get ( key ) ; } catch ( java.util.concurrent.ExecutionException | org.eclipse.jgit.errors.LargeObjectException e ) { IntraLineLoader.log.warn ( ( "Error computing " + key ) , e ) ; return new com.google.gerrit.server.patch.IntraLineDiff ( IntraLineDiff.Status.ERROR ) ; } } else { return new com.google.gerrit.server.patch.IntraLineDiff ( IntraLineDiff.Status.DISABLED ) ; } }
Source:
public void start ( ) { long interval = scheduleConfig.getInterval ( ) ; long delay = scheduleConfig.getInitialDelay ( ) ; if ( ( delay == ( com.google.gerrit.server.config.ScheduleConfig.MISSING_CONFIG ) ) && ( interval == ( com.google.gerrit.server.config.ScheduleConfig.MISSING_CONFIG ) ) ) { com.googlesource.gerrit.plugins.quota.PublisherScheduler.log.info ( "Ignoring missing schedule configuration" ) ; } else if ( ( delay < 0 ) || ( interval <= 0 ) ) { com.googlesource.gerrit.plugins.quota.PublisherScheduler.log.warn ( "Ignoring invalid schedule configuration" ) ; } else { workQueue.getDefaultQueue ( ) . scheduleWithFixedDelay ( publisher , delay , interval , java.util.concurrent.TimeUnit.MILLISECONDS ) ; } }

Target:
public void start ( ) { long interval = scheduleConfig.getInterval ( ) ; long delay = scheduleConfig.getInitialDelay ( ) ; if ( ( delay == ( com.google.gerrit.server.config.ScheduleConfig.MISSING_CONFIG ) ) && ( interval == ( com.google.gerrit.server.config.ScheduleConfig.MISSING_CONFIG ) ) ) { com.googlesource.gerrit.plugins.quota.PublisherScheduler.log.info ( "Ignoring missing schedule configuration" ) ; } else if ( ( delay < 0 ) || ( interval <= 0 ) ) { com.googlesource.gerrit.plugins.quota.PublisherScheduler.log.warn ( "Ignoring invalid schedule configuration" ) ; } else { workQueue.getDefaultQueue ( ) . scheduleAtFixedRate ( publisher , delay , interval , java.util.concurrent.TimeUnit.MILLISECONDS ) ; } }
Source:
private java.lang.String getCommand ( java.lang.String command , com.google.gitiles.RevisionParser.Result result , java.lang.String path ) { if ( ! ( com.google.gitiles.ViewFilter.CMD_AUTO.equals ( command ) ) ) { return command ; } else if ( ( result.getOldRevision ( ) ) != null ) { return com.google.gitiles.ViewFilter.CMD_DIFF ; } else { return com.google.gitiles.ViewFilter.CMD_SHOW ; } }

Target:
private GitilesView.Builder parseDescribeCommand ( javax.servlet.http.HttpServletRequest req , java.lang.String repoName , java.lang.String path ) { if ( com.google.gitiles.ViewFilter.isEmptyOrSlash ( path ) ) { return null ; } return com.google.gitiles.GitilesView.describe ( ) . setRepositoryName ( repoName ) . setPathPart ( path ) ; }
Source:
protected void resetHtml ( final java.lang.String body ) { com.google.gwt.user.client.DOM.setInnerHTML ( table.getBodyElement ( ) , body ) ; }

Target:
protected void resetHtml ( final java.lang.String body ) { for ( final java.util.Iterator < com.google.gwt.user.client.ui.Widget > i = table.iterator ( ) ; i.hasNext ( ) ; ) { i.next ( ) ; i.remove ( ) ; } com.google.gwt.user.client.DOM.setInnerHTML ( table.getBodyElement ( ) , body ) ; }
Source:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.client.Dispatcher.toPublish ( patchSet.getId ( ) ) ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; Util.MANAGE_SVC.publish ( patchSet.getId ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.common.data.ChangeDetail > ( ) { public void onSuccess ( com.google.gerrit.common.data.ChangeDetail result ) { detailCache.set ( result ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; super . onFailure ( caught ) ; } } ) ; }
Source:
public static com.google.gerrit.extensions.client.EditPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.EditPreferencesInfo i = new com.google.gerrit.extensions.client.EditPreferencesInfo ( ) ; i.tabSize = 8 ; i.lineLength = 100 ; i.hideTopMenu = false ; i.showTabs = true ; i.showWhitespaceErrors = false ; i.syntaxHighlighting = true ; i.hideLineNumbers = false ; i.theme = com.google.gerrit.extensions.client.Theme.DEFAULT ; return i ; }

Target:
public static com.google.gerrit.extensions.client.EditPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.EditPreferencesInfo i = new com.google.gerrit.extensions.client.EditPreferencesInfo ( ) ; i.tabSize = 8 ; i.lineLength = 100 ; i.hideTopMenu = false ; i.showTabs = true ; i.showWhitespaceErrors = false ; i.syntaxHighlighting = true ; i.hideLineNumbers = false ; i.theme = Theme.DEFAULT ; i.keyMapType = KeyMapType.DEFAULT ; return i ; }
Source:
public void addPatchSets ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.data.ChangeAttribute ca , java.util.Collection < com.google.gerrit.reviewdb.client.PatchSet > ps , java.util.Map < com.google.gerrit.reviewdb.client.PatchSet.Id , java.util.Collection < com.google.gerrit.reviewdb.client.PatchSetApproval > > approvals , com.google.gerrit.common.data.LabelTypes labelTypes ) { addPatchSets ( db , ca , ps , approvals , false , null , labelTypes ) ; }

Target:
public void addPatchSets ( com.google.gerrit.reviewdb.server.ReviewDb db , org.eclipse.jgit.revwalk.RevWalk revWalk , com.google.gerrit.server.data.ChangeAttribute ca , java.util.Collection < com.google.gerrit.reviewdb.client.PatchSet > ps , java.util.Map < com.google.gerrit.reviewdb.client.PatchSet.Id , java.util.Collection < com.google.gerrit.reviewdb.client.PatchSetApproval > > approvals , com.google.gerrit.common.data.LabelTypes labelTypes ) { addPatchSets ( db , revWalk , ca , ps , approvals , false , null , labelTypes ) ; }
Source:
protected java.util.List < com.google.gerrit.reviewdb.client.Change > impl ( com.google.gerrit.server.util.RequestContext ctx ) throws com.google.gwtorm.server.OrmException { java.lang.String ref = event.getRefName ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey project = new com.google.gerrit.reviewdb.client.Project.NameKey ( event.getProjectName ( ) ) ; if ( ref.equals ( RefNames.REFS_CONFIG ) ) { return com.google.gerrit.server.query.change.ChangeData.asChanges ( queryProvider.get ( ) . byProjectOpen ( project ) ) ; } return com.google.gerrit.server.query.change.ChangeData.asChanges ( queryProvider.get ( ) . byBranchOpen ( new com.google.gerrit.reviewdb.client.Branch.NameKey ( project , ref ) ) ) ; }

Target:
protected java.util.List < com.google.gerrit.reviewdb.client.Change > impl ( com.google.gerrit.server.util.RequestContext ctx ) throws com.google.gwtorm.server.OrmException { java.lang.String ref = event.getRefName ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey project = new com.google.gerrit.reviewdb.client.Project.NameKey ( event.getProjectName ( ) ) ; if ( ref.equals ( RefNames.REFS_CONFIG ) ) { return com.google.gerrit.server.query.change.ChangeData.asChanges ( queryProvider.get ( ) . byProjectOpen ( project ) ) ; } return com.google.gerrit.server.query.change.ChangeData.asChanges ( queryProvider.get ( ) . byBranchNew ( new com.google.gerrit.reviewdb.client.Branch.NameKey ( project , ref ) ) ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.index.account.AccountIndexRewriter.class ) ; bind ( com.google.gerrit.server.index.account.AccountIndexCollection.class ) ; listener ( ) . to ( com.google.gerrit.server.index.account.AccountIndexCollection.class ) ; bind ( com.google.gerrit.server.index.change.ChangeIndexRewriter.class ) ; bind ( com.google.gerrit.server.index.change.ChangeIndexCollection.class ) ; listener ( ) . to ( com.google.gerrit.server.index.change.ChangeIndexCollection.class ) ; factory ( ChangeIndexer.Factory.class ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.index.account.AccountIndexRewriter.class ) ; bind ( com.google.gerrit.server.index.account.AccountIndexCollection.class ) ; listener ( ) . to ( com.google.gerrit.server.index.account.AccountIndexCollection.class ) ; factory ( AccountIndexer.Factory.class ) ; bind ( com.google.gerrit.server.index.change.ChangeIndexRewriter.class ) ; bind ( com.google.gerrit.server.index.change.ChangeIndexCollection.class ) ; listener ( ) . to ( com.google.gerrit.server.index.change.ChangeIndexCollection.class ) ; factory ( ChangeIndexer.Factory.class ) ; }
Source:
protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { toGerrit ( com.google.gerrit.common.PageLinks.toChangeQuery ( req.getPathInfo ( ) ) , req , rsp ) ; }

Target:
protected void doGet ( final javax.servlet.http.HttpServletRequest req , final javax.servlet.http.HttpServletResponse rsp ) throws java.io.IOException { try { com.google.gerrit.reviewdb.Change.Id id = Change.Id.parse ( req.getPathInfo ( ) ) ; com.google.gerrit.httpd.UrlModule.toGerrit ( com.google.gerrit.common.PageLinks.toChange ( id ) , req , rsp ) ; } catch ( java.lang.IllegalArgumentException err ) { rsp.sendError ( HttpServletResponse.SC_NOT_FOUND ) ; } }
Source:
private void writeObject ( final java.io.ObjectOutputStream out ) throws java.io.IOException { out.writeUTF ( projectKey.get ( ) ) ; org.spearce.jgit.lib.ObjectIdSerialization.write ( out , oldId ) ; org.spearce.jgit.lib.ObjectIdSerialization.write ( out , newId ) ; com.google.gerrit.server.patch.DiffCacheKey.writeString ( out , fileName ) ; com.google.gerrit.server.patch.DiffCacheKey.writeString ( out , sourceFileName ) ; }

Target:
private void writeObject ( final java.io.ObjectOutputStream out ) throws java.io.IOException { out.writeUTF ( projectKey.get ( ) ) ; org.spearce.jgit.lib.ObjectIdSerialization.write ( out , oldId ) ; org.spearce.jgit.lib.ObjectIdSerialization.write ( out , newId ) ; com.google.gerrit.server.patch.DiffCacheKey.writeString ( out , fileName ) ; com.google.gerrit.server.patch.DiffCacheKey.writeString ( out , sourceFileName ) ; com.google.gerrit.server.patch.DiffCacheKey.writeString ( out , whitespace.name ( ) ) ; }
Source:
void onRestore ( int idx ) { java.lang.String path = list.get ( idx ) . path ( ) ; com.google.gerrit.client.changes.ChangeEditApi.restore ( curr.getParentKey ( ) . get ( ) , path , new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.VoidResult result ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChangeInEditMode ( curr.getParentKey ( ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ; }

Target:
void onDelete ( int idx ) { java.lang.String path = list.get ( idx ) . path ( ) ; com.google.gerrit.client.changes.ChangeEditApi.delete ( project.get ( ) , curr.getParentKey ( ) . get ( ) , path , new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.VoidResult result ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChangeInEditMode ( project , curr.getParentKey ( ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ; }
Source:
public com.google.gerrit.server.account.AccountState createEntry ( final com.google.gerrit.reviewdb.Account.Id key ) throws java.lang.Exception { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.server.account.AccountState state = load ( db , key ) ; if ( ( state.getUserName ( ) ) != null ) { byName.put ( state.getUserName ( ) , state.getAccount ( ) . getId ( ) ) ; } return state ; } finally { db.close ( ) ; } }

Target:
public com.google.gerrit.server.account.AccountState createEntry ( final com.google.gerrit.reviewdb.Account.Id key ) throws java.lang.Exception { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.server.account.AccountState state = load ( db , key ) ; if ( ( state.getUserName ( ) ) != null ) { byName.put ( new com.google.gerrit.reviewdb.Account.Username ( state.getUserName ( ) ) , state.getAccount ( ) . getId ( ) ) ; } return state ; } finally { db.close ( ) ; } }
Source:
public java.lang.Object apply ( com.google.gerrit.server.change.PatchResource resource , com.google.gerrit.server.change.Reviewed.Input input ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.server.ReviewDb db = dbProvider.get ( ) ; com.google.gerrit.reviewdb.client.AccountPatchReview apr = com.google.gerrit.server.change.Reviewed.getExisting ( db , resource ) ; if ( apr == null ) { db.accountPatchReviews ( ) . insert ( java.util.Collections.singleton ( new com.google.gerrit.reviewdb.client.AccountPatchReview ( resource.getPatchKey ( ) , resource.getAccountId ( ) ) ) ) ; return com.google.gerrit.extensions.restapi.Response.created ( "" ) ; } else { return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; } }

Target:
public java.lang.Object apply ( com.google.gerrit.server.change.FileResource resource , com.google.gerrit.server.change.Reviewed.Input input ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.server.ReviewDb db = dbProvider.get ( ) ; com.google.gerrit.reviewdb.client.AccountPatchReview apr = com.google.gerrit.server.change.Reviewed.getExisting ( db , resource ) ; if ( apr == null ) { db.accountPatchReviews ( ) . insert ( java.util.Collections.singleton ( new com.google.gerrit.reviewdb.client.AccountPatchReview ( resource.getPatchKey ( ) , resource.getAccountId ( ) ) ) ) ; return com.google.gerrit.extensions.restapi.Response.created ( "" ) ; } else { return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; } }
Source:
private static java.lang.String duration ( double ns ) { if ( ns < 0.5 ) { return null ; } java.lang.String suffix = "ns" ; if ( ns >= 1000.0 ) { ns /= 1000.0 ; suffix = "us" ; } if ( ns >= 1000.0 ) { ns /= 1000.0 ; suffix = "ms" ; } if ( ns >= 1000.0 ) { ns /= 1000.0 ; suffix = "s " ; } return java.lang.String.format ( "%4.1f%s" , ns , suffix ) . trim ( ) ; }

Target:
private static java.lang.String duration ( double ns ) { if ( ns < 0.5 ) { return null ; } java.lang.String suffix = "ns" ; if ( ns >= 1000.0 ) { ns /= 1000.0 ; suffix = "us" ; } if ( ns >= 1000.0 ) { ns /= 1000.0 ; suffix = "ms" ; } if ( ns >= 1000.0 ) { ns /= 1000.0 ; suffix = "s" ; } return java.lang.String.format ( "%4.1f%s" , ns , suffix ) . trim ( ) ; }
Source:
private void appendLineNumber ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx , boolean isForSideA ) { m.openTd ( ) ; m.setStyleName ( Gerrit.RESOURCES.css ( ) . lineNumber ( ) ) ; if ( isForSideA ) { m.addStyleName ( Gerrit.RESOURCES.css ( ) . rightBorder ( ) ) ; } m.append ( com.google.gwtexpui.safehtml.client.SafeHtml.asis ( ( ( "<a href=\"javascript:void(0)\">" + ( idx + 1 ) ) + "</a>" ) ) ) ; m.closeTd ( ) ; }

Target:
private void appendLineNumberForSideB ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx ) { m.openTd ( ) ; m.setStyleName ( Gerrit.RESOURCES.css ( ) . lineNumber ( ) ) ; m.append ( com.google.gwtexpui.safehtml.client.SafeHtml.asis ( ( ( "<a href=\"javascript:void(0)\">" + ( idx + 1 ) ) + "</a>" ) ) ) ; m.closeTd ( ) ; }
Source:
private static com.google.gerrit.client.change.RelatedChangesTab.MyTable getMyTable ( com.google.gwt.dom.client.NativeEvent event ) { com.google.gerrit.client.change.Element e = event.getEventTarget ( ) . cast ( ) ; for ( e = com.google.gwt.user.client.DOM.getParent ( e ) ; e != null ; e = com.google.gwt.user.client.DOM.getParent ( e ) ) { com.google.gwt.user.client.EventListener l = com.google.gwt.user.client.DOM.getEventListener ( e ) ; if ( l instanceof com.google.gerrit.client.change.RelatedChangesTab.MyTable ) { return ( ( com.google.gerrit.client.change.RelatedChangesTab.MyTable ) ( l ) ) ; } } return null ; }

Target:
private com.google.gwt.user.client.Element getRow ( int row ) { if ( ( ( startRow ) <= row ) && ( row < ( ( startRow ) + ( body.getChildCount ( ) ) ) ) ) { return body.getChild ( ( row - ( startRow ) ) ) . cast ( ) ; } return null ; }
Source:
boolean matches ( org.eclipse.jgit.lib.Repository git ) throws java.io.IOException { org.eclipse.jgit.lib.Ref head = git.getRef ( Constants.HEAD ) ; return ( ( head != null ) && ( head.isSymbolic ( ) ) ) && ( GitRepositoryManager.REF_CONFIG.equals ( head.getLeaf ( ) . getName ( ) ) ) ; }

Target:
boolean matches ( org.eclipse.jgit.lib.Repository git ) throws java.io.IOException { org.eclipse.jgit.lib.Ref head = git.getRef ( Constants.HEAD ) ; return ( ( head != null ) && ( head.isSymbolic ( ) ) ) && ( RefNames.REFS_CONFIG.equals ( head.getLeaf ( ) . getName ( ) ) ) ; }
Source:
private static com.google.gerrit.server.git.CodeReviewCommit failed ( final org.eclipse.jgit.revwalk.RevWalk rw , final org.eclipse.jgit.revwalk.RevFlag canMergeFlag , final com.google.gerrit.server.git.CodeReviewCommit mergeTip , final com.google.gerrit.server.git.CodeReviewCommit n , final com.google.gerrit.server.git.CommitMergeStatus failure ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { rw.resetRetain ( canMergeFlag ) ; rw.markStart ( n ) ; rw.markUninteresting ( mergeTip ) ; com.google.gerrit.server.git.CodeReviewCommit failed ; while ( ( failed = ( ( com.google.gerrit.server.git.CodeReviewCommit ) ( rw.next ( ) ) ) ) != null ) { failed.statusCode = failure ; } return failed ; }

Target:
private static com.google.gerrit.server.git.CodeReviewCommit failed ( final org.eclipse.jgit.revwalk.RevWalk rw , final org.eclipse.jgit.revwalk.RevFlag canMergeFlag , final com.google.gerrit.server.git.CodeReviewCommit mergeTip , final com.google.gerrit.server.git.CodeReviewCommit n , final com.google.gerrit.server.git.CommitMergeStatus failure ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { rw.resetRetain ( canMergeFlag ) ; rw.markStart ( n ) ; rw.markUninteresting ( mergeTip ) ; com.google.gerrit.server.git.CodeReviewCommit failed ; while ( ( failed = ( ( com.google.gerrit.server.git.CodeReviewCommit ) ( rw.next ( ) ) ) ) != null ) { failed.setStatusCode ( failure ) ; } return failed ; }
Source:
static void postSignIn ( final boolean success ) { final com.google.gerrit.client.SignInDialog d = com.google.gerrit.client.SignInDialog.current ; assert d != null ; if ( success ) { com.google.gerrit.client.Gerrit.postSignIn ( ) ; d.hide ( ) ; if ( ( d.callback ) != null ) { com.google.gwt.user.client.DeferredCommand.addCommand ( new com.google.gwt.user.client.Command ( ) { public void execute ( ) { d.callback.onSuccess ( null ) ; } } ) ; } } else { d.hide ( ) ; } }

Target:
private void onCallback ( final com.google.gerrit.client.reviewdb.Account result ) { if ( result != null ) { com.google.gerrit.client.Gerrit.postSignIn ( ) ; hide ( ) ; final com.google.gwt.user.client.rpc.AsyncCallback < ? > ac = appCallback ; if ( ac != null ) { com.google.gwt.user.client.DeferredCommand.addCommand ( new com.google.gwt.user.client.Command ( ) { public void execute ( ) { ac.onSuccess ( null ) ; } } ) ; } } else { hide ( ) ; } }
Source:
protected void onInitUI ( ) { final com.google.gwt.user.client.ui.FlowPanel me = ( ( com.google.gwt.user.client.ui.FlowPanel ) ( getWidget ( ) ) ) ; me.add ( ( header = new com.google.gwt.user.client.ui.FlowPanel ( ) ) ) ; me.add ( ( body = new com.google.gwt.user.client.ui.FlowPanel ( ) ) ) ; header.setStyleName ( "gerrit-ScreenHeader" ) ; header.add ( ( headerText = new com.google.gwt.user.client.ui.InlineLabel ( ) ) ) ; }

Target:
protected void onInitUI ( ) { final com.google.gwt.user.client.ui.FlowPanel me = ( ( com.google.gwt.user.client.ui.FlowPanel ) ( getWidget ( ) ) ) ; me.add ( ( header = new com.google.gwt.user.client.ui.FlowPanel ( ) ) ) ; me.add ( ( body = new com.google.gwt.user.client.ui.FlowPanel ( ) ) ) ; header.setStyleName ( Gerrit.RESOURCES.css ( ) . screenHeader ( ) ) ; header.add ( ( headerText = new com.google.gwt.user.client.ui.InlineLabel ( ) ) ) ; }
Source:
private void setDoubleClickHandler ( ) { if ( ( messageClick ) == null ) { messageClick = contentPanelMessage.addDomHandler ( new com.google.gwt.event.dom.client.DoubleClickHandler ( ) { @ java.lang.Override public void onDoubleClick ( com.google.gwt.event.dom.client.DoubleClickEvent arg0 ) { editArea.setText ( contentPanelMessage.getText ( ) ) ; setEdit ( ( ! ( isEdit ( ) ) ) ) ; runClickCallback ( ) ; } } , com.google.gwt.event.dom.client.DoubleClickEvent.getType ( ) ) ; } }

Target:
private void removeUI ( ) { if ( ( replyToBox ) != null ) { replyToBox.unregisterReplyBox ( ) ; } getPaddingWidget ( ) . clear ( ) ; removeFromParent ( ) ; getSelfWidget ( ) . clear ( ) ; }
Source:
public java.lang.String getUrl ( ) { java.lang.StringBuilder b = new java.lang.StringBuilder ( ) ; b.append ( "ssh://" ) ; b.append ( session.getUserName ( ) ) ; b.append ( "@" ) ; b.append ( session.getHost ( ) ) ; b.append ( ":" ) ; b.append ( session.getPort ( ) ) ; return b.toString ( ) ; }

Target:
public java.lang.String getUrl ( ) { com.google.common.base.Preconditions.checkState ( ( ( session ) != null ) , "session must be opened" ) ; java.lang.StringBuilder b = new java.lang.StringBuilder ( ) ; b.append ( "ssh://" ) ; b.append ( session.getUserName ( ) ) ; b.append ( "@" ) ; b.append ( session.getHost ( ) ) ; b.append ( ":" ) ; b.append ( session.getPort ( ) ) ; return b.toString ( ) ; }
Source:
private void assertBranches ( java.util.List < java.lang.String > branches ) throws java.lang.Exception { java.util.List < java.lang.String > expected = com.google.common.collect.Lists.newArrayList ( "HEAD" , "refs/meta/config" , "refs/heads/master" ) ; expected.addAll ( branches ) ; com.google.gerrit.acceptance.rest.project.BranchAssert.assertRefNames ( expected , project ( ) . branches ( ) . get ( ) ) ; }

Target:
private void assertBranches ( java.util.List < java.lang.String > branches ) throws java.lang.Exception { java.util.List < java.lang.String > expected = com.google.common.collect.Lists.newArrayList ( "HEAD" , RefNames.REFS_CONFIG , "refs/heads/master" ) ; expected.addAll ( branches ) ; com.google.gerrit.acceptance.rest.project.BranchAssert.assertRefNames ( expected , project ( ) . branches ( ) . get ( ) ) ; }
Source:
private void initMessage ( final com.google.gwt.user.client.ui.Panel body ) { body.add ( new com.google.gerrit.client.ui.SmallHeading ( Util.C.headingCoverMessage ( ) ) ) ; final com.google.gwt.user.client.ui.VerticalPanel mwrap = new com.google.gwt.user.client.ui.VerticalPanel ( ) ; mwrap.setStyleName ( "gerrit-CoverMessage" ) ; body.add ( mwrap ) ; message = new com.google.gwt.user.client.ui.TextArea ( ) ; message.setCharacterWidth ( 60 ) ; message.setVisibleLines ( 10 ) ; com.google.gwt.user.client.DOM.setElementPropertyBoolean ( message.getElement ( ) , "spellcheck" , true ) ; mwrap.add ( message ) ; }

Target:
private void initMessage ( final com.google.gwt.user.client.ui.Panel body ) { body.add ( new com.google.gerrit.client.ui.SmallHeading ( Util.C.headingCoverMessage ( ) ) ) ; final com.google.gwt.user.client.ui.VerticalPanel mwrap = new com.google.gwt.user.client.ui.VerticalPanel ( ) ; mwrap.setStyleName ( "gerrit-CoverMessage" ) ; body.add ( mwrap ) ; message = new com.google.gwtexpui.globalkey.client.NpTextArea ( ) ; message.setCharacterWidth ( 60 ) ; message.setVisibleLines ( 10 ) ; com.google.gwt.user.client.DOM.setElementPropertyBoolean ( message.getElement ( ) , "spellcheck" , true ) ; mwrap.add ( message ) ; }
Source:
public int compare ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . compare ( a.when , b.when ) . compare ( a.who.get ( ) , b.who.get ( ) ) . compare ( a.psId.get ( ) , b.psId.get ( ) ) . result ( ) ; }

Target:
public int compare ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . compare ( a.when , b.when ) . compare ( a.who , b.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( a.psId.get ( ) , b.psId.get ( ) ) . result ( ) ; }
Source:
com.googlesource.gerrit.plugins.replication.ReplicationState [ ] getStatesAsArray ( ) { java.util.Set < com.googlesource.gerrit.plugins.replication.ReplicationState > statesSet = new java.util.HashSet < > ( ) ; statesSet.addAll ( stateMap.values ( ) ) ; return statesSet.toArray ( new com.googlesource.gerrit.plugins.replication.ReplicationState [ statesSet.size ( ) ] ) ; }

Target:
private void statesCleanUp ( ) { if ( ( ! ( stateMap.isEmpty ( ) ) ) && ( ! ( isRetrying ( ) ) ) ) { for ( java.util.Map.Entry < java.lang.String , com.googlesource.gerrit.plugins.replication.ReplicationState > entry : stateMap.entries ( ) ) { entry.getValue ( ) . notifyRefReplicated ( projectName.get ( ) , entry.getKey ( ) , uri , RefPushResult.FAILED , null ) ; } } }
Source:
public void show ( ) { super . show ( ) ; if ( ( regWindowResize ) == null ) { regWindowResize = com.google.gwt.user.client.Window.addResizeHandler ( this ) ; } com.google.gwtexpui.globalkey.client.GlobalKey.dialog ( this ) ; if ( fileList.isLoaded ( ) ) { installFileList ( ) ; } else { fileList.onTableLoaded ( new com.google.gwt.user.client.Command ( ) { @ java.lang.Override public void execute ( ) { sp.setHeight ( "" ) ; setPosition ( getOffsetWidth ( ) , getOffsetHeight ( ) ) ; installFileList ( ) ; } } ) ; } }

Target:
public void execute ( ) { sp.setHeight ( "" ) ; setPosition ( getOffsetWidth ( ) , getOffsetHeight ( ) ) ; fileList.setRegisterKeys ( true ) ; fileList.movePointerTo ( callerKey ) ; }
Source:
public void requestReceived ( com.github.tomakehurst.wiremock.http.Request request , com.github.tomakehurst.wiremock.http.Response response ) { if ( request.getAbsoluteUrl ( ) . contains ( flushRequest ) ) { try { checkPoint.await ( ) ; } catch ( java.lang.InterruptedException | java.util.concurrent.BrokenBarrierException e ) { com.google.common.base.Throwables.propagateIfPossible ( e ) ; } } }

Target:
public void requestReceived ( com.github.tomakehurst.wiremock.http.Request request , com.github.tomakehurst.wiremock.http.Response response ) { if ( request.getAbsoluteUrl ( ) . contains ( flushRequest ) ) { try { checkPoint.await ( ) ; } catch ( java.lang.InterruptedException | java.util.concurrent.BrokenBarrierException e ) { org.junit.Assert.fail ( ) ; } } }
Source:
public void restoreFile ( java.lang.String filePath ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeEdits.Post.Input restoreInput = new com.google.gerrit.server.change.ChangeEdits.Post.Input ( ) ; restoreInput.restorePath = filePath ; changeEditsPost.apply ( changeResource , restoreInput ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot restore file of change edit" , e ) ; } }

Target:
public void restoreFile ( java.lang.String filePath ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.restapi.change.ChangeEdits.Post.Input restoreInput = new com.google.gerrit.server.restapi.change.ChangeEdits.Post.Input ( ) ; restoreInput.restorePath = filePath ; changeEditsPost.apply ( changeResource , restoreInput ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot restore file of change edit" , e ) ; } }
Source:
private com.google.gerrit.server.git.ProjectConfig parseConfig ( com.google.gerrit.reviewdb.client.Project.NameKey p , java.lang.String idStr ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException , org.eclipse.jgit.errors.RepositoryNotFoundException { org.eclipse.jgit.lib.ObjectId id = org.eclipse.jgit.lib.ObjectId.fromString ( idStr ) ; if ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) . equals ( id ) ) { return null ; } try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( p ) ) { com.google.gerrit.server.git.ProjectConfig pc = new com.google.gerrit.server.git.ProjectConfig ( p ) ; pc.load ( repo , id ) ; return pc ; } }

Target:
private com.google.gerrit.server.project.ProjectConfig parseConfig ( com.google.gerrit.reviewdb.client.Project.NameKey p , java.lang.String idStr ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException , org.eclipse.jgit.errors.RepositoryNotFoundException { org.eclipse.jgit.lib.ObjectId id = org.eclipse.jgit.lib.ObjectId.fromString ( idStr ) ; if ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) . equals ( id ) ) { return null ; } try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( p ) ) { com.google.gerrit.server.project.ProjectConfig pc = new com.google.gerrit.server.project.ProjectConfig ( p ) ; pc.load ( repo , id ) ; return pc ; } }
Source:
public boolean isOwner ( ) { return ( canPerform ( com.google.gerrit.reviewdb.ApprovalCategory.OWN , ( ( short ) ( 1 ) ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ; }

Target:
public boolean isOwner ( ) { if ( canPerform ( com.google.gerrit.reviewdb.ApprovalCategory.OWN , ( ( short ) ( 1 ) ) ) ) { return true ; } if ( ( ! ( RefRight.ALL.equals ( getRefName ( ) ) ) ) && ( getProjectControl ( ) . isOwner ( ) ) ) { return true ; } return false ; }
Source:
private java.lang.String parseError ( com.google.gerrit.common.data.ReviewResult.Error.Type type ) { switch ( type ) { case ABANDON_NOT_PERMITTED : return "not permitted to abandon change" ; case RESTORE_NOT_PERMITTED : return "not permitted to restore change" ; case SUBMIT_NOT_PERMITTED : return "not permitted to submit change" ; case SUBMIT_NOT_READY : return "approvals or dependencies lacking" ; case CHANGE_IS_CLOSED : return "change is closed" ; case CHANGE_NOT_ABANDONED : return "change is not abandoned" ; case PUBLISH_NOT_PERMITTED : return "not permitted to publish change" ; case DELETE_NOT_PERMITTED : return "not permitted to delete change/patch set" ; case RULE_ERROR : return "rule error" ; case NOT_A_DRAFT : return "change/patch set is not a draft" ; case GIT_ERROR : return "error writing change to git repository" ; case DEST_BRANCH_NOT_FOUND : return "destination branch not found" ; default : return "failure in review" ; } }

Target:
private com.google.gerrit.extensions.api.changes.RevisionApi revisionApi ( com.google.gerrit.reviewdb.client.PatchSet patchSet ) throws com.google.gerrit.extensions.restapi.RestApiException { return changeApi ( patchSet ) . revision ( patchSet.getRevision ( ) . get ( ) ) ; }
Source:
private void insertDummyApproval ( final com.google.gerrit.reviewdb.Change change , final com.google.gerrit.reviewdb.PatchSet.Id psId , final com.google.gerrit.reviewdb.Account.Id forAccount , final com.google.gerrit.reviewdb.ApprovalCategory.Id catId , final com.google.gerrit.reviewdb.ReviewDb db ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.reviewdb.PatchSetApproval ca = new com.google.gerrit.reviewdb.PatchSetApproval ( new com.google.gerrit.reviewdb.PatchSetApproval.Key ( psId , forAccount , catId ) , ( ( short ) ( 0 ) ) ) ; ca.cache ( change ) ; db.patchSetApprovals ( ) . insert ( java.util.Collections.singleton ( ca ) ) ; }

Target:
public void run ( ) { try { final com.google.gerrit.server.mail.CreateChangeSender cm ; cm = createChangeSenderFactory.create ( change ) ; cm.setFrom ( me ) ; cm.setPatchSet ( ps , info ) ; cm.addReviewers ( reviewers ) ; cm.addExtraCC ( cc ) ; cm.send ( ) ; } catch ( java.lang.Exception e ) { com.google.gerrit.server.git.ReceiveCommits.log.error ( ( "Cannot send email for new change " + ( change.getId ( ) ) ) , e ) ; } }
Source:
public void testAppend_SafeHtml ( ) { final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder b = new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) ; assertSame ( b , b.append ( ( ( com.google.gwtexpui.safehtml.client.SafeHtml ) ( null ) ) ) ) ; assertEquals ( "" , b.asString ( ) ) ; assertSame ( b , b.append ( new com.google.gwtexpui.safehtml.client.SafeHtmlString ( "foo" ) ) ) ; assertSame ( b , b.append ( new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( "bar" ) ) ) ; assertEquals ( "foobar" , b.asString ( ) ) ; }

Target:
public void testEntityNbsp ( ) { final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder b = new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) ; org.junit.Assert.assertSame ( b , b.nbsp ( ) ) ; org.junit.Assert.assertEquals ( "&nbsp;" , b.asString ( ) ) ; }
Source:
private byte [ ] dataRowKey ( T obj ) { com.google.gwtorm.nosql.IndexKeyBuilder b = new com.google.gwtorm.nosql.IndexKeyBuilder ( ) ; b.add ( com.google.gwtorm.nosql.generic.GenericAccess.getRelationName ( ) ) ; b.delimiter ( ) ; com.google.gwtorm.nosql.generic.GenericAccess.getKeyIndex ( ) . encode ( b , obj ) ; return b.toByteArray ( ) ; }

Target:
protected byte [ ] dataRowKey ( K key ) { com.google.gwtorm.nosql.IndexKeyBuilder b = new com.google.gwtorm.nosql.IndexKeyBuilder ( ) ; b.add ( com.google.gwtorm.nosql.generic.GenericAccess.getRelationName ( ) ) ; b.delimiter ( ) ; encodePrimaryKey ( b , key ) ; return b.toByteArray ( ) ; }
Source:
public void emptyServletPath ( ) { com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( mockRequest ( "/c/foo/bar" , "" , "/c" ) ) ) . isEqualTo ( "/foo/bar" ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( mockRequest ( "/c/foo%2Fbar" , "" , "/c" ) ) ) . isEqualTo ( "/foo%2Fbar" ) ; }

Target:
public void emptyServletPath ( ) { com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( fakeRequest ( "" , "/c" , "/foo/bar" ) ) ) . isEqualTo ( "/foo/bar" ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.util.http.RequestUtil.getEncodedPathInfo ( fakeRequest ( "" , "/c" , "/foo%2Fbar" ) ) ) . isEqualTo ( "/foo%2Fbar" ) ; }
Source:
private java.util.List < com.google.gerrit.reviewdb.Account > byPreferredEmail ( final javax.servlet.http.HttpServletResponse rsp , final java.lang.String email ) { try { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { return db.accounts ( ) . byPreferredEmail ( email ) . toList ( ) ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { getServletContext ( ) . log ( "cannot query database" , e ) ; return java.util.Collections.< com.google.gerrit.reviewdb.Account > emptyList ( ) ; } }

Target:
private com.google.gerrit.server.account.AuthResult bySshUserName ( final javax.servlet.http.HttpServletResponse rsp , final java.lang.String userName ) { try { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { return auth ( db.accounts ( ) . bySshUserName ( userName ) ) ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { getServletContext ( ) . log ( "cannot query database" , e ) ; return null ; } }
Source:
protected void configure ( ) { if ( ! ( com.google.gerrit.server.util.BouncyCastleUtil.havePGP ( ) ) ) { com.google.gerrit.server.git.gpg.SignedPushModule.log.info ( ( "BouncyCastle PGP not installed; signed push verification is" + " disabled" ) ) ; return ; } bind ( com.google.gerrit.server.git.gpg.PublicKeyChecker.class ) . to ( com.google.gerrit.server.git.gpg.GerritPublicKeyChecker.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.server.git.ReceivePackInitializer.class ) . to ( com.google.gerrit.server.git.gpg.SignedPushModule.Initializer.class ) ; }

Target:
protected void configure ( ) { if ( ! ( com.google.gerrit.server.util.BouncyCastleUtil.havePGP ( ) ) ) { com.google.gerrit.server.git.gpg.SignedPushModule.log.info ( ( "BouncyCastle PGP not installed; signed push verification is" + " disabled" ) ) ; return ; } bind ( com.google.gerrit.server.git.gpg.PublicKeyChecker.class ) . to ( com.google.gerrit.server.git.gpg.GerritPublicKeyChecker.class ) ; bind ( com.google.gerrit.server.git.gpg.PublicKeyStore.class ) . toProvider ( com.google.gerrit.server.git.gpg.SignedPushModule.StoreProvider.class ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.server.git.ReceivePackInitializer.class ) . to ( com.google.gerrit.server.git.gpg.SignedPushModule.Initializer.class ) ; }
Source:
protected void configure ( ) { bind ( com.google.gerrit.pgm.util.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.Objects.firstNonNull ( getInstallPlugins ( ) , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.InstallPlugins.class ) . toInstance ( plugins ) ; bind ( com.google.gerrit.pgm.init.PluginsDistribution.class ) . toInstance ( pluginsDistribution ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.pgm.init.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.Objects.firstNonNull ( getInstallPlugins ( ) , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.InstallPlugins.class ) . toInstance ( plugins ) ; bind ( com.google.gerrit.pgm.init.PluginsDistribution.class ) . toInstance ( pluginsDistribution ) ; }
Source:
public com.google.gerrit.reviewdb.client.PatchSet currentPatchSet ( com.google.inject.Provider < com.google.gerrit.reviewdb.server.ReviewDb > db ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change c = change ( db ) ; if ( c == null ) { return null ; } for ( com.google.gerrit.reviewdb.client.PatchSet p : patches ( db ) ) { if ( p.getId ( ) . equals ( c.currentPatchSetId ( ) ) ) { return p ; } } return null ; }

Target:
public com.google.gerrit.reviewdb.client.PatchSet currentPatchSet ( com.google.inject.Provider < com.google.gerrit.reviewdb.server.ReviewDb > db ) throws com.google.gwtorm.server.OrmException { if ( ( currentPatchSet ) == null ) { com.google.gerrit.reviewdb.client.Change c = change ( db ) ; if ( c == null ) { return null ; } for ( com.google.gerrit.reviewdb.client.PatchSet p : patches ( db ) ) { if ( p.getId ( ) . equals ( c.currentPatchSetId ( ) ) ) { currentPatchSet = p ; return p ; } } } return currentPatchSet ; }
Source:
public void testIsEnabledRefParentNoBranchEnabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { } ; setupIsEnabled ( "false" , "true" , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertFalse ( itsConfig.isEnabled ( "testProject" , "refs/heads/testBranch" ) ) ; }

Target:
public void testIsEnabledRefNoParentMatchingBranchMiddleDisabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/foo.*" , "^refs/heads/test.*" , "^refs/heads/baz.*" } ; setupIsEnabled ( "false" , null , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectNK = new com.google.gerrit.reviewdb.client.Project.NameKey ( "testProject" ) ; assertFalse ( itsConfig.isEnabled ( projectNK , "refs/heads/testBranch" ) ) ; }
Source:
public com.google.gerrit.client.reviewdb.AccountGroup lookup ( final java.lang.String groupName ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.ReviewDb db = schema.open ( ) ; try { final com.google.gerrit.client.reviewdb.AccountGroup.NameKey nameKey = new com.google.gerrit.client.reviewdb.AccountGroup.NameKey ( groupName ) ; final com.google.gerrit.client.reviewdb.AccountGroup group = db.accountGroups ( ) . get ( nameKey ) ; if ( group != null ) { return group ; } else { return null ; } } finally { db.close ( ) ; } }

Target:
public com.google.gerrit.client.reviewdb.AccountGroup lookup ( final java.lang.String groupName ) { return byName.get ( new com.google.gerrit.client.reviewdb.AccountGroup.NameKey ( groupName ) ) ; }
Source:
public void updateSchema ( ) throws com.google.gwtorm.client.OrmException { try { createSequences ( ) ; createRelations ( ) ; for ( final com.google.gwtorm.schema.RelationModel rel : dbDef.getSchemaModel ( ) . getRelations ( ) ) { addColumns ( rel ) ; } } catch ( java.sql.SQLException e ) { throw new com.google.gwtorm.client.OrmException ( "Schema update failure" , e ) ; } }

Target:
public void updateSchema ( final com.google.gwtorm.client.StatementExecutor e ) throws com.google.gwtorm.client.OrmException { try { createSequences ( e ) ; createRelations ( e ) ; for ( final com.google.gwtorm.schema.RelationModel rel : dbDef.getSchemaModel ( ) . getRelations ( ) ) { addColumns ( e , rel ) ; } } catch ( java.sql.SQLException err ) { throw new com.google.gwtorm.client.OrmException ( "Cannot update schema" , err ) ; } }
Source:
public void createDraftChangeNotAllowed ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( isAllowDrafts ( ) ) . isFalse ( ) ; com.google.gerrit.extensions.common.ChangeInfo ci = newChangeInfo ( ChangeStatus.DRAFT ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.post ( "/changes/" , ci ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_METHOD_NOT_ALLOWED ) ; com.google.common.truth.Truth.assertThat ( r.getEntityContent ( ) ) . contains ( "draft workflow is disabled" ) ; }

Target:
private void assertCreateFails ( com.google.gerrit.extensions.common.ChangeInfo in , java.lang.Class < ? extends com.google.gerrit.extensions.restapi.RestApiException > errType , java.lang.String errSubstring ) throws java.lang.Exception { try { gApi.changes ( ) . create ( in ) ; org.junit.Assert.fail ( ( "Expected " + ( errType.getSimpleName ( ) ) ) ) ; } catch ( com.google.gerrit.extensions.restapi.RestApiException expected ) { com.google.common.truth.Truth.assertThat ( expected ) . isInstanceOf ( errType ) ; com.google.common.truth.Truth.assertThat ( expected.getMessage ( ) ) . contains ( errSubstring ) ; } }
Source:
public void testInsertOneDBException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement insert = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.insert ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; }

Target:
public void testInsertOneException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { sqlException = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement insert = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.AbstractTestJdbcAccess.INSERT , sqlException ) ; try { classUnderTest.insert ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , sqlException ) ; } assertCorrectUpdating ( insert , 1 ) ; }