auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static boolean isMetadata ( java.lang.String name ) { return ( name.startsWith ( com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES ) ) || ( com.google.gerrit.reviewdb.client.RefNames.isRefsEdit ( name ) ) ; }

Target:
private static boolean isMetadata ( com.google.gerrit.server.project.ProjectControl projectCtl , java.lang.String name ) { return ( ( name.startsWith ( com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES ) ) || ( com.google.gerrit.reviewdb.client.RefNames.isRefsEdit ( name ) ) ) || ( ( projectCtl.getProjectState ( ) . isAllUsers ( ) ) && ( name.equals ( RefNames.REFS_EXTERNAL_IDS ) ) ) ; }
Source:
private com.google.gerrit.reviewdb.client.PatchSetApproval psa ( com.google.gerrit.reviewdb.client.Account.Id accountId , java.lang.String label , int value ) { return new com.google.gerrit.reviewdb.client.PatchSetApproval ( new com.google.gerrit.reviewdb.client.PatchSetApproval.Key ( change.currentPatchSetId ( ) , accountId , new com.google.gerrit.reviewdb.client.PatchSetApproval.LabelId ( label ) ) , ( ( short ) ( value ) ) , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; }

Target:
private com.google.gerrit.reviewdb.client.PatchSetApproval psa ( com.google.gerrit.reviewdb.client.Account.Id accountId , java.lang.String label , int value ) { return new com.google.gerrit.reviewdb.client.PatchSetApproval ( new com.google.gerrit.reviewdb.client.PatchSetApproval.Key ( change.currentPatchSetId ( ) , accountId , new com.google.gerrit.reviewdb.client.LabelId ( label ) ) , ( ( short ) ( value ) ) , com.google.gerrit.common.TimeUtil.nowTs ( ) ) ; }
Source:
protected void preDisplay ( final com.google.gerrit.common.data.GroupDetail result ) { enableForm ( result.canModify ) ; saveName.setVisible ( result.canModify ) ; saveOwner.setVisible ( result.canModify ) ; saveDesc.setVisible ( result.canModify ) ; saveGroupOptions.setVisible ( result.canModify ) ; delMember.setVisible ( result.canModify ) ; members.setEnabled ( result.canModify ) ; saveType.setVisible ( result.canModify ) ; display ( result ) ; }

Target:
private void enableForm ( final boolean canModify ) { groupNameTxt.setEnabled ( canModify ) ; ownerTxtBox.setEnabled ( canModify ) ; descTxt.setEnabled ( canModify ) ; typeSelect.setEnabled ( canModify ) ; addMemberBox.setEnabled ( canModify ) ; members.setEnabled ( canModify ) ; externalNameFilter.setEnabled ( canModify ) ; externalNameSearch.setEnabled ( canModify ) ; visibleToAllCheckBox.setEnabled ( canModify ) ; emailOnlyAuthors.setEnabled ( canModify ) ; addIncludeBox.setEnabled ( canModify ) ; includes.setEnabled ( canModify ) ; }
Source:
public com.google.gerrit.reviewdb.Change update ( com.google.gerrit.reviewdb.Change c ) { c.setStatus ( Change.Status.MERGED ) ; if ( ! ( merged.equals ( c.currentPatchSetId ( ) ) ) ) { try { c.setCurrentPatchSet ( patchSetInfoFactory.get ( merged ) ) ; } catch ( com.google.gerrit.server.patch.PatchSetInfoNotAvailableException e1 ) { com.google.gerrit.server.git.MergeOp.log.error ( ( "Cannot read merged patch set " + merged ) , e1 ) ; } } com.google.gerrit.server.ChangeUtil.updated ( c ) ; return c ; }

Target:
public com.google.gerrit.reviewdb.Change update ( com.google.gerrit.reviewdb.Change c ) { c.setStatus ( Change.Status.MERGED ) ; c.setMergeable ( true ) ; if ( ! ( merged.equals ( c.currentPatchSetId ( ) ) ) ) { try { c.setCurrentPatchSet ( patchSetInfoFactory.get ( schema , merged ) ) ; } catch ( com.google.gerrit.server.patch.PatchSetInfoNotAvailableException e1 ) { com.google.gerrit.server.git.MergeOp.log.error ( ( "Cannot read merged patch set " + merged ) , e1 ) ; } } com.google.gerrit.server.ChangeUtil.updated ( c ) ; return c ; }
Source:
public static com.google.gerrit.extensions.restapi.BinaryResult create ( java.lang.String data ) { try { return com.google.gerrit.extensions.restapi.BinaryResult.create ( data.getBytes ( "UTF-8" ) ) . setContentType ( "text/plain" ) . setCharacterEncoding ( "UTF-8" ) ; } catch ( java.io.UnsupportedEncodingException e ) { throw new java.lang.RuntimeException ( "JVM does not support UTF-8" , e ) ; } }

Target:
public static com.google.gerrit.extensions.restapi.BinaryResult create ( java.lang.String data ) { return new com.google.gerrit.extensions.restapi.BinaryResult.StringResult ( data ) ; }
Source:
public boolean filterSessionAuth ( final com.google.gerrit.extensions.registration.DynamicItem < com.google.gerrit.httpd.WebSession > webSession , javax.servlet.http.HttpServletRequest request ) { request.setAttribute ( "gerrit-username" , webSession.get ( ) . getCurrentUser ( ) . getUserName ( ) ) ; request.setAttribute ( "gerrit-token" , webSession.get ( ) . getSessionId ( ) ) ; return true ; }

Target:
public boolean filterSessionAuth ( final com.google.gerrit.extensions.registration.DynamicItem < com.google.gerrit.httpd.WebSession > webSession , javax.servlet.http.HttpServletRequest request ) { request.setAttribute ( "gerrit-username" , webSession.get ( ) . getUser ( ) . getUserName ( ) ) ; request.setAttribute ( "gerrit-token" , webSession.get ( ) . getSessionId ( ) ) ; return true ; }
Source:
public java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > onCommitReceived ( com.google.gerrit.server.events.CommitReceivedEvent receiveEvent ) throws com.google.gerrit.server.git.validators.CommitValidationException { if ( itsConfig.isEnabled ( receiveEvent.project.getName ( ) ) ) { return validCommit ( receiveEvent.command , receiveEvent.commit ) ; } else { return java.util.Collections.emptyList ( ) ; } }

Target:
public java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > onCommitReceived ( com.google.gerrit.server.events.CommitReceivedEvent receiveEvent ) throws com.google.gerrit.server.git.validators.CommitValidationException { if ( itsConfig.isEnabled ( receiveEvent.project.getName ( ) , receiveEvent.refName ) ) { return validCommit ( receiveEvent.command , receiveEvent.commit ) ; } else { return java.util.Collections.emptyList ( ) ; } }
Source:
public void advertiseRefs ( org.eclipse.jgit.transport.BaseReceivePack rp ) { allRefs = rp.getAdvertisedRefs ( ) ; if ( ( allRefs ) == null ) { allRefs = rp.getRepository ( ) . getAllRefs ( ) ; } rp.setAdvertisedRefs ( allRefs , rp.getAdvertisedObjects ( ) ) ; }

Target:
public void advertiseRefs ( org.eclipse.jgit.transport.BaseReceivePack rp ) throws org.eclipse.jgit.transport.ServiceMayNotContinueException { allRefs = rp.getAdvertisedRefs ( ) ; if ( ( allRefs ) == null ) { try { allRefs = rp.getRepository ( ) . getRefDatabase ( ) . getRefs ( org.eclipse.jgit.lib.RefDatabase.ALL ) ; } catch ( java.io.IOException e ) { org.eclipse.jgit.transport.ServiceMayNotContinueException ex = new org.eclipse.jgit.transport.ServiceMayNotContinueException ( e.getMessage ( ) ) ; ex.initCause ( e ) ; throw ex ; } } rp.setAdvertisedRefs ( allRefs , rp.getAdvertisedObjects ( ) ) ; }
Source:
public void onlyDateNoTime ( ) throws java.lang.Exception { java.util.Map < java.lang.String , java.lang.String > params = new java.util.HashMap < > ( ) ; params.put ( "t1" , "2013-10-10" ) ; params.put ( "t2" , "2014-10-10" ) ; java.lang.String query = com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.queryMaker.formQueryFromRequestParameters ( params ) ; com.google.common.truth.Truth.assertThat ( query ) . isNotEqualTo ( com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.defaultQuery ) ; }

Target:
public void onlyDateNoTime ( ) throws java.lang.Exception { java.lang.String query = queryMaker.formQueryFromRequestParameters ( com.google.common.collect.ImmutableMap.of ( com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.T1 , "2013-10-10" , com.ericsson.gerrit.plugins.eventslog.sql.QueryMakerTest.T2 , "2014-10-10" ) ) ; com.google.common.truth.Truth.assertThat ( query ) . isNotEqualTo ( defaultQuery ) ; }
Source:
protected com.google.gwtorm.server.OrmException convertError ( final java.lang.String op , final java.sql.SQLException err ) { if ( ( ( err.getCause ( ) ) == null ) && ( ( err.getNextException ( ) ) != null ) ) { err.initCause ( err.getNextException ( ) ) ; } return schema.getDialect ( ) . convertError ( op , com.google.gwtorm.jdbc.JdbcAccess.getRelationName ( ) , err ) ; }

Target:
protected com.google.gwtorm.server.OrmException convertError ( final java.lang.String op , java.sql.SQLException err ) { if ( ( ( err.getCause ( ) ) == null ) && ( ( err.getNextException ( ) ) != null ) ) { if ( ( schema.getDialect ( ) ) instanceof com.google.gwtorm.schema.sql.DialectDB2 ) { err = err.getNextException ( ) ; } else { err.initCause ( err.getNextException ( ) ) ; } } return schema.getDialect ( ) . convertError ( op , com.google.gwtorm.jdbc.JdbcAccess.getRelationName ( ) , err ) ; }
Source:
private static boolean cacheForever ( final java.lang.String pathInfo ) { if ( pathInfo.endsWith ( ".cache.gif" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.html" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.png" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.jar" ) ) { return true ; } return false ; }

Target:
private static boolean cacheForever ( final java.lang.String pathInfo ) { if ( pathInfo.endsWith ( ".cache.gif" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.html" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.png" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.jar" ) ) { return true ; } if ( pathInfo.endsWith ( ".cache.swf" ) ) { return true ; } return false ; }
Source:
private void format ( com.google.gerrit.client.changes.ChangeInfo.GitPerson person , com.google.gwt.dom.client.Element name , com.google.gwt.dom.client.Element date ) { name.setInnerText ( ( ( ( ( person.name ( ) ) + " <" ) + ( person.email ( ) ) ) + ">" ) ) ; date.setInnerText ( com.google.gerrit.client.FormatUtil.mediumFormat ( person.date ( ) ) ) ; }

Target:
private static void formatLink ( com.google.gerrit.client.changes.ChangeInfo.GitPerson person , com.google.gerrit.client.ui.InlineHyperlink name , com.google.gwt.dom.client.Element date , com.google.gerrit.reviewdb.client.Change.Status status ) { name.setText ( com.google.gerrit.client.change.CommitBox.renderName ( person ) ) ; name.setTargetHistoryToken ( com.google.gerrit.common.PageLinks.toAccountQuery ( com.google.gerrit.client.change.CommitBox.owner ( person ) , status ) ) ; date.setInnerText ( com.google.gerrit.client.FormatUtil.mediumFormat ( person.date ( ) ) ) ; }
Source:
public void onLoad ( ) { super . onLoad ( ) ; save.setVisible ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) ; addDomHandler ( new com.google.gwt.event.dom.client.KeyDownHandler ( ) { @ java.lang.Override public void onKeyDown ( com.google.gwt.event.dom.client.KeyDownEvent event ) { if ( ( ( event.getNativeKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE ) ) || ( ( event.getNativeKeyCode ( ) ) == ',' ) ) { close ( ) ; } } } , com.google.gwt.event.dom.client.KeyDownEvent.getType ( ) ) ; }

Target:
public void run ( ) { if ( ( prefs.context ( ) ) == ( com.google.gerrit.reviewdb.client.AccountDiffPreference.WHOLE_FILE_CONTEXT ) ) { contextEntireFile.setValue ( true ) ; } view.setContext ( prefs.context ( ) ) ; }
Source:
public void createChangeWithPrivateByDefaultEnabled ( ) throws java.lang.Exception { setPrivateByDefault ( project2 , InheritableBoolean.TRUE ) ; com.google.gerrit.extensions.common.ChangeInput input = new com.google.gerrit.extensions.common.ChangeInput ( project2.get ( ) , "master" , "empty change" ) ; com.google.common.truth.Truth.assertThat ( gApi.changes ( ) . create ( input ) . get ( ) . isPrivate ) . isEqualTo ( true ) ; }

Target:
public void createChangeWithPrivateByDefaultEnabled ( ) throws java.lang.Exception { setPrivateByDefault ( project2 , InheritableBoolean.TRUE ) ; com.google.gerrit.extensions.common.ChangeInput input = new com.google.gerrit.extensions.common.ChangeInput ( project2.get ( ) , "master" , "empty change" ) ; com.google.common.truth.Truth.assertThat ( gApi.changes ( ) . create ( input ) . get ( ) . isPrivate ) . isTrue ( ) ; }
Source:
private com.google.inject.Injector createSysInjector ( final com.google.gerrit.pgm.init.BaseInit.SiteInit init ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < > ( ) ; modules.add ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.pgm.init.api.ConsoleUI.class ) . toInstance ( init.ui ) ; bind ( com.google.gerrit.pgm.init.api.InitFlags.class ) . toInstance ( init.flags ) ; } } ) ; return createDbInjector ( com.google.gerrit.server.schema.DataSourceProvider.Context.SINGLE_USER ) . createChildInjector ( modules ) ; }

Target:
private com.google.inject.Injector createSysInjector ( final com.google.gerrit.pgm.init.BaseInit.SiteInit init ) { if ( ( sysInjector ) == null ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < > ( ) ; modules.add ( new com.google.inject.AbstractModule ( ) { @ java.lang.Override protected void configure ( ) { bind ( com.google.gerrit.pgm.init.api.ConsoleUI.class ) . toInstance ( init.ui ) ; bind ( com.google.gerrit.pgm.init.api.InitFlags.class ) . toInstance ( init.flags ) ; } } ) ; sysInjector = createDbInjector ( com.google.gerrit.server.schema.DataSourceProvider.Context.SINGLE_USER ) . createChildInjector ( modules ) ; } return sysInjector ; }
Source:
static void checkEnabled ( ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException { if ( ! ( com.google.gerrit.gpg.BouncyCastleUtil.havePGP ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( "GPG not enabled" ) ; } }

Target:
static void checkVisible ( com.google.inject.Provider < com.google.gerrit.server.CurrentUser > self , com.google.gerrit.server.account.AccountResource rsrc ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException { if ( ! ( com.google.gerrit.gpg.BouncyCastleUtil.havePGP ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( "GPG not enabled" ) ; } if ( ( self.get ( ) ) != ( rsrc.getUser ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( ) ; } }
Source:
static java.lang.String replaceName ( java.lang.String in , java.lang.String name ) { java.lang.String key = "${name}" ; int n = in.indexOf ( key ) ; if ( 0 <= n ) { return ( ( in.substring ( 0 , n ) ) + name ) + ( in.substring ( ( n + ( key.length ( ) ) ) ) ) ; } return null ; }

Target:
static java.lang.String replaceName ( java.lang.String in , java.lang.String name , boolean keyIsOptional ) { java.lang.String key = "${name}" ; int n = in.indexOf ( key ) ; if ( 0 <= n ) { return ( ( in.substring ( 0 , n ) ) + name ) + ( in.substring ( ( n + ( key.length ( ) ) ) ) ) ; } if ( keyIsOptional ) { return in ; } return null ; }
Source:
void setHeaderVisible ( boolean show ) { headerVisible = show ; com.google.gwt.user.client.ui.UIObject.setVisible ( patchSetNavRow , show ) ; if ( show ) { parent.header.removeStyleName ( com.google.gerrit.client.diff.DiffTable.style.fullscreen ( ) ) ; } else { parent.header.addStyleName ( com.google.gerrit.client.diff.DiffTable.style.fullscreen ( ) ) ; } parent.resizeCodeMirror ( ) ; }

Target:
void setHeaderVisible ( boolean show ) { headerVisible = show ; com.google.gwt.user.client.ui.UIObject.setVisible ( patchSetNavRow , show ) ; com.google.gwt.user.client.ui.UIObject.setVisible ( diffHeaderRow , ( show && ( header ) ) ) ; if ( show ) { parent.header.removeStyleName ( com.google.gerrit.client.diff.DiffTable.style.fullscreen ( ) ) ; } else { parent.header.addStyleName ( com.google.gerrit.client.diff.DiffTable.style.fullscreen ( ) ) ; } parent.resizeCodeMirror ( ) ; }
Source:
public void testEvictProjectListOK ( ) throws java.lang.Exception { java.lang.String key = "all" ; java.lang.String keyJson = new com.google.gson.GsonBuilder ( ) . create ( ) . toJson ( key ) ; org.mockito.Mockito.when ( httpSessionMock.post ( buildCacheEndpoint ( Constants.PROJECT_LIST ) , keyJson ) ) . thenReturn ( new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.SUCCESSFUL , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.EMPTY_MSG ) ) ; com.google.common.truth.Truth.assertThat ( forwarder.evict ( Constants.PROJECT_LIST , key ) ) . isTrue ( ) ; }

Target:
public void testAddToProjectListOK ( ) throws java.lang.Exception { java.lang.String projectName = "projectToAdd" ; org.mockito.Mockito.when ( httpSessionMock.post ( buildProjectListCacheEndpoint ( projectName ) ) ) . thenReturn ( new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.SUCCESSFUL , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.EMPTY_MSG ) ) ; com.google.common.truth.Truth.assertThat ( forwarder.addToProjectList ( projectName ) ) . isTrue ( ) ; }
Source:
public java.lang.Iterable < com.google.gerrit.extensions.common.WebLinkInfo > getPatchSetLinks ( java.lang.String project , java.lang.String commit ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.extensions.webui.PatchSetWebLink webLink : patchSetLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getPatchSetUrl ( project , commit ) ) ) ; } return links ; }

Target:
public java.lang.Iterable < com.google.gerrit.extensions.common.WebLinkInfo > getPatchSetLinks ( java.lang.String project , java.lang.String commit ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > links = com.google.common.collect.Lists.newArrayList ( ) ; for ( com.google.gerrit.extensions.webui.PatchSetWebLink webLink : patchSetLinks ) { links.add ( new com.google.gerrit.extensions.common.WebLinkInfo ( webLink.getLinkName ( ) , webLink.getImageUrl ( ) , webLink.getPatchSetUrl ( project , commit ) , webLink.getTarget ( ) ) ) ; } return links ; }
Source:
public java.lang.Object apply ( com.google.gerrit.server.account.AccountResource self ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.QueryChanges query = changes.list ( ) ; query.addQuery ( ( "starredby:" + ( self.getUser ( ) . getAccountId ( ) . get ( ) ) ) ) ; return query.apply ( TopLevelResource.INSTANCE ) ; }

Target:
public java.lang.Object apply ( com.google.gerrit.server.account.AccountResource self ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.BadRequestException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.change.QueryChanges query = changes.list ( ) ; query.addQuery ( ( "starredby:" + ( self.getUser ( ) . getAccountId ( ) . get ( ) ) ) ) ; return query.apply ( TopLevelResource.INSTANCE ) ; }
Source:
public void parseTopic ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-set: 1\n" ) + "Topic: Some Topic\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-set: 1\n" ) + "Topic:\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-set: 1\n" ) + "Topic: Some Topic\n" ) + "Topic: Other Topic" ) ) ) ; }

Target:
public void parseStatus ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-set: 1\n" ) + "Status: NEW\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-set: 1\n" ) + "Status: new\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( "Update change\n\nPatch-set: 1\nStatus: OOPS\n" ) ; assertParseFails ( "Update change\n\nPatch-set: 1\nStatus: NEW\nStatus: NEW\n" ) ; }
Source:
private org.eclipse.jgit.lib.Config config ( org.junit.runner.Description description ) { com.google.gerrit.acceptance.GerritConfigs cfgs = description.getAnnotation ( com.google.gerrit.acceptance.GerritConfigs.class ) ; com.google.gerrit.acceptance.GerritConfig cfg = description.getAnnotation ( com.google.gerrit.acceptance.GerritConfig.class ) ; if ( ( cfgs != null ) && ( cfg != null ) ) { throw new java.lang.IllegalStateException ( "Use either @GerritConfigs or @GerritConfig not both" ) ; } if ( cfgs != null ) { return com.google.gerrit.acceptance.ConfigAnnotationParser.parse ( baseConfig , cfgs ) ; } else if ( cfg != null ) { return com.google.gerrit.acceptance.ConfigAnnotationParser.parse ( baseConfig , cfg ) ; } else { return baseConfig ; } }

Target:
protected TestRepository < ? > . CommitBuilder amendBuilder ( ) throws java.lang.Exception { org.eclipse.jgit.lib.ObjectId head = repo ( ) . getRef ( "HEAD" ) . getObjectId ( ) ; TestRepository < ? > . CommitBuilder b = testRepo.amendRef ( "HEAD" ) ; com.google.common.base.Optional < java.lang.String > id = com.google.gerrit.acceptance.GitUtil.getChangeId ( testRepo , head ) ; if ( id.isPresent ( ) ) { b.insertChangeId ( id.get ( ) . substring ( 1 ) ) ; } else { b.insertChangeId ( ) ; } return b ; }
Source:
public void byHashtagWithoutNotedb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isFalse ( ) ; setUpHashtagChanges ( ) ; assertQuery ( "hashtag:foo" ) ; assertQuery ( "hashtag:bar" ) ; assertQuery ( "hashtag:\" bar \"" ) ; assertQuery ( "hashtag:\"a tag\"" ) ; assertQuery ( "hashtag:\" a tag \"" ) ; assertQuery ( "hashtag:#foo" ) ; assertQuery ( "hashtag:\"# #foo\"" ) ; }

Target:
public void byHashtagWithoutNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isFalse ( ) ; setUpHashtagChanges ( ) ; assertQuery ( "hashtag:foo" ) ; assertQuery ( "hashtag:bar" ) ; assertQuery ( "hashtag:\" bar \"" ) ; assertQuery ( "hashtag:\"a tag\"" ) ; assertQuery ( "hashtag:\" a tag \"" ) ; assertQuery ( "hashtag:#foo" ) ; assertQuery ( "hashtag:\"# #foo\"" ) ; }
Source:
private java.lang.String getCommentFromFile ( final java.lang.String filename ) { try { return com.google.common.io.Files.toString ( new java.io.File ( config.getTemplatesPath ( ) , filename ) , com.google.common.base.Charsets.UTF_8 ) ; } catch ( final java.io.IOException exc ) { final java.lang.String errmsg = java.lang.String.format ( "Cannot find %s file in gerrit etc dir. Please check your gerrit configuration" , filename ) ; com.criteo.gerrit.plugins.automerge.ReviewUpdater.log.error ( errmsg ) ; return errmsg ; } }

Target:
private java.lang.String getCommentFromFile ( final java.lang.String filename ) { try { return com.google.common.io.Files.asCharSource ( new java.io.File ( config.getTemplatesPath ( ) , filename ) , com.google.common.base.Charsets.UTF_8 ) . read ( ) ; } catch ( final java.io.IOException exc ) { final java.lang.String errmsg = java.lang.String.format ( "Cannot find %s file in gerrit etc dir. Please check your gerrit configuration" , filename ) ; com.criteo.gerrit.plugins.automerge.ReviewUpdater.log.error ( errmsg ) ; return errmsg ; } }
Source:
private static java.lang.String newName ( final com.google.gerrit.server.patch.PatchListEntry entry ) { switch ( entry.getChangeType ( ) ) { case DELETED : return null ; case ADDED : case MODIFIED : case COPIED : case RENAMED : default : return entry.getNewName ( ) ; } }

Target:
private static java.lang.String newName ( final com.google.gerrit.server.patch.PatchListEntry entry ) { switch ( entry.getChangeType ( ) ) { case DELETED : return null ; case ADDED : case MODIFIED : case COPIED : case RENAMED : case REWRITE : default : return entry.getNewName ( ) ; } }
Source:
void flush ( ) throws java.io.IOException { com.google.common.base.Preconditions.checkState ( ( ( finalIns ) != null ) ) ; for ( com.google.gerrit.server.notedb.InsertedObject obj : tempIns.getInsertedObjects ( ) ) { finalIns.insert ( obj.type ( ) , obj.data ( ) . toByteArray ( ) ) ; } finalIns.flush ( ) ; tempIns.clear ( ) ; }

Target:
void flush ( ) throws java.io.IOException { com.google.common.base.Preconditions.checkState ( ( ( finalIns ) != null ) ) ; for ( com.google.gerrit.server.git.InsertedObject obj : tempIns.getInsertedObjects ( ) ) { finalIns.insert ( obj.type ( ) , obj.data ( ) . toByteArray ( ) ) ; } finalIns.flush ( ) ; tempIns.clear ( ) ; }
Source:
private com.google.gerrit.server.mail.Address toAddress ( final com.google.gerrit.reviewdb.Account.Id id ) { final com.google.gerrit.reviewdb.Account a = args.accountCache.get ( id ) . getAccount ( ) ; final java.lang.String e = a.getPreferredEmail ( ) ; if ( e == null ) { return null ; } return new com.google.gerrit.server.mail.Address ( a.getFullName ( ) , e ) ; }

Target:
private com.google.gerrit.server.mail.Address toAddress ( final com.google.gerrit.reviewdb.Account.Id id ) { final com.google.gerrit.reviewdb.Account a = com.google.gerrit.server.util.FutureUtil.get ( args.accountCache.getAccount ( id ) ) ; final java.lang.String e = a.getPreferredEmail ( ) ; if ( e == null ) { return null ; } return new com.google.gerrit.server.mail.Address ( a.getFullName ( ) , e ) ; }
Source:
protected void configure ( ) { final java.lang.String cacheName = WebSessionManager.CACHE_NAME ; final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.server.http.WebSessionManager.Key , com.google.gerrit.server.http.WebSessionManager.Val > > type = new com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.server.http.WebSessionManager.Key , com.google.gerrit.server.http.WebSessionManager.Val > > ( ) { } ; disk ( type , cacheName ) . timeToIdle ( 12 , java.util.concurrent.TimeUnit.HOURS ) . timeToLive ( com.google.gerrit.server.cache.NamedCacheBinding.INFINITE , java.util.concurrent.TimeUnit.HOURS ) ; bind ( com.google.gerrit.server.http.WebSessionManager.class ) ; bind ( com.google.gerrit.server.http.WebSession.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; }

Target:
protected void configure ( ) { final java.lang.String cacheName = WebSessionManager.CACHE_NAME ; final com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.server.http.WebSessionManager.Key , com.google.gerrit.server.http.WebSessionManager.Val > > type = new com.google.inject.TypeLiteral < com.google.gerrit.server.cache.Cache < com.google.gerrit.server.http.WebSessionManager.Key , com.google.gerrit.server.http.WebSessionManager.Val > > ( ) { } ; disk ( type , cacheName ) . memoryLimit ( 1024 ) . timeToIdle ( 12 , java.util.concurrent.TimeUnit.HOURS ) . timeToLive ( com.google.gerrit.server.cache.NamedCacheBinding.INFINITE_TIME , java.util.concurrent.TimeUnit.HOURS ) . evictionPolicy ( EvictionPolicy.LRU ) ; bind ( com.google.gerrit.server.http.WebSessionManager.class ) ; bind ( com.google.gerrit.server.http.WebSession.class ) . in ( com.google.inject.servlet.RequestScoped.class ) ; }
Source:
void appendApproval ( com.google.gerrit.reviewdb.ApprovalCategory category , short value , com.google.gerrit.reviewdb.Account user ) { sb.append ( category.getName ( ) . replace ( ' ' , '-' ) ) ; sb.append ( ( value < 0 ? "-" : "+" ) ) . append ( java.lang.Math.abs ( value ) ) . append ( ": " ) ; appendUserData ( user ) ; sb.append ( "\n" ) ; }

Target:
void appendApproval ( com.google.gerrit.reviewdb.ApprovalCategory category , short value , com.google.gerrit.reviewdb.Account user ) { sb.append ( category.getLabelName ( ) ) ; sb.append ( ( value < 0 ? "-" : "+" ) ) . append ( java.lang.Math.abs ( value ) ) . append ( ": " ) ; appendUserData ( user ) ; sb.append ( "\n" ) ; }
Source:
private java.lang.String newChange ( org.eclipse.jgit.api.Git git , org.eclipse.jgit.lib.PersonIdent ident ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , ident , PushOneCommit.SUBJECT , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME , com.google.gerrit.acceptance.edit.ChangeEditIT.CONTENT_OLD ) ; return push.to ( git , "refs/for/master" ) . getChangeId ( ) ; }

Target:
private java.lang.String amendChange ( org.eclipse.jgit.api.Git git , org.eclipse.jgit.lib.PersonIdent ident , java.lang.String changeId ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , ident , PushOneCommit.SUBJECT , com.google.gerrit.acceptance.edit.ChangeEditIT.FILE_NAME2 , new java.lang.String ( com.google.gerrit.acceptance.edit.ChangeEditIT.CONTENT_NEW2 ) , changeId ) ; return push.to ( git , "refs/for/master" ) . getChangeId ( ) ; }
Source:
void onIconClick ( @ java.lang.SuppressWarnings ( value = "unused" ) com.google.gwt.event.dom.client.ClickEvent e ) { parent.getCmFromSide ( side ) . scrollToY ( 0 ) ; parent.getCommentManager ( ) . insertNewDraft ( side , 0 ) ; }

Target:
private com.google.gerrit.client.ui.InlineHyperlink createLink ( java.lang.String label , com.google.gerrit.reviewdb.client.PatchSet.Id id ) { assert ( other ) != null ; if ( sideA ) { assert ( other.idActive ) != null ; } com.google.gerrit.reviewdb.client.PatchSet.Id diffBase = ( sideA ) ? id : other.idActive ; com.google.gerrit.reviewdb.client.PatchSet.Id revision = ( sideA ) ? other.idActive : id ; return new com.google.gerrit.client.ui.InlineHyperlink ( label , ( parent.isSideBySide ( ) ? com.google.gerrit.client.Dispatcher.toSideBySide ( diffBase , revision , path ) : com.google.gerrit.client.Dispatcher.toUnified ( diffBase , revision , path ) ) ) ; }
Source:
private void setMillisProvider ( ) { clockStepMs = java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 1 , java.util.concurrent.TimeUnit.SECONDS ) ; final java.util.concurrent.atomic.AtomicLong clockMs = new java.util.concurrent.atomic.AtomicLong ( ( ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( ChangeUtil.SORT_KEY_EPOCH_MINS , java.util.concurrent.TimeUnit.MINUTES ) ) + ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 60 , java.util.concurrent.TimeUnit.DAYS ) ) ) ) ; org.joda.time.DateTimeUtils.setCurrentMillisProvider ( new org.joda.time.DateTimeUtils.MillisProvider ( ) { @ java.lang.Override public long getMillis ( ) { return clockMs.getAndAdd ( clockStepMs ) ; } } ) ; }

Target:
private void setTimeForTesting ( ) { systemTimeZone = java.lang.System.setProperty ( "user.timezone" , "US/Eastern" ) ; clockStepMs = java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 1 , java.util.concurrent.TimeUnit.SECONDS ) ; final java.util.concurrent.atomic.AtomicLong clockMs = new java.util.concurrent.atomic.AtomicLong ( new org.joda.time.DateTime ( 2009 , 9 , 30 , 17 , 0 , 0 ) . getMillis ( ) ) ; org.joda.time.DateTimeUtils.setCurrentMillisProvider ( new org.joda.time.DateTimeUtils.MillisProvider ( ) { @ java.lang.Override public long getMillis ( ) { return clockMs.getAndAdd ( clockStepMs ) ; } } ) ; }
Source:
public void run ( ) { if ( cm.extras ( ) . hasActiveLine ( ) ) { newDraft ( cm ) ; } }

Target:
java.lang.Runnable newDraftCallback ( net.codemirror.lib.CodeMirror cm ) { if ( ! ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) ) { return signInCallback ( cm ) ; } return ( ) -> { if ( cm.extras ( ) . hasActiveLine ( ) ) { newDraft ( cm ) ; } } ; }
Source:
static void setNotCacheable ( javax.servlet.http.HttpServletResponse res ) { res.setHeader ( com.google.common.net.HttpHeaders.CACHE_CONTROL , "no-cache, no-store, max-age=0, must-revalidate" ) ; res.setHeader ( com.google.common.net.HttpHeaders.PRAGMA , "no-cache" ) ; res.setHeader ( com.google.common.net.HttpHeaders.EXPIRES , "Mon, 01 Jan 1990 00:00:00 GMT" ) ; res.setDateHeader ( com.google.common.net.HttpHeaders.DATE , new org.joda.time.Instant ( ) . getMillis ( ) ) ; }

Target:
static void setNotCacheable ( javax.servlet.http.HttpServletResponse res ) { res.setHeader ( com.google.common.net.HttpHeaders.CACHE_CONTROL , "no-cache, no-store, max-age=0, must-revalidate" ) ; res.setHeader ( com.google.common.net.HttpHeaders.PRAGMA , "no-cache" ) ; res.setHeader ( com.google.common.net.HttpHeaders.EXPIRES , "Mon, 01 Jan 1990 00:00:00 GMT" ) ; res.setDateHeader ( com.google.common.net.HttpHeaders.DATE , java.time.Instant.now ( ) . toEpochMilli ( ) ) ; }
Source:
public java.util.List < com.google.gerrit.reviewdb.client.Change > load ( com.google.gerrit.reviewdb.client.Project.NameKey key ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( key ) ; com.google.gerrit.server.util.ManualRequestContext ctx = requestContext.open ( ) ) { return com.google.gerrit.server.git.ScanningChangeCacheImpl.scan ( repo , ctx.getReviewDbProvider ( ) . get ( ) ) ; } }

Target:
public java.util.List < com.google.gerrit.reviewdb.client.Change > load ( com.google.gerrit.reviewdb.client.Project.NameKey key ) throws java.lang.Exception { try ( org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( key ) ; com.google.gerrit.server.util.ManualRequestContext ctx = requestContext.open ( ) ) { return com.google.gerrit.server.git.ScanningChangeCacheImpl.scan ( notesMigration , notesFactory , repo , ctx.getReviewDbProvider ( ) . get ( ) , key ) ; } }
Source:
private void assertNoIncludes ( java.lang.String group ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup g = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( group ) ) ; java.util.Iterator < com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid > it = db.accountGroupIncludesByUuid ( ) . byGroup ( g.getId ( ) ) . iterator ( ) ; org.junit.Assert.assertFalse ( it.hasNext ( ) ) ; }

Target:
private void assertNoIncludes ( java.lang.String group ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup g = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( group ) ) ; java.util.Iterator < com.google.gerrit.reviewdb.client.AccountGroupById > it = db.accountGroupById ( ) . byGroup ( g.getId ( ) ) . iterator ( ) ; org.junit.Assert.assertFalse ( it.hasNext ( ) ) ; }
Source:
public java.util.List < com.googlecode.prolog_cafe.lang.Term > evaluate ( ) throws com.google.gerrit.server.project.RuleEvalException { return evaluateImpl ( "locate_submit_rule" , "can_submit" , "locate_submit_filter" , "filter_submit_results" ) ; }

Target:
public java.util.List < com.google.gerrit.common.data.SubmitRecord > canSubmit ( ) { java.util.List < com.googlecode.prolog_cafe.lang.Term > results ; try { results = evaluateImpl ( "locate_submit_rule" , "can_submit" , "locate_submit_filter" , "filter_submit_results" ) ; } catch ( com.google.gerrit.server.project.RuleEvalException e ) { return ruleError ( e.getMessage ( ) , e ) ; } if ( results.isEmpty ( ) ) { return ruleError ( java.lang.String.format ( ( "Submit rule '%s' for change %s of %s has " + "no solution." ) , getSubmitRule ( ) , cd.getId ( ) , getProjectName ( ) ) ) ; } return resultsToSubmitRecord ( getSubmitRule ( ) , results ) ; }
Source:
public void changeProjectAccess ( com.google.gerrit.reviewdb.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ProjectAccess > cb ) { org.eclipse.jgit.lib.ObjectId base ; if ( ( baseRevision != null ) && ( ! ( baseRevision.isEmpty ( ) ) ) ) { base = org.eclipse.jgit.lib.ObjectId.fromString ( baseRevision ) ; } else { base = null ; } changeProjectAccessFactory.create ( projectName , base , sections , msg ) . to ( cb ) ; }

Target:
public void reviewProjectAccess ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String baseRevision , java.lang.String msg , java.util.List < com.google.gerrit.common.data.AccessSection > sections , com.google.gwtjsonrpc.common.AsyncCallback < com.google.gerrit.reviewdb.client.Change.Id > cb ) { reviewProjectAccessFactory.create ( projectName , com.google.gerrit.httpd.rpc.project.ProjectAdminServiceImpl.getBase ( baseRevision ) , sections , msg ) . to ( cb ) ; }
Source:
protected void configureServlets ( ) { serve ( ( "/" + ( OpenIdServiceImpl.RETURN_URL ) ) ) . with ( com.google.gerrit.httpd.auth.openid.OpenIdLoginServlet.class ) ; serve ( ( "/" + ( XrdsServlet.LOCATION ) ) ) . with ( com.google.gerrit.httpd.auth.openid.XrdsServlet.class ) ; filter ( "/" ) . through ( com.google.gerrit.httpd.auth.openid.XrdsFilter.class ) ; install ( new com.google.gerrit.httpd.rpc.RpcServletModule ( com.google.gerrit.httpd.rpc.RpcServletModule.PREFIX ) { @ java.lang.Override protected void configureServlets ( ) { rpc ( com.google.gerrit.httpd.auth.openid.OpenIdServiceImpl.class ) ; } } ) ; }

Target:
protected void configureServlets ( ) { serve ( "/login/*" ) . with ( com.google.gerrit.httpd.auth.openid.LoginForm.class ) ; serve ( ( "/" + ( OpenIdServiceImpl.RETURN_URL ) ) ) . with ( com.google.gerrit.httpd.auth.openid.OpenIdLoginServlet.class ) ; serve ( ( "/" + ( XrdsServlet.LOCATION ) ) ) . with ( com.google.gerrit.httpd.auth.openid.XrdsServlet.class ) ; filter ( "/" ) . through ( com.google.gerrit.httpd.auth.openid.XrdsFilter.class ) ; bind ( com.google.gerrit.httpd.auth.openid.OpenIdServiceImpl.class ) ; }
Source:
public void onClick ( com.google.gwt.user.client.ui.Widget sender ) { if ( sender == ( save ) ) { onSave ( ) ; } else if ( sender == ( discard ) ) { onDiscard ( ) ; } }

Target:
public void onClick ( com.google.gwt.user.client.ui.Widget sender ) { if ( sender == ( edit ) ) { edit ( ) ; } else if ( sender == ( save ) ) { onSave ( ) ; } else if ( sender == ( cancel ) ) { render ( ) ; } else if ( sender == ( discard ) ) { onDiscard ( ) ; } }
Source:
public static void submit ( int id , java.lang.String commit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.SubmitInfo > cb ) { com.google.gerrit.client.changes.ChangeApi.SubmitInput in = com.google.gerrit.client.changes.ChangeApi.SubmitInput.create ( ) ; in.wait_for_merge ( true ) ; com.google.gerrit.client.changes.ChangeApi.call ( id , commit , "submit" ) . post ( in , cb ) ; }

Target:
public static void submit ( int id , java.lang.String commit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.changes.SubmitInfo > cb ) { com.google.gerrit.client.changes.ChangeApi.SubmitInput in = com.google.gerrit.client.changes.ChangeApi.SubmitInput.create ( ) ; in.waitForMerge ( true ) ; com.google.gerrit.client.changes.ChangeApi.call ( id , commit , "submit" ) . post ( in , cb ) ; }
Source:
private java.lang.Class < com.google.gwtorm.client.Schema > loadClass ( ) throws com.google.gwtorm.client.OrmException { try { final java.lang.Class < ? > c = java.lang.Class.forName ( getImplClassName ( ) , false , classLoader ) ; return ( ( java.lang.Class < com.google.gwtorm.client.Schema > ) ( c ) ) ; } catch ( java.lang.ClassNotFoundException err ) { throw new com.google.gwtorm.client.OrmException ( "Cannot load generated class" , err ) ; } }

Target:
private java.lang.Class < com.google.gwtorm.server.Schema > loadClass ( ) throws com.google.gwtorm.server.OrmException { try { final java.lang.Class < ? > c = java.lang.Class.forName ( getImplClassName ( ) , false , classLoader ) ; return ( ( java.lang.Class < com.google.gwtorm.server.Schema > ) ( c ) ) ; } catch ( java.lang.ClassNotFoundException err ) { throw new com.google.gwtorm.server.OrmException ( "Cannot load generated class" , err ) ; } }
Source:
public void start ( ) { if ( ( graphiteReporter ) != null ) { graphiteReporter.start ( rate , com.googlesource.gerrit.plugins.metricsreporters.GerritGraphiteReporter.DEFAULT_RATE_UNIT ) ; } }

Target:
public void start ( ) { if ( ( graphiteReporter ) != null ) { try { graphiteReporter.start ( rate , com.googlesource.gerrit.plugins.metricsreporters.GerritGraphiteReporter.DEFAULT_RATE_UNIT ) ; } catch ( java.lang.IllegalArgumentException e ) { java.lang.String msg = e.getMessage ( ) ; if ( "Reporter already started" . equals ( msg ) ) { com.googlesource.gerrit.plugins.metricsreporters.GerritGraphiteReporter.log.warn ( msg ) ; } else { throw e ; } } } }
Source:
public com.google.gerrit.reviewdb.client.AccountGroup get ( final com.google.gerrit.reviewdb.client.AccountGroup.NameKey name ) { return byName.get ( name ) ; }

Target:
public void evictAfterRename ( final com.google.gerrit.reviewdb.client.AccountGroup.NameKey oldName , final com.google.gerrit.reviewdb.client.AccountGroup.NameKey newName ) { if ( oldName != null ) { byName.invalidate ( oldName.get ( ) ) ; } if ( newName != null ) { byName.invalidate ( newName.get ( ) ) ; } }
Source:
public void content ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.extensions.restapi.BinaryResult bin = gApi.changes ( ) . id ( r.getChangeId ( ) ) . revision ( r.getCommit ( ) . name ( ) ) . file ( com.google.gerrit.acceptance.PushOneCommit.FILE_NAME ) . content ( ) ; java.io.ByteArrayOutputStream os = new java.io.ByteArrayOutputStream ( ) ; bin.writeTo ( os ) ; java.lang.String res = new java.lang.String ( os.toByteArray ( ) , java.nio.charset.StandardCharsets.UTF_8 ) ; com.google.common.truth.Truth.assertThat ( res ) . isEqualTo ( com.google.gerrit.acceptance.PushOneCommit.FILE_CONTENT ) ; }

Target:
public void content ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; assertContent ( r , com.google.gerrit.acceptance.PushOneCommit.FILE_NAME , com.google.gerrit.acceptance.PushOneCommit.FILE_CONTENT ) ; assertContent ( r , com.google.gerrit.reviewdb.client.Patch.COMMIT_MSG , r.getCommit ( ) . getFullMessage ( ) ) ; }
Source:
public com.google.gerrit.server.notedb.ChangeNotes createChecked ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.notedb.ChangeNotes notes = create ( db , project , changeId ) ; if ( ( notes.getChange ( ) ) == null ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } return notes ; }

Target:
public com.google.gerrit.server.notedb.ChangeNotes createChecked ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Project.NameKey project , com.google.gerrit.reviewdb.client.Change.Id changeId ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change change = com.google.gerrit.reviewdb.server.ReviewDbUtil.unwrapDb ( db ) . changes ( ) . get ( changeId ) ; if ( ( change == null ) || ( ! ( change.getProject ( ) . equals ( project ) ) ) ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( changeId ) ; } return new com.google.gerrit.server.notedb.ChangeNotes ( args , change ) . load ( ) ; }
Source:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > logInvalidResult ( com.googlecode.prolog_cafe.lang.Term rule , com.googlecode.prolog_cafe.lang.Term record ) { return logRuleError ( ( ( ( ( ( ( ( "Submit rule " + rule ) + " for change " ) + ( change.getId ( ) ) ) + " of " ) + ( getProject ( ) . getName ( ) ) ) + " output invalid result: " ) + record ) ) ; }

Target:
private java.util.List < com.google.gerrit.common.data.SubmitRecord > logInvalidResult ( com.googlecode.prolog_cafe.lang.Term rule , com.googlecode.prolog_cafe.lang.Term record , java.lang.String reason ) { return logRuleError ( ( ( ( ( ( ( ( ( "Submit rule " + rule ) + " for change " ) + ( change.getId ( ) ) ) + " of " ) + ( getProject ( ) . getName ( ) ) ) + " output invalid result: " ) + record ) + ( reason == null ? "" : ". Reason: " + reason ) ) ) ; }
Source:
public void visit ( org.pegdown.ast.VerbatimNode node ) { html.open ( "pre" ) ; html.open ( "code" ) ; java.lang.String text = node.getText ( ) ; while ( text.startsWith ( "\n" ) ) { html.open ( "br" ) ; text = text.substring ( 1 ) ; } html.appendAndEscape ( text ) ; html.close ( "code" ) ; html.close ( "pre" ) ; }

Target:
public void visit ( com.google.gitiles.doc.DivNode node ) { html.open ( "div" ) . attribute ( "class" , node.getStyleName ( ) ) ; visitChildren ( node ) ; html.close ( "div" ) ; }
Source:
protected void onLoad ( ) { super . onLoad ( ) ; Util.ACCOUNT_SEC.myExternalIds ( new com.google.gerrit.client.rpc.GerritCallback < java.util.List < com.google.gerrit.reviewdb.AccountExternalId > > ( ) { public void onSuccess ( final java.util.List < com.google.gerrit.reviewdb.AccountExternalId > result ) { identites.display ( result ) ; display ( ) ; } } ) ; }

Target:
protected void onLoad ( ) { super . onLoad ( ) ; Util.ACCOUNT_SEC.myExternalIds ( new com.google.gerrit.client.rpc.ScreenLoadCallback < java.util.List < com.google.gerrit.reviewdb.AccountExternalId > > ( this ) { public void preDisplay ( final java.util.List < com.google.gerrit.reviewdb.AccountExternalId > result ) { identites.display ( result ) ; } } ) ; }
Source:
public void onSend ( ) { com.google.gerrit.client.changes.ChangeApi.createChange ( project , getDestinationBranch ( ) , message.getText ( ) , null , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.changes.ChangeInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.changes.ChangeInfo result ) { sent = true ; hide ( ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( result.legacyId ( ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { enableButtons ( true ) ; super . onFailure ( caught ) ; } } ) ; }

Target:
public void onSend ( ) { com.google.gerrit.client.changes.ChangeApi.createChange ( project , getDestinationBranch ( ) , getDestinationTopic ( ) , message.getText ( ) , null , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.info.ChangeInfo > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.info.ChangeInfo result ) { sent = true ; hide ( ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( result.legacyId ( ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { enableButtons ( true ) ; super . onFailure ( caught ) ; } } ) ; }
Source:
private < T extends java.lang.Enum < ? > > void set ( org.eclipse.jgit.lib.Config cfg , java.lang.String section , java.lang.String name , T value , T def ) { if ( ( value != null ) && ( value != def ) ) { cfg.setString ( section , null , name , value.toString ( ) ) ; } else { cfg.unset ( section , null , name ) ; } }

Target:
< T extends java.lang.Enum < ? > > T select ( final java.lang.String title , final java.lang.String name , final T defValue ) { return select ( title , name , defValue , false ) ; }
Source:
public java.util.Optional < com.google.gerrit.reviewdb.client.Account.Id > load ( java.lang.String username ) throws java.lang.Exception { try ( com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ) { return java.util.Optional.ofNullable ( db.accountExternalIds ( ) . get ( new com.google.gerrit.reviewdb.client.AccountExternalId.Key ( com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_GERRIT , username ) ) ) . map ( AccountExternalId :: getAccountId ) ; } }

Target:
public java.util.Optional < com.google.gerrit.reviewdb.client.Account.Id > load ( java.lang.String username ) throws java.lang.Exception { try ( com.google.gerrit.reviewdb.server.ReviewDb db = schema.open ( ) ) { return java.util.Optional.ofNullable ( com.google.gerrit.server.account.ExternalId.from ( db.accountExternalIds ( ) . get ( ExternalId.Key.create ( com.google.gerrit.server.account.ExternalId.SCHEME_GERRIT , username ) . asAccountExternalIdKey ( ) ) ) ) . map ( ExternalId :: accountId ) ; } }