auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResolvedReferenceType getSuperClass() { try { if (ctClass.getSuperclass() == null) { return new ReferenceTypeImpl(typeSolver.solveType(Object.class.getCanonicalName()), typeSolver); } if (ctClass.getGenericSignature() == null) { return new ReferenceTypeImpl(new JavassistClassDeclaration(ctClass.getSuperclass(), typeSolver), typeSolver); } SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return JavassistUtils.signatureTypeToType(classSignature.getSuperClass(), typeSolver, this).asReferenceType(); } catch (NotFoundException e) { <START> return solveSuperClass(); <END> } catch (BadBytecode e) { throw new RuntimeException(e); } }</code><technical_language>mmm, this NotFoundException</technical_language>

Target:
public ResolvedReferenceType getSuperClass() { try { if (ctClass.getClassFile().getSuperclass() == null) { return new ReferenceTypeImpl(typeSolver.solveType(Object.class.getCanonicalName()), typeSolver); } if (ctClass.getGenericSignature() == null) { return new ReferenceTypeImpl(typeSolver.solveType(JavassistUtils.internalNameToCanonicalName(ctClass.getClassFile().getSuperclass())), typeSolver); } SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return JavassistUtils.signatureTypeToType(classSignature.getSuperClass(), typeSolver, this).asReferenceType(); } catch (BadBytecode e) { throw new RuntimeException(e); } }
Source:
<code>public JsonElement encode(BigDecimal value) { if ( value == null ) { return JsonNull.INSTANCE; } if ( value.scale() > decimalScale ) { <START> log.bigDecimalRounded( value, value.scale(), decimalScale ); <END> } return new JsonPrimitive( value ); }</code><technical_language>here... First, condition is slightly wrong: a big decimal normalized, in case "unscaled value" end zeros, in case require rounding all. For example 12.34 represented 123400 scale 4. a decimalScale of 2, value.scale() > decimalScale, trigger warning fact resulting number applying scale, 1234.00, require rounding. want value.stripTrailingZeros().scale() > decimalScale. Second, I issue a warning rounding. a trace, if want (and please guard computation if ( log.isTrace() )). Rounding big decimals is a problem; a valid case. user want high precision in database, care in index. Third, another problem, more important in opinion: values precise fit in a long scaling rounded, completely wrong. I Elasticsearch behaves, I that, if fail, throw exception side happen. For example try index new BigDecimal(String.valueOf( Long.MAX_VALUE ) + "345") a decimalScale of 0, -2, watch hell break loose</technical_language>

Target:
public JsonElement encode(BigDecimal value) { if ( value == null ) { return JsonNull.INSTANCE; } if ( isTooLarge( value ) ) { throw log.scaledNumberTooLarge( value ); } return new JsonPrimitive( value ); }
Source:
<code>public void show(LocalHotspot localHotspot) { openTab(SonarLintToolWindowFactory.TAB_HOTSPOTS); ContentManager contentManager = getToolWindow().getContentManager(); Content content = contentManager.findContent(SonarLintToolWindowFactory.TAB_HOTSPOTS); <START> if(content.getComponent() instanceof SonarLintHotspotsPanel) { <END> SonarLintHotspotsPanel sonarLintHotspotsPanel = (SonarLintHotspotsPanel) content.getComponent(); sonarLintHotspotsPanel.setHotspot(localHotspot); } }</code><technical_language>Formatter ;)</technical_language>

Target:
public void show(LocalHotspot localHotspot) { openTab(SonarLintToolWindowFactory.TAB_HOTSPOTS); ContentManager contentManager = getToolWindow().getContentManager(); Content content = contentManager.findContent(SonarLintToolWindowFactory.TAB_HOTSPOTS); SonarLintHotspotsPanel sonarLintHotspotsPanel = (SonarLintHotspotsPanel) content.getComponent(); sonarLintHotspotsPanel.setHotspot(localHotspot); }
Source:
<code>protected Map<String, String> getDefaultAwardAccountAttributes() { String defaultAttributes = parameterService.getParameterValueAsString(RassStep.class, RassParameterConstants.DEFAULT_AWARD_ACCOUNT); if (StringUtils.countMatches(defaultAttributes, CUKFSConstants.COLON) != 2) { throw new RuntimeException("Default Award Account KFS System Parameter must contain two colon separators."); } String defaultChart = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); defaultAttributes = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); String defaultAccountNumber = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); <START> String defaulAccountActiveIndicator = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); <END> if (StringUtils.isBlank(defaultChart) || StringUtils.isBlank(defaultAccountNumber) || StringUtils.isBlank(defaulAccountActiveIndicator)) { throw new RuntimeException("Default Award Account KFS System Parameter cannot have a blank chart or account or account active indicator."); } Map<String, String> defaultValuePairs = new HashMap<String, String>(); defaultValuePairs.put(KFSPropertyConstants.CHART, defaultChart); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_NUMBER, defaultAccountNumber); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR, defaulAccountActiveIndicator); return defaultValuePairs; }</code><technical_language>Minor typo in variable name; changed "defaulAccountActiveIndicator" "defaultAccountActiveIndicator"</technical_language>

Target:
protected Map<String, String> getDefaultAwardAccountAttributes() { String defaultAttributes = parameterService.getParameterValueAsString(RassStep.class, RassParameterConstants.DEFAULT_AWARD_ACCOUNT); if (StringUtils.countMatches(defaultAttributes, CUKFSConstants.COLON) != 2) { throw new RuntimeException("Default Award Account KFS System Parameter must contain two colon separators."); } String defaultChart = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); defaultAttributes = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); String defaultAccountNumber = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); String defaultAccountActiveIndicator = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); if (StringUtils.isBlank(defaultChart) || StringUtils.isBlank(defaultAccountNumber) || StringUtils.isBlank(defaultAccountActiveIndicator)) { throw new RuntimeException("Default Award Account KFS System Parameter cannot have a blank chart or account or account active indicator."); } Map<String, String> defaultValuePairs = new HashMap<String, String>(); defaultValuePairs.put(KFSPropertyConstants.CHART, defaultChart); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_NUMBER, defaultAccountNumber); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR, defaultAccountActiveIndicator); return defaultValuePairs; }
Source:
<code>protected boolean validate() { StorageServerConnections paramConnection = getConnection(); if (StringUtils.isNotEmpty(paramConnection.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_NOT_EMPTY); } if (!isValidConnection(paramConnection)) { return false; } Guid storagePoolId = Guid.isNullOrEmpty(getParameters().getVdsId()) ? null : getVds().getStoragePoolId(); String duplicateConnectionId = isConnWithSameDetailsExists(paramConnection, storagePoolId); String <START> currentConnectionId = <END> paramConnection.getId(); if (!duplicateConnectionId.equalsIgnoreCase(currentConnectionId)) { String storageDomainName = getStorageNameByConnectionId(duplicateConnectionId); addValidationMessageVariable("connectionId", duplicateConnectionId); addValidationMessageVariable("storageDomainName", storageDomainName); return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS); } if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { if (getVds() == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (getVds().getStatus() != VDSStatus.Up) { return failValidation(EngineMessage.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } } return true; }</code><technical_language>remove this new variable declaration call: paramConnection.getId() in if statement in line #88</technical_language>

Target:
protected boolean validate() { StorageServerConnections paramConnection = getConnection(); if (StringUtils.isNotEmpty(paramConnection.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_NOT_EMPTY); } if (!isValidConnection(paramConnection)) { return false; } Guid storagePoolId = Guid.isNullOrEmpty(getParameters().getVdsId()) ? null : getVds().getStoragePoolId(); String duplicateConnectionId = isConnWithSameDetailsExists(paramConnection, storagePoolId); if (!duplicateConnectionId.isEmpty() && !duplicateConnectionId.equalsIgnoreCase(paramConnection.getId())) { String storageDomainName = getStorageNameByConnectionId(duplicateConnectionId); addValidationMessageVariable("connectionId", duplicateConnectionId); addValidationMessageVariable("storageDomainName", storageDomainName); return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS); } if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { if (getVds() == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (getVds().getStatus() != VDSStatus.Up) { return failValidation(EngineMessage.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } } return true; }
Source:
<code>public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (positionOffset == 0 && length == positionOffset && arrayOffset == 0 && positionCount == values.length) { return this; } <START> positionOffset += arrayOffset; <END> boolean[] newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length); byte[] newValues = Arrays.copyOfRange(values, positionOffset, positionOffset + length); return new ByteArrayBlock(length, newValueIsNull, newValues); }</code><technical_language>A Block is a mutable data structure. Is obvious safe return non-copy copyRegion method? _If is_, consider renaming method avoid confusion in future</technical_language>

Target:
public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); positionOffset += arrayOffset; boolean[] newValueIsNull = compactArray(valueIsNull, positionOffset, length); byte[] newValues = compactArray(values, positionOffset, length); if (newValueIsNull == valueIsNull && newValues == values) { return this; } return new ByteArrayBlock(length, newValueIsNull, newValues); }
Source:
<code>public String retrieveReport(ServiceContext context, String endPoint) throws Exception { HttpGet request = new HttpGet(endPoint); request.addHeader("User-Agent", USER_AGENT); request.addHeader("Accept", ACCEPT); ClientHttpResponse response = null; <START> try { <END> response = this.execute(context, request); return IOUtils.toString(response.getBody(), StandardCharsets.UTF_8.name()); } catch (Exception e) { Log.warning(Log.SERVICE, "Error calling INSPIRE service to retrieve the result report: " + endPoint, e); throw e; } finally { request.completed(); request.releaseConnection(); response.close(); } }</code><technical_language>try-with-resources syntax remove finally clause? java try (ClientHttpResponse response = this.execute(context, request)) { ... } catch (Exception e) { ... }</technical_language>

Target:
public String retrieveReport(ServiceContext context, String endPoint) throws Exception { HttpGet request = new HttpGet(endPoint); request.addHeader("User-Agent", USER_AGENT); request.addHeader("Accept", ACCEPT); try (ClientHttpResponse response = this.execute(context, request)) { return IOUtils.toString(response.getBody(), StandardCharsets.UTF_8.name()); } catch (Exception e) { Log.warning(Log.SERVICE, "Error calling INSPIRE service to retrieve the result report: " + endPoint, e); throw e; } }
Source:
<code>public void addsCookieToResponse() throws IOException { MatcherAssert.assertThat( new RsPrint( new RsWithCookie( new RsEmpty(), RsWithCookieTest.FOO, RsWithCookieTest.WORKS, RsWithCookieTest.PATH ) ).print(), Matchers.equalTo( <START> Joiner.on(RsWithCookieTest.CRLF).join( <END> RsWithCookieTest.HTTP_OK, RsWithCookieTest.SET_COOKIE, "", "" ) ) ); }</code><technical_language>@dalifreire move this joiner logic a private method</technical_language>

Target:
public void addsCookieToResponse() throws IOException { final String foo = "foo"; final String works = "works?"; final String path = "Path=/"; MatcherAssert.assertThat( new RsPrint( new RsWithCookie( new RsEmpty(), foo, works, path ) ).print(), Matchers.equalTo( RsWithCookieTest.cookies( RsWithCookieTest.formatCookie(foo, works, path) ) ) ); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: return getSucceeded() ? (isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM : AuditLogType.USER_ADD_FLOATING_DISK) : (isAddToVm ? AuditLogType.USER_FAILED_ADD_DISK_TO_VM : AuditLogType.USER_FAILED_ADD_FLOATING_DISK); case END_SUCCESS: <START> return getSucceeded() ? (isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_SUCCESS <END> : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_SUCCESS) : (isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_FAILURE); default: return AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE; } }</code><technical_language>if in END_SUCCESS hell do need check getSucceeded? Also, added 4 nested 'if' statements do code readable</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { boolean isAddToVm = !Guid.Empty.equals(getParameters().getVmId()); switch (getActionState()) { case EXECUTE: if (getSucceeded()) { return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM : AuditLogType.USER_ADD_FLOATING_DISK; } return isAddToVm ? AuditLogType.USER_FAILED_ADD_DISK_TO_VM : AuditLogType.USER_FAILED_ADD_FLOATING_DISK; case END_SUCCESS: if (getSucceeded()) { return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_SUCCESS : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_SUCCESS; } return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_FAILURE; default: return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_FAILURE; } }
Source:
<code>public void setApplication(ApplicationConfig application) { if (!ConfigManager.getInstance().getApplication().isPresent() || !ConfigManager.getInstance().getApplication().get().equals(application)) { ConfigManager.getInstance().setApplication(application); <START> } <END> this.application = application; }</code><technical_language>need this logic? logic, including null check duplicate check implemented in org.apache.dubbo.config.context.ConfigManager#setApplication. added again? other change in this file</technical_language>

Target:
public void setApplication(ApplicationConfig application) { ConfigManager.getInstance().setApplication(application); this.application = application; }
Source:
<code>public DruidQueryGeneratorContext visitTableScan(TableScanNode node, DruidQueryGeneratorContext contextIn) { DruidTableHandle tableHandle = (DruidTableHandle) node.getTable().getConnectorHandle(); checkArgument(!tableHandle.getDql().isPresent(), "Druid tableHandle should not have dql before pushdown"); <START> LinkedHashMap<VariableReferenceExpression, Selection> selections = new LinkedHashMap<>(); <END> node.getOutputVariables().forEach(outputColumn -> { DruidColumnHandle druidColumn = (DruidColumnHandle) (node.getAssignments().get(outputColumn)); selections.put(outputColumn, new Selection(druidColumn.getColumnName(), TABLE_COLUMN)); }); return new DruidQueryGeneratorContext(selections, tableHandle.getTableName()); }</code><technical_language>Map</technical_language>

Target:
public DruidQueryGeneratorContext visitTableScan(TableScanNode node, DruidQueryGeneratorContext contextIn) { DruidTableHandle tableHandle = (DruidTableHandle) node.getTable().getConnectorHandle(); checkArgument(!tableHandle.getDql().isPresent(), "Druid tableHandle should not have dql before pushdown"); Map<VariableReferenceExpression, Selection> selections = new LinkedHashMap<>(); node.getOutputVariables().forEach(outputColumn -> { DruidColumnHandle druidColumn = (DruidColumnHandle) (node.getAssignments().get(outputColumn)); selections.put(outputColumn, new Selection(druidColumn.getColumnName(), TABLE_COLUMN)); }); return new DruidQueryGeneratorContext(selections, tableHandle.getTableName()); }
Source:
<code>public Collection<ContainerSpec> listContainerSpec(String serverTemplateId) { <START> ContainerSpecList containerSpecList = makeGetRequestAndCreateCustomResponse(controllerBaseUrl + "/management/servers" + serverTemplateId + "/containers", ContainerSpecList.class); <END> if (containerSpecList != null && containerSpecList.getContainerSpecs() != null) { return Arrays.asList(containerSpecList.getContainerSpecs()); } return Collections.emptyList(); }</code><technical_language>hardcored urls</technical_language>

Target:
public Collection<ContainerSpec> listContainerSpec(String serverTemplateId) { ContainerSpecList containerSpecList = makeGetRequestAndCreateCustomResponse(controllerBaseUrl + MANAGEMENT_URI_PART + serverTemplateId + CONTAINERS_LAST_URI_PART, ContainerSpecList.class); if (containerSpecList != null && containerSpecList.getContainerSpecs() != null) { return Arrays.asList(containerSpecList.getContainerSpecs()); } return Collections.emptyList(); }
Source:
<code><START> public void close() { <END> if (transactor != null) { try { transactor.close(); } catch (IOException e) { throw new RuntimeException(e); } } if (cache != null) { try { cache.close(); } catch (IOException e) { throw new RuntimeException(e); } } cw.close(); sbw.close(); try { bw.close(); } catch (MutationsRejectedException e) { throw new RuntimeException(e); } curator.close(); }</code><technical_language>this synchronized</technical_language>

Target:
public synchronized void close() { isClosed = true; if (tid != null) { try { tid.close(); } catch (IOException e) { throw new RuntimeException(e); } } if (cache != null) { try { cache.close(); } catch (IOException e) { throw new RuntimeException(e); } } cw.close(); sbw.close(); try { bw.close(); } catch (MutationsRejectedException e) { throw new RuntimeException(e); } curator.close(); }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (bus == null) { registerBus(); } if (requestCode == SettingsActivity.ACTIVITY_REQUEST_SHOW_SETTINGS) { <START> if (resultCode == SettingsActivity.ACTIVITY_RESULT_LANGUAGE_CHANGED) { <END> Handler uiThread = new Handler(Looper.getMainLooper()); uiThread.postDelayed(new Runnable() { @Override public void run() { displayMainPage(true); Intent widgetIntent = new Intent(getApplicationContext(), WidgetProviderFeaturedPage.class); widgetIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); int[] ids = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds( new ComponentName(getApplication(), WidgetProviderFeaturedPage.class)); widgetIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids); sendBroadcast(widgetIntent); } }, DateUtils.SECOND_IN_MILLIS); } else if (resultCode == SettingsActivity.ACTIVITY_RESULT_LOGOUT) { doLogout(); } } if ((requestCode == ACTIVITY_REQUEST_LANGLINKS && resultCode == LangLinksActivity.ACTIVITY_RESULT_LANGLINK_SELECT)) { fragmentContainerView.post(new Runnable() { @Override public void run() { handleIntent(data); } }); } else if ((requestCode == ACTIVITY_REQUEST_GALLERY && resultCode == GalleryActivity.ACTIVITY_RESULT_FILEPAGE_SELECT)) { fragmentContainerView.post(new Runnable() { @Override public void run() { handleIntent(data); } }); } else { super.onActivityResult(requestCode, resultCode, data); } }</code><technical_language>awesome this a separate method, onSettingsResult()? onActivityResult get big quick of results end handling</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (bus == null) { registerBus(); } if (settingsActivityRequested(requestCode)) { handleSettingsActivityResult(resultCode); } else if (newArticleLanguageSelected(requestCode, resultCode) || galleryFilePageSelected(requestCode, resultCode)) { handleLangLinkOrFilePageResult(data); } else { super.onActivityResult(requestCode, resultCode, data); } }
Source:
<code>int offer(FragmentResponseMessage message) { <START> if (message instanceof FragmentResponseMessage) { <END> FragmentResponseMessage msg = (FragmentResponseMessage)message; long hash = 0; for (int i = 0; i < msg.getTableCount(); i++) { int depId = msg.getTableDependencyIdAtIndex(i); VoltTable dep = msg.getTableAtIndex(i); List<VoltTable> tables = m_alldeps.get(depId); if (tables == null) { tables = new ArrayList<VoltTable>(); m_alldeps.put(depId, tables); } if (!msg.isRecovering()) { if (!tables.isEmpty() && tables.get(0).getStatusCode() == VoltTableUtil.NULL_DEPENDENCY_STATUS) { tables.clear(); } hash ^= MiscUtils.cheesyBufferCheckSum(dep.getBuffer()); } else { if (!tables.isEmpty()) { continue; } } tables.add(dep); } int[] hashes = new int[] { (int) hash, 0, 0 }; return checkCommon(hashes, msg.isRecovering(), message, false); } return super.offer(message); }</code><technical_language>get rid of instanceof here</technical_language>

Target:
int offer(FragmentResponseMessage message) { long hash = 0; for (int i = 0; i < message.getTableCount(); i++) { int depId = message.getTableDependencyIdAtIndex(i); VoltTable dep = message.getTableAtIndex(i); List<VoltTable> tables = m_alldeps.get(depId); if (tables == null) { tables = new ArrayList<VoltTable>(); m_alldeps.put(depId, tables); } if (!message.isRecovering()) { if (!tables.isEmpty() && tables.get(0).getStatusCode() == VoltTableUtil.NULL_DEPENDENCY_STATUS) { tables.clear(); } hash ^= MiscUtils.cheesyBufferCheckSum(dep.getBuffer()); } else { if (!tables.isEmpty()) { continue; } } tables.add(dep); } int[] hashes = new int[] { (int) hash, 0, 0 }; return checkCommon(hashes, message.isRecovering(), message, false); }
Source:
<code>public void close(String namespace) { level1.close(namespace); <START> level2.close(namespace); <END> }</code><technical_language>concern below, please try-finally</technical_language>

Target:
public void close(String namespace) { Throwable t = null; try { level1.close(namespace); } catch (Throwable t1) { t = t1; throw t1; } finally { if (t != null) { try { level2.close(namespace); } catch (Throwable t2) { t.addSuppressed(t2); } } else { level2.close(namespace); } } }
Source:
<code>HealthStatus getHealthStatusForMetric(String serviceName, EndpointStatistics endpointStatistics, String metricName, double rateThreshold, long steadyStateP99Limit, long quietP99Limit, double errorRateProportion) { if (endpointStatistics.getP99() > quietP99Limit && endpointStatistics.getOneMin() > 0) { log.info("[Service - {}] | Point health status for is UNHEALTHY as the quiet state p99 is very high - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("quietP99Limit", endpointStatistics.getP99())); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getOneMin() < rateThreshold) { log.info("[Service - {}] | Point health status for is UNKNOWN as the request rate is low - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("oneMinRate", endpointStatistics.getOneMin())); return HealthStatus.UNKNOWN; } double errorProportion = getErrorProportion(endpointStatistics); if (errorProportion > errorRateProportion) { log.info("[Service - {}] | Point health status for is UNHEALTHY due to high error proportion - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), SafeArg.of("errorProportion", errorProportion)); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getP99() > steadyStateP99Limit) { log.info("[Service - {}] | Point health status for is UNHEALTHY due to high p99 - {}", SafeArg.of("service", serviceName), SafeArg.of("metricName", metricName), <START> SafeArg.of("p99", endpointStatistics.getP99())); <END> return HealthStatus.UNHEALTHY; } return HealthStatus.HEALTHY; }</code><technical_language>suggest logging EndpointStatistics for visibility</technical_language>

Target:
HealthStatus getHealthStatusForMetric(String serviceName, EndpointStatistics endpointStatistics, String metricName, double rateThreshold, long steadyStateP99Limit, long quietP99Limit, double errorRateProportion) { if (endpointStatistics.getP99() > quietP99Limit && endpointStatistics.getOneMin() > 0) { logHealthInfo(serviceName, metricName, HealthStatus.UNHEALTHY, "higher p99 than what we allow in quiet state", endpointStatistics); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getOneMin() < rateThreshold) { logHealthInfo(serviceName, metricName, HealthStatus.UNKNOWN, "low request rate", endpointStatistics); return HealthStatus.UNKNOWN; } double errorProportion = getErrorProportion(endpointStatistics); if (errorProportion > errorRateProportion) { logHealthInfo(serviceName, metricName, HealthStatus.UNHEALTHY, "high error proportion", endpointStatistics); return HealthStatus.UNHEALTHY; } if (endpointStatistics.getP99() > steadyStateP99Limit) { logHealthInfo(serviceName, metricName, HealthStatus.UNHEALTHY, "high p99", endpointStatistics); return HealthStatus.UNHEALTHY; } return HealthStatus.HEALTHY; }
Source:
<code><START> private void mockFlowDoesNotExist() throws Exception { <END> final Map<String, Object> executionMap = mockUpdateResponse(); executionMap.put("error", "Flow does not exist"); }</code><technical_language>Do need add ("error", "Flow exist") in executionMap mocking update response for this scenario? Also, ConnectorParams.RESPONSE_ERROR instead of error</technical_language>

Target:
private void mockFlowDoesNotExist() throws Exception { final Map<String, Object> executionMap = mockUpdateResponse(); executionMap.put(ConnectorParams.RESPONSE_ERROR, "Flow does not exist"); }
Source:
<code>protected void unsetWorkflowImplServiceListener(WorkflowImplServiceListener workflowListener) { <START> if(workflowListener !=null) { <END> WorkflowImplServiceDataHolder.getInstance().getWorkflowListenerList() .remove(workflowListener); } }</code><technical_language>Do need null check ? I register a service null object. formatting is wrong: != null</technical_language>

Target:
protected void unsetWorkflowImplServiceListener(WorkflowImplServiceListener workflowListener) { WorkflowImplServiceDataHolder.getInstance().getWorkflowListenerList().remove(workflowListener); }
Source:
<code>public void testDemo() { parseCode(TEST_DEMO); ASTMethodDeclaration node = acu.findDescendantsOfType(ASTMethodDeclaration.class).get(0); Scope s = node.getScope(); Map<NameDeclaration, List<NameOccurrence>> m = s.getDeclarations(); for (Map.Entry<NameDeclaration, List<NameOccurrence>> entry : m.entrySet()) { assertEquals("buz", entry.getKey().getImage()); assertEquals("ArrayList", ((TypedNameDeclaration) entry.getKey()).getTypeImage()); <START> List<NameOccurrence> u = m.get(entry.getKey()); <END> assertEquals(1, u.size()); NameOccurrence o = u.get(0); int beginLine = o.getLocation().getBeginLine(); assertEquals(3, beginLine); } }</code><technical_language>This is wrong, entry.getValue()</technical_language>

Target:
public void testDemo() { parseCode(TEST_DEMO); ASTMethodDeclaration node = acu.findDescendantsOfType(ASTMethodDeclaration.class).get(0); Scope s = node.getScope(); Map<NameDeclaration, List<NameOccurrence>> m = s.getDeclarations(); for (Map.Entry<NameDeclaration, List<NameOccurrence>> entry : m.entrySet()) { assertEquals("buz", entry.getKey().getImage()); assertEquals("ArrayList", ((TypedNameDeclaration) entry.getKey()).getTypeImage()); List<NameOccurrence> u = entry.getValue(); assertEquals(1, u.size()); NameOccurrence o = u.get(0); int beginLine = o.getLocation().getBeginLine(); assertEquals(3, beginLine); } }
Source:
<code>CryptographyAsyncClient(JsonWebKey key, HttpPipeline pipeline, CryptographyServiceVersion version) { Objects.requireNonNull(key); if (!key.isValid()) { throw new IllegalArgumentException("Json Web Key is not valid"); } if (key.getKeyOps() == null) { throw new IllegalArgumentException("Json Web Key's key operations property is not configured"); } if (key.getKeyType() == null) { throw new IllegalArgumentException("Json Web Key's key type property is not configured"); } this.key = key; service = RestProxy.create(CryptographyService.class, pipeline); if (!Strings.isNullOrEmpty(key.getKeyId())) { <START> unpackAndValidateId(key.getKeyId()); <END> cryptographyServiceClient = new CryptographyServiceClient(key.getKeyId(), service); } else { cryptographyServiceClient = null; } initializeCryptoClients(); }</code><technical_language>Yay! Glad this is renamed :)</technical_language>

Target:
CryptographyAsyncClient(JsonWebKey key, HttpPipeline pipeline, CryptographyServiceVersion version) { Objects.requireNonNull(key); if (!key.isValid()) { throw new IllegalArgumentException("Json Web Key is not valid"); } if (key.getKeyOps() == null) { throw new IllegalArgumentException("Json Web Key's key operations property is not configured"); } if (key.getKeyType() == null) { throw new IllegalArgumentException("Json Web Key's key type property is not configured"); } this.key = key; service = RestProxy.create(CryptographyService.class, pipeline); if (!Strings.isNullOrEmpty(key.getId())) { unpackAndValidateId(key.getId()); cryptographyServiceClient = new CryptographyServiceClient(key.getId(), service); } else { cryptographyServiceClient = null; } initializeCryptoClients(); }
Source:
<code>private boolean supportsConditionProviders() { ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); return !am.isLowRamDevice() <START> || mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); <END> }</code><technical_language>this line this branch (sorry, forgot mention)</technical_language>

Target:
private boolean supportsConditionProviders() { ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); return !am.isLowRamDevice(); }
Source:
<code>public void setAsText(String string) throws IllegalArgumentException { Focus val = (Focus) super.getValue(); if (val == null) { val = new Focus(); super.setValue(val); } <START> val.setStringValue(string); <END> }</code><technical_language>just: java setValue(new Focus(string));</technical_language>

Target:
public void setAsText(String string) throws IllegalArgumentException { setValue(new Focus(string)); }
Source:
<code><START> public void whenEventIsTooLargeThenResultIsAborted() throws Exception { <END> final EventType eventType = buildDefaultEventType(); final JSONArray batch = buildLargeBatch(1); mockSuccessfulValidation(eventType); final EventPublishResult result = publisher.publish(batch, eventType.getName(), FULL_ACCESS_CLIENT); assertThat(result.getStatus(), equalTo(EventPublishingStatus.ABORTED)); verify(enrichment, times(0)).enrich(any(), any()); verify(partitionResolver, times(0)).resolvePartition(any(), any()); verify(topicRepository, times(0)).syncPostBatch(any(), any()); }</code><technical_language>Please provide a test multibyte chars in message body</technical_language>

Target:
public void whenEventIsTooLargeThenResultIsAborted() throws Exception { final EventType eventType = buildDefaultEventType(); final JSONArray batch = buildLargeBatch(1); mockSuccessfulValidation(eventType); final EventPublishResult result = publisher.publish(batch.toString(), eventType.getName(), FULL_ACCESS_CLIENT); assertThat(result.getStatus(), equalTo(EventPublishingStatus.ABORTED)); verify(enrichment, times(0)).enrich(any(), any()); verify(partitionResolver, times(0)).resolvePartition(any(), any()); verify(topicRepository, times(0)).syncPostBatch(any(), any()); }
Source:
<code>static String minimize(String name) { int maxMnemonic = Math.max(PATH_MAX - 44, 1); String result = name.replaceAll("(%[0-9A-F]{2}|[^a-zA-Z0-9-_.])+", "_"). <START> replaceFirst(".*?(.{0," + maxMnemonic + "}$)", "$1") + <END> "-" + uniqueSuffix(name); assert result.length() <= PATH_MAX : result + " does not fit inside " + PATH_MAX; return result; }</code><technical_language>a lot of regex magic for a simple StringUtils.left(safeName,maxMnemonic) + "-" + uniqueSuffix(name) Obfuscates is done</technical_language>

Target:
static String minimize(String name) { String mnemonic = name.replaceAll("(%[0-9A-F]{2}|[^a-zA-Z0-9-_.])+", "_"); int maxMnemonic = Math.max(PATH_MAX - 53, 1); String result = StringUtils.right(mnemonic, maxMnemonic) + "-" + uniqueSuffix(name); assert result.length() <= PATH_MAX : result + " does not fit inside " + PATH_MAX; return result; }
Source:
<code>public QueuableTask nextTaskToLaunch() throws TaskQueueException { ResAllocs remaining = null; for (QueueBucket bucket : sortedBuckets.getSortedList()) { final QueuableTask task = bucket.nextTaskToLaunch(); if (task != null) { if (bucket.isBelowGuaranteedConsumption()) { return task; } if (remaining == null) { ResAllocs totalTierResources = availableTierResGetter.get(); <START> ResAllocs used = ResAllocsUtil.addAll(sortedBuckets.getSortedList().stream().map(QueueBucket::getUsedOrGuaranteed).collect(Collectors.toList())); <END> remaining = ResAllocsUtil.subtract(totalTierResources, used); } if (!ResAllocsUtil.isLess(task, remaining)) { return task; } } } return null; }</code><technical_language>This is expensive computation for task is assigned resources. resources a running count in Tier.totals. However, need get ceiling, implies Tier object need maintain running counts. is actual usage, right now, another counts ceiling</technical_language>

Target:
public QueuableTask nextTaskToLaunch() throws TaskQueueException { ResAllocs remaining = ResAllocsUtil.subtract(tierSla.getTierAlloc(), tierUsage.getUsage().getEffective()); for (QueueBucket bucket : sortedBuckets.getSortedList()) { final QueuableTask task = bucket.nextTaskToLaunch(); if (task != null) { if (bucket.isBelowGuaranteedConsumption()) { return task; } if (!ResAllocsUtil.isLess(task, remaining)) { return task; } } } return null; }
Source:
<code>public Choices getBestMatch(String field, String text, Collection collection, String locale) { String formName; try { formName = Utils.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getBestMatch(field, text, collection, locale); } catch (DCInputsReaderException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>Please a logger</technical_language>

Target:
public Choices getBestMatch(String field, String text, Collection collection, String locale) { String formName; try { init(); if(collection==null) { Set<Choice> choices = new HashSet<Choice>(); for(ChoiceAuthority ca : delegates.values()) { Choices tmp = ca.getBestMatch(field, text, null, locale); if(tmp.total>0) { Set<Choice> mySet = new HashSet<Choice>(Arrays.asList(tmp.values)); choices.addAll(mySet); } } if(!choices.isEmpty()) { Choice[] results = new Choice[choices.size()-1]; choices.toArray(results); return new Choices(results, 0, choices.size(), Choices.CF_UNCERTAIN, false); } } else { formName = dci.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getBestMatch(field, text, collection, locale); } } catch (DCInputsReaderException e) { log.error(e.getMessage(), e); } return new Choices(Choices.CF_NOTFOUND); }
Source:
<code>private List<String> getOrderedDimValues(ServiceMetricEvent event) { String prefixKey = getPrefixKey(event.getMetric(), whiteListDimsMapper); if (prefixKey == null) { return null; } ImmutableList.Builder<String> outputList = new ImmutableList.Builder(); Set<String> dimensions = whiteListDimsMapper.get(prefixKey); if (dimensions == null) { return Collections.emptyList(); } for (String dimKey : dimensions) { String dimValue = (String) event.getUserDims().get(dimKey); if (dimValue != null) { <START> outputList.add(NoopGraphiteEventConverter.sanitize(dimValue)); <END> } } return outputList.build(); }</code><technical_language>WhiteList converter a method NoopGraphiteEventConverter correct design perspective</technical_language>

Target:
private List<String> getOrderedDimValues(ServiceMetricEvent event) { String prefixKey = getPrefixKey(event.getMetric(), whiteListDimsMapper); if (prefixKey == null) { return null; } ImmutableList.Builder<String> outputList = new ImmutableList.Builder(); Set<String> dimensions = whiteListDimsMapper.get(prefixKey); if (dimensions == null) { return Collections.emptyList(); } for (String dimKey : dimensions) { String dimValue = (String) event.getUserDims().get(dimKey); if (dimValue != null) { outputList.add(GraphiteEmitter.sanitize(dimValue)); } } return outputList.build(); }
Source:
<code>private void navigateMySite() { clickOn(R.id.nav_sites); waitForElementToBeDisplayedWithoutFailure(R.id.row_blog_posts); <START> takeScreenshot("4-screenshot-my-site"); <END> }</code><technical_language>change this 4-keep-tabs-on-your-site</technical_language>

Target:
private void navigateMySite() { clickOn(R.id.nav_sites); waitForElementToBeDisplayedWithoutFailure(R.id.row_blog_posts); takeScreenshot("4-keep-tabs-on-your-site"); }
Source:
<code>private void generateResult() throws DbException { for (TupleBatch tb : groupStates.getData().getAll()) { List<Column<?>> columns = new ArrayList<Column<?>>(); for (int i = 0; i < gfields.length; ++i) { <START> columns.add(tb.getDataColumns().get(i)); <END> } for (Aggregator agg : emitAggs) { columns.addAll(agg.emitOutput(tb)); } resultBuffer.absorb(new TupleBatch(getSchema(), columns), true); } groupStates.cleanup(); }</code><technical_language>Nitpick: avoid loop columns.addAll(tb.getDataColumns().subList(0, gfields.length))</technical_language>

Target:
protected void generateResult() throws DbException { if (groupStates.numTuples() == 0) { return; } int stateOffset = gfields.length; for (Aggregator agg : internalAggs) { if (agg instanceof UserDefinedAggregator) { ((UserDefinedAggregator) agg).finalizePythonUpdaters(groupStates.getData(), stateOffset); } stateOffset += agg.getStateSize(); } Schema inputSchema = getChild().getSchema(); for (TupleBatch tb : groupStates.getData().getAll()) { List<Column<?>> columns = new ArrayList<Column<?>>(); columns.addAll(tb.getDataColumns().subList(0, gfields.length)); stateOffset = gfields.length; int emitOffset = 0; for (AggregatorFactory factory : factories) { int stateSize = factory.generateStateSchema(inputSchema).numColumns(); int emitSize = factory.generateSchema(inputSchema).numColumns(); TupleBatch state = tb.selectColumns(MyriaArrayUtils.range(stateOffset, stateSize)); for (GenericEvaluator eval : emitEvals.subList(emitOffset, emitOffset + emitSize)) { columns.add(eval.evalTupleBatch(state, getSchema()).getResultColumns().get(0)); } stateOffset += stateSize; emitOffset += emitSize; } addToResult(columns); } groupStates.cleanup(); }
Source:
<code>public CalendarSet<?> getCalendarSet(PortletRequest request) { final Set<UserDefinedCalendarConfiguration> calendars = new HashSet<UserDefinedCalendarConfiguration>(); final CalendarSet<UserDefinedCalendarConfiguration> set = new CalendarSet<UserDefinedCalendarConfiguration>(calendars); final String username = getUsername(request); <START> if (username != null) { <END> final List<UserDefinedCalendarConfiguration> cals = calendarStore .getCalendarConfigurations(username); calendars.addAll(cals); } return set; }</code><technical_language>log error in this case? username non-null</technical_language>

Target:
public CalendarSet<?> getCalendarSet(PortletRequest request) { final Set<UserDefinedCalendarConfiguration> calendars = new HashSet<UserDefinedCalendarConfiguration>(); final CalendarSet<UserDefinedCalendarConfiguration> set = new CalendarSet<UserDefinedCalendarConfiguration>(calendars); final String username = getUsername(request); if (username != null) { final List<UserDefinedCalendarConfiguration> cals = calendarStore .getCalendarConfigurations(username); calendars.addAll(cals); } else { log.warn("username is null -- returning empty calendar set"); } return set; }
Source:
<code>public boolean isRegistered(VeluxProduct product) { logger.trace("isRegistered(VeluxProduct {}) called.", product.toString()); if (product.isV2()) { return isRegistered(product.getSerialNumber()); <START> } else { <END> return isRegistered(product.getProductUniqueIndex()); } }</code><technical_language>else is redundant here</technical_language>

Target:
public boolean isRegistered(VeluxProduct product) { logger.trace("isRegistered(VeluxProduct {}) called.", product.toString()); if (product.isV2()) { return isRegistered(product.getSerialNumber()); } return isRegistered(product.getProductUniqueIndex()); }
Source:
<code>private void doResolveAllUncached0(String hostname, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) { try { <START> handler.supressFlushes(); <END> final DnsServerAddressStream nameServerAddrs = dnsServerAddressStreamProvider.nameServerAddressStream(hostname); new DnsAddressResolveContext(this, hostname, additionals, nameServerAddrs, resolveCache, authoritativeDnsServerCache).resolve(promise); } finally { handler.mayFlush(); } }</code><technical_language>Is reentrancy a problem? possible</technical_language>

Target:
private void doResolveAllUncached0(String hostname, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) { assert executor().inEventLoop(); final DnsServerAddressStream nameServerAddrs = dnsServerAddressStreamProvider.nameServerAddressStream(hostname); new DnsAddressResolveContext(this, hostname, additionals, nameServerAddrs, resolveCache, authoritativeDnsServerCache).resolve(promise); }
Source:
<code>public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); long time = System.currentTimeMillis(); Map<String, Ref> refsBefore = getAllRefs(); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { nonHeads.addAll(listRefLogObjects(ref, 0)); if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } <START> Set<PackIndex> excluded = new HashSet<PackIndex>(); <END> for (PackFile f : repo.getObjectDatabase().getPacks()) if (new File(f.getPackFile().getPath() + ".keep").exists()) excluded.add(f.getIndex()); tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets, excluded); if (heads != null) { ret.add(heads); excluded.add(heads.getIndex()); } } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets, excluded); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); lastPackedRefs = refsBefore; lastRepackTime = time; return ret; }</code><technical_language>This a List. PackIndex in a set is relying reference equality</technical_language>

Target:
public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); long time = System.currentTimeMillis(); Map<String, Ref> refsBefore = getAllRefs(); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { nonHeads.addAll(listRefLogObjects(ref, 0)); if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } List<PackIndex> excluded = new LinkedList<PackIndex>(); for (PackFile f : repo.getObjectDatabase().getPacks()) if (f.shouldBeKept()) excluded.add(f.getIndex()); tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets, excluded); if (heads != null) { ret.add(heads); excluded.add(0, heads.getIndex()); } } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets, excluded); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); lastPackedRefs = refsBefore; lastRepackTime = time; return ret; }
Source:
<code>public Response<?> apply(ChangeResource resource, Post.Input input) throws AuthException, InvalidChangeOperationException, IOException, ResourceConflictException, OrmException { Optional<ChangeEdit> edit = editUtil.byChange(resource.getChange()); if (!edit.isPresent()) { edit = createEdit(resource.getChange()); } if (input != null && !Strings.isNullOrEmpty(input.path) <START> && input.restore != null && input.restore) { <END> editModifier.restoreFile(edit.get(), input.path); } return Response.none(); }</code><technical_language>restore a path 400</technical_language>

Target:
public Response<?> apply(ChangeResource resource, Post.Input input) throws AuthException, InvalidChangeOperationException, IOException, ResourceConflictException, BadRequestException, OrmException { Optional<ChangeEdit> edit = editUtil.byChange(resource.getChange()); if (!edit.isPresent()) { edit = createEdit(resource.getChange()); } if (input != null && input.restore != null && input.restore) { if (Strings.isNullOrEmpty(input.path)) { throw new BadRequestException("no path provided"); } editModifier.restoreFile(edit.get(), input.path); } return Response.none(); }
Source:
<code>private void handleZoom(MotionEvent event, Camera.Parameters params) { int maxZoom = params.getMaxZoom(); int zoom = params.getZoom(); float newDist = getFingerSpacing(event); if (newDist > mDist) { if (zoom < maxZoom) zoom+=6; } else if (newDist < mDist) { <START> if (zoom > 0) <END> zoom-=6; } mDist = newDist; params.setZoom(zoom); mCamera.setParameters(params); }</code><technical_language>This condition combined</technical_language>

Target:
private void handleZoom(MotionEvent event, Camera.Parameters params) { int maxZoom = params.getMaxZoom(); int zoom = params.getZoom(); float newDist = getFingerSpacing(event); if (newDist > mDist && zoom < maxZoom) { zoom+=6; } else if (newDist < mDist && zoom > 0) { zoom-=6; } mDist = newDist; params.setZoom(zoom); mCamera.setParameters(params); }