auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static boolean isDateField ( java.lang.String name ) { return ( ( "lastUpdated" . equals ( name ) ) || ( "grantedOn" . equals ( name ) ) ) || ( "timestamp" . equals ( name ) ) ; }

Target:
private static boolean isDateField ( java.lang.String name ) { return ( ( ( "lastUpdated" . equals ( name ) ) || ( "grantedOn" . equals ( name ) ) ) || ( "timestamp" . equals ( name ) ) ) || ( "createdOn" . equals ( name ) ) ; }
Source:
private com.google.gerrit.extensions.client.SubmitType getSubmitType ( com.google.gerrit.server.query.change.ChangeData cd , com.google.gerrit.reviewdb.client.PatchSet patchSet ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.common.data.SubmitTypeRecord rec = submitRuleEvaluatorFactory.create ( cd ) . setPatchSet ( patchSet ) . getSubmitType ( ) ; if ( ( rec.status ) != ( SubmitTypeRecord.Status.OK ) ) { throw new com.google.gwtorm.server.OrmException ( ( "Submit type rule failed: " + rec ) ) ; } return rec.type ; }

Target:
private com.google.gerrit.extensions.client.SubmitType getSubmitType ( com.google.gerrit.server.CurrentUser user , com.google.gerrit.server.query.change.ChangeData cd , com.google.gerrit.reviewdb.client.PatchSet patchSet ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.common.data.SubmitTypeRecord rec = submitRuleEvaluatorFactory.create ( user , cd ) . setPatchSet ( patchSet ) . getSubmitType ( ) ; if ( ( rec.status ) != ( SubmitTypeRecord.Status.OK ) ) { throw new com.google.gwtorm.server.OrmException ( ( "Submit type rule failed: " + rec ) ) ; } return rec.type ; }
Source:
static void addHistoryHook ( final com.google.gwt.core.client.JavaScriptObject hook ) { if ( ( com.google.gerrit.client.Gerrit.historyHooks ) == null ) { com.google.gerrit.client.Gerrit.historyHooks = new java.util.ArrayList < com.google.gwt.core.client.JavaScriptObject > ( ) ; com.google.gwt.user.client.History.addHistoryListener ( new com.google.gwt.user.client.HistoryListener ( ) { public void onHistoryChanged ( final java.lang.String historyToken ) { com.google.gerrit.client.Gerrit.dispatchHistoryHooks ( historyToken ) ; } } ) ; } com.google.gerrit.client.Gerrit.historyHooks.add ( hook ) ; }

Target:
static void addHistoryHook ( final com.google.gwt.core.client.JavaScriptObject hook ) { if ( ( com.google.gerrit.client.Gerrit.historyHooks ) == null ) { com.google.gerrit.client.Gerrit.historyHooks = new java.util.ArrayList < com.google.gwt.core.client.JavaScriptObject > ( ) ; com.google.gwt.user.client.History.addValueChangeHandler ( new com.google.gwt.event.logical.shared.ValueChangeHandler < java.lang.String > ( ) { @ java.lang.Override public void onValueChange ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.String > event ) { com.google.gerrit.client.Gerrit.dispatchHistoryHooks ( event.getValue ( ) ) ; } } ) ; } com.google.gerrit.client.Gerrit.historyHooks.add ( hook ) ; }
Source:
private java.lang.String anchorHref ( java.lang.String val ) { if ( com.google.gitiles.doc.html.HtmlBuilder.URI.getValueFilter ( ) . matcher ( val ) . find ( ) ) { return com.google.gitiles.doc.html.HtmlBuilder.URI.escape ( val ) ; } return com.google.gitiles.doc.html.HtmlBuilder.URI.getInnocuousOutput ( ) ; }

Target:
private java.lang.String anchorHref ( java.lang.String val ) { if ( ( com.google.gitiles.doc.html.HtmlBuilder.URI.getValueFilter ( ) . matcher ( val ) . find ( ) ) || ( com.google.gitiles.doc.html.HtmlBuilder.isValidGitUri ( val ) ) ) { return com.google.gitiles.doc.html.HtmlBuilder.URI.escape ( val ) ; } return com.google.gitiles.doc.html.HtmlBuilder.URI.getInnocuousOutput ( ) ; }
Source:
private void readObject ( final java.io.ObjectInputStream in ) throws java.io.IOException { projectKey = new com.google.gerrit.client.reviewdb.Project.NameKey ( in.readUTF ( ) ) ; oldId = org.spearce.jgit.lib.ObjectIdSerialization.read ( in ) ; newId = org.spearce.jgit.lib.ObjectIdSerialization.read ( in ) ; fileName = com.google.gerrit.server.patch.DiffCacheKey.readString ( in ) ; sourceFileName = com.google.gerrit.server.patch.DiffCacheKey.readString ( in ) ; }

Target:
private void readObject ( final java.io.ObjectInputStream in ) throws java.io.IOException { projectKey = new com.google.gerrit.client.reviewdb.Project.NameKey ( in.readUTF ( ) ) ; oldId = org.spearce.jgit.lib.ObjectIdSerialization.read ( in ) ; newId = org.spearce.jgit.lib.ObjectIdSerialization.read ( in ) ; fileName = com.google.gerrit.server.patch.DiffCacheKey.readString ( in ) ; sourceFileName = com.google.gerrit.server.patch.DiffCacheKey.readString ( in ) ; whitespace = com.google.gerrit.client.patches.PatchScriptSettings.Whitespace.valueOf ( com.google.gerrit.server.patch.DiffCacheKey.readString ( in ) ) ; }
Source:
private boolean canPushWithForce ( ) { if ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { return false ; } boolean result = false ; for ( com.google.gerrit.common.data.PermissionRule rule : access ( Permission.PUSH ) ) { if ( rule.isBlock ( ) ) { return false ; } if ( rule.getForce ( ) ) { result = true ; } } return result ; }

Target:
private boolean canPushWithForce ( ) { if ( ( ! ( canWrite ( ) ) ) || ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) ) { return false ; } boolean result = false ; for ( com.google.gerrit.common.data.PermissionRule rule : access ( Permission.PUSH ) ) { if ( rule.isBlock ( ) ) { return false ; } if ( rule.getForce ( ) ) { result = true ; } } return result ; }
Source:
public void testCarriageReturn ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit c = makeCommit ( ) ; com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator validator = new com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator ( null , new com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.PATTERN_CACHE ) , null , null , null ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = validator.performValidation ( repo , c , com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.EMPTY_PLUGIN_CONFIG ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactlyElementsIn ( com.google.common.collect.ImmutableSet.of ( "ERROR: found carriage return (CR) character in file: foo.txt" ) ) ; }

Target:
public void testCarriageReturn ( ) throws java.lang.Exception { org.eclipse.jgit.revwalk.RevCommit c = makeCommit ( ) ; com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator validator = new com.googlesource.gerrit.plugins.uploadvalidator.InvalidLineEndingValidator ( null , new com.googlesource.gerrit.plugins.uploadvalidator.ContentTypeUtil ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.PATTERN_CACHE ) , null , null , null ) ; java.util.List < com.google.gerrit.server.git.validators.CommitValidationMessage > m = validator.performValidation ( repo , c , com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.EMPTY_PLUGIN_CONFIG ) ; com.google.common.truth.Truth.assertThat ( com.googlesource.gerrit.plugins.uploadvalidator.TestUtils.transformMessages ( m ) ) . containsExactly ( "ERROR: found carriage return (CR) character in file: foo.txt" ) ; }
Source:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc , com.google.gerrit.extensions.client.GeneralPreferencesInfo input ) throws com.google.gerrit.extensions.restapi.BadRequestException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { if ( ! ( com.google.gerrit.server.restapi.config.SetPreferences.hasSetFields ( input ) ) ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "unsupported option" ) ; } com.google.gerrit.server.account.Preferences.validateMy ( input.my ) ; try ( com.google.gerrit.server.git.MetaDataUpdate md = metaDataUpdateFactory.get ( ) . create ( allUsersName ) ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo updatedPrefs = com.google.gerrit.server.account.Preferences.updateDefaultGeneralPreferences ( md , input ) ; accountCache.evictAllNoReindex ( ) ; return updatedPrefs ; } }

Target:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc , com.google.gerrit.extensions.client.GeneralPreferencesInfo input ) throws com.google.gerrit.extensions.restapi.BadRequestException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { if ( ! ( com.google.gerrit.server.restapi.config.SetPreferences.hasSetFields ( input ) ) ) { throw new com.google.gerrit.extensions.restapi.BadRequestException ( "unsupported option" ) ; } com.google.gerrit.server.account.Preferences.validateMy ( input.my ) ; try ( com.google.gerrit.server.git.MetaDataUpdate md = metaDataUpdateFactory.get ( ) . create ( allUsersName ) ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo updatedPrefs = com.google.gerrit.server.account.Preferences.updateDefaultGeneralPreferences ( md , input ) ; accountCache.evictAll ( ) ; return updatedPrefs ; } }
Source:
public void onSuccess ( final com.google.gerrit.client.reviewdb.AccountSshKey result ) { addNew.setEnabled ( true ) ; addTxt.setText ( "" ) ; keys.addOneKey ( result ) ; }

Target:
public void onSuccess ( final com.google.gerrit.client.reviewdb.AccountSshKey result ) { addNew.setEnabled ( true ) ; addTxt.setText ( "" ) ; keys.addOneKey ( result ) ; if ( ! ( keys.isVisible ( ) ) ) { showAddKeyBlock ( false ) ; setKeyTableVisible ( true ) ; } }
Source:
public com.google.gerrit.extensions.common.GroupInfo format ( com.google.gerrit.common.data.GroupDescription.Basic group ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.extensions.common.GroupInfo info = init ( group ) ; if ( ( options.contains ( com.google.gerrit.extensions.client.ListGroupsOption.MEMBERS ) ) || ( options.contains ( com.google.gerrit.extensions.client.ListGroupsOption.INCLUDES ) ) ) { com.google.gerrit.server.group.GroupResource rsrc = new com.google.gerrit.server.group.GroupResource ( groupControlFactory.controlFor ( group ) ) ; initMembersAndSubgroups ( rsrc , info ) ; } return info ; }

Target:
private com.google.gerrit.extensions.common.GroupInfo createGroupInfo ( com.google.gerrit.common.data.GroupDescription.Basic group , java.util.function.Supplier < com.google.gerrit.server.account.GroupControl > groupControlSupplier ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.extensions.common.GroupInfo info = com.google.gerrit.server.group.GroupJson.createBasicGroupInfo ( group ) ; if ( group instanceof com.google.gerrit.common.data.GroupDescription.Internal ) { addInternalDetails ( info , ( ( com.google.gerrit.common.data.GroupDescription.Internal ) ( group ) ) , groupControlSupplier ) ; } return info ; }
Source:
public static java.lang.String toLongString ( final com.google.gerrit.extensions.api.projects.ProjectState type ) { if ( type == null ) { return "" ; } switch ( type ) { case ACTIVE : return com.google.gerrit.client.admin.Util.C.projectState_ACTIVE ( ) ; case READ_ONLY : return com.google.gerrit.client.admin.Util.C.projectState_READ_ONLY ( ) ; case HIDDEN : return com.google.gerrit.client.admin.Util.C.projectState_HIDDEN ( ) ; default : return type.name ( ) ; } }

Target:
public static java.lang.String toLongString ( final com.google.gerrit.extensions.client.ProjectState type ) { if ( type == null ) { return "" ; } switch ( type ) { case ACTIVE : return com.google.gerrit.client.admin.Util.C.projectState_ACTIVE ( ) ; case READ_ONLY : return com.google.gerrit.client.admin.Util.C.projectState_READ_ONLY ( ) ; case HIDDEN : return com.google.gerrit.client.admin.Util.C.projectState_HIDDEN ( ) ; default : return type.name ( ) ; } }
Source:
public static void doSignOut ( ) { com.google.gerrit.client.Gerrit.myAccount = null ; com.google.gwt.user.client.Cookies.removeCookie ( com.google.gerrit.client.Gerrit.ACCOUNT_COOKIE ) ; com.google.gerrit.client.Gerrit.globalHandlers.fireEvent ( new com.google.gerrit.client.SignOutEvent ( ) ) ; com.google.gwtexpui.globalkey.client.GlobalKey.filter ( new com.google.gwtexpui.globalkey.client.KeyCommandFilter ( ) { public boolean include ( final com.google.gwtexpui.globalkey.client.KeyCommand key ) { return ! ( key instanceof com.google.gerrit.client.ui.NeedsSignInKeyCommand ) ; } } ) ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; final com.google.gerrit.client.ui.Screen cs = com.google.gerrit.client.Gerrit.body.getView ( ) ; if ( cs != null ) { cs.onSignOut ( ) ; } }

Target:
private static com.google.gwt.user.client.ui.Anchor anchor ( final java.lang.String text , final java.lang.String to ) { final com.google.gwt.user.client.ui.Anchor a = new com.google.gwt.user.client.ui.Anchor ( text , to ) ; a.setStyleName ( "gerrit-MenuItem" ) ; com.google.gwt.user.client.ui.Accessibility.setRole ( a.getElement ( ) , Accessibility.ROLE_MENUITEM ) ; return a ; }
Source:
void resizeCodeMirror ( ) { int rest = ( ( ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + ( header.getOffsetHeight ( ) ) ) + ( diffTable.getHeaderHeight ( ) ) ) + 10 ; int h = ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - rest ; cmA.setHeight ( h ) ; cmB.setHeight ( h ) ; cmA.refresh ( ) ; cmB.refresh ( ) ; diffTable.sidePanel.adjustGutters ( cmB ) ; }

Target:
private int getCodeMirrorHeight ( ) { int rest = ( ( ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + ( header.getOffsetHeight ( ) ) ) + ( diffTable.getHeaderHeight ( ) ) ) + 5 ; return ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - rest ; }
Source:
public void listBranchesOfNonExistingProject_NotFound ( ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( GET ( "/projects/non-existing/branches" ) . getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_NOT_FOUND ) ; }

Target:
public void listBranchesOfNonVisibleProject_NotFound ( ) throws java.lang.Exception { blockRead ( project , "refs/*" ) ; setApiUser ( user ) ; try { gApi.projects ( ) . name ( project.get ( ) ) . branches ( ) . get ( ) ; org.junit.Assert.fail ( "Expected ResourceNotFoundException" ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException expected ) { } }
Source:
public static boolean branchExists ( final com.google.gerrit.server.git.GitRepositoryManager repoManager , final com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { final org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( branch.getParentKey ( ) ) ; try { boolean exists = ( repo.getRef ( branch.get ( ) ) ) != null ; if ( ! exists ) { exists = repo.getFullBranch ( ) . equals ( branch.get ( ) ) ; } return exists ; } finally { repo.close ( ) ; } }

Target:
public static boolean branchExists ( final com.google.gerrit.server.git.GitRepositoryManager repoManager , final com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { final org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( branch.getParentKey ( ) ) ; try { boolean exists = ( repo.getRefDatabase ( ) . exactRef ( branch.get ( ) ) ) != null ; if ( ! exists ) { exists = repo.getFullBranch ( ) . equals ( branch.get ( ) ) ; } return exists ; } finally { repo.close ( ) ; } }
Source:
private void parseReviewer ( com.google.gerrit.server.notedb.ReviewerState state , java.lang.String line ) throws org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.PersonIdent ident = org.eclipse.jgit.util.RawParseUtils.parsePersonIdent ( line ) ; if ( ident == null ) { throw invalidFooter ( state.getFooterKey ( ) , line ) ; } com.google.gerrit.reviewdb.client.Account.Id accountId = parseIdent ( ident ) ; if ( ! ( reviewers.containsKey ( accountId ) ) ) { reviewers.put ( accountId , state ) ; } }

Target:
private void parseReviewer ( com.google.gerrit.server.notedb.ReviewerStateInternal state , java.lang.String line ) throws org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.PersonIdent ident = org.eclipse.jgit.util.RawParseUtils.parsePersonIdent ( line ) ; if ( ident == null ) { throw invalidFooter ( state.getFooterKey ( ) , line ) ; } com.google.gerrit.reviewdb.client.Account.Id accountId = parseIdent ( ident ) ; if ( ! ( reviewers.containsKey ( accountId ) ) ) { reviewers.put ( accountId , state ) ; } }
Source:
public java.lang.String apply ( java.lang.String s ) { try { return java.net.URLEncoder.encode ( s , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) . replace ( "%2F" , "/" ) . replace ( "%2f" , "/" ) . replace ( "+" , "%20" ) . replace ( "%2B" , "+" ) . replace ( "%2b" , "+" ) ; } catch ( java.io.UnsupportedEncodingException e ) { throw new java.lang.IllegalStateException ( e ) ; } }

Target:
static java.lang.String escapeName ( java.lang.String name ) { try { return java.net.URLEncoder.encode ( name , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) . replace ( "%2F" , "/" ) . replace ( "%2f" , "/" ) . replace ( "+" , "%20" ) . replace ( "%2B" , "+" ) . replace ( "%2b" , "+" ) ; } catch ( java.io.UnsupportedEncodingException e ) { throw new java.lang.IllegalStateException ( e ) ; } }
Source:
public void newPatchSetOnWipChangeSettingReadyInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%ready" , sc.owner ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . notTo ( sc.owner ) . to ( sc.reviewer ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; assertThat ( sender ) . notSent ( ) ; }

Target:
public void newPatchSetOnWipChangeSettingReadyInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( ) ; pushTo ( sc , "refs/for/master%ready" , sc.owner ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . to ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) . noOneElse ( ) ; assertThat ( sender ) . notSent ( ) ; }
Source:
private void expandAfter ( ) { net.codemirror.lib.TextMarker.FromTo range = textMarker.find ( ) ; int start = range.getFrom ( ) . getLine ( ) ; int oldEnd = range.getTo ( ) . getLine ( ) ; int newEnd = oldEnd - ( com.google.gerrit.client.diff.SkipBar.NUM_ROWS_TO_EXPAND ) ; boolean attach = start == 0 ; if ( attach ) { clearMarkerAndWidget ( ) ; } else { textMarker.clear ( ) ; } collapse ( start , newEnd , attach ) ; updateSelection ( ) ; }

Target:
private void expandAfter ( ) { net.codemirror.lib.TextMarker.FromTo range = textMarker.find ( ) ; int start = range.from ( ) . line ( ) ; int oldEnd = range.to ( ) . line ( ) ; int newEnd = oldEnd - ( com.google.gerrit.client.diff.SkipBar.NUM_ROWS_TO_EXPAND ) ; boolean attach = start == 0 ; if ( attach ) { clearMarkerAndWidget ( ) ; } else { textMarker.clear ( ) ; } collapse ( start , newEnd , attach ) ; updateSelection ( ) ; }
Source:
public static com.google.gerrit.server.patch.DiffSummaryKey fromPatchListKey ( com.google.gerrit.server.patch.PatchListKey plk ) { return new com.google.gerrit.server.patch.DiffSummaryKey ( plk.getOldId ( ) , plk.getParentNum ( ) , plk.getNewId ( ) , plk.getWhitespace ( ) ) ; }

Target:
public static com.google.gerrit.server.patch.DiffSummaryKey fromPatchListKey ( com.google.gerrit.server.patch.PatchListKey plk ) { com.google.common.base.Preconditions.checkArgument ( ( ( plk.getAlgorithm ( ) ) == ( PatchListKey.Algorithm.OPTIMIZED_DIFF ) ) ) ; return new com.google.gerrit.server.patch.DiffSummaryKey ( plk.getOldId ( ) , plk.getParentNum ( ) , plk.getNewId ( ) , plk.getWhitespace ( ) ) ; }
Source:
void operation ( final java.lang.Runnable apply ) { cmA.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { cmB.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { apply.run ( ) ; } } ) ; } } ) ; }

Target:
public void execute ( ) { deferred = null ; cmA.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { cmB.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { for ( java.lang.Runnable thunk : list ) { thunk.run ( ) ; } } } ) ; } } ) ; }
Source:
private static java.nio.file.Path popdir ( java.net.URL u , java.nio.file.Path dir , java.lang.String name ) throws java.io.FileNotFoundException { if ( com.google.gerrit.launcher.GerritLauncher.last ( dir ) . equals ( name ) ) { return dir.getParent ( ) ; } throw new java.io.FileNotFoundException ( ( "Cannot find buck-out from " + u ) ) ; }

Target:
private static java.lang.String name ( java.nio.file.Path dir ) { return dir.getFileName ( ) . toString ( ) ; }
Source:
public java.lang.String format ( ) { if ( ( value ( ) ) == ( ( short ) ( 0 ) ) ) { return '-' + ( label ( ) ) ; } else if ( ( value ( ) ) < 0 ) { return ( label ( ) ) + ( value ( ) ) ; } else { return ( ( label ( ) ) + '+' ) + ( value ( ) ) ; } }

Target:
public static java.lang.StringBuilder appendTo ( java.lang.StringBuilder sb , java.lang.String label , short value ) { if ( value == ( ( short ) ( 0 ) ) ) { return sb.append ( '-' ) . append ( label ) ; } else if ( value < 0 ) { return sb.append ( label ) . append ( value ) ; } return sb.append ( label ) . append ( '+' ) . append ( value ) ; }
Source:
protected boolean canDelete ( com.google.gerrit.server.project.ProjectResource rsrc ) { com.google.gerrit.server.permissions.PermissionBackend.WithUser userPermission = permissionBackend.user ( userProvider ) ; com.google.gerrit.server.permissions.PermissionBackend.ForProject projectPermission = userPermission.project ( rsrc.getNameKey ( ) ) ; return ( ( userPermission.testOrFalse ( GlobalPermission.ADMINISTRATE_SERVER ) ) || ( userPermission.testOrFalse ( new com.google.gerrit.extensions.api.access.PluginPermission ( pluginName , com.googlesource.gerrit.plugins.deleteproject.DeleteProjectCapability.DELETE_PROJECT ) ) ) ) || ( ( userPermission.testOrFalse ( new com.google.gerrit.extensions.api.access.PluginPermission ( pluginName , com.googlesource.gerrit.plugins.deleteproject.DeleteOwnProjectCapability.DELETE_OWN_PROJECT ) ) ) && ( projectPermission.testOrFalse ( ProjectPermission.WRITE_CONFIG ) ) ) ; }

Target:
protected boolean canDelete ( com.google.gerrit.server.project.ProjectResource rsrc ) { com.google.gerrit.server.permissions.PermissionBackend.WithUser userPermission = permissionBackend.currentUser ( ) ; com.google.gerrit.server.permissions.PermissionBackend.ForProject projectPermission = userPermission.project ( rsrc.getNameKey ( ) ) ; return ( ( userPermission.testOrFalse ( GlobalPermission.ADMINISTRATE_SERVER ) ) || ( userPermission.testOrFalse ( new com.google.gerrit.extensions.api.access.PluginPermission ( pluginName , com.googlesource.gerrit.plugins.deleteproject.DeleteProjectCapability.DELETE_PROJECT ) ) ) ) || ( ( userPermission.testOrFalse ( new com.google.gerrit.extensions.api.access.PluginPermission ( pluginName , com.googlesource.gerrit.plugins.deleteproject.DeleteOwnProjectCapability.DELETE_OWN_PROJECT ) ) ) && ( projectPermission.testOrFalse ( ProjectPermission.WRITE_CONFIG ) ) ) ; }
Source:
private boolean canRead ( org.eclipse.jgit.lib.ObjectId revId ) throws java.io.IOException { try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { org.eclipse.jgit.revwalk.RevCommit commit = rw.parseCommit ( revId ) ; return projectControl.canReadCommit ( db , repo , commit ) ; } }

Target:
private boolean canRead ( org.eclipse.jgit.lib.ObjectId revId ) throws com.google.gerrit.server.permissions.PermissionBackendException , java.io.IOException { try { permissionBackend.user ( user ) . project ( project.getNameKey ( ) ) . check ( ProjectPermission.READ ) ; return true ; } catch ( com.google.gerrit.extensions.restapi.AuthException e ) { try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( repo ) ) { org.eclipse.jgit.revwalk.RevCommit commit = rw.parseCommit ( revId ) ; return projectControl.canReadCommit ( db , repo , commit ) ; } } }
Source:
public void run ( ) { java.lang.String t = prefs.theme ( ) . name ( ) . toLowerCase ( ) ; view.getCmFromSide ( DisplaySide.A ) . setOption ( "theme" , t ) ; view.getCmFromSide ( DisplaySide.B ) . setOption ( "theme" , t ) ; }

Target:
void onSyntaxHighlighting ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > e ) { prefs.syntaxHighlighting ( e.getValue ( ) ) ; if ( ( view ) != null ) { mode.setEnabled ( prefs.syntaxHighlighting ( ) ) ; if ( prefs.syntaxHighlighting ( ) ) { setMode ( view.getContentType ( ) ) ; } view.setSyntaxHighlighting ( prefs.syntaxHighlighting ( ) ) ; } }
Source:
void openAll ( ) { if ( ( table ) != null ) { java.lang.String self = com.google.gerrit.client.Gerrit.selfRedirect ( null ) ; for ( com.google.gerrit.client.diff.FileInfo info : com.google.gerrit.client.rpc.Natives.asList ( table.list ) ) { com.google.gwt.user.client.Window.open ( ( ( self + "#" ) + ( url ( info ) ) ) , "_blank" , null ) ; } } }

Target:
void openAll ( ) { if ( ( table ) != null ) { java.lang.String self = com.google.gerrit.client.Gerrit.selfRedirect ( null ) ; for ( com.google.gerrit.client.info.FileInfo info : com.google.gerrit.client.rpc.Natives.asList ( table.list ) ) { com.google.gwt.user.client.Window.open ( ( ( self + "#" ) + ( url ( info ) ) ) , "_blank" , null ) ; } } }
Source:
public boolean match ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.client.OrmException { com.google.gerrit.reviewdb.Change change = cd.change ( dbProvider ) ; return ( change != null ) && ( ( change.getSortKey ( ) . compareTo ( getValue ( ) ) ) < 0 ) ; }

Target:
public boolean match ( com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.client.OrmException { com.google.gerrit.reviewdb.Change c = cd.change ( dbProvider ) ; return ( c != null ) && ( ( c.getSortKeyDesc ( ) . compareTo ( getValue ( ) ) ) > 0 ) ; }
Source:
public void testUnblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertTrue ( "u can force push" , u.controlForRef ( "refs/heads/master" ) . canForceUpdate ( ) ) ; }

Target:
public void testUnblockForce ( ) { com.google.gerrit.common.data.PermissionRule r = com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; r.setForce ( true ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) . setForce ( true ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertCanForceUpdate ( "refs/heads/master" , u ) ; }
Source:
public void createNewChangeSignedOffByFooter ( ) throws java.lang.Exception { setSignedOffByFooter ( ) ; com.google.gerrit.extensions.common.ChangeInfo info = assertCreateSucceeds ( newChangeInput ( ChangeStatus.NEW ) ) ; java.lang.String message = info.revisions.get ( info.currentRevision ) . commit.message ; com.google.common.truth.Truth.assertThat ( message ) . contains ( java.lang.String.format ( "%sAdministrator <%s>" , org.eclipse.jgit.lib.Constants.SIGNED_OFF_BY_TAG , admin.getIdent ( ) . getEmailAddress ( ) ) ) ; }

Target:
public void createEmptyChange_InvalidSubject ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInput ci = newChangeInput ( ChangeStatus.NEW ) ; ci.subject = "Change-Id: I1234000000000000000000000000000000000000" ; assertCreateFails ( ci , com.google.gerrit.extensions.restapi.ResourceConflictException.class , "missing subject; Change-Id must be in commit message footer" ) ; }
Source:
private org.eclipse.jgit.lib.ObjectId pushChangeTo ( org.eclipse.jgit.junit.TestRepository < ? > repo , java.lang.String branch ) throws java.lang.Exception { return pushChangeTo ( repo , branch , "some change" ) ; }

Target:
private void expectToHaveCommitMessage ( org.eclipse.jgit.junit.TestRepository < ? > repo , java.lang.String branch , java.lang.String expectedMessage ) throws java.lang.Exception { org.eclipse.jgit.lib.ObjectId commitId = repo.git ( ) . fetch ( ) . setRemote ( "origin" ) . call ( ) . getAdvertisedRef ( ( "refs/heads/" + branch ) ) . getObjectId ( ) ; org.eclipse.jgit.revwalk.RevWalk rw = repo.getRevWalk ( ) ; org.eclipse.jgit.revwalk.RevCommit c = rw.parseCommit ( commitId ) ; com.google.common.truth.Truth.assertThat ( c.getFullMessage ( ) ) . isEqualTo ( expectedMessage ) ; }
Source:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { if ( ( event.getNativeEvent ( ) . getCharCode ( ) ) == 0 ) { Window.Location.reload ( ) ; return ; } if ( topic.canEdit ( ) ) { topic.onEdit ( ) ; } } else { com.google.gerrit.client.Gerrit.doSignIn ( getToken ( ) ) ; } }

Target:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { reviewers.onOpenForm ( ) ; } else { com.google.gerrit.client.Gerrit.doSignIn ( getToken ( ) ) ; } }
Source:
private void initRepository ( ) throws java.io.IOException { if ( ( repo ) == null ) { this . repo = repoManager.openRepository ( project ) ; closeRepo = true ; inserter = repo.newObjectInserter ( ) ; revWalk = new org.eclipse.jgit.revwalk.RevWalk ( inserter.newReader ( ) ) ; } }

Target:
private void initRepository ( ) throws java.io.IOException { if ( ( repo ) == null ) { this . repo = repoManager.openRepository ( project ) ; closeRepo = true ; inserter = repo.newObjectInserter ( ) ; revWalk = new org.eclipse.jgit.revwalk.RevWalk ( inserter.newReader ( ) ) ; commands = new com.google.gerrit.server.git.ChainedReceiveCommands ( repo ) ; } }
Source:
private com.googlesource.gerrit.plugins.reviewers.ReviewerFilterSection newReviewerFilterSection ( java.lang.String filter ) { com.google.common.collect.ImmutableSet.Builder < java.lang.String > b = com.google.common.collect.ImmutableSet.builder ( ) ; for ( java.lang.String reviewer : cfg.getStringList ( com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.FILTER , filter , "reviewer" ) ) { b.add ( reviewer ) ; } return new com.googlesource.gerrit.plugins.reviewers.ReviewerFilterSection ( filter , b.build ( ) ) ; }

Target:
private com.googlesource.gerrit.plugins.reviewers.ReviewerFilterSection newReviewerFilterSection ( java.lang.String filter ) { com.google.common.collect.ImmutableSet.Builder < java.lang.String > b = com.google.common.collect.ImmutableSet.builder ( ) ; for ( java.lang.String reviewer : cfg.getStringList ( com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.FILTER , filter , com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.REVIEWER ) ) { b.add ( reviewer ) ; } return new com.googlesource.gerrit.plugins.reviewers.ReviewerFilterSection ( filter , b.build ( ) ) ; }
Source:
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 ; }

Target:
public boolean isOwner ( ) { if ( canPerform ( com.google.gerrit.reviewdb.ApprovalCategory.OWN , ( ( short ) ( 1 ) ) ) ) { return true ; } if ( ( getRefName ( ) . equals ( RefRight.ALL.substring ( 0 , ( ( RefRight.ALL.length ( ) ) - 1 ) ) ) ) && ( getProjectControl ( ) . isOwner ( ) ) ) { return true ; } return false ; }
Source:
public java.lang.String getUrl ( java.lang.String project ) { if ( ! ( isEnabled ( ) ) ) { return null ; } java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( com.googlesource.gerrit.plugins.download.scheme.SshScheme.ensureSlash ( sshdAddress ) ) ; r.append ( project ) ; return r.toString ( ) ; }

Target:
public java.lang.String getUrl ( java.lang.String project ) { if ( ( ! ( isEnabled ( ) ) ) || ( ! ( userProvider.get ( ) . isIdentifiedUser ( ) ) ) ) { return null ; } java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "ssh://" ) ; r.append ( userProvider.get ( ) . getUserName ( ) ) ; r.append ( "@" ) ; r.append ( com.googlesource.gerrit.plugins.download.scheme.SshScheme.ensureSlash ( sshdAddress ) ) ; r.append ( project ) ; return r.toString ( ) ; }
Source:
public void testUpsertOneException ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchException ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , new java.sql.BatchUpdateException ( ) ) ; try { createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.client.OrmException e ) { } }

Target:
public void testUpsertOneException ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.SQLException exception = new java.sql.BatchUpdateException ( ) ; java.sql.PreparedStatement update = stubStatementThrowExceptionOnExecute ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , exception ) ; com.google.gwtorm.jdbc.JdbcAccess < com.google.gwtorm.jdbc.TestJdbcAccess.Data , com.google.gwtorm.jdbc.TestJdbcAccess.Data.DataKey > classUnderTest = createClassUnderTest ( ) ; try { classUnderTest.upsert ( oneRow ) ; org.junit.Assert.fail ( "missingException" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { org.junit.Assert.assertSame ( e.getCause ( ) , exception ) ; } com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; }
Source:
private RevisionParser.Result parseRevision ( javax.servlet.http.HttpServletRequest req , java.lang.String path ) throws java.io.IOException { com.google.gitiles.RevisionParser revParser = new com.google.gitiles.RevisionParser ( org.eclipse.jgit.http.server.ServletUtils.getRepository ( req ) , accessFactory.forRequest ( req ) , visibilityCache ) ; return revParser.parse ( path ) ; }

Target:
private RevisionParser.Result parseRevision ( javax.servlet.http.HttpServletRequest req , java.lang.String path ) throws java.io.IOException { com.google.gitiles.RevisionParser revParser = new com.google.gitiles.RevisionParser ( org.eclipse.jgit.http.server.ServletUtils.getRepository ( req ) , accessFactory.forRequest ( req ) , visibilityCache ) ; return revParser.parse ( com.google.gitiles.ViewFilter.checkLeadingSlash ( path ) ) ; }
Source:
public com.google.gerrit.server.account.AccountSshKey create ( com.google.gerrit.server.account.AccountSshKey.Id id , java.lang.String encoded ) throws com.google.gerrit.common.errors.InvalidSshKeyException { try { com.google.gerrit.server.account.AccountSshKey key = new com.google.gerrit.server.account.AccountSshKey ( id , com.google.gerrit.sshd.SshUtil.toOpenSshPublicKey ( encoded ) ) ; com.google.gerrit.sshd.SshUtil.parse ( key ) ; return key ; } catch ( java.security.NoSuchAlgorithmException | java.security.spec.InvalidKeySpecException e ) { throw new com.google.gerrit.common.errors.InvalidSshKeyException ( ) ; } catch ( java.security.NoSuchProviderException e ) { com.google.gerrit.sshd.SshKeyCreatorImpl.log.error ( "Cannot parse SSH key" , e ) ; throw new com.google.gerrit.common.errors.InvalidSshKeyException ( ) ; } }

Target:
public com.google.gerrit.server.account.AccountSshKey create ( com.google.gerrit.reviewdb.client.Account.Id accountId , int seq , java.lang.String encoded ) throws com.google.gerrit.common.errors.InvalidSshKeyException { try { com.google.gerrit.server.account.AccountSshKey key = com.google.gerrit.server.account.AccountSshKey.create ( accountId , seq , com.google.gerrit.sshd.SshUtil.toOpenSshPublicKey ( encoded ) ) ; com.google.gerrit.sshd.SshUtil.parse ( key ) ; return key ; } catch ( java.security.NoSuchAlgorithmException | java.security.spec.InvalidKeySpecException e ) { throw new com.google.gerrit.common.errors.InvalidSshKeyException ( ) ; } catch ( java.security.NoSuchProviderException e ) { com.google.gerrit.sshd.SshKeyCreatorImpl.log.error ( "Cannot parse SSH key" , e ) ; throw new com.google.gerrit.common.errors.InvalidSshKeyException ( ) ; } }
Source:
public java.util.List < com.google.gerrit.client.data.ChangeInfo > run ( final com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gwtorm.client.OrmException { final com.google.gerrit.client.reviewdb.Account.Id me = com.google.gerrit.client.rpc.RpcUtil.getAccountId ( ) ; final com.google.gerrit.client.data.AccountCache ac = new com.google.gerrit.client.data.AccountCache ( db ) ; final java.util.Set < com.google.gerrit.client.reviewdb.Change.Id > starred = com.google.gerrit.client.changes.ChangeListServiceImpl.starredBy ( db , me ) ; return com.google.gerrit.client.changes.ChangeListServiceImpl.list ( db.changes ( ) . get ( starred ) , starred , ac ) ; }

Target:
public int compare ( final com.google.gerrit.client.data.ChangeInfo o1 , final com.google.gerrit.client.data.ChangeInfo o2 ) { return ( o1.getId ( ) . get ( ) ) - ( o2.getId ( ) . get ( ) ) ; }
Source:
public void deleteReviewerFromReviewableChangeByAdmin ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( ) ; setApiUser ( admin ) ; removeReviewer ( sc , extraReviewer ) ; assertThat ( sender ) . sent ( "deleteReviewer" , sc ) . to ( sc.owner , extraReviewer ) . cc ( extraCcer , sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; }

Target:
public void deleteReviewerFromReviewableChangeByAdmin ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChangeWithExtraReviewer ( ) ; setApiUser ( admin ) ; removeReviewer ( sc , extraReviewer ) ; assertThat ( sender ) . sent ( "deleteReviewer" , sc ) . to ( sc.owner , extraReviewer ) . cc ( extraCcer , sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) . noOneElse ( ) ; }
Source:
public java.lang.String getContentType ( ) { return "plain/text" ; }

Target:
private void addSshKeys ( java.util.List < java.lang.String > sshKeys ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException { for ( final java.lang.String sshKey : sshKeys ) { com.google.gerrit.server.account.AddSshKey.Input in = new com.google.gerrit.server.account.AddSshKey.Input ( ) ; in.raw = com.google.gerrit.common.RawInputUtil.create ( sshKey.getBytes ( ) , "plain/text" ) ; addSshKey.apply ( rsrc , in ) ; } }
Source:
public com.google.gerrit.server.git.ReceiveCommits.Capable canUpload ( ) { if ( ! ( projectControl.canUploadToAtLeastOneRef ( ) ) ) { java.lang.String reqName = project.getName ( ) ; return new com.google.gerrit.server.git.ReceiveCommits.Capable ( ( ( "Upload denied for project '" + reqName ) + "'" ) ) ; } if ( project.isUseContributorAgreements ( ) ) { try { return verifyActiveContributorAgreement ( ) ; } catch ( com.google.gwtorm.client.OrmException e ) { com.google.gerrit.server.git.ReceiveCommits.log.error ( "Cannot query database for agreements" , e ) ; return new com.google.gerrit.server.git.ReceiveCommits.Capable ( "Cannot verify contribution agreement" ) ; } } else { return com.google.gerrit.server.git.ReceiveCommits.Capable.OK ; } }

Target:
public com.google.gerrit.common.data.Capable canUpload ( ) { com.google.gerrit.common.data.Capable result = projectControl.canPushToAtLeastOneRef ( ) ; if ( result != ( com.google.gerrit.common.data.Capable.OK ) ) { return result ; } return com.google.gerrit.server.util.MagicBranch.checkMagicBranchRefs ( repo , project ) ; }
Source:
private int limit ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > s ) { int n = com.google.common.base.Objects.firstNonNull ( com.google.gerrit.server.query.change.ChangeQueryBuilder.getLimit ( s ) , maxLimit ) ; return ( limit ) > 0 ? ( java.lang.Math.min ( n , limit ) ) + 1 : n + 1 ; }

Target:
private int limit ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > s ) { int n = com.google.common.base.MoreObjects.firstNonNull ( com.google.gerrit.server.query.change.ChangeQueryBuilder.getLimit ( s ) , maxLimit ) ; return ( limit ) > 0 ? ( java.lang.Math.min ( n , limit ) ) + 1 : n + 1 ; }
Source:
public void parseApproval ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Patch-Set: 1\n" ) + "Label: Label1=+1\n" ) + "Label: Label2=1\n" ) + "Label: Label3=0\n" ) + "Label: Label4=-1\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Label: Label1=X\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Label: Label1 = 1\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Label: X+Y\n" ) ) ) ; }

Target:
public void parseBranch ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Patch-Set: 1\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseSucceeds ( ( "Update change\n" + ( ( ( "\n" + "Branch: master\n" ) + "Patch-Set: 1\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( "\n" + "Patch-Set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Branch: refs/heads/stable" ) ) ) ; }
Source:
public void testUpsertOneNotExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT , 1 ) ; createClassUnderTest ( ) . upsert ( oneRow ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( insert ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertExpectedIdsUsed ( insert , 1 ) ; }

Target:
public void upsertOneNotExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.AbstractTestJdbcAccess.UPDATE ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.AbstractTestJdbcAccess.INSERT , 1 ) ; classUnderTest.upsert ( oneRow ) ; assertCorrectUpdating ( update , 1 ) ; assertCorrectUpdating ( insert , 1 ) ; }
Source:
public void missingRepo ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = com.google.gerrit.testutil.TestChanges.newChange ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "otherproject" ) , adminId ) ; db.changes ( ) . insert ( java.util.Collections.singleton ( c ) ) ; insertMissingPatchSet ( c , "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) ; assertProblems ( c , "Destination repository not found: otherproject" ) ; }

Target:
public void patchSetObjectAndRefMissingWithFix ( ) throws java.lang.Exception { java.lang.String rev = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ; com.google.gerrit.server.project.ChangeControl ctl = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = insertMissingPatchSet ( ctl , rev ) ; ctl = reload ( ctl ) ; java.lang.String refName = ps.getId ( ) . toRefName ( ) ; assertProblems ( ctl , new com.google.gerrit.extensions.api.changes.FixInput ( ) , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Ref missing: " + refName ) ) , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Object missing: patch set 2: " + rev ) ) ) ; }
Source:
private static boolean isRewritePossible ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) { if ( ( ( ( p.getClass ( ) ) != ( com.google.gerrit.server.query.AndPredicate.class ) ) && ( ( p.getClass ( ) ) != ( com.google.gerrit.server.query.OrPredicate.class ) ) ) && ( ( p.getClass ( ) ) != ( com.google.gerrit.server.query.NotPredicate.class ) ) ) { return false ; } return ( p.getChildCount ( ) ) > 0 ; }

Target:
private static boolean isBoolean ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) { return ( ( p instanceof com.google.gerrit.server.query.AndPredicate ) || ( p instanceof com.google.gerrit.server.query.OrPredicate ) ) || ( p instanceof com.google.gerrit.server.query.NotPredicate ) ; }
Source:
private com.google.gerrit.pgm.init.File getPath ( ) { com.google.gerrit.pgm.init.Path basePath = site.resolve ( flags.cfg.getString ( "gerrit" , null , "basePath" ) ) ; if ( basePath == null ) { throw new java.lang.IllegalStateException ( "gerrit.basePath must be configured" ) ; } return com.google.gerrit.pgm.init.FileKey.resolve ( basePath.resolve ( allUsers ) . toFile ( ) , FS.DETECTED ) ; }

Target:
private java.io.File getPath ( ) { java.nio.file.Path basePath = site.resolve ( flags.cfg.getString ( "gerrit" , null , "basePath" ) ) ; if ( basePath == null ) { throw new java.lang.IllegalStateException ( "gerrit.basePath must be configured" ) ; } return org.eclipse.jgit.lib.RepositoryCache.FileKey.resolve ( basePath.resolve ( allUsers ) . toFile ( ) , FS.DETECTED ) ; }
Source:
private boolean isRefDeleted ( com.googlesource.gerrit.plugins.refprotection.Event event ) { if ( event.getNewObjectId ( ) . equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) . getName ( ) ) ) { com.googlesource.gerrit.plugins.refprotection.RefUpdateListener.log.info ( java.lang.String.format ( "Ref Deleted: project [%s] refname [%s] old object id [%s]" , event.getProjectName ( ) , event.getRefName ( ) , event.getOldObjectId ( ) ) ) ; return true ; } return false ; }

Target:
private boolean isRefDeleted ( com.google.gerrit.server.events.RefUpdatedEvent event ) { if ( event.refUpdate.newRev.equals ( org.eclipse.jgit.lib.ObjectId.zeroId ( ) . getName ( ) ) ) { com.googlesource.gerrit.plugins.refprotection.RefUpdateListener.log.info ( java.lang.String.format ( "Ref Deleted: project [%s] refname [%s] old object id [%s]" , event.getProjectNameKey ( ) . toString ( ) , event.getRefName ( ) , event.refUpdate.oldRev ) ) ; return true ; } return false ; }
Source:
public static void generateHttpPassword ( java.lang.String account , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.rpc.NativeString > cb ) { com.google.gerrit.client.account.AccountApi.HttpPasswordInput in = com.google.gerrit.client.account.AccountApi.HttpPasswordInput.create ( ) ; in.generate ( true ) ; com.google.gerrit.client.account.AccountApi.accounts ( ) . id ( account ) . view ( "password.http" ) . put ( in , cb ) ; }

Target:
public static void generateHttpPassword ( java.lang.String account , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.rpc.NativeString > cb ) { com.google.gerrit.client.account.AccountApi.HttpPasswordInput in = com.google.gerrit.client.account.AccountApi.HttpPasswordInput.create ( ) ; in.generate ( true ) ; new com.google.gerrit.client.rpc.RestApi ( "/accounts/" ) . id ( account ) . view ( "password.http" ) . put ( in , cb ) ; }