auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<SessionDataDto> getAllWithMetaData(int start, int length) { <START> System.out.println(start + " - " + length); <END> @SuppressWarnings("unchecked") List<SessionData> sessionDataList = (List<SessionData>) entityManager.createQuery("select sd from SessionData as sd order by sd.startTime asc").setFirstResult(start).setMaxResults(length).getResultList(); if (sessionDataList.isEmpty()) { return Collections.EMPTY_LIST; } Map<Long, String> userCommentMap = Collections.EMPTY_MAP; List<Object[]> userComments = entityManager.createQuery( "select smd.sessionData.id, smd.userComment from SessionMetaDataEntity as smd where smd.sessionData in (:sessionDataList)") .setParameter("sessionDataList", sessionDataList) .getResultList(); if (!userComments.isEmpty()) { userCommentMap = new HashMap<Long, String>(userComments.size()); for (Object[] objects : userComments) { userCommentMap.put((Long)objects[0], (String)objects[1]); } } List<SessionDataDto> sessionDataDtoList = new ArrayList<SessionDataDto>(sessionDataList.size()); for (SessionData sessionData : sessionDataList) { sessionDataDtoList.add(new SessionDataDto( sessionData.getId(), sessionData.getSessionId(), dateFormatter.format(sessionData.getStartTime()), dateFormatter.format(sessionData.getEndTime()), sessionData.getActiveKernels(), sessionData.getTaskExecuted(), sessionData.getTaskFailed(), HTMLFormatter.format(sessionData.getComment()), userCommentMap.get(sessionData.getId())) ); } return sessionDataDtoList; }</code><technical_language>do need it</technical_language>

Target:
private List<SessionDataDto> getAllWithMetaData(int start, int length) { @SuppressWarnings("unchecked") List<SessionData> sessionDataList = (List<SessionData>) entityManager.createQuery("select sd from SessionData as sd order by sd.startTime asc").setFirstResult(start).setMaxResults(length).getResultList(); if (sessionDataList.isEmpty()) { return Collections.EMPTY_LIST; } Map<Long, String> userCommentMap = Collections.EMPTY_MAP; List<Object[]> userComments = entityManager.createQuery( "select smd.sessionData.id, smd.userComment from SessionMetaDataEntity as smd where smd.sessionData in (:sessionDataList)") .setParameter("sessionDataList", sessionDataList) .getResultList(); if (!userComments.isEmpty()) { userCommentMap = new HashMap<Long, String>(userComments.size()); for (Object[] objects : userComments) { userCommentMap.put((Long)objects[0], (String)objects[1]); } } List<SessionDataDto> sessionDataDtoList = new ArrayList<SessionDataDto>(sessionDataList.size()); for (SessionData sessionData : sessionDataList) { sessionDataDtoList.add(createSessionDataDto(sessionData, userCommentMap.get(sessionData.getId()))); } return sessionDataDtoList; }
Source:
<code>public final void render(float delta) { <START> Gdx.gl.glClearColor(0, 132 / 255f, 197 / 255f, 1); <END> Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); cBatch.begin(); cBatch.draw(cBackground, 0, 0); cBatch.end(); cStage.act(); cStage.draw(); }</code><technical_language>magic numbers..</technical_language>

Target:
public void render(float delta) { final float red = 0f; final float green = 132 / 255f; final float blue = 197 / 255f; final float alpha = 0f; Gdx.gl.glClearColor(red, green, blue, alpha); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); cBatch.begin(); cBatch.draw(cBackground, 0, 0); cBatch.end(); cStage.act(); cStage.draw(); }
Source:
<code>public void setUp() throws Exception { super.setUp(); TestUtil.createTable(con, "updateable", "id int primary key, name text, notselected text, ts timestamp with time zone, intarr int[]"); TestUtil.createTable(con, "second", "id1 int primary key, name1 text"); TestUtil.createTable(con, "serialtable", "gen_id serial primary key, name text"); <START> TestUtil.createTable(con, "compositepktable", "gen_id serial, dec_id serial, name text"); <END> TestUtil.execute( "alter sequence compositepktable_dec_id_seq increment by 10; alter sequence compositepktable_dec_id_seq restart with 10", con); TestUtil.execute( "alter table compositepktable add primary key ( gen_id, dec_id )", con); TestUtil.createTable(con, "stream", "id int primary key, asi text, chr text, bin bytea"); TestUtil.createTable(con, "multicol", "id1 int not null, id2 int not null, val text"); TestUtil.createTable(con, "booltable", "id int not null primary key, b boolean default false"); TestUtil.execute( "insert into booltable (id) values (1)", con); Statement st2 = con.createStatement(); st2.execute("ALTER TABLE multicol ADD CONSTRAINT multicol_pk PRIMARY KEY (id1, id2)"); st2.execute("insert into second values (1,'anyvalue' )"); st2.close(); }</code><technical_language>put name column pk's together</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); TestUtil.createTable(con, "updateable", "id int primary key, name text, notselected text, ts timestamp with time zone, intarr int[]"); TestUtil.createTable(con, "second", "id1 int primary key, name1 text"); TestUtil.createTable(con, "serialtable", "gen_id serial primary key, name text"); TestUtil.createTable(con, "compositepktable", "gen_id serial, name text, dec_id serial"); TestUtil.execute( "alter sequence compositepktable_dec_id_seq increment by 10; alter sequence compositepktable_dec_id_seq restart with 10", con); TestUtil.execute( "alter table compositepktable add primary key ( gen_id, dec_id )", con); TestUtil.createTable(con, "stream", "id int primary key, asi text, chr text, bin bytea"); TestUtil.createTable(con, "multicol", "id1 int not null, id2 int not null, val text"); TestUtil.createTable(con, "booltable", "id int not null primary key, b boolean default false"); TestUtil.execute( "insert into booltable (id) values (1)", con); Statement st2 = con.createStatement(); st2.execute("ALTER TABLE multicol ADD CONSTRAINT multicol_pk PRIMARY KEY (id1, id2)"); st2.execute("insert into second values (1,'anyvalue' )"); st2.close(); }
Source:
<code>private void excludeSingleTag(PostDiscoveryFilter filter) { <START> assertTrue(filter.apply(classWithTag1).excluded()); assertTrue(filter.apply(classWithTag1AndSurroundingWhitespace).excluded()); assertTrue(filter.apply(classWithBothTags).excluded()); assertThat(filter.apply(classWithTag1).getReason().get()).contains( "Test excluded Because it contains tags: [tag1]"); assertThat(filter.apply(classWithTag1AndSurroundingWhitespace).getReason().get()).contains( "Test excluded Because it contains tags: [tag1]"); assertThat(filter.apply(classWithBothTags).getReason().get()).contains( "Test excluded Because it contains tags: [tag1,tag2]"); <END> assertTrue(filter.apply(classWithTag2).included()); assertTrue(filter.apply(classWithDifferentTags).included()); assertTrue(filter.apply(classWithNoTags).included()); assertThat(filter.apply(classWithTag2).getReason().get()).contains( "Test included Because it contains tags: [tag2]"); assertThat(filter.apply(classWithDifferentTags).getReason().get()).contains( "Test included Because it contains tags: [foo,bar]"); assertThat(filter.apply(classWithNoTags).getReason().get()).contains( "Test included Because it contains tags: []"); }</code><technical_language>a bit more readable, regroup exclusion/reason assertions a method assertExcluded(FilterResult filterResult, String reason) call assertExcluded(filter.apply(...), "reason")... (and assertIncluded counterpart for inclusions)</technical_language>

Target:
private void excludeSingleTag(PostDiscoveryFilter filter) { assertTrue(filter.apply(classWithTag1).excluded()); assertTrue(filter.apply(classWithTag1AndSurroundingWhitespace).excluded()); assertTrue(filter.apply(classWithBothTags).excluded()); assertReason(filter.apply(classWithTag1), "Test excluded Because it satisfy expression(s): [tag1]"); assertReason(filter.apply(classWithTag1AndSurroundingWhitespace), "Test excluded Because it satisfy expression(s): [tag1]"); assertReason(filter.apply(classWithBothTags), "Test excluded Because it satisfy expression(s): [tag1]"); assertTrue(filter.apply(classWithTag2).included()); assertTrue(filter.apply(classWithDifferentTags).included()); assertTrue(filter.apply(classWithNoTags).included()); assertReason(filter.apply(classWithTag2), "Test included Because it does not satisfy expression(s): [tag1]"); assertReason(filter.apply(classWithDifferentTags), "Test included Because it does not satisfy expression(s): [tag1]"); assertReason(filter.apply(classWithNoTags), "Test included Because it does not satisfy expression(s): [tag1]"); }
Source:
<code>private void execute(IExecution<DB> execution, boolean asTransaction) { query( db -> { execution.execute(db); <START> return Optional.empty(); <END> }, asTransaction ); }</code><technical_language>suggestion return null; Nitpick: returning null works, is slightly simpler</technical_language>

Target:
private void execute(IExecution<DB> execution, boolean asTransaction) { query( db -> { execution.execute(db); return null; }, asTransaction ); }
Source:
<code>private Agency findOrCreateAuthority(Line line) { String groupRef = line.getRepresentedByGroupRef().getRef(); Network network = netexIndex.lookupNetworkForLine(groupRef); if(network != null) { String orgRef = network.getTransportOrganisationRef().getValue().getRef(); Agency agency = agenciesById.get(orgRef); if(agency != null) return agency; } LOG.warn("No authority found for " + line.getId()); <START> Agency agency = agenciesById.get(authorityMapper.dummyAgencyId()); <END> if (agency == null) { agency = authorityMapper.createDummyAgency(); agenciesById.add(agency); } return agency; }</code><technical_language>Normalize terminology: dummy vs. default agency. Clarify this is for missing agencies (not in input data)</technical_language>

Target:
private Agency findOrCreateAuthority(Line line) { String groupRef = line.getRepresentedByGroupRef().getRef(); Network network = netexIndex.lookupNetworkForLine(groupRef); if(network != null) { String orgRef = network.getTransportOrganisationRef().getValue().getRef(); Agency agency = agenciesById.get(orgRef); if(agency != null) return agency; } return createOrGetDummyAgency(line); }
Source:
<code>public void testPredicate() throws Exception { MockWebServer server = mockWebServer(); byte[] payloadInProcess = payloadFromResource("/datacenter/datacenter-state-inprocess.xml"); byte[] payloadAvailable = payloadFromResource("/datacenter/datacenter-state.xml"); server.enqueue(new MockResponse().setBody(payloadInProcess)); server.enqueue(new MockResponse().setBody(payloadInProcess)); server.enqueue(new MockResponse().setBody(payloadInProcess)); server.enqueue(new MockResponse().setBody(payloadAvailable)); server.enqueue(new MockResponse().setBody(payloadAvailable)); ProfitBricksApi pbApi = api(server.getUrl(rootUrl)); Predicate<String> waitUntilAvailable = Predicates2.retry( new ProvisioningStatusPollingPredicate(pbApi, ProvisioningStatusAware.DATACENTER, ProvisioningState.AVAILABLE), 30l, 1l, TimeUnit.SECONDS); String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"; try { waitUntilAvailable.apply(id); ProvisioningState finalState = pbApi.dataCenterApi().getDataCenterState(id); <START> assertEquals(finalState, ProvisioningState.AVAILABLE); <END> } finally { pbApi.close(); server.shutdown(); } }</code><technical_language>verify requests made</technical_language>

Target:
public void testPredicate() throws Exception { MockWebServer server = mockWebServer(); byte[] payloadInProcess = payloadFromResource("/datacenter/datacenter-state-inprocess.xml"); byte[] payloadAvailable = payloadFromResource("/datacenter/datacenter-state.xml"); server.enqueue(new MockResponse().setBody(payloadInProcess)); server.enqueue(new MockResponse().setBody(payloadInProcess)); server.enqueue(new MockResponse().setBody(payloadInProcess)); server.enqueue(new MockResponse().setBody(payloadAvailable)); server.enqueue(new MockResponse().setBody(payloadAvailable)); ProfitBricksApi pbApi = api(server.getUrl(rootUrl)); Predicate<String> waitUntilAvailable = Predicates2.retry( new ProvisioningStatusPollingPredicate(pbApi, ProvisioningStatusAware.DATACENTER, ProvisioningState.AVAILABLE), 30l, 1l, TimeUnit.SECONDS); String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"; try { waitUntilAvailable.apply(id); ProvisioningState finalState = pbApi.dataCenterApi().getDataCenterState(id); assertRequestHasCommonProperties(server.takeRequest()); assertEquals(finalState, ProvisioningState.AVAILABLE); } finally { pbApi.close(); server.shutdown(); } }
Source:
<code>private Value(DoubleAdder count, DoubleAdder sum, List<Double> quantiles, TimeWindowQuantiles quantileValues) { this.count = count.sum(); this.sum = sum.sum(); <START> this.min = quantileValues == null ? Double.NaN : quantileValues.getMin(); <END> this.max = quantileValues == null ? Double.NaN : quantileValues.getMax(); this.quantiles = Collections.unmodifiableSortedMap(snapshot(quantiles, quantileValues)); }</code><technical_language>This is anti-pattern in Prometheus monitoring, exposing these, invalid output. Please remove them</technical_language>

Target:
private Value(DoubleAdder count, DoubleAdder sum, List<Double> quantiles, TimeWindowQuantiles quantileValues) { this.count = count.sum(); this.sum = sum.sum(); this.quantiles = Collections.unmodifiableSortedMap(snapshot(quantiles, quantileValues)); }
Source:
<code>public void start() { IResourceRegistry registry = new ResourceRegistry(); OseeTemplateTokens.register(registry); singletons.add(new AgileEndpointImpl(atsServer)); singletons.add(new AgileTeamEndpointImpl(atsServer)); singletons.add(new VersionResource(atsServer)); singletons.add(new TeamResource(atsServer)); singletons.add(new ProgramResource(atsServer)); singletons.add(new ActionableItemResource(atsServer)); singletons.add(new ActionResource(atsServer, orcsApi)); singletons.add(new StateResource(atsServer)); singletons.add(new ConvertResource(atsServer)); singletons.add(new CpaResource(orcsApi, atsServer, cpaRegistry)); singletons.add(new UserResource(atsServer.getUserService())); singletons.add(new AtsEndpointImpl(atsServer, logger, registry, cpaRegistry)); singletons.add(new ActionUiResource(atsServer, logger)); <START> logger.info("ATS - Application started - %s", System.getProperty("OseeApplicationServer")); <END> }</code><technical_language>This logger line needs removed - OseeApplicationServer null - a client-side property</technical_language>

Target:
public void start() { IResourceRegistry registry = new ResourceRegistry(); OseeTemplateTokens.register(registry); singletons.add(new AgileEndpointImpl(atsServer)); singletons.add(new AgileTeamEndpointImpl(atsServer)); singletons.add(new VersionResource(atsServer)); singletons.add(new TeamResource(atsServer)); singletons.add(new ProgramResource(atsServer)); singletons.add(new ActionableItemResource(atsServer)); singletons.add(new ActionResource(atsServer, orcsApi)); singletons.add(new StateResource(atsServer)); singletons.add(new ConvertResource(atsServer)); singletons.add(new CpaResource(orcsApi, atsServer, cpaRegistry)); singletons.add(new UserResource(atsServer.getUserService())); singletons.add(new AtsEndpointImpl(atsServer, logger, registry, cpaRegistry)); singletons.add(new ActionUiResource(atsServer, logger)); }
Source:
<code>private void releaseSegment(int segmentId){ activeSegments.remove(segmentId); if (segmentsToRelease.contains(segmentId)){ <START> doSleepFor(DEFAULT_BACKOFF_TIME_MILLIS * 2); <END> segmentsToRelease.remove(segmentId); } }</code><technical_language>Instead of a sleep here, attach a timeout blacklisted segments? allow this thread immediately a Launcher thread. is another segment this thread grab. blacklist need a map, is timestamp released. if a segment is in map, current time is of entry, blacklisted. Otherwise, remove entry</technical_language>

Target:
public void releaseSegment(int segmentId) { releaseSegment(segmentId, tokenClaimInterval * 2, MILLISECONDS); }
Source:
<code>public static void addPrettyPathToModel(FileModel fileModel, GraphContext context) { if (fileModel == null) { return; } ArrayList<String> types = fileModel.asVertex().getProperty(WindupVertexFrame.TYPE_PROP); if (types.contains(JavaClassFileModel.TYPE)) { JavaClassFileModel jcfm = ((JavaClassFileModel) fileModel); jcfm.setCachedPrettyPath(jcfm.getPrettyPathWithinProject(true)); } else if (types.contains(JavaSourceFileModel.TYPE)) { JavaSourceFileModel jsfm = context.getFramed().frame(fileModel.asVertex(), JavaSourceFileModel.class); <START> jsfm.setCachedPrettyPath(jsfm.getPrettyPathWithinProject(true)); <END> } else if (types.contains(ReportResourceFileModel.TYPE)) { ReportResourceFileModel rrfm = (ReportResourceFileModel)fileModel; rrfm.setCachedPrettyPath(rrfm.getPrettyPathWithinProject(false)); } else { fileModel.setCachedPrettyPath(fileModel.getPrettyPathWithinProject(false)); } }</code><technical_language>@klinki - I send a PR a fix. :)</technical_language>

Target:
public static void addPrettyPathToModel(FileModel fileModel, GraphContext context) { if (fileModel == null) { return; } ArrayList<String> types = fileModel.asVertex().getProperty(WindupVertexFrame.TYPE_PROP); if (types.contains(JavaClassFileModel.TYPE)) { JavaClassFileModel jcfm = ((JavaClassFileModel) fileModel); jcfm.setCachedPrettyPath(jcfm.getPrettyPathWithinProject(true)); } else if (types.contains(JavaSourceFileModel.TYPE)) { JavaSourceFileModel jsfm = ((JavaSourceFileModel)fileModel); jsfm.setCachedPrettyPath(jsfm.getPrettyPathWithinProject(true)); } else if (types.contains(ReportResourceFileModel.TYPE)) { ReportResourceFileModel rrfm = (ReportResourceFileModel)fileModel; rrfm.setCachedPrettyPath(rrfm.getPrettyPathWithinProject(false)); } else { fileModel.setCachedPrettyPath(fileModel.getPrettyPathWithinProject(false)); } }
Source:
<code>public void before() throws Throwable { try (Connection connection = DriverManager.getConnection(pgUrl, pgUser, "")) { try(Statement statement = connection.createStatement()){ statement.execute("DROP TABLE IF EXISTS ordered_entry_index"); <START> statement.execute("CREATE TABLE ordered_entry_index (SERIAL_NUMBER INTEGER PRIMARY KEY, ENTRY JSONB, leaf_input varchar)"); <END> statement.execute("DROP TABLE IF EXISTS total_entries"); statement.execute("CREATE TABLE IF NOT EXISTS total_entries (count INTEGER, last_updated TIMESTAMP WITHOUT TIME ZONE DEFAULT now())"); statement.execute("INSERT INTO TOTAL_ENTRIES(COUNT) VALUES(0)"); statement.execute("DROP TABLE IF EXISTS CURRENT_KEYS"); statement.execute("CREATE TABLE CURRENT_KEYS (SERIAL_NUMBER INTEGER PRIMARY KEY, KEY VARCHAR UNIQUE)"); statement.execute("DROP TABLE IF EXISTS TOTAL_RECORDS"); statement.execute("CREATE TABLE TOTAL_RECORDS (COUNT INTEGER)"); statement.execute("INSERT INTO TOTAL_RECORDS(COUNT) VALUES(0)"); } } }</code><technical_language>is leaf_input included in list of columns? removed</technical_language>

Target:
public void before() throws Throwable { try (Connection connection = DriverManager.getConnection(pgUrl, pgUser, "")) { try(Statement statement = connection.createStatement()){ statement.execute("DROP TABLE IF EXISTS ordered_entry_index"); statement.execute("CREATE TABLE ordered_entry_index (SERIAL_NUMBER INTEGER PRIMARY KEY, ENTRY JSONB)"); statement.execute("DROP TABLE IF EXISTS total_entries"); statement.execute("CREATE TABLE IF NOT EXISTS total_entries (count INTEGER, last_updated TIMESTAMP WITHOUT TIME ZONE DEFAULT now())"); statement.execute("INSERT INTO TOTAL_ENTRIES(COUNT) VALUES(0)"); statement.execute("DROP TABLE IF EXISTS CURRENT_KEYS"); statement.execute("CREATE TABLE CURRENT_KEYS (SERIAL_NUMBER INTEGER PRIMARY KEY, KEY VARCHAR UNIQUE)"); statement.execute("DROP TABLE IF EXISTS TOTAL_RECORDS"); statement.execute("CREATE TABLE TOTAL_RECORDS (COUNT INTEGER)"); statement.execute("INSERT INTO TOTAL_RECORDS(COUNT) VALUES(0)"); } } }
Source:
<code>public final boolean incrementToken() throws IOException { if (state != null) { restoreState(state); if (toCyrillic.length() > 0) { replayTerm(toCyrillic); if (toLatin.length() == 0) { state = null; } return true; } if (toLatin.length() > 0) { replayTerm(toLatin); state = null; return true; } <START> assert false; <END> } if (!input.incrementToken()) { return false; } boolean matchesCyrillicAndLatin = hasChars(LATIN_REG) && hasChars(CYR_REG); if (matchesCyrillicAndLatin) { toCyrillic.setLength(0); toCyrillic.append(termAtt); translationTable.replaceLatinToCyrillic(toCyrillic); toLatin.setLength(0); toLatin.append(termAtt); translationTable.replaceCyrillicToLatin(toLatin); if (!LATIN_REG.matcher(toCyrillic).find()) { state = captureState(); } else { toCyrillic.setLength(0); } if (!CYR_REG.matcher(toLatin).find()) { if (state == null) { state = captureState(); } } else { toLatin.setLength(0); } } return true; }</code><technical_language>"assert false" fail. I expect this is this is a state reached. If case, throwing a more explicit IllegalStateException, a message, easier debug in case breaks</technical_language>

Target:
public final boolean incrementToken() throws IOException, IllegalStateException { if (state != null) { restoreState(state); if (scriptOne.length() > 0) { replayTerm(scriptOne); if (scriptTwo.length() == 0) { state = null; } return true; } if (scriptTwo.length() > 0) { replayTerm(scriptTwo); state = null; return true; } throw new IllegalStateException(); } if (!input.incrementToken()) { return false; } boolean matchesBothScripts = hasChars(TranslationTableDictionaries.LATIN_REG) && hasChars(TranslationTableDictionaries.CYR_REG); if (matchesBothScripts) { scriptOne.setLength(0); scriptOne.append(termAtt); translationTable.replaceScriptOne(scriptOne); scriptTwo.setLength(0); scriptTwo.append(termAtt); translationTable.replaceScriptTwo(scriptTwo); if (!TranslationTableDictionaries.LATIN_REG.matcher(scriptOne).find()) { state = captureState(); } else { scriptOne.setLength(0); } if (!TranslationTableDictionaries.CYR_REG.matcher(scriptTwo).find()) { if (state == null) { state = captureState(); } } else { scriptTwo.setLength(0); } } return true; }
Source:
<code>public void testMethodsOnClassNoViolationsChecked() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ClassMemberImpliedModifierCheck.class); checkConfig.addAttribute("violateImpliedStaticOnNestedEnum", "false"); checkConfig.addAttribute("violateImpliedStaticOnNestedInterface", "false"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; <START> verify(checkConfig, getPath("InputClassMemberImpliedModifierOnClass.java"), <END> expected); }</code><technical_language>Please do reused input file in test methods. for demanding</technical_language>

Target:
public void testMethodsOnClassNoViolationsChecked() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ClassMemberImpliedModifierCheck.class); checkConfig.addAttribute("violateImpliedStaticOnNestedEnum", "false"); checkConfig.addAttribute("violateImpliedStaticOnNestedInterface", "false"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputClassMemberImpliedModifierOnClassNoViolations.java"), expected); }
Source:
<code>public StatusCheckerResult postExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { errors = new ArrayList(); UserInfo postUserInfo = new UserInfo(device); CLog.d("postExecutionUsers=" + postUserInfo.format()); for (Integer preUser : preUserInfo.users) { if (!postUserInfo.runningUsers.containsKey(preUser)) { <START> errors.add("User " + preUser + " no longer exists after test"); <END> } } for (Integer postUser : postUserInfo.users) { if (!preUserInfo.runningUsers.containsKey(postUser)) { errors.add("User " + postUser + " was created during the test and not deleted"); } } if (preUserInfo.currentUser != postUserInfo.currentUser) { errors.add( "User " + preUserInfo.currentUser + " was the currentUser before, has changed to " + postUserInfo.currentUser); } for (Integer user : preUserInfo.users) { Boolean preUserRunning = preUserInfo.runningUsers.get(user); Boolean postUserRunning = postUserInfo.runningUsers.get(user); if (postUserRunning == null) { continue; } if (preUserRunning != postUserRunning) { errors.add( "User " + user + " was " + formatRunning(preUserRunning) + ", has changed to " + formatRunning(postUserRunning)); } } if (errors.size() > 0) { CLog.w("UserInfo has changed: " + String.join("; ", errors)); } if (!isTesting) { errors = null; } return new StatusCheckerResult(CheckStatus.SUCCESS); }</code><technical_language>adding errors instead of logging directly</technical_language>

Target:
public StatusCheckerResult postExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { errors = new ArrayList(); DeviceUserState postDeviceUserState = new DeviceUserState(device); CLog.d("postExecutionUsers=" + postDeviceUserState.toString()); ArrayList<Integer> removedUsers = mPreDeviceUserState.findRemovedUsers(postDeviceUserState); ArrayList<Integer> addedUsers = mPreDeviceUserState.findAddedUsers(postDeviceUserState); boolean currentUserChanged = mPreDeviceUserState.currentUserChanged(postDeviceUserState); ArrayList<UserRunningChanged> changedRunningUsers = mPreDeviceUserState.findRunningChanged(postDeviceUserState); for (Integer removedUser : removedUsers) { errors.add("User " + removedUser + " no longer exists after test"); } for (Integer addedUser : addedUsers) { errors.add("User " + addedUser + " was created during the test and not deleted"); } if (currentUserChanged) { errors.add( "User " + mPreDeviceUserState.currentUser + " was the currentUser before, has changed to " + postDeviceUserState.currentUser); } for (UserRunningChanged changedRunningUser : changedRunningUsers) { boolean wasRunning = changedRunningUser.wasRunning; errors.add( "User " + changedRunningUser.userID + " was " + formatRunning(wasRunning) + ", has changed to " + formatRunning(!wasRunning)); } if (errors.size() > 0) { CLog.w("DeviceUserState has changed: " + String.join("; ", errors)); } if (!isTesting) { errors = null; } return new StatusCheckerResult(CheckStatus.SUCCESS); }
Source:
<code>public Map<String, Serializable> extractVariables(TaskContext taskContext, TaskResult taskResult, boolean useTaskVariables) throws IOException, ClassNotFoundException { Map<String, Serializable> variables = new HashMap<>(); if (taskContext.getInitializer().getJobVariables() != null) { for (JobVariable jobVariable : taskContext.getInitializer().getJobVariables().values()) { variables.put(jobVariable.getName(), jobVariable.getValue()); } } try { if (taskContext.getPreviousTasksResults() != null) { variables.putAll(extractPreviousTaskResultVariablesFromTaskContext(taskContext)); } if (useTaskVariables && taskContext.getInitializer().getTaskVariables() != null) { variables.putAll(addTaskVariablesAndBackupInheritedVariables(variables, taskContext.getInitializer() <START> .getTaskVariables())); <END> } if (taskResult != null && taskResult.getPropagatedVariables() != null) { variables.putAll(SerializationUtil.deserializeVariableMap(taskResult.getPropagatedVariables())); } } catch (IOException | ClassNotFoundException e) { logger.error("Could not deserialize variables", e); throw e; } variables.putAll(retrieveContextVariables(taskContext.getInitializer())); variables.put(SchedulerVars.PA_SCHEDULER_HOME.toString(), taskContext.getSchedulerHome()); return variables; }</code><technical_language>Instead of variables.putAll(...), method addTaskVariablesAndBackupInheritedVariables put variables in variables map. remove "indirection"</technical_language>

Target:
public Map<String, Serializable> extractVariables(TaskContext taskContext, TaskResult taskResult, boolean useTaskVariables) throws IOException, ClassNotFoundException { Map<String, Serializable> variables = new HashMap<>(); if (taskContext.getInitializer().getJobVariables() != null) { for (JobVariable jobVariable : taskContext.getInitializer().getJobVariables().values()) { variables.put(jobVariable.getName(), jobVariable.getValue()); } } try { if (taskContext.getPreviousTasksResults() != null) { variables.putAll(extractPreviousTaskResultVariablesFromTaskContext(taskContext)); } if (useTaskVariables && taskContext.getInitializer().getTaskVariables() != null) { addTaskVariablesAndBackupInheritedVariables(variables, taskContext.getInitializer().getTaskVariables()); } if (taskResult != null && taskResult.getPropagatedVariables() != null) { variables.putAll(SerializationUtil.deserializeVariableMap(taskResult.getPropagatedVariables())); } } catch (IOException | ClassNotFoundException e) { logger.error("Could not deserialize variables", e); throw e; } variables.putAll(retrieveContextVariables(taskContext.getInitializer())); variables.put(SchedulerVars.PA_SCHEDULER_HOME.toString(), taskContext.getSchedulerHome()); return variables; }
Source:
<code>public MessageLockContainer(Duration cleanupInterval) { cleanupOperation = Flux.interval(cleanupInterval).subscribe(e -> { if (lockTokens.isEmpty()) { return; } final Instant now = Instant.now(); final boolean removed = lockTokens.entrySet().removeIf(entry -> { final Instant expiration = entry.getValue(); return expiration != null && expiration.isBefore(now); }); if (removed) { <START> logger.verbose("{}: Removed expired entries.", e); <END> } }); }</code><technical_language>worth making this log info removing expired entries uncommon users able info level? Also, consider adding a count of expired entries removed in log</technical_language>

Target:
public MessageLockContainer(Duration cleanupInterval) { cleanupOperation = Flux.interval(cleanupInterval).subscribe(e -> { if (lockTokens.isEmpty()) { return; } final Instant now = Instant.now(); lockTokens.entrySet().removeIf(entry -> { final Instant expiration = entry.getValue(); final boolean isExpired = expiration != null && expiration.isBefore(now); if (isExpired) { logger.info("lockToken[{}]. expiration[{}]. Removing expired entry. ", entry.getKey(), expiration, e); } return isExpired; }); }); }
Source:
<code>void createConnectionsUponTopologyChange() { if(!m_topologyChangeAware || m_createConnectionUponTopoChangeInProgress.get()) { return; } m_createConnectionUponTopoChangeInProgress.set(true); ImmutableSet<Integer> unconnected = m_unconnectedHosts.get(); if (unconnected != null && !unconnected.isEmpty()) { <START> m_unconnectedHosts.set(ImmutableSet.copyOf(new HashSet<Integer>())); <END> for (Integer host : unconnected) { if (!isHostConnected(host)) { for (ClientStatusListenerExt csl : m_listeners) { if (csl instanceof ClientImpl.CSL) { ((ClientImpl.CSL)csl).createConnectionsUponTopologyChange(); m_createConnectionUponTopoChangeInProgress.set(false); return; } } } } } m_createConnectionUponTopoChangeInProgress.set(false); }</code><technical_language>java m_unconnectedHosts.set(ImmutableSet.of());</technical_language>

Target:
void createConnectionsUponTopologyChange() { if(!m_topologyChangeAware || m_createConnectionUponTopoChangeInProgress.get()) { return; } m_createConnectionUponTopoChangeInProgress.set(true); ImmutableSet<Integer> unconnected = m_unconnectedHosts.get(); if (unconnected != null && !unconnected.isEmpty()) { m_unconnectedHosts.compareAndSet(unconnected, ImmutableSet.copyOf(new HashSet<Integer>())); for (Integer host : unconnected) { if (!isHostConnected(host)) { for (ClientStatusListenerExt csl : m_listeners) { if (csl instanceof ClientImpl.InternalClientStatusListener) { ((ClientImpl.InternalClientStatusListener)csl).createConnectionsUponTopologyChange(); break; } } } } } m_createConnectionUponTopoChangeInProgress.set(false); }
Source:
<code>public Pair<CursorStreamProviderFactory, CursorIteratorProviderFactory> getPairFor(CursorProviderFactory provider) { CursorStreamProviderFactory cursorStreamProviderFactory; CursorIteratorProviderFactory cursorIteratorProviderFactory; if (provider instanceof CursorIteratorProviderFactory) { cursorIteratorProviderFactory = (CursorIteratorProviderFactory) provider; if (provider instanceof NullCursorIteratorProviderFactory && muleContext.getConfiguration().isInheritIterableRepeatability()) { cursorStreamProviderFactory = forBytes().getNullCursorProviderFactory(); } else { cursorStreamProviderFactory = forBytes().getDefaultCursorProviderFactory(); } } else if (provider instanceof CursorStreamProviderFactory) { cursorStreamProviderFactory = (CursorStreamProviderFactory) provider; cursorIteratorProviderFactory = forObjects().getDefaultCursorProviderFactory(); } else { <START> cursorStreamProviderFactory = forBytes().getDefaultCursorProviderFactory(); <END> cursorIteratorProviderFactory = forObjects().getDefaultCursorProviderFactory(); } return new Pair<>(cursorStreamProviderFactory, cursorIteratorProviderFactory); }</code><technical_language>IllegalArgumentException thrown</technical_language>

Target:
public Pair<CursorStreamProviderFactory, CursorIteratorProviderFactory> getPairFor(CursorProviderFactory provider) { CursorStreamProviderFactory cursorStreamProviderFactory; CursorIteratorProviderFactory cursorIteratorProviderFactory; if (provider instanceof CursorIteratorProviderFactory) { cursorIteratorProviderFactory = (CursorIteratorProviderFactory) provider; if (provider instanceof NullCursorIteratorProviderFactory && muleContext.getConfiguration().isInheritIterableRepeatability()) { cursorStreamProviderFactory = forBytes().getNullCursorProviderFactory(); } else { cursorStreamProviderFactory = forBytes().getDefaultCursorProviderFactory(); } } else if (provider instanceof CursorStreamProviderFactory) { cursorStreamProviderFactory = (CursorStreamProviderFactory) provider; cursorIteratorProviderFactory = forObjects().getDefaultCursorProviderFactory(); } else { throw new IllegalArgumentException("The given cursor provider factory must be either a CursorStreamProviderFactory or a CursorIteratorProviderFactory"); } return new Pair<>(cursorStreamProviderFactory, cursorIteratorProviderFactory); }
Source:
<code>private ByteBuffer parseCBPayLoad(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; pcapPacketHeader.getInt(); long packetLength = ConversionHelper.unsignedIntToLong(blockLength); SeekableByteChannel fFileChannel = getFileChannel(); if (fFileChannel.size() - fFileChannel.position() < packetLength) { throw new BadPcapFileException(String.format("%04x", packetLength) + " is causing buffer overrun."); } <START> if (blockLength > Integer.MAX_VALUE) { <END> throw new BadPcapFileException(String.format("%04x", blockLength) + " packet length is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) packetLength - 12); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); int payLoad = fFileChannel.read(pcapPacketData); if (payLoad == 0) { throw new BadPcapFileException(String.format("%04x", payLoad) + " is a bad payload."); } pcapPacketData.flip(); fFileChannel.position(fFileChannel.position() + blockLength - 12); return pcapPacketData; }</code><technical_language>This is impossible, blockLength is int</technical_language>

Target:
private ByteBuffer parseCBPayLoad(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; pcapPacketHeader.getInt(); long packetLength = ConversionHelper.unsignedIntToLong(blockLength); SeekableByteChannel fileChannel = getFileChannel(); if (fileChannel.size() - fileChannel.position() < packetLength) { throw new BadPcapFileException(String.format("%04x", packetLength) + " is causing buffer overrun."); } if (blockLength > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", blockLength) + " packet length is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) packetLength - 12); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); int payLoad = fileChannel.read(pcapPacketData); if (payLoad == 0) { throw new BadPcapFileException(String.format("%04x", payLoad) + " is a bad payload."); } pcapPacketData.flip(); fileChannel.position(fileChannel.position() + blockLength - 12); return pcapPacketData; }
Source:
<code>public void testOSGIDebugCommand() throws CarbonToolsIntegrationTestException, IOException { String[] cmdArray; String expectedString = "OSGi debugging has been enabled with options:"; boolean isFoundTheMessage = false; InputStream is = null; InputStreamReader isr = null; int timeout = 30000; BufferedReader br = null; if (CarbonCommandToolsUtil.isCurrentOSWindows()) { cmdArray = new String[] {"cmd.exe", "/c", "wso2server.bat", "-DosgiDebugOptions", "-DportOffset=1"}; commandDirectory = CarbonCommandToolsUtil.getCarbonHome(context) + File.separator + "bin"; } else { cmdArray = new String[] {"sh", "wso2server.sh", "-DosgiDebugOptions", "-DportOffset=1"}; <START> commandDirectory = CarbonCommandToolsUtil.getCarbonHome(context) + "/bin"; <END> } try { process = CarbonCommandToolsUtil.runScript(commandDirectory, cmdArray); String line; long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < timeout) { is = process.getInputStream(); isr = new InputStreamReader(is); br = new BufferedReader(isr); if (br != null) { line = br.readLine(); if (line.contains(expectedString)) { log.info("found the string " + expectedString + " in line " + line); isFoundTheMessage = true; break; } } } } finally { if (is != null) { is.close(); } if (isr != null) { isr.close(); } if (br != null) { br.close(); } } CarbonCommandToolsUtil.isServerStartedUp(context, portOffset); Assert.assertTrue(isFoundTheMessage, "Java file not created successfully"); }</code><technical_language>file separator instead of /bin</technical_language>

Target:
public void testOSGIDebugCommand() throws CarbonToolsIntegrationTestException, IOException { String[] cmdArray; String expectedString = "OSGi debugging has been enabled with options:"; boolean isFoundTheMessage = false; InputStream is = null; int timeout = 30000; BufferedReader br = null; if ((CarbonCommandToolsUtil.getCurrentOperatingSystem(). contains(OperatingSystems.WINDOWS.name().toLowerCase())) ) { cmdArray = new String[] {"cmd.exe", "/c", "wso2server.bat", "-DosgiDebugOptions", "-DportOffset=1"}; commandDirectory = CarbonCommandToolsUtil.getCarbonHome(context) + File.separator + "bin"; } else { cmdArray = new String[] {"sh", "wso2server.sh", "-DosgiDebugOptions", "-DportOffset=1"}; commandDirectory = CarbonCommandToolsUtil.getCarbonHome(context) + "/bin"; } try { process = CarbonCommandToolsUtil.runScript(commandDirectory, cmdArray); String line; long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < timeout) { is = process.getInputStream(); br = new BufferedReader(new InputStreamReader(is, "UTF-8")); if (br != null) { line = br.readLine(); if (line.contains(expectedString)) { log.info("found the string " + expectedString + " in line " + line); isFoundTheMessage = true; break; } } } } finally { if (is != null) { is.close(); } if (br != null) { br.close(); } } CarbonCommandToolsUtil.isServerStartedUp(context, portOffset); Assert.assertTrue(isFoundTheMessage, "Java file not created successfully"); }
Source:
<code>public void refreshAllUsers() { final Map<String, List<DbUser>> usersPerAuthz = new HashMap<>(); final Map<String, List<DbGroup>> groupsPerAuthz = new HashMap<>(); for (DbGroup dbGroup : DbFacade.getInstance().getDbGroupDao().getAll()) { MultiValueMapUtils.addToMap(dbGroup.getDomain(), dbGroup, groupsPerAuthz); } for (DbUser dbUser : DbFacade.getInstance().getDbUserDao().getAll()) { MultiValueMapUtils.addToMap(dbUser.getDomain(), dbUser, usersPerAuthz); } Set<String> authzNames = new HashSet<String>() { { addAll(usersPerAuthz.keySet()); addAll(groupsPerAuthz.keySet()); } }; List<DbUser> refreshedUsers = new ArrayList<>(); for (String authzName : authzNames) { <START> refreshedUsers.addAll(refreshAllUsers(EngineExtensionsManager.getInstance().getExtensionByName(authzName), <END> usersPerAuthz.get(authzName), groupsPerAuthz.get(authzName))); } for (DbUser dbUser : refreshedUsers) { DbFacade.getInstance().getDbUserDao().update(dbUser); } }</code><technical_language>need deal users added extension is removed. name of AllUsers is misleading refresh group well? phases? for users for groups</technical_language>

Target:
public void refreshAllUsers() { sync.refreshAllUsers(DbFacade.getInstance().getDbUserDao().getAll()); }
Source:
<code>LogMessageContext(String prefix) { this.appendSubject = getSubject(prefix, "append"); <START> this.consumeSubject = getSubject(prefix, "read"); <END> this.resetSubject = getSubject(prefix, "reset"); this.backupSubject = getSubject(prefix, "backup"); }</code><technical_language>read consume</technical_language>

Target:
LogMessageContext(String prefix) { this.appendSubject = getSubject(prefix, "append"); this.consumeSubject = getSubject(prefix, "consume"); this.resetSubject = getSubject(prefix, "reset"); this.backupSubject = getSubject(prefix, "backup"); }
Source:
<code>protected void onPause() { super.onPause(); mMap.setOnMapLoadedCallback(null); <START> if (mMap != null && (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED <END> || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { mMap.setMyLocationEnabled(false); } }</code><technical_language>remove null check mMap wrap mMap.setOnMapLoadedCallback(null); in a null check. Currently mMap != null is equiv a no-op</technical_language>

Target:
protected void onPause() { super.onPause(); if (mMap != null) { mMap.setOnMapLoadedCallback(null); if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mMap.setMyLocationEnabled(false); } } }
Source:
<code>public ElasticsearchRecordCursor(List<ElasticsearchColumnHandle> columnHandles, ElasticsearchConnectorConfig config, ElasticsearchSplit split) { <START> this.columnHandles = requireNonNull(columnHandles, "columnHandle is null"); <END> this.maxHits = requireNonNull(config, "config is null").getMaxHits(); this.timeout = config.getRequestTimeout(); for (int i = 0; i < columnHandles.size(); i++) { jsonPathToIndex.put(columnHandles.get(i).getColumnJsonPath(), i); } this.builder = new ElasticsearchQueryBuilder(columnHandles, config, split); this.searchHits = sendElasticQuery(builder).iterator(); }</code><technical_language>preferred clean for requireNonNull checks (as I told previously in some reviews): requireNonNull(columnHandles, "columnHandle is null"); this.columnHandles = columnHandles; instead of this.columnHandles = requireNonNull(columnHandles, "columnHandle is null");</technical_language>

Target:
public ElasticsearchRecordCursor(List<ElasticsearchColumnHandle> columnHandles, ElasticsearchConnectorConfig config, ElasticsearchSplit split) { requireNonNull(columnHandles, "columnHandle is null"); requireNonNull(config, "config is null"); this.columnHandles = columnHandles; this.maxHits = config.getMaxHits(); this.timeout = config.getRequestTimeout(); for (int i = 0; i < columnHandles.size(); i++) { jsonPathToIndex.put(columnHandles.get(i).getColumnJsonPath(), i); } this.builder = new ElasticsearchQueryBuilder(columnHandles, config, split); this.searchHits = sendElasticQuery(builder).iterator(); }
Source:
<code>public void setTreeFilter(TreeFilter filter) { super.setTreeFilter(filter); if (filter instanceof FollowFilter) { FollowFilter followFilter = (FollowFilter) filter; RenameCallback renameCallback = followFilter.getRenameCallback(); <START> if (renameCallback == null) { <END> followFilter.setRenameCallback(callback); } } }</code><technical_language>style nit: curly braces single line blocks</technical_language>

Target:
public void setTreeFilter(TreeFilter filter) { super.setTreeFilter(filter); if (filter instanceof FollowFilter) { FollowFilter followFilter = (FollowFilter) filter; RenameCallback renameCallback = followFilter.getRenameCallback(); if (renameCallback == null) followFilter.setRenameCallback(callback); } }
Source:
<code><START> public void saveRunQC(RunQC runQC) throws IOException { <END> if (runQcStore != null) { runQcStore.save(runQC); } else { throw new IOException("No runQcStore available. Check that it has been declared in the Spring config."); } }</code><technical_language>remove return value</technical_language>

Target:
public long saveRunQC(RunQC runQC) throws IOException { if (runQcStore != null) { Long runQcId = runQcStore.save(runQC); if (runAlertManager != null) runAlertManager.update(runQC.getRun()); return runQcId; } else { throw new IOException("No runQcStore available. Check that it has been declared in the Spring config."); } }
Source:
<code>public Object visit(ASTElement node, Object data) { if (APEX_PAGE.equalsIgnoreCase(node.getName())) { List<ASTAttribute> attribs = node.findChildrenOfType(ASTAttribute.class); boolean controller = false; boolean action = false; boolean isEl = false; ASTElExpression valToReport = null; for (ASTAttribute attr : attribs) { switch (attr.getName().toLowerCase()) { case "action": action = true; break; case "controller": controller = true; break; default: break; } if (action) { <START> ASTElExpression value = attr.getFirstDescendantOfType(ASTElExpression.class); <END> if (value != null) { if (doesElContainIdentifiers(value)) { isEl = true; valToReport = value; } } } } if (controller && isEl && valToReport != null) { addViolation(data, valToReport); } } return super.visit(node, data); }</code><technical_language>this block case "action": block? I want check of action attribute, attributes action</technical_language>

Target:
public Object visit(ASTElement node, Object data) { if (APEX_PAGE.equalsIgnoreCase(node.getName())) { List<ASTAttribute> attribs = node.findChildrenOfType(ASTAttribute.class); boolean controller = false; boolean isEl = false; ASTElExpression valToReport = null; for (ASTAttribute attr : attribs) { switch (attr.getName().toLowerCase()) { case "action": ASTElExpression value = attr.getFirstDescendantOfType(ASTElExpression.class); if (value != null) { if (doesElContainIdentifiers(value)) { isEl = true; valToReport = value; } } break; case "controller": controller = true; break; default: break; } } if (controller && isEl && valToReport != null) { addViolation(data, valToReport); } } return super.visit(node, data); }
Source:
<code>public void remove() { super.remove(); bPlayer.addCooldown(this); MultiAbilityManager.unbindMultiAbility(player); flying.remove(player.getUniqueId()); if (player.isOnline() && !player.isDead()) { player.eject(); } <START> ProjectKorra.flightHandler.removeInstance(player, "FlightMultiAbility"); <END> player.setGliding(hadGlide); }</code><technical_language>This line manage player's flight state, change "FlightMultiAbility" getName() a final String value</technical_language>

Target:
public void remove() { super.remove(); bPlayer.addCooldown(this); MultiAbilityManager.unbindMultiAbility(player); flying.remove(player.getUniqueId()); if (player.isOnline() && !player.isDead()) { player.eject(); } ProjectKorra.flightHandler.removeInstance(player, ID); player.setGliding(hadGlide); }
Source:
<code>private static void parseAppStanza(ClientInfo.Builder builder, String stanza) { if (StringUtils.isBlank(stanza)) { return; } String[] components = stanza.split("/"); if (components.length == 2) { if (!components[0].matches(DIGITS_REGEXP)) { builder.withAppName(parseString(components[0])); } <START> builder.withAppVersion(parseInteger(components[1])).build(); <END> } else if (components.length == 1) { if (components[0].matches(DIGITS_REGEXP)) { builder.withAppVersion(parseInteger(components[0])); } else { builder.withAppName(parseString(components[0])); } } }</code><technical_language>Minor: Stray build? (And in parseOsStanza() parseSdkStanza().)</technical_language>

Target:
private static void parseAppStanza(ClientInfo.Builder builder, String stanza) { if (StringUtils.isBlank(stanza)) { return; } String[] components = stanza.split("/"); if (components.length == 2) { if (!components[0].matches(DIGITS_REGEXP)) { builder.withAppName(parseString(components[0])); } builder.withAppVersion(parseInteger(components[1])); } else if (components.length == 1) { if (components[0].matches(DIGITS_REGEXP)) { builder.withAppVersion(parseInteger(components[0])); } else { builder.withAppName(parseString(components[0])); } } }