auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public com.google.gerrit.extensions.common.SshKeyInfo addSshKey ( java.lang.String key ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.account.AddSshKey.Input in = new com.google.gerrit.server.account.AddSshKey.Input ( ) ; in.raw = com.google.gerrit.common.RawInputUtil.create ( key ) ; try { return addSshKey.apply ( account , in ) . value ( ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException | org.eclipse.jgit.errors.ConfigInvalidException | com.google.gerrit.server.permissions.PermissionBackendException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot add SSH key" , e ) ; } }

Target:
public com.google.gerrit.extensions.common.SshKeyInfo addSshKey ( java.lang.String key ) throws com.google.gerrit.extensions.restapi.RestApiException { com.google.gerrit.server.account.AddSshKey.Input in = new com.google.gerrit.server.account.AddSshKey.Input ( ) ; in.raw = com.google.gerrit.common.RawInputUtil.create ( key ) ; try { return addSshKey.apply ( account , in ) . value ( ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot add SSH key" , e ) ; } }
Source:
private void setProjectSettings ( ) { com.google.gerrit.reviewdb.client.Project project = config.getProject ( ) ; project.setDescription ( description ) ; project.setSubmitType ( SubmitType.MERGE_IF_NECESSARY ) ; project.setUseContributorAgreements ( InheritableBoolean.INHERIT ) ; project.setUseSignedOffBy ( InheritableBoolean.INHERIT ) ; project.setUseContentMerge ( InheritableBoolean.INHERIT ) ; project.setRequireChangeID ( InheritableBoolean.INHERIT ) ; }

Target:
private void setProjectSettings ( ) { com.google.gerrit.reviewdb.client.Project project = projectConfig.getProject ( ) ; project.setParentName ( config.getBaseProject ( getRepository ( ) . isPrivate ( ) ) ) ; project.setDescription ( description ) ; project.setSubmitType ( SubmitType.MERGE_IF_NECESSARY ) ; project.setUseContributorAgreements ( InheritableBoolean.INHERIT ) ; project.setUseSignedOffBy ( InheritableBoolean.INHERIT ) ; project.setUseContentMerge ( InheritableBoolean.INHERIT ) ; project.setRequireChangeID ( InheritableBoolean.INHERIT ) ; }
Source:
public com.google.gerrit.server.plugins.ServerPlugin get ( java.io.File srcFile , org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot , com.googlesource.gerrit.plugins.scripting.groovyprovider.PluginDescription description ) throws com.google.gerrit.server.plugins.InvalidPluginException { com.googlesource.gerrit.plugins.scripting.groovyprovider.GroovyPluginScriptEngine scriptEngine = scriptEngineProvider.get ( ) ; return new com.google.gerrit.server.plugins.ServerPlugin ( getPluginName ( srcFile ) , description.canonicalUrl , description.user , srcFile , snapshot , new com.googlesource.gerrit.plugins.scripting.groovyprovider.GroovyPluginScanner ( getPluginName ( srcFile ) , scriptEngine , srcFile ) , description.dataDir , scriptEngine.getGroovyClassLoader ( ) ) ; }

Target:
public com.google.gerrit.server.plugins.ServerPlugin get ( java.nio.file.Path srcFile , org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot , com.googlesource.gerrit.plugins.scripting.groovyprovider.PluginDescription description ) throws com.google.gerrit.server.plugins.InvalidPluginException { com.googlesource.gerrit.plugins.scripting.groovyprovider.GroovyPluginScriptEngine scriptEngine = scriptEngineProvider.get ( ) ; return new com.google.gerrit.server.plugins.ServerPlugin ( getPluginName ( srcFile ) , description.canonicalUrl , description.user , srcFile , snapshot , new com.googlesource.gerrit.plugins.scripting.groovyprovider.GroovyPluginScanner ( getPluginName ( srcFile ) , scriptEngine , srcFile ) , description.dataDir , scriptEngine.getGroovyClassLoader ( ) ) ; }
Source:
public com.google.gerrit.extensions.api.changes.DraftApi createDraft ( com.google.gerrit.extensions.api.changes.DraftInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return draft ( createDraft.apply ( revision , in ) . value ( ) . id ) ; } catch ( java.io.IOException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot create draft" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.changes.DraftApi createDraft ( com.google.gerrit.extensions.api.changes.DraftInput in ) throws com.google.gerrit.extensions.restapi.RestApiException { try { java.lang.String id = createDraft.apply ( revision , in ) . value ( ) . id ; return changes.id ( revision.getChange ( ) . getId ( ) . get ( ) ) . revision ( revision.getPatchSet ( ) . getId ( ) . get ( ) ) . draft ( id ) ; } catch ( java.io.IOException | com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot create draft" , e ) ; } }
Source:
private java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > getFileWebLinks ( com.google.gerrit.reviewdb.client.Project project , java.lang.String rev , java.lang.String file ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > fileWebLinks = new java.util.ArrayList < > ( ) ; for ( com.google.gerrit.extensions.common.WebLinkInfo link : webLinks.get ( ) . getPatchLinks ( project.getName ( ) , rev , file ) ) { if ( ( ! ( com.google.common.base.Strings.isNullOrEmpty ( link.name ) ) ) && ( ! ( com.google.common.base.Strings.isNullOrEmpty ( link.url ) ) ) ) { fileWebLinks.add ( link ) ; } } return fileWebLinks ; }

Target:
private java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > getFileWebLinks ( com.google.gerrit.reviewdb.client.Project project , java.lang.String rev , java.lang.String file ) { java.util.List < com.google.gerrit.extensions.common.WebLinkInfo > fileWebLinks = new java.util.ArrayList < > ( ) ; for ( com.google.gerrit.extensions.common.WebLinkInfo link : webLinks.get ( ) . getFileLinks ( project.getName ( ) , rev , file ) ) { if ( ( ! ( com.google.common.base.Strings.isNullOrEmpty ( link.name ) ) ) && ( ! ( com.google.common.base.Strings.isNullOrEmpty ( link.url ) ) ) ) { fileWebLinks.add ( link ) ; } } return fileWebLinks ; }
Source:
public void loginPhase1 ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response , com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope ... scopes ) throws java.io.IOException { java.lang.String scopeRequested = request.getParameter ( "scope" ) ; java.lang.String baseScopeKey = com.google.common.base.Objects.firstNonNull ( scopeRequested , "scopes" ) ; response.sendRedirect ( java.lang.String.format ( "%s?client_id=%s%s&redirect_uri=%s&state=%s%s" , config.gitHubOAuthUrl , config.gitHubClientId , getScope ( baseScopeKey , scopes ) , com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.getURLEncoded ( config.oAuthFinalRedirectUrl ) , me ( ) , com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.getURLEncoded ( request.getRequestURI ( ) . toString ( ) ) ) ) ; }

Target:
public void loginPhase1 ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response , java.util.Set < com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.Scope > scopes ) throws java.io.IOException { java.lang.String scopesString = getScope ( scopes ) ; com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.LOG.debug ( ( ( ( "Initiating GitHub Login for ClientId=" + ( config.gitHubClientId ) ) + " Scopes=" ) + scopesString ) ) ; response.sendRedirect ( java.lang.String.format ( "%s?client_id=%s%s&redirect_uri=%s&state=%s%s" , config.gitHubOAuthUrl , config.gitHubClientId , scopesString , com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.getURLEncoded ( config.oAuthFinalRedirectUrl ) , me ( ) , com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.getURLEncoded ( request.getRequestURI ( ) . toString ( ) ) ) ) ; }
Source:
public void keyExpiringInFuture ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey k = com.google.gerrit.gpg.testutil.TestKeys.validKeyWithExpiration ( ) ; com.google.gerrit.gpg.PublicKeyChecker checker = new com.google.gerrit.gpg.PublicKeyChecker ( ) . setStore ( store ) ; assertNoProblems ( checker , k ) ; checker.setEffectiveTime ( com.google.gerrit.gpg.PublicKeyCheckerTest.parseDate ( "2015-07-10 12:00:00 -0400" ) ) ; assertNoProblems ( checker , k ) ; checker.setEffectiveTime ( com.google.gerrit.gpg.PublicKeyCheckerTest.parseDate ( "2075-07-10 12:00:00 -0400" ) ) ; assertProblems ( checker , k , "Key is expired" ) ; }

Target:
public void keyExpiringInFuture ( ) throws java.lang.Exception { com.google.gerrit.gpg.testing.TestKey k = com.google.gerrit.gpg.testing.TestKeys.validKeyWithExpiration ( ) ; com.google.gerrit.gpg.PublicKeyChecker checker = new com.google.gerrit.gpg.PublicKeyChecker ( ) . setStore ( store ) ; assertNoProblems ( checker , k ) ; checker.setEffectiveTime ( com.google.gerrit.gpg.PublicKeyCheckerTest.parseDate ( "2015-07-10 12:00:00 -0400" ) ) ; assertNoProblems ( checker , k ) ; checker.setEffectiveTime ( com.google.gerrit.gpg.PublicKeyCheckerTest.parseDate ( "2075-07-10 12:00:00 -0400" ) ) ; assertProblems ( checker , k , "Key is expired" ) ; }
Source:
private synchronized void runHook ( com.google.gerrit.reviewdb.client.Project.NameKey project , java.io.File hook , java.util.List < java.lang.String > args ) { if ( ( project != null ) && ( hook.exists ( ) ) ) { hookQueue.execute ( new com.google.gerrit.common.ChangeHookRunner.AsyncHookTask ( project , hook , args ) ) ; } }

Target:
private synchronized void runHook ( java.nio.file.Path hook , java.util.List < java.lang.String > args ) { if ( java.nio.file.Files.exists ( hook ) ) { hookQueue.execute ( new com.google.gerrit.common.ChangeHookRunner.AsyncHookTask ( null , hook , args ) ) ; } }
Source:
public void parseTopic ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( "\n" + "Branch: refs/heads/master\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" ) + "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 parseReviewer ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( ( "\n" + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Patch-Set: 1\n" ) + "Reviewer: Change Owner <1@gerrit>\n" ) + "CC: Other Account <2@gerrit>\n" ) + "Subject: This is a test change\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( "\n" + "Patch-Set: 1\n" ) + "Reviewer: 1@gerrit\n" ) ) ) ; }
Source:
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 ; }

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 ) ) ) ) { return getCurrentUser ( ) . isAdministrator ( ) ; } else { return getProjectControl ( ) . isOwner ( ) ; } }
Source:
public void onPluginLoad ( ) { com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "upload" , new com.googlesource.gerrit.plugins.imagare.client.ImageUploadScreen.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "settings" , new com.googlesource.gerrit.plugins.imagare.client.ImagareAdminScreen.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . settingsScreen ( "preferences" , ( ( com.google.gerrit.plugin.client.Plugin.get ( ) . getName ( ) ) + " Preferences" ) , new com.googlesource.gerrit.plugins.imagare.client.ImagarePreferenceScreen.Factory ( ) ) ; }

Target:
public void onSuccess ( com.googlesource.gerrit.plugins.imagare.client.ConfigInfo info ) { if ( info.enableImageServer ( ) ) { com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "upload" , new com.googlesource.gerrit.plugins.imagare.client.ImageUploadScreen.Factory ( ) ) ; } com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "settings" , new com.googlesource.gerrit.plugins.imagare.client.ImagareAdminScreen.Factory ( info.enableImageServer ( ) ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . settingsScreen ( "preferences" , ( ( com.google.gerrit.plugin.client.Plugin.get ( ) . getName ( ) ) + " Preferences" ) , new com.googlesource.gerrit.plugins.imagare.client.ImagarePreferenceScreen.Factory ( info.enableImageServer ( ) ) ) ; }
Source:
private boolean canEditDescription ( ) { if ( getChange ( ) . getStatus ( ) . isOpen ( ) ) { return ( ( ( isOwner ( ) ) || ( getRefControl ( ) . isOwner ( ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ) || ( getUser ( ) . getCapabilities ( ) . canAdministrateServer ( ) ) ; } return false ; }

Target:
private boolean canEditDescription ( ) { if ( getChange ( ) . getStatus ( ) . isOpen ( ) ) { return ( ( ( isOwner ( ) ) || ( getRefControl ( ) . isOwner ( ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ) || ( getUser ( ) . getCapabilities ( ) . isAdmin_DoNotUse ( ) ) ; } return false ; }
Source:
public void remove ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key1 = com.google.gerrit.gpg.testutil.TestKey.key1 ( ) ; store.add ( key1.getPublicKeyRing ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) , key1 ) ; store.remove ( key1.getPublicKey ( ) . getFingerprint ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FAST_FORWARD , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) ) ; }

Target:
public void remove ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key1 = com.google.gerrit.gpg.testutil.TestKeys.key1 ( ) ; store.add ( key1.getPublicKeyRing ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.NEW , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) , key1 ) ; store.remove ( key1.getPublicKey ( ) . getFingerprint ( ) ) ; org.junit.Assert.assertEquals ( RefUpdate.Result.FAST_FORWARD , store.save ( newCommitBuilder ( ) ) ) ; assertKeys ( key1.getKeyId ( ) ) ; }
Source:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( ( event.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { doCreateGroup ( ) ; } }

Target:
protected void onInitUI ( ) { super . onInitUI ( ) ; setPageTitle ( Util.C.groupListTitle ( ) ) ; createGroupLinkPanel = new com.google.gwt.user.client.ui.VerticalPanel ( ) ; createGroupLinkPanel.setStyleName ( Gerrit.RESOURCES.css ( ) . createGroupLink ( ) ) ; createGroupLinkPanel.add ( new com.google.gerrit.client.ui.Hyperlink ( Util.C.headingCreateGroup ( ) , com.google.gerrit.common.PageLinks.ADMIN_CREATE_GROUP ) ) ; add ( createGroupLinkPanel ) ; groups = new com.google.gerrit.client.admin.GroupTable ( true , com.google.gerrit.common.PageLinks.ADMIN_GROUPS ) ; add ( groups ) ; }
Source:
public com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > read ( ) throws com.google.gwtorm.server.OrmException { return source.read ( ) ; }

Target:
public java.util.Iterator < com.google.gerrit.server.query.change.ChangeData > iterator ( ) { return com.google.common.collect.Iterables.transform ( rs , new com.google.common.base.Function < com.google.gerrit.server.query.change.ChangeData , com.google.gerrit.server.query.change.ChangeData > ( ) { @ java.lang.Override public com.google.gerrit.server.query.change.ChangeData apply ( com.google.gerrit.server.query.change.ChangeData input ) { input.cacheFromSource ( source ) ; return input ; } } ) . iterator ( ) ; }
Source:
protected java.lang.Class < ? > findClass ( java.lang.String name ) throws java.lang.ClassNotFoundException { if ( isSystemPath ( name ) ) { try { return systemClassLoader.loadClass ( name ) ; } catch ( java.lang.ClassNotFoundException e ) { } } return super . findClass ( name ) ; }

Target:
protected java.lang.Class < ? > findClass ( java.lang.String name ) throws java.lang.ClassNotFoundException { if ( ctx.isSystemClass ( name.replace ( '/' , '.' ) ) ) { try { return systemClassLoader.loadClass ( name ) ; } catch ( java.lang.ClassNotFoundException e ) { } } return super . findClass ( name ) ; }
Source:
static com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > change ( final com.google.gwtorm.server.ResultSet < com.google.gerrit.reviewdb.client.Change > rs ) { return new com.google.gerrit.server.query.change.ChangeDataResultSet < com.google.gerrit.reviewdb.client.Change > ( rs , true ) { @ java.lang.Override com.google.gerrit.server.query.change.ChangeData convert ( com.google.gerrit.reviewdb.client.Change t ) { return new com.google.gerrit.server.query.change.ChangeData ( t ) ; } } ; }

Target:
static com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > change ( final com.google.gerrit.server.query.change.ChangeData.Factory factory , final com.google.inject.Provider < com.google.gerrit.reviewdb.server.ReviewDb > db , final com.google.gwtorm.server.ResultSet < com.google.gerrit.reviewdb.client.Change > rs ) { return new com.google.gerrit.server.query.change.ChangeDataResultSet < com.google.gerrit.reviewdb.client.Change > ( rs , true ) { @ java.lang.Override com.google.gerrit.server.query.change.ChangeData convert ( com.google.gerrit.reviewdb.client.Change t ) { return factory.create ( db.get ( ) , t ) ; } } ; }
Source:
private void add ( java.util.List < com.google.gerrit.sshd.SshKeyCacheEntry > kl , com.google.gerrit.server.account.AccountSshKey k ) { try { kl.add ( new com.google.gerrit.sshd.SshKeyCacheEntry ( k.getKey ( ) , com.google.gerrit.sshd.SshUtil.parse ( k ) ) ) ; } catch ( java.lang.OutOfMemoryError e ) { throw e ; } catch ( java.lang.Throwable e ) { markInvalid ( k ) ; } }

Target:
private void add ( java.util.List < com.google.gerrit.sshd.SshKeyCacheEntry > kl , com.google.gerrit.server.account.AccountSshKey k ) { try { kl.add ( new com.google.gerrit.sshd.SshKeyCacheEntry ( k.accountId ( ) , com.google.gerrit.sshd.SshUtil.parse ( k ) ) ) ; } catch ( java.lang.OutOfMemoryError e ) { throw e ; } catch ( java.lang.Throwable e ) { markInvalid ( k ) ; } }
Source:
public void onFailure ( java.lang.Throwable reason ) { new com.google.gerrit.client.ErrorDialog ( reason ) . center ( ) ; }

Target:
private static void publish ( java.lang.String token ) { new com.google.gerrit.client.Dispatcher.AsyncSplit ( token ) { public void onSuccess ( ) { com.google.gerrit.client.Gerrit.display ( token , select ( ) ) ; } private com.google.gerrit.client.ui.Screen select ( ) { java.lang.String p = "change,publish," ; if ( token.startsWith ( p ) ) return new com.google.gerrit.client.changes.PublishCommentScreen ( PatchSet.Id.parse ( com.google.gerrit.client.Dispatcher.skip ( p , token ) ) ) ; return new com.google.gerrit.client.NotFoundScreen ( ) ; } } . onSuccess ( ) ; }
Source:
private void setuser ( final com.google.gerrit.pgm.init.Section database , java.lang.String username , java.lang.String password ) { if ( ( username != null ) && ( ! ( username.isEmpty ( ) ) ) ) { database.set ( "username" , username ) ; } if ( ( password != null ) && ( ! ( password.isEmpty ( ) ) ) ) { sec.setString ( "database" , null , "password" , password ) ; } }

Target:
private void setuser ( final com.google.gerrit.pgm.init.api.Section database , java.lang.String username , java.lang.String password ) { if ( ( username != null ) && ( ! ( username.isEmpty ( ) ) ) ) { database.set ( "username" , username ) ; } if ( ( password != null ) && ( ! ( password.isEmpty ( ) ) ) ) { sec.set ( "database" , null , "password" , password ) ; } }
Source:
public void parseInvalidTimestamps ( ) { com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "2006-01-02-15:04:05.999000000" ) ; com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "2006-01-02T15:04:05.999000000" ) ; com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "2006-01-02" ) ; com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "15:04:05" ) ; com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "15:04:05.999000000" ) ; com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "2006-01-02 10:04:05.999 -0500" ) ; com.google.gwtjsonrpc.common.JavaSqlTimestampHelperTest.assertInvalid ( "2006-01-02 10:04:05.999000000 -0500" ) ; }

Target:
public void parseDateOnly ( ) { org.junit.Assert.assertEquals ( "2006-01-01 19:00:00.000 -0500" , reformat ( "2006-01-02" ) ) ; }
Source:
public com.google.gerrit.client.ui.Screen recycleThis ( final com.google.gerrit.client.ui.Screen newScreen ) { final com.google.gerrit.client.account.AccountSettings s = ( ( com.google.gerrit.client.account.AccountSettings ) ( newScreen ) ) ; initialTabToken = s.initialTabToken ; return this ; }

Target:
public void onLoad ( ) { if ( ( info ) == null ) { initUI ( ) ; } super . onLoad ( ) ; display ( com.google.gerrit.client.Gerrit.getUserAccount ( ) ) ; tabs.selectTab ( tabTokens.indexOf ( initialTabToken ) ) ; Util.ACCOUNT_SVC.myAccount ( new com.google.gerrit.client.rpc.ScreenLoadCallback < com.google.gerrit.client.reviewdb.Account > ( this ) { @ java.lang.Override protected void preDisplay ( final com.google.gerrit.client.reviewdb.Account result ) { display ( result ) ; } } ) ; }
Source:
private static void recursiveDelete ( java.io.File path ) { java.io.File [ ] entries = path.listFiles ( ) ; if ( entries != null ) { for ( java.io.File e : entries ) { com.google.gerrit.pgm.Init.recursiveDelete ( e ) ; } } if ( ( ! ( path.delete ( ) ) ) && ( path.exists ( ) ) ) { java.lang.System.err.println ( ( "warn: Cannot remove " + path ) ) ; } }

Target:
private static boolean nullOrEmpty ( java.util.List < ? > list ) { return ( list == null ) || ( list.isEmpty ( ) ) ; }
Source:
protected com.google.gerrit.extensions.common.ChangeInfo get ( java.lang.String id , com.google.gerrit.extensions.common.ListChangesOption ... options ) throws com.google.gerrit.extensions.restapi.RestApiException { java.util.EnumSet < com.google.gerrit.extensions.common.ListChangesOption > s = java.util.EnumSet.noneOf ( com.google.gerrit.extensions.common.ListChangesOption.class ) ; s.addAll ( java.util.Arrays.asList ( options ) ) ; return gApi.changes ( ) . id ( id ) . get ( s ) ; }

Target:
protected PushOneCommit.Result pushTo ( java.lang.String ref ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , testRepo ) ; return push.to ( ref ) ; }
Source:
private com.google.gerrit.extensions.common.Comment.Range toRange ( com.google.gerrit.reviewdb.client.CommentRange commentRange ) { com.google.gerrit.extensions.common.Comment.Range range = null ; if ( commentRange != null ) { range = new com.google.gerrit.extensions.common.Comment.Range ( ) ; range.startLine = commentRange.getStartLine ( ) ; range.startCharacter = commentRange.getStartCharacter ( ) ; range.endLine = commentRange.getEndLine ( ) ; range.endCharacter = commentRange.getEndCharacter ( ) ; } return range ; }

Target:
private com.google.gerrit.extensions.client.Comment.Range toRange ( com.google.gerrit.reviewdb.client.CommentRange commentRange ) { com.google.gerrit.extensions.client.Comment.Range range = null ; if ( commentRange != null ) { range = new com.google.gerrit.extensions.client.Comment.Range ( ) ; range.startLine = commentRange.getStartLine ( ) ; range.startCharacter = commentRange.getStartCharacter ( ) ; range.endLine = commentRange.getEndLine ( ) ; range.endCharacter = commentRange.getEndCharacter ( ) ; } return range ; }
Source:
public java.io.File resolve ( final java.lang.String path ) { if ( ( path != null ) && ( ! ( path.isEmpty ( ) ) ) ) { java.io.File loc = new java.io.File ( path ) ; if ( ! ( loc.isAbsolute ( ) ) ) { loc = new java.io.File ( site_path , path ) ; } return loc ; } return null ; }

Target:
public java.io.File resolve ( final java.lang.String path ) { if ( ( path != null ) && ( ! ( path.isEmpty ( ) ) ) ) { java.io.File loc = new java.io.File ( path ) ; if ( ! ( loc.isAbsolute ( ) ) ) { loc = new java.io.File ( site_path , path ) ; } try { return loc.getCanonicalFile ( ) ; } catch ( java.io.IOException e ) { return loc.getAbsoluteFile ( ) ; } } return null ; }
Source:
private void assertSubmitter ( com.google.gerrit.acceptance.PushOneCommit.Result change ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo info = get ( change.getChangeId ( ) , ListChangesOption.MESSAGES ) ; com.google.common.truth.Truth.assertThat ( info.messages ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( info.messages ) . hasSize ( 3 ) ; if ( ( getSubmitType ( ) ) == ( com.google.gerrit.extensions.client.SubmitType.CHERRY_PICK ) ) { com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getLast ( info.messages ) . message ) . startsWith ( "Change has been successfully cherry-picked as " ) ; } else { com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getLast ( info.messages ) . message ) . isEqualTo ( "Change has been successfully merged into the git repository by Administrator" ) ; } }

Target:
private void assertSubmitter ( com.google.gerrit.acceptance.PushOneCommit.Result change ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo info = get ( change.getChangeId ( ) , ListChangesOption.MESSAGES ) ; com.google.common.truth.Truth.assertThat ( info.messages ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( info.messages ) . hasSize ( 3 ) ; if ( ( getSubmitType ( ) ) == ( com.google.gerrit.extensions.client.SubmitType.CHERRY_PICK ) ) { com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getLast ( info.messages ) . message ) . startsWith ( "Change has been successfully cherry-picked as " ) ; } else { com.google.common.truth.Truth.assertThat ( com.google.common.collect.Iterables.getLast ( info.messages ) . message ) . isEqualTo ( "Change has been successfully merged by Administrator" ) ; } }
Source:
public void replacementStringOfFixReplacementIsAcceptedAsIs ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; java.util.List < com.google.gerrit.extensions.common.RobotCommentInfo > robotCommentInfos = getRobotComments ( ) ; com.google.gerrit.acceptance.api.revision.RobotCommentInfoSubject.assertThatList ( robotCommentInfos ) . onlyElement ( ) . onlyFixSuggestion ( ) . onlyReplacement ( ) . replacement ( ) . isEqualTo ( fixReplacementInfo.replacement ) ; }

Target:
public void replacementStringOfFixReplacementIsAcceptedAsIs ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; addRobotComment ( changeId , withFixRobotCommentInput ) ; java.util.List < com.google.gerrit.extensions.common.RobotCommentInfo > robotCommentInfos = getRobotComments ( ) ; com.google.gerrit.extensions.common.RobotCommentInfoSubject.assertThatList ( robotCommentInfos ) . onlyElement ( ) . onlyFixSuggestion ( ) . onlyReplacement ( ) . replacement ( ) . isEqualTo ( fixReplacementInfo.replacement ) ; }
Source:
public java.util.Collection < com.google.gerrit.reviewdb.ProjectRight > getAllRights ( final com.google.gerrit.reviewdb.ApprovalCategory.Id id ) { java.util.Collection < com.google.gerrit.reviewdb.ProjectRight > l = allRights.get ( id ) ; if ( l == null ) { l = new java.util.ArrayList < com.google.gerrit.reviewdb.ProjectRight > ( ) ; l.addAll ( getProjectRights ( id ) ) ; l.addAll ( getWildcardRights ( id ) ) ; l = java.util.Collections.unmodifiableCollection ( l ) ; allRights.put ( id , l ) ; } return l ; }

Target:
public java.util.Collection < com.google.gerrit.reviewdb.RefRight > getAllRights ( final com.google.gerrit.reviewdb.ApprovalCategory.Id id ) { java.util.Collection < com.google.gerrit.reviewdb.RefRight > l = allRights.get ( id ) ; if ( l == null ) { l = new java.util.ArrayList < com.google.gerrit.reviewdb.RefRight > ( ) ; l.addAll ( getRefRights ( id ) ) ; l.addAll ( getWildcardRights ( id ) ) ; l = java.util.Collections.unmodifiableCollection ( l ) ; allRights.put ( id , l ) ; } return l ; }
Source:
protected void pruneOldIndexes ( final T oldObj , T newObj ) throws com.google.gwtorm.client.OrmException { if ( oldObj != null ) { for ( com.google.gwtorm.nosql.IndexFunction < T > f : com.google.gwtorm.nosql.generic.GenericAccess.getQueryIndexes ( ) ) { if ( f.includes ( oldObj ) ) { final byte [ ] k = indexRowKey ( f , oldObj ) ; if ( ! ( matches ( f , newObj , k ) ) ) { db.delete ( k ) ; } } } } }

Target:
protected void pruneOldIndexes ( final T oldObj , T newObj ) throws com.google.gwtorm.client.OrmException { if ( oldObj != null ) { for ( com.google.gwtorm.nosql.IndexFunction < T > f : com.google.gwtorm.nosql.generic.GenericAccess.getIndexes ( ) ) { if ( f.includes ( oldObj ) ) { final byte [ ] idxKey = indexRowKey ( f , oldObj ) ; if ( ( newObj == null ) || ( ! ( matches ( f , newObj , idxKey ) ) ) ) { db.delete ( idxKey ) ; } } } } }
Source:
protected com.google.gerrit.common.data.ProjectAccess updateProjectConfig ( com.google.gerrit.server.git.ProjectConfig config , com.google.gerrit.server.git.MetaDataUpdate md , boolean parentProjectUpdate ) throws com.google.gerrit.server.permissions.PermissionBackendException , com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.revwalk.RevCommit commit = config.commit ( md ) ; gitRefUpdated.fire ( config.getProject ( ) . getNameKey ( ) , RefNames.REFS_CONFIG , base , commit.getId ( ) , user.asIdentifiedUser ( ) . getAccount ( ) ) ; projectCache.evict ( config.getProject ( ) ) ; return projectAccessFactory.create ( projectName ) . call ( ) ; }

Target:
protected com.google.gerrit.common.data.ProjectAccess updateProjectConfig ( com.google.gerrit.server.git.ProjectConfig config , com.google.gerrit.server.git.MetaDataUpdate md , boolean parentProjectUpdate ) throws com.google.gerrit.server.permissions.PermissionBackendException , com.google.gerrit.server.project.NoSuchProjectException , java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.revwalk.RevCommit commit = config.commit ( md ) ; gitRefUpdated.fire ( config.getProject ( ) . getNameKey ( ) , RefNames.REFS_CONFIG , base , commit.getId ( ) , user.asIdentifiedUser ( ) . getAccount ( ) ) ; projectCache.evict ( config.getProject ( ) ) ; createGroupPermissionSyncer.syncIfNeeded ( ) ; return projectAccessFactory.create ( projectName ) . call ( ) ; }
Source:
private void assertSubmitApproval ( com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSetApproval a = getSubmitter ( patchSetId ) ; org.junit.Assert.assertTrue ( a.isSubmit ( ) ) ; org.junit.Assert.assertEquals ( 1 , a.getValue ( ) ) ; org.junit.Assert.assertEquals ( admin.id , a.getAccountId ( ) ) ; }

Target:
private void assertSubmitApproval ( com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSetApproval a = getSubmitter ( patchSetId ) ; com.google.common.truth.Truth.assertThat ( a.isSubmit ( ) ) . isTrue ( ) ; com.google.common.truth.Truth.assertThat ( a.getValue ( ) ) . isEqualTo ( ( ( short ) ( 1 ) ) ) ; com.google.common.truth.Truth.assertThat ( a.getAccountId ( ) ) . isEqualTo ( admin.id ) ; }
Source:
public void allRefsVisibleWithRefsMetaConfig ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/meta/config" ) ; assertRefs ( "HEAD" , "refs/changes/01/1/1" , "refs/changes/01/1/meta" , "refs/changes/02/2/1" , "refs/changes/02/2/meta" , "refs/heads/branch" , "refs/heads/master" , "refs/meta/config" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }

Target:
public void allRefsVisibleWithRefsMetaConfig ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/meta/config" ) ; assertRefs ( "HEAD" , ( ( r1 ) + "1" ) , ( ( r1 ) + "meta" ) , ( ( r2 ) + "1" ) , ( ( r2 ) + "meta" ) , "refs/heads/branch" , "refs/heads/master" , "refs/meta/config" , "refs/tags/branch-tag" , "refs/tags/master-tag" ) ; }
Source:
public void noRescheduleOnSuccess ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.WEBHOOK_URL , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.HEADERS , remote , com.googlesource.gerrit.plugins.webhooks.PostTaskTest.BODY ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.OK_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verifyZeroInteractions ( executor ) ; }

Target:
public void noRescheduleOnSuccess ( ) throws java.io.IOException { org.mockito.Mockito.when ( session.post ( org.mockito.ArgumentMatchers.eq ( remote ) , org.mockito.ArgumentMatchers.eq ( content ) ) ) . thenReturn ( com.googlesource.gerrit.plugins.webhooks.PostTaskTest.OK_RESULT ) ; task.run ( ) ; org.mockito.Mockito.verifyZeroInteractions ( executor ) ; }
Source:
public void onFailure ( java.lang.Throwable err ) { com.google.gerrit.client.change.RelatedChangesTab tab = tabs.get ( com.google.gerrit.client.change.RelatedChanges.RELATED_CHANGES ) ; tab.setTitle ( Resources.M.relatedChanges ( "na" ) ) ; tab.setError ( err.getMessage ( ) ) ; }

Target:
public void onSelection ( com.google.gwt.event.logical.shared.SelectionEvent < java.lang.Integer > event ) { if ( ( selectedTab ) >= 0 ) { tabs.get ( selectedTab ) . registerKeys ( false ) ; } selectedTab = event.getSelectedItem ( ) ; tabs.get ( selectedTab ) . registerKeys ( true ) ; }
Source:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { int row = getCurrentRow ( ) ; if ( ( 1 <= row ) && ( row <= ( this . list.length ( ) ) ) ) { com.google.gerrit.client.diff.FileInfo info = this . list.get ( ( row - 1 ) ) ; com.google.gwt.dom.client.InputElement b = getReviewed ( info ) ; boolean c = ! ( b.isChecked ( ) ) ; setReviewed ( info , c ) ; b.setChecked ( c ) ; } }

Target:
public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { int row = getCurrentRow ( ) ; if ( ( 1 <= row ) && ( row <= ( this . list.length ( ) ) ) ) { com.google.gerrit.client.info.FileInfo info = this . list.get ( ( row - 1 ) ) ; com.google.gwt.dom.client.InputElement b = getReviewed ( info ) ; boolean c = ! ( b.isChecked ( ) ) ; setReviewed ( info , c ) ; b.setChecked ( c ) ; } }
Source:
public void onFailure ( final java.lang.Throwable caught ) { com.google.gwt.core.client.GWT.log ( "Fail" , caught ) ; }

Target:
public void onLoad ( ) { super . onLoad ( ) ; table.setSavePointerId ( com.google.gwt.user.client.History.getToken ( ) ) ; Util.LIST_SVC.forAccount ( ownerId , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.data.AccountDashboardInfo > ( ) { public void onSuccess ( final com.google.gerrit.client.data.AccountDashboardInfo r ) { display ( r ) ; } } ) ; }
Source:
com.google.gerrit.server.git.BatchUpdate getUpdate ( ) { com.google.common.base.Preconditions.checkState ( ( ( db ) != null ) , "call setContext before getUpdate" ) ; if ( ( update ) == null ) { update = batchUpdateFactory.create ( db , getProjectName ( ) , caller , ts ) ; update.setRepository ( repo , rw , ins ) ; } return update ; }

Target:
public com.google.gerrit.server.git.BatchUpdate getUpdate ( ) { com.google.common.base.Preconditions.checkState ( ( ( db ) != null ) , "call setContext before getUpdate" ) ; if ( ( update ) == null ) { update = batchUpdateFactory.create ( db , getProjectName ( ) , caller , ts ) . setRepository ( repo , rw , ins ) . setRequestId ( submissionId ) ; } return update ; }
Source:
private void loadMyEmails ( ) throws com.google.gerrit.server.ssh.Failure { try { for ( final com.google.gerrit.client.reviewdb.AccountExternalId id : db.accountExternalIds ( ) . byAccount ( userAccount.getId ( ) ) ) { if ( ( ( id.getEmailAddress ( ) ) != null ) && ( ( id.getEmailAddress ( ) . length ( ) ) > 0 ) ) { myEmails.add ( id.getEmailAddress ( ) ) ; } } } catch ( com.google.gwtorm.client.OrmException e ) { throw new com.google.gerrit.server.ssh.Failure ( 1 , "database error" ) ; } }

Target:
private void loadMyEmails ( ) throws com.google.gerrit.server.ssh.Failure { try { for ( final com.google.gerrit.client.reviewdb.AccountExternalId id : db.accountExternalIds ( ) . byAccount ( userAccount.getId ( ) ) ) { if ( ( ( id.getEmailAddress ( ) ) != null ) && ( ( id.getEmailAddress ( ) . length ( ) ) > 0 ) ) { myEmails.add ( id.getEmailAddress ( ) ) ; } } } catch ( com.google.gwtorm.client.OrmException e ) { throw new com.google.gerrit.server.ssh.Failure ( 1 , "fatal: database error" , e ) ; } }
Source:
public void handle ( net.codemirror.lib.CodeMirror instance , int line , java.lang.String gutter , com.google.gwt.event.dom.client.MouseDownEvent clickEvent ) { instance.setCursor ( net.codemirror.lib.LineCharacter.create ( line ) ) ; instance.setActiveLine ( instance.getLineHandle ( line ) ) ; insertNewDraft ( instance ) . run ( ) ; }

Target:
public void handle ( net.codemirror.lib.CodeMirror instance , int line , java.lang.String gutter , com.google.gwt.dom.client.NativeEvent clickEvent ) { instance.setCursor ( net.codemirror.lib.LineCharacter.create ( line ) ) ; instance.setActiveLine ( instance.getLineHandle ( line ) ) ; insertNewDraft ( instance ) . run ( ) ; }
Source:
protected PushOneCommit.Result ammendChange ( java.lang.String changeId ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.util.Collections.shuffle ( com.google.gerrit.acceptance.AbstractDaemonTest.RANDOM ) ; com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , PushOneCommit.SUBJECT , PushOneCommit.FILE_NAME , new java.lang.String ( com.google.common.primitives.Chars.toArray ( com.google.gerrit.acceptance.AbstractDaemonTest.RANDOM ) ) , changeId ) ; return push.to ( git , "refs/for/master" ) ; }

Target:
protected PushOneCommit.Result amendChange ( java.lang.String changeId ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.util.Collections.shuffle ( com.google.gerrit.acceptance.AbstractDaemonTest.RANDOM ) ; com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , PushOneCommit.SUBJECT , PushOneCommit.FILE_NAME , new java.lang.String ( com.google.common.primitives.Chars.toArray ( com.google.gerrit.acceptance.AbstractDaemonTest.RANDOM ) ) , changeId ) ; return push.to ( git , "refs/for/master" ) ; }
Source:
private static void updateChange ( final com.google.gerrit.reviewdb.server.ReviewDb db , final com.google.gerrit.reviewdb.client.Change change , final com.google.gerrit.reviewdb.client.PatchSetInfo psInfo ) throws com.google.gwtorm.server.OrmException { db.changes ( ) . atomicUpdate ( change.getId ( ) , new com.google.gwtorm.server.AtomicUpdate < com.google.gerrit.reviewdb.client.Change > ( ) { @ java.lang.Override public com.google.gerrit.reviewdb.client.Change update ( com.google.gerrit.reviewdb.client.Change c ) { if ( psInfo != null ) { c.setCurrentPatchSet ( psInfo ) ; } com.google.gerrit.server.ChangeUtil.updated ( c ) ; return c ; } } ) ; }

Target:
private void updateChange ( final com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.reviewdb.client.Change change , final com.google.gerrit.reviewdb.client.PatchSetInfo psInfo ) throws com.google.gwtorm.server.OrmException , java.io.IOException { change = db.changes ( ) . atomicUpdate ( change.getId ( ) , new com.google.gwtorm.server.AtomicUpdate < com.google.gerrit.reviewdb.client.Change > ( ) { @ java.lang.Override public com.google.gerrit.reviewdb.client.Change update ( com.google.gerrit.reviewdb.client.Change c ) { if ( psInfo != null ) { c.setCurrentPatchSet ( psInfo ) ; } com.google.gerrit.server.ChangeUtil.updated ( c ) ; return c ; } } ) ; indexer.index ( db , change ) ; }
Source:
public void testUnblockInLocal_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , fixers , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl f = util.user ( local , fixers ) ; org.junit.Assert.assertFalse ( "u can't push" , f.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockInLocal_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , fixers , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl f = util.user ( local , fixers ) ; assertCannotUpdate ( "refs/heads/master" , f ) ; }
Source:
public java.lang.Object login ( boolean quiet ) { try { token = client.login ( getUsername ( ) , getPassword ( ) ) ; log.info ( ( ( ( "Connected to " + ( getUrl ( ) ) ) + " as " ) + ( token ) ) ) ; return token ; } catch ( java.lang.Exception ex ) { if ( ! quiet ) { log.error ( "I was unable to logout" , ex ) ; } return null ; } }

Target:
public java.lang.Object login ( boolean quiet ) { try { token = client.login ( getUsername ( ) , getPassword ( ) ) ; log.info ( ( ( ( "Connected to " + ( getUrl ( ) ) ) + " as " ) + ( token ) ) ) ; return token ; } catch ( java.lang.Exception ex ) { if ( ! quiet ) { log.error ( "I was unable to login" , ex ) ; } return null ; } }
Source:
public boolean isAccessTokenForClient ( java.lang.String clientname , java.lang.String accessToken ) { try { com.google.gson.JsonObject jsonWebToken = toJsonWebToken ( accessToken ) ; return ( ( getAttribute ( jsonWebToken , com.googlesource.gerrit.plugins.cfoauth.UAAClient.USER_NAME_ATTRIBUTE ) ) == null ) && ( clientname.equals ( getAttribute ( jsonWebToken , com.googlesource.gerrit.plugins.cfoauth.UAAClient.SUB_ATTRIBUTE ) ) ) ; } catch ( com.googlesource.gerrit.plugins.cfoauth.UAAClientException e ) { return false ; } }

Target:
public boolean isAccessTokenForClient ( java.lang.String clientname , java.lang.String accessToken ) { try { com.google.gson.JsonObject jsonWebToken = toJsonWebToken ( accessToken ) ; return ( ( getAttribute ( jsonWebToken , com.googlesource.gerrit.plugins.cfoauth.UAAClient.USER_NAME_ATTRIBUTE ) ) == null ) && ( equalsAdjustCase ( clientname , getAttribute ( jsonWebToken , com.googlesource.gerrit.plugins.cfoauth.UAAClient.SUB_ATTRIBUTE ) ) ) ; } catch ( com.googlesource.gerrit.plugins.cfoauth.UAAClientException e ) { return false ; } }
Source:
public void unstarChange ( java.lang.String changeId ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeResource rsrc = changes.parse ( TopLevelResource.INSTANCE , com.google.gerrit.extensions.restapi.IdString.fromUrl ( changeId ) ) ; com.google.gerrit.server.account.AccountResource.StarredChange starredChange = new com.google.gerrit.server.account.AccountResource.StarredChange ( account.getUser ( ) , rsrc ) ; starredChangesDelete.apply ( starredChange , new com.google.gerrit.server.account.StarredChanges.EmptyInput ( ) ) ; } catch ( com.google.gwtorm.server.OrmException | java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot unstar change" , e ) ; } }

Target:
public void unstarChange ( java.lang.String changeId ) throws com.google.gerrit.extensions.restapi.RestApiException { try { com.google.gerrit.server.change.ChangeResource rsrc = changes.parse ( TopLevelResource.INSTANCE , com.google.gerrit.extensions.restapi.IdString.fromUrl ( changeId ) ) ; com.google.gerrit.server.account.AccountResource.StarredChange starredChange = new com.google.gerrit.server.account.AccountResource.StarredChange ( account.getUser ( ) , rsrc ) ; starredChangesDelete.apply ( starredChange , new com.google.gerrit.server.account.StarredChanges.EmptyInput ( ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot unstar change" , e ) ; } }
Source:
public void suggestReviewersWithoutLimitOptionSpecified ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; java.lang.String query = "users3" ; java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > suggestedReviewerInfos = newGson ( ) . fromJson ( adminSession.get ( ( ( ( "/changes/" + changeId ) + "/suggest_reviewers?q=" ) + query ) ) . getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > > ( ) { } . getType ( ) ) ; com.google.common.truth.Truth.assertThat ( suggestedReviewerInfos ) . hasSize ( 1 ) ; }

Target:
public void suggestReviewersWithoutLimitOptionSpecified ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; java.lang.String query = user3.fullName ; java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > suggestedReviewerInfos = newGson ( ) . fromJson ( adminSession.get ( ( ( ( "/changes/" + changeId ) + "/suggest_reviewers?q=" ) + query ) ) . getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > > ( ) { } . getType ( ) ) ; com.google.common.truth.Truth.assertThat ( suggestedReviewerInfos ) . hasSize ( 1 ) ; }
Source:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { new com.google.gerrit.client.changes.RestoreChangeDialog ( patchSet.getId ( ) , new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ChangeDetail > ( ) { public void onSuccess ( com.google.gerrit.common.data.ChangeDetail result ) { changeScreen.update ( result ) ; } public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; } } ) . center ( ) ; }

Target:
private com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ChangeDetail > createCommentedCallback ( final com.google.gwt.user.client.ui.Button b ) { return new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.common.data.ChangeDetail > ( ) { public void onSuccess ( com.google.gerrit.common.data.ChangeDetail result ) { changeScreen.update ( result ) ; } public void onFailure ( java.lang.Throwable caught ) { b.setEnabled ( true ) ; } } ; }
Source:
protected void renderTextError ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , int statusCode , java.lang.String message ) throws java.io.IOException { res.setStatus ( statusCode ) ; setApiHeaders ( res , com.google.gitiles.FormatType.TEXT ) ; setCacheHeaders ( res ) ; java.io.Writer out = getWriter ( res ) ; out.write ( message ) ; out.close ( ) ; }

Target:
protected void renderTextError ( javax.servlet.http.HttpServletRequest req , javax.servlet.http.HttpServletResponse res , int statusCode , java.lang.String message ) throws java.io.IOException { res.setStatus ( statusCode ) ; setApiHeaders ( res , com.google.gitiles.FormatType.TEXT ) ; setCacheHeaders ( res ) ; java.io.Writer out = newWriter ( res ) ; out.write ( message ) ; out.close ( ) ; }