auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void parseChildren(JsonNode root, InventoryStructure.AbstractBuilder<?> bld, DeserializationContext mapper) throws IOException { JsonNode children = root.get("children"); if (children == null) { return; } if (!children.isObject()) { throw new JsonParseException("The 'children' is supposed to be an object.", JsonLocation.NA); } else { Iterator<Map.Entry<String, JsonNode>> fields = children.fields(); while (fields.hasNext()) { Map.Entry<String, JsonNode> e = fields.next(); String typeName = e.getKey(); JsonNode childrenNode = e.getValue(); if (!childrenNode.isArray()) { continue; } <START> InventoryStructure.EntityType type = InventoryStructure.EntityType.valueOf(typeName); <END> Iterator<JsonNode> childrenNodes = childrenNode.elements(); while (childrenNodes.hasNext()) { JsonNode childNode = childrenNodes.next(); Entity.Blueprint bl = mapper.readValue(prepareTraverse(childNode.get("data")), type.blueprintType); InventoryStructure.ChildBuilder<?> childBld = bld.startChild(bl); parseChildren(childNode, childBld, mapper); childBld.end(); } } } }</code><technical_language>this put try-catch block? line 70? java InventoryStructure.EntityType type; try { type = InventoryStructure.EntityType.valueOf(typeName); } catch (IllegalArgumentException e) { throw new JsonParseException("Unrecognized of 'type'. Supported values " + LEGAL_ENTITY_TYPES + " '" + typeName + "'.", JsonLocation.NA); }</technical_language>

Target:
private void parseChildren(JsonNode root, InventoryStructure.AbstractBuilder<?> bld, DeserializationContext mapper) throws IOException { JsonNode children = root.get("children"); if (children == null) { return; } if (!children.isObject()) { throw new JsonParseException("The 'children' is supposed to be an object.", JsonLocation.NA); } else { Iterator<Map.Entry<String, JsonNode>> fields = children.fields(); while (fields.hasNext()) { Map.Entry<String, JsonNode> e = fields.next(); String typeName = e.getKey(); JsonNode childrenNode = e.getValue(); if (!childrenNode.isArray()) { continue; } InventoryStructure.EntityType type; try { type = InventoryStructure.EntityType.valueOf(typeName); } catch (IllegalArgumentException ex) { throw new JsonParseException("Unrecognized value of 'type'. Supported values are " + LEGAL_ENTITY_TYPES + " but got '" + typeName + "'.", JsonLocation.NA); } Iterator<JsonNode> childrenNodes = childrenNode.elements(); while (childrenNodes.hasNext()) { JsonNode childNode = childrenNodes.next(); Entity.Blueprint bl = mapper.readValue(prepareTraverse(childNode.get("data")), type.blueprintType); InventoryStructure.ChildBuilder<?> childBld = bld.startChild(bl); parseChildren(childNode, childBld, mapper); childBld.end(); } } } }
Source:
<code>public RequestBuilder buildRequest(Api api) { <START> return api.action("zeroconfig").param("type", "message"); <END> }</code><technical_language>"agent" field needs in case underlying consumer library setting a custom User-Agent infeasible. URL-encoded custom UA fine for "agent" parameter</technical_language>

Target:
public RequestBuilder buildRequest(Api api) { return api.action("zeroconfig") .param("type", "message") .param("agent", ((WikipediaApp)ctx.getApplicationContext()).getUserAgent()); }
Source:
<code>public void before() throws IOException, OperationException { if (operations.invoke("list-changes", serviceAddress).isFailed()) { operations.add(serviceAddress, Values.of("max-history", 100)).assertSuccess(); } page.navigate(); <START> } <END></code><technical_language>testing => max-history 100 => list-changes op fail</technical_language>

Target:
public void before() throws IOException, OperationException { final int MAX_HISTORY = 100; if (!operations.exists(serviceAddress)) { operations.add(serviceAddress, Values.of("max-history", MAX_HISTORY)).assertSuccess(); } else { operations.writeAttribute(serviceAddress, "max-history", MAX_HISTORY); } page.navigate(); }
Source:
<code>public void noStrings003() throws Exception { MultiStringMatcher m = MultiStringMatcher.builder().add((String[]) null).build(); List<Match> matches = m.find("dddhiheddd", 0); <START> assertEquals("Expected no match", 0, matches.size()); <END> }</code><technical_language>Right</technical_language>

Target:
public void noStrings003() throws Exception { MultiStringMatcher m = MultiStringMatcher.builder().add((String[]) null).build(); assertNull("Expected no match", m.indexOf("dhihedd", 0)); List<Match> matches = m.find("dddhiheddd", 0); assertEquals("Expected no match", 0, matches.size()); }
Source:
<code>public void shouldGetMismatchingJobPlansInCaseOfPipelineHasUpdated() { StageConfig second = StageConfigMother.stageConfig("second"); second.getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); PipelineConfig pipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); pipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); pipeline.add(second); PipelineConfig irrelevantPipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); irrelevantPipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); JobPlan jobPlan1 = getJobPlan(pipeline.getName(), pipeline.get(0).name(), pipeline.get(0).getJobs().last()); JobPlan jobPlan2 = getJobPlan(pipeline.getName(), pipeline.get(1).name(), pipeline.get(1).getJobs().first()); JobPlan jobPlan3 = getJobPlan(irrelevantPipeline.getName(), irrelevantPipeline.get(0).name(), irrelevantPipeline.get(0).getJobs().first()); jobPlans.add(jobPlan1); jobPlans.add(jobPlan2); jobPlans.add(jobPlan3); pipeline.remove(1); <START> List<JobPlan> jobsToRemove = buildAssignmentService.getMismatchingJobPlansFromUpdatedPipeline(pipeline, jobPlans); <END> assertThat(jobsToRemove.size(), is(1)); assertThat(jobsToRemove.get(0), is(jobPlan2)); }</code><technical_language>dont invoke pipelineConfigChangedListener() test instead of exposing methods - getMismatchingJobPlansFromUpdatedPipeline getAllJobPlansFromDeletedPipeline for test. tests a bit more explicit</technical_language>

Target:
public void shouldGetMismatchingJobPlansInCaseOfPipelineHasUpdated() { StageConfig second = StageConfigMother.stageConfig("second"); second.getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); PipelineConfig pipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); pipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); pipeline.add(second); PipelineConfig irrelevantPipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); irrelevantPipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); JobPlan jobPlan1 = getJobPlan(pipeline.getName(), pipeline.get(0).name(), pipeline.get(0).getJobs().last()); JobPlan jobPlan2 = getJobPlan(pipeline.getName(), pipeline.get(1).name(), pipeline.get(1).getJobs().first()); JobPlan jobPlan3 = getJobPlan(irrelevantPipeline.getName(), irrelevantPipeline.get(0).name(), irrelevantPipeline.get(0).getJobs().first()); jobPlans = (ArrayList<JobPlan>) buildAssignmentService.jobPlans(); jobPlans.add(jobPlan1); jobPlans.add(jobPlan2); jobPlans.add(jobPlan3); pipeline.remove(1); assertThat(jobPlans.size(), is(3)); when(goConfigService.hasPipelineNamed(pipeline.getName())).thenReturn(true); buildAssignmentService.pipelineConfigChangedListener().onEntityConfigChange(pipeline); assertThat(jobPlans.size(), is(2)); assertThat(jobPlans.get(0), is(jobPlan1)); assertThat(jobPlans.get(1), is(jobPlan3)); }
Source:
<code>private static void checkLxmlParseCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); if (checkCallExpressionFqn(callExpression, LXML_PARSE)) { CallExpression parserCall = getParserCall( getArgValueAsCallExpression( TreeUtils.nthArgumentOrKeyword(1, "parser", callExpression.arguments()))); if (parserCall != null && isUnsafeParserUsage(parserCall)) { <START> ctx.addIssue(parserCall, MESSAGE).secondary(callExpression, MESSAGE); <END> } } }</code><technical_language>need add message secondary location</technical_language>

Target:
private static void checkLxmlParseCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); if (checkCallExpressionFqn(callExpression, LXML_PARSE)) { CallExpression parserCall = getParserCall( getArgValueAsCallExpression( TreeUtils.nthArgumentOrKeyword(1, "parser", callExpression.arguments()))); if (parserCall != null && isUnsafeParserUsage(parserCall)) { ctx.addIssue(parserCall, MESSAGE).secondary(callExpression, null); } } }
Source:
<code>private X509TrustManager trustManagerForCertificates(InputStream in) throws GeneralSecurityException { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in); if (certificates.isEmpty()) { throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } char[] password = "password".toCharArray(); KeyStore keyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { String certificateAlias = Integer.toString(index++); keyStore.setCertificateEntry(certificateAlias, certificate); } <START> KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance( <END> KeyManagerFactory.getDefaultAlgorithm()); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers)); } return (X509TrustManager) trustManagers[0]; }</code><technical_language>is this obsolete too</technical_language>

Target:
private X509TrustManager trustManagerForCertificates(InputStream in) throws GeneralSecurityException { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in); if (certificates.isEmpty()) { throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } char[] password = "password".toCharArray(); KeyStore keyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { String certificateAlias = Integer.toString(index++); keyStore.setCertificateEntry(certificateAlias, certificate); } TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers)); } return (X509TrustManager) trustManagers[0]; }
Source:
<code>public QuarkIterator(ITmfStateSystem ss, int quark, long initialTime) { this (ss, quark, initialTime, <START> Long.MAX_VALUE, 0); <END> }</code><technical_language>1</technical_language>

Target:
public QuarkIterator(ITmfStateSystem ss, int quark, long initialTime) { this (ss, quark, initialTime, Long.MAX_VALUE, 1); }
Source:
<code>public ValidationResult isOsSupportedForVirtIoScsi(VM vm) { List<DiskInterface> supportedDiskInterfaces = <START> getSupportedDiskInterfaces(vm.getOs(), vm.getVdsGroupCompatibilityVersion()); <END> if (!supportedDiskInterfaces.contains(DiskInterface.VirtIO_SCSI)) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return ValidationResult.VALID; }</code><technical_language>Consider extracting this a method in isDiskInterfaceSupported</technical_language>

Target:
public ValidationResult isOsSupportedForVirtIoScsi(VM vm) { if (!isDiskInterfaceSupportedByOs(DiskInterface.VirtIO_SCSI, vm.getOs(), vm.getVdsGroupCompatibilityVersion())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return ValidationResult.VALID; }
Source:
<code>public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_PAGE_UP: scroll(true, screenScrollingPercent, smoothScrolling); return true; case KeyEvent.KEYCODE_PAGE_DOWN: scroll(false, screenScrollingPercent, smoothScrolling); return true; case KeyEvent.KEYCODE_CAMERA: disableTouch = !disableTouch; if (disableTouch) { Toast.makeText(this, "Touch screen disabled", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, "Touch screen enabled", Toast.LENGTH_SHORT).show(); } Log.d(TAG, "toggling touch screen, now disableTouch is " + disableTouch); return true; } <START> if (volumeButtonsScrolling) { <END> switch (event.getKeyCode()) { case KeyEvent.KEYCODE_VOLUME_UP: scroll(true, screenScrollingPercent, smoothScrolling); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: scroll(false, screenScrollingPercent, smoothScrolling); return true; } } } return super.dispatchKeyEvent(event); }</code><technical_language>this if block merged switch-case block before? If not, fix bug double scrolling button press (handle KeyEvent.ACTION_DOWN)</technical_language>

Target:
public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { int code = event.getKeyCode(); if(code == disableTouchKeyCode && (disableTouch || disableTouchOptionEnabled)) { disableTouch = !disableTouch; settings.setDisableTouchLastState(disableTouch); Log.d(TAG, "toggling touch screen, now disableTouch is " + disableTouch); showDisableTouchToast(); return true; } switch (code) { case KeyEvent.KEYCODE_PAGE_UP: case KeyEvent.KEYCODE_PAGE_DOWN: scroll(code == KeyEvent.KEYCODE_PAGE_UP, screenScrollingPercent, smoothScrolling); return true; case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: if (volumeButtonsScrolling) { scroll(code == KeyEvent.KEYCODE_VOLUME_UP, screenScrollingPercent, smoothScrolling); return true; } break; } } return super.dispatchKeyEvent(event); }
Source:
<code>public void build() { for (final DTCellValue52 cell : row) { if (sourceColumnIndex == 1) { xlsRow.createCell(targetColumnIndex) .setCellValue(cell.getStringValue()); } else if (sourceColumnIndex > 1) { final BaseColumn baseColumn = dtable.getExpandedColumns().get(sourceColumnIndex); if (baseColumn instanceof ActionInsertFactCol52) { addActionInsertFirstColumn(); } <START> if (baseColumn instanceof ConditionCol52 && isNullOrNotNull(((ConditionCol52) baseColumn).getOperator())) { <END> xlsRow.createCell(targetColumnIndex) .setCellValue("null"); } else if (isWorkItemColumn()) { if (cell.getBooleanValue() != null && cell.getBooleanValue()) { xlsRow.createCell(targetColumnIndex) .setCellValue("X"); } } else if (dtable.getExpandedColumns().get(sourceColumnIndex) instanceof ActionRetractFactCol52) { if (isNullOrEmpty(cell.getStringValue())) { xlsRow.createCell(targetColumnIndex) .setCellValue(cell.getStringValue()); } } else { setValue(cell, getColumnDataType(sourceColumnIndex)); } } sourceColumnIndex++; targetColumnIndex++; } rowCount++; }</code><technical_language>I splitting checking of operator org.drools.workbench.screens.guided.dtable.backend.server.conversion.Util class isOperator method. For example if isOperator simplify this if as: if (isOperator("== null") || isOperator("!= null")) { // ... }</technical_language>

Target:
public void build() { for (final DTCellValue52 cell : row) { if (sourceColumnIndex == 1) { xlsRow.createCell(targetColumnIndex) .setCellValue(cell.getStringValue()); } else if (sourceColumnIndex > 1) { final BaseColumn baseColumn = dtable.getExpandedColumns().get(sourceColumnIndex); if (baseColumn instanceof ActionInsertFactCol52) { addActionInsertFirstColumn(); } if (isOperator("== null") || isOperator("!= null")) { xlsRow.createCell(targetColumnIndex) .setCellValue("null"); } else if (isWorkItemColumn()) { if (cell.getBooleanValue() != null && cell.getBooleanValue()) { xlsRow.createCell(targetColumnIndex) .setCellValue("X"); } } else if (dtable.getExpandedColumns().get(sourceColumnIndex) instanceof ActionRetractFactCol52) { if (!StringUtils.isEmpty(cell.getStringValue())) { xlsRow.createCell(targetColumnIndex) .setCellValue(cell.getStringValue()); } } else { setValue(cell, getColumnDataType(sourceColumnIndex)); } } sourceColumnIndex++; targetColumnIndex++; } rowCount++; }
Source:
<code>protected MasterObjectAxisProvider getMasterObjectAxisProvider(final TableConfiguration configuration) { MasterObjectAxisProvider master = null; if (0 < configuration.getRowAxisProviders().size()) { final Iterator<AbstractAxisProvider> rowAxisProvidersIterator = configuration.getRowAxisProviders().iterator(); while (rowAxisProvidersIterator.hasNext() && null == master) { <START> AbstractAxisProvider axisProvider = rowAxisProvidersIterator.next(); <END> if (axisProvider instanceof MasterObjectAxisProvider) { master = (MasterObjectAxisProvider) axisProvider; } } } return master; }</code><technical_language>final</technical_language>

Target:
protected MasterObjectAxisProvider getMasterObjectAxisProvider(final TableConfiguration configuration) { MasterObjectAxisProvider master = null; if (0 < configuration.getRowAxisProviders().size()) { final Iterator<AbstractAxisProvider> rowAxisProvidersIterator = configuration.getRowAxisProviders().iterator(); while (rowAxisProvidersIterator.hasNext() && null == master) { final AbstractAxisProvider axisProvider = rowAxisProvidersIterator.next(); if (axisProvider instanceof MasterObjectAxisProvider) { master = (MasterObjectAxisProvider) axisProvider; } } } return master; }
Source:
<code>public void test_update_returning_with_asterisk_contains_all_columns_in_returning_clause() { AnalyzedUpdateStatement stmt = e.analyze( <START> "UPDATE users SET name='noam' WHERE ID=1 RETURNING *"); <END> assertThat( stmt.assignmentByTargetCol().keySet(), contains(isReference("name", DataTypes.STRING))); assertThat(stmt.returnValues().size(), is(17)); }</code><technical_language>suggestion "UPDATE users SET name='noam' RETURNING *");</technical_language>

Target:
public void test_update_returning_with_asterisk_contains_all_columns_in_returning_clause() { AnalyzedUpdateStatement stmt = e.analyze( "UPDATE users SET name='noam' RETURNING *"); assertThat( stmt.assignmentByTargetCol().keySet(), contains(isReference("name", DataTypes.STRING))); assertThat(stmt.returnValues().size(), is(17)); }
Source:
<code><START> public void testSetupLayout() { <END> MarkLogicInputProperties properties = new MarkLogicInputProperties("root"); properties.schema.init(); properties.setupLayout(); Form main = properties.getForm(Form.MAIN); assertThat(main, notNullValue()); Collection<Widget> mainWidgets = main.getWidgets(); assertThat(mainWidgets, hasSize(6)); Widget schemaWidget = main.getWidget("schema"); assertThat(schemaWidget, notNullValue()); Widget fileWidget = main.getWidget("filename"); assertThat(fileWidget, notNullValue()); Widget useCustomDelimiterWidget = main.getWidget("useCustomDelimiter"); assertThat(useCustomDelimiterWidget, notNullValue()); Widget delimiterWidget = main.getWidget("delimiter"); assertThat(delimiterWidget, notNullValue()); Widget customDelimiterWidget = main.getWidget("customDelimiter"); assertThat(customDelimiterWidget, notNullValue()); Widget guessSchemaWidget = main.getWidget("guessSchema"); assertThat(guessSchemaWidget, notNullValue()); }</code><technical_language>Check formatting</technical_language>

Target:
public void testSetupLayout() { testInputProperties.connection.init(); testInputProperties.schema.init(); testInputProperties.setupLayout(); Form main = testInputProperties.getForm(Form.MAIN); assertNotNull(main.getWidget(testInputProperties.connection)); assertNotNull(main.getWidget(testInputProperties.criteria)); assertNull(main.getWidget(testInputProperties.maxRetrieve)); assertNull(main.getWidget(testInputProperties.pageSize)); assertNull(main.getWidget(testInputProperties.useQueryOption)); assertNull(main.getWidget(testInputProperties.queryLiteralType)); assertNull(main.getWidget(testInputProperties.queryOptionName)); assertNull(main.getWidget(testInputProperties.queryOptionLiterals)); Form advanced = testInputProperties.getForm(Form.ADVANCED); assertNotNull(advanced.getWidget(testInputProperties.maxRetrieve)); assertNotNull(advanced.getWidget(testInputProperties.pageSize)); assertNotNull(advanced.getWidget(testInputProperties.useQueryOption)); assertNotNull(advanced.getWidget(testInputProperties.queryLiteralType)); assertNotNull(advanced.getWidget(testInputProperties.queryOptionName)); assertNotNull(advanced.getWidget(testInputProperties.queryOptionLiterals)); }
Source:
<code>public void createAssertion_correct() throws IOException { PrivateKey privateKey = ServiceAccountCredentials.privateKeyFromPkcs8(SA_PRIVATE_KEY_PKCS8); List<String> scopes = Arrays.asList("scope1", "scope2"); ServiceAccountCredentials credentials = new ServiceAccountCredentials( SA_CLIENT_ID, SA_CLIENT_EMAIL, privateKey, SA_PRIVATE_KEY_ID, scopes, null, null, SERVICE_ACCOUNT_USER); JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; <START> long currentTime = Clock.SYSTEM.currentTimeMillis(); <END> String assertion = credentials.createAssertion(jsonFactory, currentTime); JsonWebSignature signature = JsonWebSignature.parse(jsonFactory, assertion); JsonWebToken.Payload payload = signature.getPayload(); assertEquals(SA_CLIENT_EMAIL, payload.getIssuer()); assertEquals(OAuth2Utils.TOKEN_SERVER_URI.toString(), payload.getAudience()); assertEquals(currentTime / 1000, (long) payload.getIssuedAtTimeSeconds()); assertEquals(currentTime / 1000 + 3600, (long) payload.getExpirationTimeSeconds()); assertEquals(SERVICE_ACCOUNT_USER, payload.getSubject()); assertEquals(Joiner.on(' ').join(scopes), payload.get("scope")); }</code><technical_language>Call this currentTimeMillis</technical_language>

Target:
public void createAssertion_correct() throws IOException { PrivateKey privateKey = ServiceAccountCredentials.privateKeyFromPkcs8(SA_PRIVATE_KEY_PKCS8); List<String> scopes = Arrays.asList("scope1", "scope2"); ServiceAccountCredentials credentials = new ServiceAccountCredentials( SA_CLIENT_ID, SA_CLIENT_EMAIL, privateKey, SA_PRIVATE_KEY_ID, scopes, null, null, SERVICE_ACCOUNT_USER); JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; long currentTimeMillis = Clock.SYSTEM.currentTimeMillis(); String assertion = credentials.createAssertion(jsonFactory, currentTimeMillis); JsonWebSignature signature = JsonWebSignature.parse(jsonFactory, assertion); JsonWebToken.Payload payload = signature.getPayload(); assertEquals(SA_CLIENT_EMAIL, payload.getIssuer()); assertEquals(OAuth2Utils.TOKEN_SERVER_URI.toString(), payload.getAudience()); assertEquals(currentTimeMillis / 1000, (long) payload.getIssuedAtTimeSeconds()); assertEquals(currentTimeMillis / 1000 + 3600, (long) payload.getExpirationTimeSeconds()); assertEquals(SERVICE_ACCOUNT_USER, payload.getSubject()); assertEquals(Joiner.on(' ').join(scopes), payload.get("scope")); }
Source:
<code>public Loader<AsyncTaskResult<CourseComponent>> onCreateLoader(int id, Bundle args) { <START> return new CourseOutlineAsyncLoader(getActivity().getApplicationContext(), courseData.getCourse().getId()); <END> }</code><technical_language>Application context required, giving fragment's</technical_language>

Target:
public Loader<AsyncTaskResult<CourseComponent>> onCreateLoader(int id, Bundle args) { return new CourseOutlineAsyncLoader(getContext(), courseData.getCourse().getId()); }
Source:
<code>public void writeData(ObjectDataOutput out) throws IOException { IOUtil.writeObject(out, key); IOUtil.writeObject(out, value); out.writeLong(cost); out.writeLong(creationTime); out.writeLong(expirationTime); out.writeLong(hits); out.writeLong(lastAccessTime); out.writeLong(lastStoredTime); out.writeLong(lastUpdateTime); out.writeLong(version); out.writeLong(ttl); <START> out.writeBoolean(maxIdle != null); <END> if (maxIdle != null) { out.writeLong(maxIdle); } }</code><technical_language>I original reason boxed add in WAN in 3.x needed distinguish case maxIdle unknown (null) default (-1). Now, EntryView implementations a maxIdle. double-check if finally remove this boxing</technical_language>

Target:
public void writeData(ObjectDataOutput out) throws IOException { IOUtil.writeObject(out, key); IOUtil.writeObject(out, value); out.writeLong(cost); out.writeLong(creationTime); out.writeLong(expirationTime); out.writeLong(hits); out.writeLong(lastAccessTime); out.writeLong(lastStoredTime); out.writeLong(lastUpdateTime); out.writeLong(version); out.writeLong(ttl); out.writeLong(maxIdle); }
Source:
<code><START> public static int getDrawableIDFor(FormEntryPrompt fep){ <END> switch(fep.getDataType()){ case Constants.DATATYPE_TEXT: return R.drawable.avatar_vellum_text; case Constants.DATATYPE_INTEGER: return R.drawable.avatar_vellum_integer; case Constants.DATATYPE_DECIMAL: return R.drawable.avatar_vellum_decimal; case Constants.DATATYPE_DATE: return R.drawable.avatar_vellum_date; case Constants.DATATYPE_DATE_TIME: return R.drawable.avatar_vellum_datetime; case Constants.DATATYPE_CHOICE: return R.drawable.avatar_vellum_single_answer; case Constants.DATATYPE_CHOICE_LIST: return R.drawable.avatar_vellum_multi_answer; case Constants.DATATYPE_GEOPOINT: return R.drawable.avatar_vellum_gps; case Constants.DATATYPE_BARCODE: return R.drawable.avatar_vellum_barcode; } return -1; }</code><technical_language>getDrawableIDFor incomplete name, getDrawableIDForControlInput getDrawableIDForDataType</technical_language>

Target:
private static int getDrawableIDFor(FormEntryPrompt fep){ switch(fep.getDataType()){ case Constants.DATATYPE_TEXT: return R.drawable.avatar_vellum_text; case Constants.DATATYPE_INTEGER: return R.drawable.avatar_vellum_integer; case Constants.DATATYPE_DECIMAL: return R.drawable.avatar_vellum_decimal; case Constants.DATATYPE_DATE: return R.drawable.avatar_vellum_date; case Constants.DATATYPE_DATE_TIME: return R.drawable.avatar_vellum_datetime; case Constants.DATATYPE_CHOICE: return R.drawable.avatar_vellum_single_answer; case Constants.DATATYPE_CHOICE_LIST: return R.drawable.avatar_vellum_multi_answer; case Constants.DATATYPE_GEOPOINT: return R.drawable.avatar_vellum_gps; case Constants.DATATYPE_BARCODE: return R.drawable.avatar_vellum_barcode; } return -1; }
Source:
<code>public void clearSurveys() { for (File file : surveyFiles) <START> { <END> file.delete(); } adapter.open(); adapter.deleteAllSurveys(); adapter.close(); }</code><technical_language>please fix formatting</technical_language>

Target:
public void clearSurveys() { for (File file : surveyFiles) { file.delete(); } adapter.open(); adapter.deleteAllSurveys(); adapter.clearCollectedData(); adapter.close(); }
Source:
<code><START> public void update() throws Exception { <END> Object operatorID = operatorRepository.create(new NewOperator("name", OperatorState.ACTIVE, "description", "dName", "fName", "emergency")); Object roamingGroupID = roamingRepository.create(new NewRoamingGroup("name", "description", RoamingGroupType.REGIONAL)); roamingRepository.assignOperators(new ID(roamingGroupID), Lists.newArrayList(new ID(operatorID))); RoamingGroupRequest newRoamingGroup = new RoamingGroupRequest(new ID(roamingGroupID), "newName", "newDescription", RoamingGroupType.INTERNATIONAL); roamingRepository.update(newRoamingGroup); RoamingGroup got = roamingRepository.findById(new ID(roamingGroupID)).get(); RoamingGroup want = new RoamingGroup( new ID(roamingGroupID), "newName", "newDescription", RoamingGroupType.INTERNATIONAL, Lists.newArrayList(new Operator(new ID(operatorID), "name", OperatorState.ACTIVE, "description", "dName", "fName", "emergency")) ); assertThat(got, deepEquals(want)); }</code><technical_language>upadateRoamingGroupWithOperators</technical_language>

Target:
public void update() throws Exception { Object operID = operatorRepository.create(new NewOperator("name", OperatorState.ACTIVE, "description", "dName", "fName", "emergency")); Object groupID = roamingRepository.create(new NewRoamingGroup("name", "description", RoamingGroupType.REGIONAL)); roamingRepository.assignOperators(new ID(groupID), Lists.newArrayList(new ID(operID))); RoamingGroupRequest newRoamingGroup = new RoamingGroupRequest(new ID(groupID), "newName", "newDescription", RoamingGroupType.INTERNATIONAL); roamingRepository.update(newRoamingGroup); RoamingGroup got = roamingRepository.findById(new ID(groupID)).get(); RoamingGroup want = new RoamingGroup( new ID(groupID), "newName", "newDescription", RoamingGroupType.INTERNATIONAL, Lists.newArrayList(new Operator(new ID(operID), "name", OperatorState.ACTIVE, "description", "dName", "fName", "emergency")) ); assertThat(got, deepEquals(want)); }
Source:
<code>public void before() { processorListenerState = new HashMap<String, Boolean>() { { put(ON_START, false); put(ON_FAILURE, false); put(ON_SHUTDOWN, false); <START> } <END> }; }</code><technical_language>alternative a Set instead of a Map assume membership in set means event detected. Clearing out set is simply a call .clear(). If prefer Map enum iterating values error prone for additional states</technical_language>

Target:
public void before() { processorListenerState = new ConcurrentHashMap<ListenerCallback, Boolean>() { { put(ListenerCallback.ON_START, false); put(ListenerCallback.ON_FAILURE, false); put(ListenerCallback.ON_SHUTDOWN, false); } }; }
Source:
<code><START> public String generateAppKeys() throws APIManagerIntegrationTestException { <END> APPKeyRequestGenerator appKeyRequestGenerator = new APPKeyRequestGenerator(TEST_APPLICATION_NAME); HttpResponse keyGenerationResponse = null; try { keyGenerationResponse = apiStore.generateApplicationKey(appKeyRequestGenerator); } catch (APIManagerIntegrationTestException e) { String error = "Error in generating Application Keys"; throw new APIManagerIntegrationTestException(error, e); } log.info("Key generation response for application \'" + TEST_APPLICATION_NAME + "\' response data :" + keyGenerationResponse.getData()); verifyResponse(keyGenerationResponse); JSONObject keyGenerationRespData = new JSONObject(keyGenerationResponse.getData()); accessToken = (keyGenerationRespData.getJSONObject("data").getJSONObject("key")) .get("accessToken").toString(); return accessToken; }</code><technical_language>throw APIManagerIntegrationTestException instead throw exception</technical_language>

Target:
public String generateAppKeys() throws Exception { APPKeyRequestGenerator appKeyRequestGenerator = new APPKeyRequestGenerator(TEST_APPLICATION_NAME); HttpResponse keyGenerationResponse = null; keyGenerationResponse = apiStore.generateApplicationKey(appKeyRequestGenerator); log.info("Key generation response for application \'" + TEST_APPLICATION_NAME + "\' response data :" + keyGenerationResponse.getData()); verifyResponse(keyGenerationResponse); JSONObject keyGenerationRespData = new JSONObject(keyGenerationResponse.getData()); accessToken = (keyGenerationRespData.getJSONObject("data").getJSONObject("key")) .get("accessToken").toString(); return accessToken; }
Source:
<code>public void testCreate() { CreateStorageServiceParams storage = api().create(NAME, LOCATION, ImmutableMap.of("property_name", "property_value"), ImmutableMap.of("accountType", StorageService.AccountType.Standard_ZRS.toString())); while (storage == null) { try { Thread.sleep(25 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } storage = api().create(NAME, LOCATION, ImmutableMap.of("property_name", "property_value"), ImmutableMap.of("accountType", StorageService.AccountType.Standard_ZRS.toString())); <START> } <END> assertEquals(storage.location(), LOCATION); assertTrue(!storage.properties().isEmpty()); }</code><technical_language>semantics of create operations? kinda weird attempt create operation N times instead of calling a get operation waiting</technical_language>

Target:
public void testCreate() { URI uri = api().create(NAME, LOCATION, ImmutableMap.of("property_name", "property_value"), ImmutableMap.of("accountType", StorageService.AccountType.Standard_LRS.toString())); if (uri != null){ assertTrue(uri.toString().contains("api-version")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 1 * 1000 ).apply(uri); assertTrue(jobDone, "create operation did not complete in the configured timeout"); } final StorageService service = api().get(NAME); assertNotNull(service); assertEquals(service.location(), LOCATION); assertNotNull(service.storageServiceProperties().creationTime()); }
Source:
<code>private boolean performSecondaryAction() { if (UploadService.hasInProgressMediaUploadsForPost(mEditPostRepository.getPost())) { ToastUtils.showToast(EditPostActivity.this, getString(R.string.editor_toast_uploading_please_wait), Duration.SHORT); return false; } if (isDiscardable()) { showEmptyPostErrorForSecondaryAction(); return false; } switch (getSecondaryAction()) { case SAVE_AS_DRAFT: saveAsDraft(); return true; case SAVE: uploadPost(false); return true; case PUBLISH_NOW: <START> showPrepublishingNudgeBottomSheetBeforePostUpload(); <END> return true; case NONE: throw new IllegalStateException("Switch in `secondaryAction` shouldn't go through the NONE case"); } return false; }</code><technical_language>NitPick: drop BeforePostUpload showPrepublishingNudgeBottomSheetBeforePostUpload, include "Prepublishing" in name conveys meaning</technical_language>

Target:
private boolean performSecondaryAction() { if (UploadService.hasInProgressMediaUploadsForPost(mEditPostRepository.getPost())) { ToastUtils.showToast(EditPostActivity.this, getString(R.string.editor_toast_uploading_please_wait), Duration.SHORT); return false; } if (isDiscardable()) { showEmptyPostErrorForSecondaryAction(); return false; } switch (getSecondaryAction()) { case SAVE_AS_DRAFT: saveAsDraft(); return true; case SAVE: uploadPost(false); return true; case PUBLISH_NOW: showPrepublishingNudgeBottomSheet(); return true; case NONE: throw new IllegalStateException("Switch in `secondaryAction` shouldn't go through the NONE case"); } return false; }
Source:
<code>public void showPleaseRateDialog() { new MaterialDialog.Builder(this) .content(R.string.please_rate) .negativeText(R.string.no_im_good) .positiveText(R.string.will_rate) .onPositive((dialog, which) -> { <START> Uri uri = Uri.parse("market://details?id=" + getApplicationContext().getPackageName()); <END> Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (!(getPackageManager().queryIntentActivities(intent, 0).size() > 0)) { UIUtils.showSnackbar(parent, getString(R.string.play_store_error)); return; } startActivity(intent); }) .show(); }</code><technical_language>Thanks for making this change! before, I getApplicationContext() code nested anonymous class. more exposed lambda, I do getPackageName() activity. Try this if compiles, change. suggestion Uri uri = Uri.parse("market://details?id=" + getPackageName());</technical_language>

Target:
public void showPleaseRateDialog() { new MaterialDialog.Builder(this) .content(R.string.please_rate) .negativeText(R.string.no_im_good) .positiveText(R.string.will_rate) .onPositive((dialog, which) -> { Uri uri = Uri.parse("market://details?id=" + getPackageName()); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (!(getPackageManager().queryIntentActivities(intent, 0).size() > 0)) { UIUtils.showSnackbar(parent, getString(R.string.play_store_error)); return; } startActivity(intent); }) .show(); }
Source:
<code>void handleApplyTransactionFailure(RaftGroupId groupId, RaftProtos.RaftPeerRole role) { UUID dnId = RatisHelper.toDatanodeId(getServer().getId()); String msg = "Ratis Transaction failure in datanode" + dnId + " with role " + role + " Triggering pipeline close action."; <START> triggerPipelineClose(groupId, msg, ClosePipelineInfo.Reason.PIPELINE_FAILED, <END> false); stop(); }</code><technical_language>Do need a new reason code here? Pipeline Failed is overloaded</technical_language>

Target:
void handleApplyTransactionFailure(RaftGroupId groupId, RaftProtos.RaftPeerRole role) { UUID dnId = RatisHelper.toDatanodeId(getServer().getId()); String msg = "Ratis Transaction failure in datanode " + dnId + " with role " + role + " .Triggering pipeline close action."; triggerPipelineClose(groupId, msg, ClosePipelineInfo.Reason.STATEMACHINE_TRANSACTION_FAILED, true); }
Source:
<code>private Unloaded<?> make(TypePool typePool, DynamicType.Builder<?> builder) { classRewriter.installReflectionMethodVisitors( builder ); Unloaded<?> unloadedClass; if ( typePool != null ) { unloadedClass = builder.make( typePool ); } else { unloadedClass = builder.make(); } if ( DEBUG ) { try { unloadedClass.saveIn( new File( System.getProperty( "java.io.tmpdir" ) + "/bytebuddy/" ) ); } catch (IOException e) { LOG.warn( "Unable to save generated class %1$s", unloadedClass.getTypeDescription().getName(), e ); } } <START> classRewriter.registerAuthorizedClass( unloadedClass.getTypeDescription().getName() ); <END> return unloadedClass; }</code><technical_language>calling ,getTypeDescription().getName() security manager is enabled, while previously didn't. I if matters (performance?), I thought warn you</technical_language>

Target:
private Unloaded<?> make(TypePool typePool, DynamicType.Builder<?> builder) { classRewriter.installReflectionMethodVisitors( builder ); Unloaded<?> unloadedClass; if ( typePool != null ) { unloadedClass = builder.make( typePool ); } else { unloadedClass = builder.make(); } if ( DEBUG ) { try { unloadedClass.saveIn( new File( System.getProperty( "java.io.tmpdir" ) + "/bytebuddy/" ) ); } catch (IOException e) { LOG.warn( "Unable to save generated class %1$s", unloadedClass.getTypeDescription().getName(), e ); } } classRewriter.registerAuthorizedClass( unloadedClass ); return unloadedClass; }
Source:
<code>public static String deleteFileList(final Iterable<Path> files) { if (Iterables.isEmpty(files)) { return "No matching recovery files found."; } final StringBuffer fileList = new StringBuffer("Deleted:\n"); try { <START> for (Path file : files) { <END> final RecoveryJob job = getRecoveryJobByName(file.getFileName().toString()); Files.delete(file); fileList.append(job.toString()); fileList.append("\n"); } return fileList.toString(); } catch (final IOException e) { return e.getMessage(); } }</code><technical_language>missing final</technical_language>

Target:
public static String deleteFileList(final Iterable<Path> files) { if (Iterables.isEmpty(files)) { return "No matching recovery files found."; } final StringBuffer fileList = new StringBuffer("Deleted:\n"); try { for (final Path file : files) { final RecoveryJob job = getRecoveryJobByName(file.getFileName().toString()); Files.delete(file); fileList.append(job.toString()); fileList.append("\n"); } return fileList.toString(); } catch (final IOException e) { return e.getMessage(); } }
Source:
<code>BlockOutputStreamEntry allocateBlockIfNeeded() throws IOException { BlockOutputStreamEntry streamEntry = getCurrentStreamEntry(); if (streamEntry != null && streamEntry.isClosed()) { currentStreamIndex++; } if (streamEntries.size() <= currentStreamIndex) { Preconditions.checkNotNull(omClient); int succeededAllocates = 0; try { allocateNewBlock(); succeededAllocates += 1; } catch (IOException ioe) { LOG.error("Try to allocate more blocks for write failed, already " <START> + "allocated " + succeededAllocates + " blocks for this write.", <END> ioe); throw ioe; } } Preconditions.checkArgument(currentStreamIndex < streamEntries.size()); BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); return current; }</code><technical_language>suggestion + "allocated blocks for this write.", succeededAllocates, ioe);</technical_language>

Target:
BlockOutputStreamEntry allocateBlockIfNeeded() throws IOException { BlockOutputStreamEntry streamEntry = getCurrentStreamEntry(); if (streamEntry != null && streamEntry.isClosed()) { currentStreamIndex++; } if (streamEntries.size() <= currentStreamIndex) { Preconditions.checkNotNull(omClient); int succeededAllocates = 0; try { allocateNewBlock(); succeededAllocates += 1; } catch (IOException ioe) { LOG.error("Try to allocate more blocks for write failed, already " + "allocated blocks for this write.", succeededAllocates, ioe); throw ioe; } } Preconditions.checkArgument(currentStreamIndex < streamEntries.size()); BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); return current; }
Source:
<code>public Class<?>[] getParameterTypes() { <START> return SuspendMethod.trimSuspendParameterTypes(method.getParameterTypes()); <END> }</code><technical_language>create field class contains trimmed parameter types? This method is invoked frequently (with invocation mock), trimming time :)</technical_language>

Target:
public Class<?>[] getParameterTypes() { return parameterTypes; }
Source:
<code>public void addChangeListener(ChangeListener listener, IdentifiedUser user) { <START> ChangeListenerHolder holder = new ChangeListenerHolder(listener, user); <END> listeners.put(listener, holder); }</code><technical_language>Style-nit: code shorter if remove holder variable: listeners.put(listener, new ChangeListenerHolder(listener, user));</technical_language>

Target:
public void addChangeListener(ChangeListener listener, IdentifiedUser user) { listeners.put(listener, new ChangeListenerHolder(listener, user)); }
Source:
<code>UsageCapacityInArrearDetail computeToBeBilledCapacityInArrear(final List<RolledUpUnit> roUnits) throws CatalogApiException { <START> Preconditions.checkState(isBuilt.get()); <END> final List<Tier> tiers = getCapacityInArrearTier(usage); final Set<String> perUnitTypeDetailTierLevel = new HashSet<String>(); int tierNum = 0; final List<UsageInArrearTierUnitDetail> toBeBilledDetails = Lists.newLinkedList(); for (final Tier cur : tiers) { tierNum++; boolean complies = true; for (final RolledUpUnit ro : roUnits) { final Limit tierLimit = getTierLimit(cur, ro.getUnitType()); if (tierLimit.getMax() != (double) -1 && ro.getAmount().doubleValue() > tierLimit.getMax()) { complies = false; } else { if (!perUnitTypeDetailTierLevel.contains(ro.getUnitType())) { toBeBilledDetails.add(new UsageConsumableInArrearTierUnitDetail(tierNum, ro.getUnitType(), cur.getRecurringPrice().getPrice(getCurrency()), 1, ro.getAmount().intValue(), BigDecimal.ZERO)); perUnitTypeDetailTierLevel.add(ro.getUnitType()); } } } if (complies) { return new UsageCapacityInArrearDetail(toBeBilledDetails, cur.getRecurringPrice().getPrice(getCurrency())); } } final Joiner joiner = Joiner.on(", "); joiner.join(roUnits); Preconditions.checkState(false, "Could not find tier for usage " + usage.getName() + "matching with data = " + joiner.join(roUnits)); return null; }</code><technical_language>Add error message for easier debugging in case hit</technical_language>

Target:
UsageCapacityInArrearDetail computeToBeBilledCapacityInArrear(final List<RolledUpUnit> roUnits) throws CatalogApiException { Preconditions.checkState(isBuilt.get()); final List<Tier> tiers = getCapacityInArrearTier(usage); final Set<String> perUnitTypeDetailTierLevel = new HashSet<String>(); int tierNum = 0; final List<UsageInArrearTierUnitDetail> toBeBilledDetails = Lists.newLinkedList(); for (final Tier cur : tiers) { tierNum++; boolean complies = true; for (final RolledUpUnit ro : roUnits) { final Limit tierLimit = getTierLimit(cur, ro.getUnitType()); if (tierLimit.getMax() != (double) -1 && ro.getAmount().doubleValue() > tierLimit.getMax()) { complies = false; } else { if (!perUnitTypeDetailTierLevel.contains(ro.getUnitType())) { toBeBilledDetails.add(new UsageInArrearTierUnitDetail(tierNum, ro.getUnitType(), cur.getRecurringPrice().getPrice(getCurrency()), ro.getAmount().intValue())); perUnitTypeDetailTierLevel.add(ro.getUnitType()); } } } if (complies) { return new UsageCapacityInArrearDetail(toBeBilledDetails, cur.getRecurringPrice().getPrice(getCurrency())); } } joiner.join(roUnits); Preconditions.checkState(false, "Could not find tier for usage " + usage.getName() + "matching with data = " + joiner.join(roUnits)); return null; }
Source:
<code>public int compare(String a, String b) { boolean aDigits = isAllDigits(a); boolean bDigits = isAllDigits(b); if (aDigits && bDigits) { <START> return Integer.compare(Integer.parseInt(a), Integer.parseInt(b)); <END> } else if (aDigits) { return -1; } else if (bDigits) { return 1; } else { return a.compareTo(b); } }</code><technical_language>I copying this existing code, I this throw if digits integer greater maxint. fix that... (in commit PR...)</technical_language>

Target:
public int compare(String a, String b) { boolean aDigits = isAllDigits(a); boolean bDigits = isAllDigits(b); if (aDigits && bDigits) { return new BigInteger(a).compareTo(new BigInteger(b)); } else if (aDigits) { return -1; } else if (bDigits) { return 1; } else { return a.compareTo(b); } }
Source:
<code>public FeedRegistryHandler() { try { registry = ServiceReferenceHolder.getInstance().getRegistry(); } catch (RegistryException e) { <START> log.error(e.getMessage()); <END> } }</code><technical_language>Log full exception</technical_language>

Target:
public FeedRegistryHandler() { try { registry = ServiceReferenceHolder.getInstance().getRegistry(); } catch (RegistryException e) { log.error("error while handle with registry", e); } }
Source:
<code>private static Proxy defaultProxy() { return new Proxy( Proxy.Type.HTTP, new InetSocketAddress( <START> System.getProperties().getProperty("https.proxyHost"), <END> Integer.parseInt(System.getProperties().getProperty("https.proxyPort")))); }</code><technical_language>change this System.getProperty() match rest of project</technical_language>

Target:
private static Proxy defaultProxy() { return new Proxy( Proxy.Type.HTTP, new InetSocketAddress( System.getProperty("https.proxyHost"), Integer.parseInt(System.getProperty("https.proxyPort")))); }
Source:
<code>public static int getConsumerAddressNum(String serviceUniqueName) { int count = 0; <START> Set<ConsumerInvokerWrapper> providerInvokerWrapperSet = ProviderConsumerRegTable.getConsumerInvoker(serviceUniqueName); <END> for (ConsumerInvokerWrapper consumerInvokerWrapper : providerInvokerWrapperSet) { int addNum = 0; if (consumerInvokerWrapper.getRegistryDirectory().getUrlInvokerMap() != null) { addNum = consumerInvokerWrapper.getRegistryDirectory().getUrlInvokerMap().size(); } count += addNum; } return count; }</code><technical_language>replace public static int getConsumerAddressNum(String serviceUniqueName) { Set<ConsumerInvokerWrapper> providerInvokerWrapperSet = ProviderConsumerRegTable.getConsumerInvoker(serviceUniqueName); return providerInvokerWrapperSet.stream() .map(piw->piw.getRegistryDirectory().getUrlInvokerMap()) .filter(Objects::nonNull) .mapToInt(Map::size).sum(); }</technical_language>

Target:
public static int getConsumerAddressNum(String serviceUniqueName) { Set<ConsumerInvokerWrapper> providerInvokerWrapperSet = ProviderConsumerRegTable.getConsumerInvoker(serviceUniqueName); return providerInvokerWrapperSet.stream() .map(w -> w.getRegistryDirectory().getUrlInvokerMap()) .filter(Objects::nonNull) .mapToInt(Map::size).sum(); }
Source:
<code>public void testSyncWithPOSTAndURLEncoded(){ syncUrl.setSyncScheme(new SyncScheme()); MessageSyncHttpClient client = new MessageSyncHttpClient( <START> getContext(), syncUrl, msg, "777777777", "21" <END> ); HttpUriRequest req = null; try { req = client.getRequest(); } catch (Exception e) assertNotNull(req); assertEquals(HttpPost.class.getCanonicalName(),req.getClass().getCanonicalName()); HttpEntity entity = ((HttpPost) req).getEntity(); assertNotNull(entity); assertEquals(UrlEncodedFormEntity.class.getCanonicalName(),entity.getClass().getCanonicalName()); }</code><technical_language>21 doing? this int? for 777777777 data type string</technical_language>

Target:
public void testSyncWithPOSTAndURLEncoded(){ syncUrl.setSyncScheme(new SyncScheme()); MessageSyncHttpClient client = new MessageSyncHttpClient( getContext(), syncUrl, msg, toNumber, deviceId ); HttpUriRequest req = null; try { req = client.getRequest(); } catch (Exception e) assertNotNull(req); assertEquals(HttpPost.class.getCanonicalName(),req.getClass().getCanonicalName()); HttpEntity entity = ((HttpPost) req).getEntity(); assertNotNull(entity); assertEquals(UrlEncodedFormEntity.class.getCanonicalName(),entity.getClass().getCanonicalName()); }