auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void zipFile ( java.io.File file , java.lang.String name , java.util.zip.ZipOutputStream zip ) throws java.io.IOException { zip.putNextEntry ( new java.util.zip.ZipEntry ( name ) ) ; try ( java.io.FileInputStream input = new java.io.FileInputStream ( file ) ) { com.google.common.io.ByteStreams.copy ( input , zip ) ; } zip.closeEntry ( ) ; }

Target:
public static void zipFile ( java.io.File file , java.lang.String name , java.util.zip.ZipOutputStream zip ) throws java.io.IOException { zip.putNextEntry ( new java.util.zip.ZipEntry ( name ) ) ; try ( java.io.InputStream input = java.nio.file.Files.newInputStream ( file.toPath ( ) ) ) { com.google.common.io.ByteStreams.copy ( input , zip ) ; } zip.closeEntry ( ) ; }
Source:
public void addComment ( final java.lang.String issueId , final java.lang.String comment ) { if ( ! ( exists ( issueId ) ) ) { log.warn ( ( ( "Story " + issueId ) + " does not exist, nothing to update" ) ) ; return ; } try { client.addComment ( issueId , comment ) ; } catch ( java.io.IOException e ) { log.error ( ( "Error: could not add comment to issue " + issueId ) ) ; } log.info ( ( ( ( "Updated " + issueId ) + "with comment: " ) + comment ) ) ; }

Target:
public void addComment ( final java.lang.String issueId , final java.lang.String comment ) { if ( ! ( exists ( issueId ) ) ) { log.warn ( ( ( "Storyboard item " + issueId ) + " does not exist" ) ) ; return ; } try { client.addComment ( issueId , comment ) ; } catch ( java.io.IOException e ) { log.error ( ( "Error: unable to comment " + issueId ) ) ; } log.info ( ( ( ( "Updated " + issueId ) + "with comment: " ) + comment ) ) ; }
Source:
private static java.lang.String nameOf ( java.lang.String name ) { if ( name.endsWith ( ".disabled" ) ) { name = name.substring ( 0 , name.lastIndexOf ( '.' ) ) ; } int ext = name.lastIndexOf ( '.' ) ; return 0 < ext ? name.substring ( 0 , ext ) : name ; }

Target:
private java.lang.String getPluginCanonicalWebUrl ( java.lang.String name ) { java.lang.String canonicalWebUrl = urlProvider.get ( ) ; if ( com.google.common.base.Strings.isNullOrEmpty ( canonicalWebUrl ) ) { return "/plugins/" + name ; } java.lang.String url = java.lang.String.format ( "%s/plugins/%s/" , com.google.common.base.CharMatcher.is ( '/' ) . trimTrailingFrom ( canonicalWebUrl ) , name ) ; return url ; }
Source:
protected void configureServlets ( ) { serve ( "/static/*" ) . with ( com.google.gerrit.httpd.raw.SiteStaticDirectoryServlet.class ) ; install ( new com.google.gerrit.server.cache.CacheModule ( ) { @ java.lang.Override protected void configure ( ) { cache ( com.google.gerrit.httpd.raw.StaticModule.CACHE , java.nio.file.Path.class , com.google.gerrit.httpd.raw.ResourceServlet.Resource.class ) . maximumWeight ( ( 1 << 20 ) ) . weigher ( ResourceServlet.Weigher.class ) ; } } ) ; }

Target:
protected void configureServlets ( ) { serve ( "/static/*" ) . with ( com.google.gerrit.httpd.raw.SiteStaticDirectoryServlet.class ) ; serveGwtUi ( ) ; install ( new com.google.gerrit.server.cache.CacheModule ( ) { @ java.lang.Override protected void configure ( ) { cache ( com.google.gerrit.httpd.raw.StaticModule.CACHE , java.nio.file.Path.class , com.google.gerrit.httpd.raw.ResourceServlet.Resource.class ) . maximumWeight ( ( 1 << 20 ) ) . weigher ( ResourceServlet.Weigher.class ) ; } } ) ; }
Source:
private com.google.gerrit.server.patch.PatchScriptBuilder newBuilder ( final com.google.gerrit.server.patch.PatchList list , org.eclipse.jgit.lib.Repository git ) { final com.google.gerrit.server.patch.PatchScriptBuilder b = builderFactory.get ( ) ; b.setRepository ( git , project ) ; b.setChange ( change ) ; b.setDiffPrefs ( diffPrefs ) ; b.setTrees ( list.isAgainstParent ( ) , list.getOldId ( ) , list.getNewId ( ) ) ; return b ; }

Target:
private com.google.gerrit.server.patch.PatchScriptBuilder newBuilder ( final com.google.gerrit.server.patch.PatchList list , org.eclipse.jgit.lib.Repository git ) { final com.google.gerrit.server.patch.PatchScriptBuilder b = builderFactory.get ( ) ; b.setRepository ( git , project ) ; b.setChange ( change ) ; b.setDiffPrefs ( diffPrefs ) ; b.setTrees ( list.getComparisonType ( ) , list.getOldId ( ) , list.getNewId ( ) ) ; return b ; }
Source:
public void onChangeAbandoned ( com.google.gerrit.extensions.events.ChangeAbandonedListener.Event event ) { com.google.gerrit.extensions.common.ChangeInfo change = event.getChange ( ) ; java.lang.String revision = event.getRevision ( ) . commit.commit ; com.googlesource.gerrit.plugins.automerger.DownstreamCreator.log.info ( "Detected revision abandoned on {}." , revision , change.project ) ; abandonDownstream ( change , revision ) ; }

Target:
public void onChangeAbandoned ( com.google.gerrit.extensions.events.ChangeAbandonedListener.Event event ) { com.google.gerrit.extensions.common.ChangeInfo change = event.getChange ( ) ; java.lang.String revision = event.getRevision ( ) . commit.commit ; com.googlesource.gerrit.plugins.automerger.DownstreamCreator.log.debug ( "Detected revision abandoned on {}." , revision , change.project ) ; abandonDownstream ( change , revision ) ; }
Source:
protected void onStarClick ( final int row ) { final com.google.gerrit.client.data.ChangeInfo c = getChangeInfo ( row ) ; if ( ( c != null ) && ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) ) { c.setStarred ( ( ! ( c.isStarred ( ) ) ) ) ; setStar ( row , c ) ; } }

Target:
protected void onStarClick ( final int row ) { final com.google.gerrit.client.data.ChangeInfo c = getChangeInfo ( row ) ; if ( ( c != null ) && ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) ) { c.setStarred ( ( ! ( c.isStarred ( ) ) ) ) ; setStar ( row , c ) ; final com.google.gerrit.client.changes.ToggleStarRequest req = new com.google.gerrit.client.changes.ToggleStarRequest ( ) ; req.toggle ( c.getId ( ) , c.isStarred ( ) ) ; Util.LIST_SVC.toggleStars ( req , VoidCallback.INSTANCE ) ; } }
Source:
public void parsePatchSetGroups ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Subject: Change subject\n" ) + "Groups: a,b,c\n" ) + "Groups: d,e,f\n" ) ) ) ; }

Target:
public void parseCommit ( ) throws java.lang.Exception { assertParseSucceeds ( ( "Update change\n" + ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Change-id: I577fb248e474018276351785930358ec0450e9f7\n" ) + "Subject: Some subject of a change\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234" ) ) ) ; assertParseFails ( ( "Update change\n" + ( ( ( ( ( "\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Subject: Some subject of a change\n" ) + "Commit: abcd1234abcd1234abcd1234abcd1234abcd1234\n" ) + "Commit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) ) ) ; assertParseFails ( ( "Update patch set 1\n" + ( ( ( ( "Uploaded patch set 1.\n" + "Patch-set: 1\n" ) + "Branch: refs/heads/master\n" ) + "Subject: Some subject of a change\n" ) + "Commit: beef" ) ) ) ; }
Source:
public void simpleReadmeDoc ( ) throws java.lang.Exception { java.lang.String title = "DocServletTest simpleDoc" ; java.lang.String url = "http://daringfireball.net/projects/markdown/syntax" ; java.lang.String markdown = ( ( ( ( ( ( "# " + title ) + "\n" ) + "\n" ) + "Tests the rendering of " ) + "[Markdown](" ) + url ) + ")." ; repo.branch ( "master" ) . commit ( ) . add ( "README.md" , markdown ) . create ( ) ; java.lang.String html = buildHtml ( "/repo/+doc/master/README.md" ) ; org.junit.Assert.assertTrue ( html.contains ( ( ( "<title>" + title ) + "</title>" ) ) ) ; org.junit.Assert.assertTrue ( html.contains ( ( ( "<h1 id=\"DocServletTest-simpleDoc\">" + title ) + "</h1>" ) ) ) ; org.junit.Assert.assertTrue ( html.contains ( ( ( "<a href=\"" + url ) + "\">Markdown</a>" ) ) ) ; }

Target:
public void simpleReadmeDoc ( ) throws java.lang.Exception { java.lang.String title = "DocServletTest simpleDoc" ; java.lang.String url = "http://daringfireball.net/projects/markdown/syntax" ; java.lang.String markdown = ( ( ( ( ( ( "# " + title ) + "\n" ) + "\n" ) + "Tests the rendering of " ) + "[Markdown](" ) + url ) + ")." ; repo.branch ( "master" ) . commit ( ) . add ( "README.md" , markdown ) . create ( ) ; java.lang.String html = buildHtml ( "/repo/+doc/master/README.md" ) ; org.junit.Assert.assertTrue ( html.contains ( ( ( "<title>" + title ) + "</title>" ) ) ) ; org.junit.Assert.assertTrue ( html.contains ( ( ( "<h1>" + title ) + "</h1>" ) ) ) ; org.junit.Assert.assertTrue ( html.contains ( ( ( "<a href=\"" + url ) + "\">Markdown</a>" ) ) ) ; }
Source:
public void abandonReviewableChangeByOtherCcingSelfNotifyOwner ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; com.google.gerrit.acceptance.TestAccount other = accounts.create ( "other" , "other@example.com" , "other" ) ; abandon ( sc.changeId , other , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.CC_ON_OWN_COMMENTS , com.google.gerrit.extensions.api.changes.NotifyHandling.OWNER ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . to ( sc.owner ) . cc ( other ) . notTo ( sc.reviewer , sc.ccer , sc.starrer ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) ; }

Target:
public void abandonReviewableWipChange ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableWipChange ( ) ; abandon ( sc.changeId , sc.owner ) ; assertThat ( sender ) . sent ( "abandon" , sc ) . cc ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ABANDONED_CHANGES ) . noOneElse ( ) ; }
Source:
public void doClaSignupHook ( com.google.gerrit.reviewdb.client.Account account , com.google.gerrit.common.data.ContributorAgreement cla ) { if ( account != null ) { final java.util.List < java.lang.String > args = new java.util.ArrayList < > ( ) ; addArg ( args , "--submitter" , getDisplayName ( account ) ) ; addArg ( args , "--user-id" , account.getId ( ) . toString ( ) ) ; addArg ( args , "--cla-name" , cla.getName ( ) ) ; runHook ( claSignedHook , args ) ; } }

Target:
public void doClaSignupHook ( com.google.gerrit.reviewdb.client.Account account , java.lang.String claName ) { if ( ! ( claSignedHook.isPresent ( ) ) ) { return ; } if ( account != null ) { java.util.List < java.lang.String > args = new java.util.ArrayList < > ( ) ; addArg ( args , "--submitter" , getDisplayName ( account ) ) ; addArg ( args , "--user-id" , account.getId ( ) . toString ( ) ) ; addArg ( args , "--cla-name" , claName ) ; runHook ( claSignedHook , args ) ; } }
Source:
public static void createProject ( java.lang.String projectName , java.lang.String parent , java.lang.Boolean createEmptyCcommit , java.lang.Boolean permissionsOnly , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > asyncCallback ) { com.google.gerrit.client.projects.ProjectApi.ProjectInput input = com.google.gerrit.client.projects.ProjectApi.ProjectInput.create ( ) ; input.setName ( projectName ) ; input.setParent ( parent ) ; input.setPermissionsOnly ( permissionsOnly ) ; input.setCreateEmptyCommit ( createEmptyCcommit ) ; new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . id ( projectName ) . ifNoneMatch ( ) . put ( input , asyncCallback ) ; }

Target:
public static void createProject ( java.lang.String projectName , java.lang.String parent , java.lang.Boolean createEmptyCcommit , java.lang.Boolean permissionsOnly , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > cb ) { com.google.gerrit.client.projects.ProjectApi.ProjectInput input = com.google.gerrit.client.projects.ProjectApi.ProjectInput.create ( ) ; input.setName ( projectName ) ; input.setParent ( parent ) ; input.setPermissionsOnly ( permissionsOnly ) ; input.setCreateEmptyCommit ( createEmptyCcommit ) ; new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . id ( projectName ) . ifNoneMatch ( ) . put ( input , cb ) ; }
Source:
public static synchronized void setClockStep ( long clockStep , java.util.concurrent.TimeUnit clockStepUnit ) { com.google.common.base.Preconditions.checkState ( ( ( com.google.gerrit.testutil.TestTimeUtil.clockMs ) != null ) , "call resetWithClockStep first" ) ; com.google.gerrit.testutil.TestTimeUtil.clockStepMs = java.util.concurrent.TimeUnit.MILLISECONDS.convert ( clockStep , clockStepUnit ) ; org.joda.time.DateTimeUtils.setCurrentMillisProvider ( new org.joda.time.DateTimeUtils.MillisProvider ( ) { @ java.lang.Override public long getMillis ( ) { return com.google.gerrit.testutil.TestTimeUtil.clockMs.getAndAdd ( com.google.gerrit.testutil.TestTimeUtil.clockStepMs ) ; } } ) ; }

Target:
public long getCurrentTime ( ) { return com.google.gerrit.testutil.TestTimeUtil.clockMs.getAndAdd ( com.google.gerrit.testutil.TestTimeUtil.clockStepMs ) ; }
Source:
public synchronized void onGitReferenceUpdated ( com.googlesource.gerrit.plugins.supermanifest.Event event ) { if ( event.getProjectName ( ) . equals ( allProjectsName.get ( ) ) ) { if ( event.getRefName ( ) . equals ( "refs/meta/config" ) ) { updateConfiguration ( ) ; } return ; } try { update ( event.getProjectName ( ) , event.getRefName ( ) , true ) ; } catch ( java.lang.Exception e ) { } }

Target:
public synchronized void onGitReferenceUpdated ( com.googlesource.gerrit.plugins.supermanifest.Event event ) { if ( event.getProjectName ( ) . equals ( allProjectsName.get ( ) ) ) { if ( event.getRefName ( ) . equals ( "refs/meta/config" ) ) { try { updateConfiguration ( ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e ) { throw new java.lang.IllegalStateException ( e ) ; } } return ; } try { update ( event.getProjectName ( ) , event.getRefName ( ) , true ) ; } catch ( java.lang.Exception e ) { } }
Source:
public void assertHasPackFile ( com.google.gerrit.reviewdb.client.Project ... projects ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { for ( com.google.gerrit.reviewdb.client.Project.NameKey p : projects ) { com.google.common.truth.Truth.assert_ ( ) . withMessage ( ( ( "Project " + ( p.get ( ) ) ) + " has no pack files." ) ) . that ( getPackFiles ( p ) ) . isNotEmpty ( ) ; } }

Target:
public void assertHasPackFile ( com.google.gerrit.reviewdb.client.Project ... projects ) throws java.io.IOException , org.eclipse.jgit.errors.RepositoryNotFoundException { for ( com.google.gerrit.reviewdb.client.Project.NameKey p : projects ) { com.google.common.truth.Truth.assertWithMessage ( ( ( "Project " + ( p.get ( ) ) ) + " has no pack files." ) ) . that ( getPackFiles ( p ) ) . isNotEmpty ( ) ; } }
Source:
public void blockOwner ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.project.Util.DEVS , "refs/*" ) ; com.google.common.truth.Truth.assertThat ( user ( local , com.google.gerrit.server.project.Util.DEVS ) . isOwner ( ) ) . isFalse ( ) ; }

Target:
public void blockPushDraftsUnblockAdmin ( ) { com.google.gerrit.server.project.testing.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/drafts/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.ADMIN , "refs/drafts/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local ) ; com.google.gerrit.server.project.ProjectControl a = user ( local , "a" , com.google.gerrit.server.project.testing.Util.ADMIN ) ; assertBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , u ) ; assertNotBlocked ( com.google.gerrit.common.data.Permission.PUSH , "refs/drafts/refs/heads/master" , a ) ; }
Source:
private void doDeleteRefRights ( final java.util.HashSet < com.google.gerrit.reviewdb.RefRight.Key > refRightIds ) { if ( ! ( refRightIds.isEmpty ( ) ) ) { Util.PROJECT_SVC.deleteRight ( projectName , refRightIds , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.common.data.ProjectDetail > ( ) { @ java.lang.Override public void onSuccess ( final com.google.gerrit.common.data.ProjectDetail result ) { display ( result ) ; } } ) ; } }

Target:
private void doDeleteRefRights ( final java.util.HashSet < com.google.gerrit.reviewdb.RefRight.Key > refRightIds ) { if ( ! ( refRightIds.isEmpty ( ) ) ) { Util.PROJECT_SVC.deleteRight ( getProjectKey ( ) , refRightIds , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.common.data.ProjectDetail > ( ) { @ java.lang.Override public void onSuccess ( final com.google.gerrit.common.data.ProjectDetail result ) { display ( result ) ; } } ) ; } }
Source:
private static org.apache.lucene.search.Query or ( com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) throws com.google.gerrit.server.query.QueryParseException { try { org.apache.lucene.search.BooleanQuery q = new org.apache.lucene.search.BooleanQuery ( ) ; for ( int i = 0 ; i < ( p.getChildCount ( ) ) ; i ++ ) { q.add ( com.google.gerrit.lucene.QueryBuilder.toQuery ( p.getChild ( i ) ) , org.apache.lucene.search.BooleanClause.Occur.SHOULD ) ; } return q ; } catch ( org.apache.lucene.search.BooleanQuery e ) { throw new com.google.gerrit.server.query.QueryParseException ( ( "cannot create query for index: " + p ) , e ) ; } }

Target:
private static org.apache.lucene.search.Query or ( com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > schema , com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > p ) throws com.google.gerrit.server.query.QueryParseException { try { org.apache.lucene.search.BooleanQuery q = new org.apache.lucene.search.BooleanQuery ( ) ; for ( int i = 0 ; i < ( p.getChildCount ( ) ) ; i ++ ) { q.add ( com.google.gerrit.lucene.QueryBuilder.toQuery ( schema , p.getChild ( i ) ) , org.apache.lucene.search.BooleanClause.Occur.SHOULD ) ; } return q ; } catch ( org.apache.lucene.search.BooleanQuery e ) { throw new com.google.gerrit.server.query.QueryParseException ( ( "cannot create query for index: " + p ) , e ) ; } }
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 { return ( repo.getRef ( branch.get ( ) ) ) != null ; } 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.getRef ( branch.get ( ) ) ) != null ; if ( ! exists ) { exists = repo.getFullBranch ( ) . equals ( branch.get ( ) ) ; } return exists ; } finally { repo.close ( ) ; } }
Source:
private boolean isHttpTransformPatternrUndefined ( javax.servlet.FilterConfig config ) { return ( ( ( java.lang.System.getProperty ( com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GLOBAL_HTTP_TRANSFORM_PATTERN ) ) == null ) && ( ( config.getServletContext ( ) . getInitParameter ( com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GLOBAL_HTTP_TRANSFORM_PATTERN ) ) == null ) ) && ( ( config.getInitParameter ( com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.HTTP_TRANSFORM_PATTERN ) ) == null ) ; }

Target:
public void init ( javax.servlet.FilterConfig config ) throws javax.servlet.ServletException { if ( isPropertyUndefined ( config , com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.HTTP_TRANSFORM_PATTERN , com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GLOBAL_HTTP_TRANSFORM_PATTERN ) ) { java.lang.System.setProperty ( com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GLOBAL_HTTP_TRANSFORM_PATTERN , com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GERRIT_GROUPING ) ; } if ( isPropertyUndefined ( config , com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.STORAGE_DIR , com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GLOBAL_STORAGE_DIR ) ) { java.lang.System.setProperty ( com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.JavamelodyFilter.GLOBAL_STORAGE_DIR , getStorageDir ( ) ) ; } super . init ( config ) ; }
Source:
public void set ( java.lang.String key , com.google.gson.JsonObject event ) throws java.io.IOException { java.nio.file.Path replicationStatusPath = getReplicationStatusPath ( key ) ; java.nio.file.Files.write ( replicationStatusPath , event.toString ( ) . getBytes ( ) , java.nio.file.StandardOpenOption.TRUNCATE_EXISTING , java.nio.file.StandardOpenOption.CREATE , java.nio.file.StandardOpenOption.WRITE ) ; }

Target:
public void set ( com.google.gerrit.reviewdb.client.Project.NameKey projectKey , java.lang.String refKey , com.google.gson.JsonObject statusEvent ) throws java.io.IOException { java.nio.file.Path replicationStatusPath = getReplicationStatusPath ( ( ( ( projectKey.get ( ) ) + "/" ) + refKey ) ) ; java.nio.file.Files.write ( replicationStatusPath , statusEvent.toString ( ) . getBytes ( ) , java.nio.file.StandardOpenOption.TRUNCATE_EXISTING , java.nio.file.StandardOpenOption.CREATE , java.nio.file.StandardOpenOption.WRITE ) ; }
Source:
public com.google.gerrit.reviewdb.client.AuthType getAuthType ( ) { return authType ; }

Target:
public boolean siteHasUsernames ( ) { if ( ( ( ( authType ) == ( com.google.gerrit.reviewdb.client.AuthType.CUSTOM_EXTENSION ) ) && ( ( getHttpPasswordUrl ( ) ) != null ) ) && ( ! ( editableAccountFields.contains ( FieldName.USER_NAME ) ) ) ) { return false ; } return true ; }
Source:
private static boolean isUser ( com.googlecode.prolog_cafe.lang.Term who ) { return ( ( ( who.isStructure ( ) ) && ( ( who.arity ( ) ) == 1 ) ) && ( who.name ( ) . equals ( "user" ) ) ) && ( who.arg ( 0 ) . isInteger ( ) ) ; }

Target:
private static boolean isUser ( com.googlecode.prolog_cafe.lang.Term who ) { return ( ( ( who instanceof com.googlecode.prolog_cafe.lang.StructureTerm ) && ( ( who.arity ( ) ) == 1 ) ) && ( who.name ( ) . equals ( "user" ) ) ) && ( ( who.arg ( 0 ) ) instanceof com.googlecode.prolog_cafe.lang.IntegerTerm ) ; }
Source:
private void initCreateTxt ( ) { project = new com.google.gwtexpui.globalkey.client.NpTextBox ( ) ; project.setVisibleLength ( 50 ) ; project.addKeyPressHandler ( new com.google.gwt.event.dom.client.KeyPressHandler ( ) { @ java.lang.Override public void onKeyPress ( com.google.gwt.event.dom.client.KeyPressEvent event ) { if ( ( event.getNativeEvent ( ) . getKeyCode ( ) ) == ( com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER ) ) { doCreateProject ( ) ; } } } ) ; }

Target:
public void onBrowserEvent ( com.google.gwt.user.client.Event event ) { super . onBrowserEvent ( event ) ; if ( ( event.getTypeInt ( ) ) == ( com.google.gwt.user.client.Event.ONPASTE ) ) { com.google.gwt.core.client.Scheduler.get ( ) . scheduleDeferred ( new com.google.gwt.core.client.Scheduler.ScheduledCommand ( ) { @ java.lang.Override public void execute ( ) { if ( ( project.getValue ( ) . trim ( ) . length ( ) ) != 0 ) { create.setEnabled ( true ) ; } } } ) ; } }
Source:
public void onFailure ( java.lang.Throwable caught ) { com.google.gwt.core.client.GWT.log ( "myAccount failed" , caught ) ; }

Target:
public void onLoad ( ) { super . onLoad ( ) ; Util.ACCOUNT_SVC.myAccount ( new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.reviewdb.Account > ( ) { public void onSuccess ( com.google.gerrit.client.reviewdb.Account result ) { com.google.gwt.core.client.GWT.log ( ( "yay, i am " + ( result.getPreferredEmail ( ) ) ) , null ) ; com.google.gwt.core.client.GWT.log ( ( "created on " + ( result.getRegisteredOn ( ) ) ) , null ) ; } } ) ; }
Source:
public void run ( ) { unschedule ( e ) ; try { mergeImpl ( e.dest ) ; } finally { finish ( e.dest ) ; } }

Target:
private synchronized void recheck ( final com.google.gerrit.git.ChangeMergeQueue.RecheckJob e ) { final long remainingDelay = ( e.recheckAt ) - ( java.lang.System.currentTimeMillis ( ) ) ; if ( ( java.util.concurrent.TimeUnit.MILLISECONDS.convert ( 10 , java.util.concurrent.TimeUnit.SECONDS ) ) < remainingDelay ) { workQueue.getDefaultQueue ( ) . schedule ( e , remainingDelay , java.util.concurrent.TimeUnit.MILLISECONDS ) ; } else { schedule ( e.dest ) ; } }
Source:
public com.google.gerrit.extensions.registration.ReloadableRegistrationHandle < T > add ( com.google.inject.Key < T > key , T item ) { java.util.concurrent.atomic.AtomicReference < T > ref = new java.util.concurrent.atomic.AtomicReference < T > ( item ) ; items.add ( ref ) ; return new ReloadableHandle ( ref , key , item ) ; }

Target:
public com.google.gerrit.extensions.registration.ReloadableRegistrationHandle < T > add ( com.google.inject.Key < T > key , com.google.inject.Provider < T > item ) { java.util.concurrent.atomic.AtomicReference < com.google.inject.Provider < T > > ref = new java.util.concurrent.atomic.AtomicReference < com.google.inject.Provider < T > > ( item ) ; items.add ( ref ) ; return new ReloadableHandle ( ref , key , item ) ; }
Source:
public void run ( ) { com.google.codereview.Main.LOG.info ( "Shutting down thread pool." ) ; pool.shutdown ( ) ; boolean waiting = true ; do { try { waiting = pool.awaitTermination ( 10 , java.util.concurrent.TimeUnit.SECONDS ) ; } catch ( java.lang.InterruptedException ie ) { } } while ( waiting ) ; com.google.codereview.Main.LOG.info ( "Thread pool shutdown." ) ; org.apache.log4j.LogManager.shutdown ( ) ; }

Target:
public void run ( ) { com.google.codereview.Main.LOG.info ( "Shutting down thread pool." ) ; pool.shutdown ( ) ; boolean isTerminated ; do { try { isTerminated = pool.awaitTermination ( 10 , java.util.concurrent.TimeUnit.SECONDS ) ; } catch ( java.lang.InterruptedException ie ) { isTerminated = false ; } } while ( ! isTerminated ) ; com.google.codereview.Main.LOG.info ( "Thread pool shutdown." ) ; org.apache.log4j.LogManager.shutdown ( ) ; }
Source:
public java.util.Map < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey , java.util.Collection < com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType > > getProjectWatches ( com.google.gerrit.reviewdb.client.Account.Id accountId ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { try ( org.eclipse.jgit.lib.Repository git = repoManager.openRepository ( allUsersName ) ; com.google.gerrit.server.account.WatchConfig watchConfig = new com.google.gerrit.server.account.WatchConfig ( accountId ) ) { watchConfig.load ( git ) ; return watchConfig.getProjectWatches ( ) ; } }

Target:
public java.util.Map < com.google.gerrit.server.account.WatchConfig.ProjectWatchKey , java.util.Set < com.google.gerrit.server.account.WatchConfig.NotifyType > > getProjectWatches ( com.google.gerrit.reviewdb.client.Account.Id accountId ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { try ( org.eclipse.jgit.lib.Repository git = repoManager.openRepository ( allUsersName ) ) { com.google.gerrit.server.account.WatchConfig watchConfig = new com.google.gerrit.server.account.WatchConfig ( accountId ) ; watchConfig.load ( git ) ; return watchConfig.getProjectWatches ( ) ; } }
Source:
public boolean handles ( java.io.File srcFile ) { java.util.List < com.google.gerrit.server.plugins.ServerPluginProvider > providers = providersForHandlingPlugin ( srcFile ) ; switch ( providers.size ( ) ) { case 1 : return true ; case 0 : return false ; default : throw new com.google.gerrit.server.plugins.MultipleProvidersForPluginException ( srcFile , providers ) ; } }

Target:
public boolean handles ( java.nio.file.Path srcPath ) { java.util.List < com.google.gerrit.server.plugins.ServerPluginProvider > providers = providersForHandlingPlugin ( srcPath ) ; switch ( providers.size ( ) ) { case 1 : return true ; case 0 : return false ; default : throw new com.google.gerrit.server.plugins.MultipleProvidersForPluginException ( srcPath , providers ) ; } }
Source:
private java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.UUID > collectGroups ( org.eclipse.jgit.lib.ProgressMonitor progress ) throws com.google.gwtorm.server.OrmException { progress.beginTask ( "Collecting groups" , ProgressMonitor.UNKNOWN ) ; java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.UUID > uuids = new java.util.ArrayList < > ( ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { for ( com.google.gerrit.reviewdb.client.AccountGroup group : db.accountGroups ( ) . all ( ) ) { uuids.add ( group.getGroupUUID ( ) ) ; } } progress.endTask ( ) ; return uuids ; }

Target:
private java.util.List < com.google.gerrit.reviewdb.client.AccountGroup.UUID > collectGroups ( org.eclipse.jgit.lib.ProgressMonitor progress ) throws com.google.gwtorm.server.OrmException { progress.beginTask ( "Collecting groups" , ProgressMonitor.UNKNOWN ) ; try ( com.google.gerrit.reviewdb.server.ReviewDb db = schemaFactory.open ( ) ) { return groups.getAll ( db ) . map ( AccountGroup :: getGroupUUID ) . collect ( com.google.common.collect.ImmutableList.toImmutableList ( ) ) ; } finally { progress.endTask ( ) ; } }
Source:
com.google.gerrit.server.project.ChangeControl create ( com.google.gerrit.server.project.RefControl refControl , com.google.gerrit.server.notedb.ChangeNotes notes ) ;

Target:
public com.google.gerrit.server.project.ChangeControl validateFor ( com.google.gerrit.reviewdb.server.ReviewDb db , com.google.gerrit.server.notedb.ChangeNotes notes , com.google.gerrit.server.CurrentUser user ) throws com.google.gerrit.server.project.NoSuchChangeException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.project.ChangeControl c = controlFor ( notes , user ) ; if ( ! ( c.isVisible ( db ) ) ) { throw new com.google.gerrit.server.project.NoSuchChangeException ( c.getId ( ) ) ; } return c ; }
Source:
private com.google.gerrit.reviewdb.client.AccountGroup group ( java.lang.String name ) throws java.lang.Exception { com.google.gerrit.server.account.CreateGroupArgs args = new com.google.gerrit.server.account.CreateGroupArgs ( ) ; args.setGroupName ( name ( name ) ) ; args.initialMembers = java.util.Collections.singleton ( admin.getId ( ) ) ; return createGroupFactory.create ( args ) . createGroup ( ) ; }

Target:
private com.google.gerrit.reviewdb.client.AccountGroup group ( java.lang.String name ) throws java.lang.Exception { com.google.gerrit.server.group.GroupJson.GroupInfo group = createGroupFactory.create ( name ( name ) ) . apply ( TopLevelResource.INSTANCE , null ) ; com.google.gerrit.common.data.GroupDescription.Basic d = groups.parseInternal ( com.google.gerrit.extensions.restapi.Url.decode ( group.id ) ) ; return com.google.gerrit.common.data.GroupDescriptions.toAccountGroup ( d ) ; }
Source:
private com.google.gerrit.server.ssh.AbstractCommand create ( final java.lang.String cmd ) { final com.google.inject.Provider < ? extends com.google.gerrit.server.ssh.AbstractCommand > f = commands.get ( cmd ) ; if ( f != null ) { return f.get ( ) ; } return new com.google.gerrit.server.ssh.AbstractCommand ( ) { @ java.lang.Override protected void run ( ) throws com.google.gerrit.server.ssh.Failure { throw new com.google.gerrit.server.ssh.UnloggedFailure ( 127 , ( ( "gerrit: " + ( getName ( ) ) ) + ": not found" ) ) ; } } ; }

Target:
public void setErrorStream ( final java.io.OutputStream err ) { this . err = err ; }
Source:
protected void configure ( ) { factory ( LuceneChangeIndex.Factory.class ) ; install ( new com.google.gerrit.server.index.IndexModule ( threads ) ) ; if ( ( ( singleVersion ) == null ) && ( ( base ) == null ) ) { install ( new com.google.gerrit.lucene.LuceneIndexModule.MultiVersionModule ( ) ) ; } else { install ( new com.google.gerrit.lucene.LuceneIndexModule.SingleVersionModule ( ) ) ; } }

Target:
protected void configure ( ) { bind ( com.google.gerrit.server.index.IndexConfig.class ) . toInstance ( com.google.gerrit.server.index.IndexConfig.createDefault ( ) ) ; factory ( LuceneChangeIndex.Factory.class ) ; install ( new com.google.gerrit.server.index.IndexModule ( threads ) ) ; if ( ( ( singleVersion ) == null ) && ( ( base ) == null ) ) { install ( new com.google.gerrit.lucene.LuceneIndexModule.MultiVersionModule ( ) ) ; } else { install ( new com.google.gerrit.lucene.LuceneIndexModule.SingleVersionModule ( ) ) ; } }
Source:
protected void onShowView ( com.google.gerrit.client.ui.Screen view ) { final java.lang.String token = view.getToken ( ) ; if ( ! ( token.equals ( com.google.gwt.user.client.History.getToken ( ) ) ) ) { com.google.gwt.user.client.History.newItem ( token , false ) ; com.google.gerrit.client.Gerrit.dispatchHistoryHooks ( token ) ; } if ( view instanceof com.google.gerrit.client.changes.ChangeListScreen ) { com.google.gerrit.client.Gerrit.lastChangeListToken = token ; } super . onShowView ( view ) ; view.onShowView ( ) ; }

Target:
protected void onShowView ( com.google.gerrit.client.ui.Screen view ) { com.google.gerrit.client.Gerrit.lastViewToken = com.google.gwt.user.client.History.getToken ( ) ; java.lang.String token = view.getToken ( ) ; if ( ! ( token.equals ( com.google.gerrit.client.Gerrit.lastViewToken ) ) ) { com.google.gwt.user.client.History.newItem ( token , false ) ; com.google.gerrit.client.Gerrit.dispatchHistoryHooks ( token ) ; } if ( view instanceof com.google.gerrit.client.changes.ChangeListScreen ) { com.google.gerrit.client.Gerrit.lastChangeListToken = token ; } super . onShowView ( view ) ; view.onShowView ( ) ; }
Source:
public void addGpgKey ( ) throws java.lang.Exception { com.google.gerrit.server.git.gpg.TestKey key = com.google.gerrit.server.git.gpg.TestKey.key1 ( ) ; java.lang.String id = com.google.gerrit.server.git.gpg.PublicKeyStore.keyIdToString ( key.getKeyId ( ) ) ; addExternalIdEmail ( admin , "test1@example.com" ) ; com.google.gerrit.extensions.common.GpgKeyInfo info = gApi.accounts ( ) . self ( ) . putGpgKeys ( com.google.common.collect.ImmutableList.of ( key.getPublicKeyArmored ( ) ) ) . get ( id ) ; info.id = id ; com.google.gerrit.acceptance.api.accounts.AccountIT.assertKeyEquals ( key , info ) ; com.google.gerrit.acceptance.api.accounts.AccountIT.assertKeyEquals ( key , gApi.accounts ( ) . self ( ) . gpgKey ( id ) . get ( ) ) ; org.bouncycastle.openpgp.PGPPublicKey stored = getOnlyKeyFromStore ( key ) ; com.google.common.truth.Truth.assertThat ( stored.getFingerprint ( ) ) . isEqualTo ( key.getPublicKey ( ) . getFingerprint ( ) ) ; setApiUser ( user ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; exception.expectMessage ( id ) ; gApi.accounts ( ) . self ( ) . gpgKey ( id ) . get ( ) ; }

Target:
private static void assertKeyMapContains ( com.google.gerrit.server.git.gpg.TestKey expected , java.util.Map < java.lang.String , com.google.gerrit.extensions.common.GpgKeyInfo > actualMap ) { com.google.gerrit.extensions.common.GpgKeyInfo actual = actualMap.get ( expected.getKeyIdString ( ) ) ; com.google.common.truth.Truth.assertThat ( actual ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( actual.id ) . isNull ( ) ; actual.id = expected.getKeyIdString ( ) ; com.google.gerrit.acceptance.api.accounts.AccountIT.assertKeyEquals ( expected , actual ) ; }
Source:
private com.google.gitiles.doc.MarkdownToHtml treeReadme ( java.lang.String path ) { return readme ( com.google.gitiles.GitilesView.path ( ) . copyFrom ( view ) . setPathPart ( path ) . build ( ) ) ; }

Target:
private com.google.gitiles.doc.MarkdownToHtml treeReadme ( java.lang.String path ) { com.google.gitiles.GitilesView v = com.google.gitiles.GitilesView.path ( ) . copyFrom ( view ) . setPathPart ( path ) . build ( ) ; java.lang.String file = ( com.google.common.base.CharMatcher.is ( '/' ) . trimTrailingFrom ( path ) ) + "/README.md" ; return readme ( v , file ) ; }
Source:
public void testOwnerProject ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.OWNER , com.google.gerrit.server.project.Util.ADMIN , "refs/*" ) ; com.google.gerrit.server.project.ProjectControl uBlah = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl uAdmin = util.user ( local , com.google.gerrit.server.project.Util.DEVS , com.google.gerrit.server.project.Util.ADMIN ) ; org.junit.Assert.assertFalse ( "not owner" , uBlah.isOwner ( ) ) ; org.junit.Assert.assertTrue ( "is owner" , uAdmin.isOwner ( ) ) ; }

Target:
private void assertAdminsAreOwnersAndDevsAreNot ( ) { com.google.gerrit.server.project.ProjectControl uBlah = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; com.google.gerrit.server.project.ProjectControl uAdmin = util.user ( local , com.google.gerrit.server.project.Util.DEVS , com.google.gerrit.server.project.Util.ADMIN ) ; org.junit.Assert.assertFalse ( "not owner" , uBlah.isOwner ( ) ) ; org.junit.Assert.assertTrue ( "is owner" , uAdmin.isOwner ( ) ) ; }
Source:
static com.google.gerrit.extensions.client.GeneralPreferencesInfo readFromGit ( com.google.gerrit.server.git.GitRepositoryManager gitMgr , com.google.gerrit.server.account.GeneralPreferencesLoader loader , com.google.gerrit.server.config.AllUsersName allUsersName , com.google.gerrit.extensions.client.GeneralPreferencesInfo in ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException , org.eclipse.jgit.errors.RepositoryNotFoundException { try ( org.eclipse.jgit.lib.Repository git = gitMgr.openRepository ( allUsersName ) ) { com.google.gerrit.server.account.VersionedAccountPreferences p = com.google.gerrit.server.account.VersionedAccountPreferences.forDefault ( ) ; p.load ( git ) ; com.google.gerrit.extensions.client.GeneralPreferencesInfo r = com.google.gerrit.server.config.ConfigUtil.loadSection ( p.getConfig ( ) , UserConfigSections.GENERAL , null , new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) , com.google.gerrit.extensions.client.GeneralPreferencesInfo.defaults ( ) , in ) ; return loader.loadMyMenusAndUrlAliases ( r , p , null ) ; } }

Target:
public com.google.gerrit.extensions.client.GeneralPreferencesInfo apply ( com.google.gerrit.server.config.ConfigResource rsrc ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { try ( org.eclipse.jgit.lib.Repository git = gitMgr.openRepository ( allUsersName ) ) { return com.google.gerrit.server.account.PreferencesConfig.readDefaultPreferences ( git ) ; } }
Source:
public void merge ( java.lang.Iterable < com.google.gerrit.common.data.SubmitRecord > submitRecords ) { this . status = com.google.gerrit.reviewdb.client.PatchLineComment.Status.MERGED ; this . submitRecords = com.google.common.collect.ImmutableList.copyOf ( submitRecords ) ; com.google.common.base.Preconditions.checkArgument ( ( ! ( this . submitRecords.isEmpty ( ) ) ) , "no submit records specified at submit time" ) ; }

Target:
public void merge ( java.lang.String submissionId , java.lang.Iterable < com.google.gerrit.common.data.SubmitRecord > submitRecords ) { this . status = com.google.gerrit.reviewdb.client.PatchLineComment.Status.MERGED ; this . submissionId = submissionId ; this . submitRecords = com.google.common.collect.ImmutableList.copyOf ( submitRecords ) ; com.google.common.base.Preconditions.checkArgument ( ( ! ( this . submitRecords.isEmpty ( ) ) ) , "no submit records specified at submit time" ) ; }
Source:
private java.lang.String count ( long cnt ) { if ( cnt == 0 ) { return "" ; } return java.lang.String.format ( "%6d" , cnt ) ; }

Target:
private void printCache ( com.google.gerrit.server.config.ListCaches.CacheInfo cache ) { stdout.print ( java.lang.String.format ( ( ( "%1s %-" + ( nw ) ) + "s|%6s %6s %7s| %7s |%4s %4s|\n" ) , ( CacheType.DISK.equals ( cache.type ) ? "D" : "" ) , cache.name , com.google.gerrit.sshd.commands.ShowCaches.nullToEmpty ( cache.entries.mem ) , com.google.gerrit.sshd.commands.ShowCaches.nullToEmpty ( cache.entries.disk ) , com.google.common.base.Strings.nullToEmpty ( cache.entries.space ) , com.google.common.base.Strings.nullToEmpty ( cache.averageGet ) , com.google.gerrit.sshd.commands.ShowCaches.formatAsPercent ( cache.hitRatio.mem ) , com.google.gerrit.sshd.commands.ShowCaches.formatAsPercent ( cache.hitRatio.disk ) ) ) ; }
Source:
protected java.lang.String getNameFor ( final com.google.gerrit.client.reviewdb.Account.Id accountId ) { if ( accountId == null ) { return "Anonymous Coward" ; } final com.google.gerrit.client.reviewdb.Account userAccount = com.google.gerrit.client.rpc.Common.getAccountCache ( ) . get ( accountId ) ; if ( userAccount == null ) { return "Anonymous Coward #" + accountId ; } java.lang.String name = userAccount.getFullName ( ) ; if ( name == null ) { name = userAccount.getPreferredEmail ( ) ; } if ( name == null ) { name = "Anonymous Coward #" + accountId ; } return name ; }

Target:
protected java.lang.String getNameFor ( final com.google.gerrit.client.reviewdb.Account.Id accountId ) { if ( accountId == null ) { return "Anonymous Coward" ; } final com.google.gerrit.client.reviewdb.Account userAccount = accountCache.get ( accountId ) . getAccount ( ) ; java.lang.String name = userAccount.getFullName ( ) ; if ( name == null ) { name = userAccount.getPreferredEmail ( ) ; } if ( name == null ) { name = "Anonymous Coward #" + accountId ; } return name ; }
Source:
public void suggestReviewersChange ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > reviewers = suggestReviewers ( changeId , "u" , 6 ) ; com.google.common.truth.Truth.assertThat ( reviewers ) . hasSize ( 6 ) ; reviewers = suggestReviewers ( changeId , "u" , 5 ) ; com.google.common.truth.Truth.assertThat ( reviewers ) . hasSize ( 5 ) ; reviewers = suggestReviewers ( changeId , "users3" , 10 ) ; com.google.common.truth.Truth.assertThat ( reviewers ) . hasSize ( 1 ) ; }

Target:
public void suggestReviewersChange ( ) throws java.lang.Exception { java.lang.String changeId = createChange ( ) . getChangeId ( ) ; java.util.List < com.google.gerrit.extensions.common.SuggestedReviewerInfo > reviewers = suggestReviewers ( changeId , name ( "u" ) , 6 ) ; com.google.common.truth.Truth.assertThat ( reviewers ) . hasSize ( 6 ) ; reviewers = suggestReviewers ( changeId , name ( "u" ) , 5 ) ; com.google.common.truth.Truth.assertThat ( reviewers ) . hasSize ( 5 ) ; reviewers = suggestReviewers ( changeId , group3.getName ( ) , 10 ) ; com.google.common.truth.Truth.assertThat ( reviewers ) . hasSize ( 1 ) ; }
Source:
private static void injectCss ( com.google.gwt.resources.client.ExternalTextResource css ) { try { css.getText ( new com.google.gwt.resources.client.ResourceCallback < com.google.gwt.resources.client.TextResource > ( ) { @ java.lang.Override public void onSuccess ( com.google.gwt.resources.client.TextResource resource ) { com.google.gwt.dom.client.StyleInjector.inject ( resource.getText ( ) ) ; } @ java.lang.Override public void onError ( com.google.gwt.resources.client.ResourceException e ) { net.codemirror.lib.Loader.error ( e ) ; } } ) ; } catch ( com.google.gwt.resources.client.ResourceException e ) { net.codemirror.lib.Loader.error ( e ) ; } }

Target:
private static void injectCss ( com.google.gwt.resources.client.ExternalTextResource css , final com.google.gwt.user.client.rpc.AsyncCallback < java.lang.Void > cb ) { try { css.getText ( new com.google.gwt.resources.client.ResourceCallback < com.google.gwt.resources.client.TextResource > ( ) { @ java.lang.Override public void onSuccess ( com.google.gwt.resources.client.TextResource resource ) { com.google.gwt.dom.client.StyleInjector.inject ( resource.getText ( ) ) ; cb.onSuccess ( null ) ; } @ java.lang.Override public void onError ( com.google.gwt.resources.client.ResourceException e ) { cb.onFailure ( e ) ; } } ) ; } catch ( com.google.gwt.resources.client.ResourceException e ) { cb.onFailure ( e ) ; } }
Source:
private boolean can ( com.google.gerrit.server.permissions.LabelPermission.WithValue perm ) { return label ( perm.permissionName ( ) . get ( ) ) . contains ( perm.value ( ) ) ; }

Target:
private boolean can ( com.google.gerrit.server.permissions.LabelPermission.WithValue perm ) { com.google.gerrit.common.data.PermissionRange r = label ( perm.permissionName ( ) . get ( ) ) ; if ( ( ( perm.forUser ( ) ) == ( com.google.gerrit.server.permissions.LabelPermission.ForUser.ON_BEHALF_OF ) ) && ( r.isEmpty ( ) ) ) { return false ; } return r.contains ( perm.value ( ) ) ; }
Source:
public void duplicatePatchSetRevisions ( ) throws java.lang.Exception { com.google.gerrit.server.notedb.ChangeNotes notes = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps1 = psUtil.current ( db , notes ) ; java.lang.String rev = ps1.getRevision ( ) . get ( ) ; notes = incrementPatchSet ( notes , testRepo.getRevWalk ( ) . parseCommit ( org.eclipse.jgit.lib.ObjectId.fromString ( rev ) ) ) ; assertProblems ( notes , null , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( ( "Multiple patch sets pointing to " + rev ) + ": [1, 2]" ) ) ) ; }

Target:
public void duplicatePatchSetRevisions ( ) throws java.lang.Exception { com.google.gerrit.server.notedb.ChangeNotes notes = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps1 = psUtil.current ( db , notes ) ; java.lang.String rev = ps1.getRevision ( ) . get ( ) ; notes = incrementPatchSet ( notes , serverSideTestRepo.getRevWalk ( ) . parseCommit ( org.eclipse.jgit.lib.ObjectId.fromString ( rev ) ) ) ; assertProblems ( notes , null , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( ( "Multiple patch sets pointing to " + rev ) + ": [1, 2]" ) ) ) ; }
Source:
public boolean isAssignee ( ) { com.google.gerrit.reviewdb.client.Account.Id currentAssignee = notes.getAssignee ( ) ; if ( ( currentAssignee != null ) && ( getUser ( ) . isIdentifiedUser ( ) ) ) { com.google.gerrit.reviewdb.client.Account.Id id = getUser ( ) . getAccountId ( ) ; return id.equals ( currentAssignee ) ; } return false ; }

Target:
public boolean isAssignee ( ) { com.google.common.base.Optional < com.google.gerrit.reviewdb.client.Account.Id > currentAssignee = notes.getAssignee ( ) ; if ( ( currentAssignee.isPresent ( ) ) && ( getUser ( ) . isIdentifiedUser ( ) ) ) { com.google.gerrit.reviewdb.client.Account.Id id = getUser ( ) . getAccountId ( ) ; return id.equals ( currentAssignee.get ( ) ) ; } return false ; }
Source:
public com.google.gerrit.server.plugins.PluginEntry apply ( java.util.jar.JarEntry jarEntry ) { try { return resourceOf ( jarEntry ) ; } catch ( java.io.IOException e ) { throw new java.lang.IllegalArgumentException ( ( ( "Cannot convert jar entry " + jarEntry ) + " to a resource" ) , e ) ; } }

Target:
public java.util.Enumeration < com.google.gerrit.server.plugins.PluginEntry > entries ( ) { return java.util.Collections.enumeration ( com.google.common.collect.Lists.transform ( java.util.Collections.list ( jarFile.entries ( ) ) , ( jarEntry ) -> { try { return resourceOf ( jarEntry ) ; } catch ( java.io.IOException e ) { throw new java.lang.IllegalArgumentException ( ( ( "Cannot convert jar entry " + jarEntry ) + " to a resource" ) , e ) ; } } ) ) ; }