auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Map<String, List<MethodMappingInfo>> loadAnnotatedMethods() { Method[] methods = getClass().getDeclaredMethods(); MultiMap<String, MethodMappingInfo> mappedMethods = new MultiMap<String, MethodMappingInfo>(); boolean isUsingAuthAnnot = false; for (int i = 0; i < methods.length; i++) { Method method = methods[i]; MethodMapping methodMapped = method.getAnnotation(MethodMapping.class); AuthorizeInvocation authorizeInvocation = method.getAnnotation(AuthorizeInvocation.class); isUsingAuthAnnot = isUsingAuthAnnot || authorizeInvocation != null; if (methodMapped != null && !method.isBridge()) { HttpMethod httpMethod = methodMapped.httpMethod(); MethodMappingInfo methodMappingInfo = new MethodMappingInfo(methodMapped, method); if (!webSerialDeserial.isMimeTypeSupported(methodMappingInfo.getInputFormat()) || !webSerialDeserial.isMimeTypeSupported(methodMappingInfo.getOutputFormat())) throw new WicketRuntimeException( "Mapped methods use a MIME type not supported by obj serializer/deserializer!"); String key = methodMappingInfo.getSegmentsCount() + "_" + httpMethod.getMethod(); mappedMethods.addValue(key, methodMappingInfo); <START> log.debug("Added mapped method: " + method + " with key: " + key); <END> } } if (isUsingAuthAnnot && roleCheckingStrategy == null) throw new WicketRuntimeException( "Annotation AuthorizeInvocation is used but no role-checking strategy has been set for the controller!"); return CollectionUtils.makeListMapImmutable(mappedMethods); }</code><technical_language>I rewrite log.debug("Added mapped method: " + method + " key: " + key); log.debug("Added mapped method: key: {}", method, key); more effective</technical_language>

Target:
private Map<String, List<MethodMappingInfo>> loadAnnotatedMethods() { Method[] methods = getClass().getDeclaredMethods(); MultiMap<String, MethodMappingInfo> mappedMethods = new MultiMap<String, MethodMappingInfo>(); boolean isUsingAuthAnnot = false; for (int i = 0; i < methods.length; i++) { Method method = methods[i]; MethodMapping methodMapped = method.getAnnotation(MethodMapping.class); AuthorizeInvocation authorizeInvocation = method.getAnnotation(AuthorizeInvocation.class); isUsingAuthAnnot = isUsingAuthAnnot || authorizeInvocation != null; if (methodMapped != null && !method.isBridge()) { HttpMethod httpMethod = methodMapped.httpMethod(); MethodMappingInfo methodMappingInfo = new MethodMappingInfo(methodMapped, method); if (!webSerialDeserial.isMimeTypeSupported(methodMappingInfo.getInputFormat()) || !webSerialDeserial.isMimeTypeSupported(methodMappingInfo.getOutputFormat())) throw new WicketRuntimeException( "Mapped methods use a MIME type not supported by obj serializer/deserializer!"); String key = methodMappingInfo.getSegmentsCount() + "_" + httpMethod.getMethod(); mappedMethods.addValue(key, methodMappingInfo); log.debug("Added mapped method: with key: {}", method, key); } } if (isUsingAuthAnnot && roleCheckingStrategy == null) throw new WicketRuntimeException( "Annotation AuthorizeInvocation is used but no role-checking strategy has been set for the controller!"); return CollectionUtils.makeListMapImmutable(mappedMethods); }
Source:
<code>public void setParameters(Map<String, Object> parameters) { super.setParameters(parameters); if (parameters != null && !parameters.isEmpty()) { <START> Object o = parameters.get(MessageProcessorConstants.CRON_EXPRESSION); <END> if (o != null) { cronExpression = o.toString(); } o = parameters.get(MessageProcessorConstants.INTERVAL); if (o != null) { interval = Integer.parseInt(o.toString()); } o = parameters.get(MessageProcessorConstants.MEMBER_COUNT); if (o != null) { memberCount = Integer.parseInt(o.toString()); } o = parameters.get(MessageProcessorConstants.IS_ACTIVATED); if (o != null) { setActivated(Boolean.valueOf(o.toString())); } o = parameters.get(ForwardingProcessorConstants.NON_RETRY_STATUS_CODES); if (o != null) { nonRetryStatusCodes = o.toString().split(","); } } }</code><technical_language>Instead of Object o, a meaningful name for object reference</technical_language>

Target:
public void setParameters(Map<String, Object> parameters) { super.setParameters(parameters); if (parameters != null && !parameters.isEmpty()) { Object param = parameters.get(MessageProcessorConstants.CRON_EXPRESSION); if (param != null) { cronExpression = param.toString(); } param = parameters.get(MessageProcessorConstants.INTERVAL); if (param != null) { interval = Integer.parseInt(param.toString()); } param = parameters.get(MessageProcessorConstants.MEMBER_COUNT); if (param != null) { memberCount = Integer.parseInt(param.toString()); } param = parameters.get(MessageProcessorConstants.IS_ACTIVATED); if (param != null) { setActivated(Boolean.valueOf(param.toString())); } param = parameters.get(ForwardingProcessorConstants.NON_RETRY_STATUS_CODES); if (param != null) { nonRetryStatusCodes = param.toString().split(","); } } }
Source:
<code>public String marshal(AbstractId id) { <START> return id.canonicalID(); <END> }</code><technical_language>guard NPE here. Serialization break if ID is null</technical_language>

Target:
public String marshal(AbstractId id) { if (id != null) return id.canonicalID(); else return null; }
Source:
<code>private boolean updateBugzillaAsMerged(final Bug bug) { boolean result = false; try { result = helper.bzHelper.updateBugzillaStatus(bug.getId(), Bug.Status.MODIFIED); } catch (Exception e) { System.err.printf("Update of the status of bugzilla bz%d failed due to %s.\n", bug.getId(), e); System.err.printf("Retrying...\n"); try { <START> result = helper.bzHelper.updateBugzillaStatus(bug.getId(), Bug.Status.MODIFIED); <END> } catch (Exception ex) { System.err.printf("Update of the status of bugzilla bz%d failed again due to %s.\n", bug.getId(), ex); } } return result; }</code><technical_language>helper.getBzHelper()</technical_language>

Target:
private boolean updateBugzillaAsMerged(final Bug bug) { boolean result = false; try { result = helper.getBZHelper().updateBugzillaStatus(bug.getId(), Bug.Status.MODIFIED); } catch (Exception e) { System.err.printf("Update of the status of bugzilla bz%d failed due to %s.\n", bug.getId(), e); System.err.printf("Retrying...\n"); try { result = helper.getBZHelper().updateBugzillaStatus(bug.getId(), Bug.Status.MODIFIED); } catch (Exception ex) { System.err.printf("Update of the status of bugzilla bz%d failed again due to %s.\n", bug.getId(), ex); } } return result; }
Source:
<code>public void testEvalPositive() { <START> Mockito.when(mockNetwork.isExternal()).thenReturn(true); <END> Assert.assertTrue(underTest.eval(mockNetwork)); }</code><technical_language>Please add static import</technical_language>

Target:
public void testEvalPositive() { when(mockNetwork.isExternal()).thenReturn(true); assertTrue(underTest.eval(mockNetwork)); }
Source:
<code>protected int poll() throws Exception { TelegramConfiguration config = endpoint.getConfiguration(); Long realOffset = offset != null ? offset : 0L; TelegramService service = TelegramServiceProvider.get().getService(); log.debug("Polling Telegram service to get updates"); UpdateResult updateResult = service.getUpdates(config.getAuthorizationToken(), offset, config.getLimit(), config.getTimeout()); if (updateResult.getUpdates() == null) { updateResult.setUpdates(Collections.emptyList()); } if (!updateResult.isOk()) { throw new IllegalStateException("The server was unable to process the request. Response was " + updateResult); } List<Update> updates = updateResult.getUpdates(); if (updates.size() > 0) { <START> log.info("Received " + updates.size() + " updates from Telegram service"); <END> } else { log.debug("No updates received from Telegram service"); } processUpdates(updates); updateOffset(updates); return updates.size(); }</code><technical_language>Avoid info logging logs poll noisy. Set this debug level</technical_language>

Target:
protected int poll() throws Exception { TelegramConfiguration config = endpoint.getConfiguration(); Long realOffset = offset != null ? offset : 0L; TelegramService service = TelegramServiceProvider.get().getService(); log.debug("Polling Telegram service to get updates"); UpdateResult updateResult = service.getUpdates(config.getAuthorizationToken(), offset, config.getLimit(), config.getTimeout()); if (updateResult.getUpdates() == null) { updateResult.setUpdates(Collections.emptyList()); } if (!updateResult.isOk()) { throw new IllegalStateException("The server was unable to process the request. Response was " + updateResult); } List<Update> updates = updateResult.getUpdates(); if (updates.size() > 0) { log.debug("Received updates from Telegram service", updates.size()); } else { log.debug("No updates received from Telegram service"); } processUpdates(updates); updateOffset(updates); return updates.size(); }
Source:
<code>private Collection<RowData> convertToRowData( Map<Map<String, String>, Collection<Row>> data, int[] projectedFields, DataStructureConverter converter) { List<RowData> result = new ArrayList<>(); <START> List<Map<String, String>> keys = Collections.EMPTY_LIST.equals(allPartitions) ? <END> Collections.singletonList(Collections.EMPTY_MAP) : allPartitions; for (Map<String, String> partition: keys) { for (Row value : data.get(partition)) { if (result.size() >= limit) { return result; } if (isRetainedAfterApplyingFilterPredicates(value)) { Row projectedRow; if (projectedFields == null) { projectedRow = value; } else { Object[] newValues = new Object[projectedFields.length]; for (int i = 0; i < projectedFields.length; ++i) { newValues[i] = value.getField(projectedFields[i]); } projectedRow = Row.of(newValues); } RowData rowData = (RowData) converter.toInternal(projectedRow); if (rowData != null) { rowData.setRowKind(value.getKind()); result.add(rowData); } } } } return result; }</code><technical_language>Collections.EMPTY_LIST.equals(allPartitions) -> allPartitions.isEmpty()</technical_language>

Target:
private Collection<RowData> convertToRowData( Map<Map<String, String>, Collection<Row>> data, int[] projectedFields, DataStructureConverter converter) { List<RowData> result = new ArrayList<>(); List<Map<String, String>> keys = allPartitions.isEmpty() ? Collections.singletonList(Collections.emptyMap()) : allPartitions; for (Map<String, String> partition: keys) { for (Row value : data.get(partition)) { if (result.size() >= limit) { return result; } boolean isRetained = FilterUtils.isRetainedAfterApplyingFilterPredicates( filterPredicates, getValueGetter(value)); if (isRetained) { Row projectedRow; if (projectedFields == null) { projectedRow = value; } else { Object[] newValues = new Object[projectedFields.length]; for (int i = 0; i < projectedFields.length; ++i) { newValues[i] = value.getField(projectedFields[i]); } projectedRow = Row.of(newValues); } RowData rowData = (RowData) converter.toInternal(projectedRow); if (rowData != null) { rowData.setRowKind(value.getKind()); result.add(rowData); } } } } return result; }
Source:
<code>public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { setTypeOracle(generatorContext.getTypeOracle()); setPropertyOracle(generatorContext.getPropertyOracle()); setTreeLogger(treeLogger); setTypeClass(getType(typeName)); PrintWriter printWriter; printWriter = tryCreatePrintWriter(generatorContext, SUFFIX); if (printWriter == null) { return typeName + SUFFIX; } ClassSourceFileComposerFactory composer = initComposer(); SourceWriter sourceWriter = composer.createSourceWriter(generatorContext, printWriter); writeInit(sourceWriter, <START> new GinjectorGenerator().generate(getTreeLogger(), generatorContext, GinjectorGenerator.DEFAULT_FQ_NAME)); <END> closeDefinition(sourceWriter); return getPackageName() + "." + getClassName(); }</code><technical_language>Extract GinjectorGenerator().generate a variable for readability</technical_language>

Target:
public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { setTypeOracle(generatorContext.getTypeOracle()); setPropertyOracle(generatorContext.getPropertyOracle()); setTreeLogger(treeLogger); setTypeClass(getType(typeName)); PrintWriter printWriter; printWriter = tryCreatePrintWriter(generatorContext, SUFFIX); if (printWriter == null) { return typeName + SUFFIX; } ClassSourceFileComposerFactory composer = initComposer(); SourceWriter sourceWriter = composer.createSourceWriter(generatorContext, printWriter); String ginjectorName = new GinjectorGenerator().generate(getTreeLogger(), generatorContext, GinjectorGenerator.DEFAULT_FQ_NAME); writeInit(sourceWriter, ginjectorName); closeDefinition(sourceWriter); return getPackageName() + "." + getClassName(); }
Source:
<code>private void postJobAction(Executor executor){ EC2Computer computer = (EC2Computer) executor.getOwner(); EC2AbstractSlave slaveNode = computer.getNode(); <START> int maxTotalUses = Integer.parseInt(slaveNode.maxTotalUses); <END> if (maxTotalUses <= -1) { return; } else if (maxTotalUses <= 1) { computer.setAcceptingTasks(false); slaveNode.terminate(); } else { slaveNode.maxTotalUses = String.valueOf(Integer.parseInt(slaveNode.maxTotalUses) - 1); } }</code><technical_language>happen if a valid integer? If a field type of int (or Integer), Stapler care of conversions error messages I think</technical_language>

Target:
private void postJobAction(Executor executor) { EC2Computer computer = (EC2Computer) executor.getOwner(); EC2AbstractSlave slaveNode = computer.getNode(); if (computer.countBusy() <= 1 && !computer.isAcceptingTasks()) { LOGGER.info("Agent " + slaveNode.instanceId + " is terminated due to maxTotalUses (" + slaveNode.maxTotalUses + ")"); slaveNode.terminate(); } else { if (slaveNode.maxTotalUses == 1) { LOGGER.info("Agent " + slaveNode.instanceId + " is still in use by more than one (" + computer.countBusy() + ") executers."); } } }
Source:
<code>public void getReplicasTest() throws Exception { List<? extends PartitionId> partitionIds = CLUSTER_MAP.getWritablePartitionIds(); for (PartitionId partitionId : partitionIds) { String originalReplicaStr = partitionId.getReplicaIds().toString().replace(", ", ","); <START> BlobId blobId = new BlobId(BlobId.DEFAULT_FLAG, ClusterMapUtils.LEGACY_DATACENTER_ID, Account.LEGACY_ACCOUNT_ID, <END> Container.LEGACY_CONTAINER_ID, partitionId); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); ReadableStreamChannel channel = getReplicasHandler.getReplicas(blobId.getID(), restResponseChannel); assertEquals("Unexpected response status", ResponseStatus.Ok, restResponseChannel.getStatus()); assertEquals("Unexpected Content-Type", "application/json", restResponseChannel.getHeader(RestUtils.Headers.CONTENT_TYPE)); String returnedReplicasStr = RestTestUtils.getJsonizedResponseBody(channel).getString(GetReplicasHandler.REPLICAS_KEY).replace("\"", ""); assertEquals("Replica IDs returned for the BlobId do no match with the replicas IDs of partition", originalReplicaStr, returnedReplicasStr); } }</code><technical_language>I I a split opinion. a stance this constructor start writing in V2. then, confusing callers sending in defaults. This caller assume toBytes() serialize in V2, is not. some standardization wrt this new version upgrades in general</technical_language>

Target:
public void getReplicasTest() throws Exception { List<? extends PartitionId> partitionIds = CLUSTER_MAP.getWritablePartitionIds(); for (PartitionId partitionId : partitionIds) { String originalReplicaStr = partitionId.getReplicaIds().toString().replace(", ", ","); BlobId blobId = new BlobId(BlobId.DEFAULT_FLAG, ClusterMapUtils.UNKNOWN_DATACENTER_ID, Account.UNKNOWN_ACCOUNT_ID, Container.UNKNOWN_CONTAINER_ID, partitionId); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); ReadableStreamChannel channel = getReplicasHandler.getReplicas(blobId.getID(), restResponseChannel); assertEquals("Unexpected response status", ResponseStatus.Ok, restResponseChannel.getStatus()); assertEquals("Unexpected Content-Type", "application/json", restResponseChannel.getHeader(RestUtils.Headers.CONTENT_TYPE)); String returnedReplicasStr = RestTestUtils.getJsonizedResponseBody(channel).getString(GetReplicasHandler.REPLICAS_KEY).replace("\"", ""); assertEquals("Replica IDs returned for the BlobId do no match with the replicas IDs of partition", originalReplicaStr, returnedReplicasStr); } }
Source:
<code>protected KualiDecimal addTargetLinesToDocument(DefaultKfsAccountForAwsResultWrapper defaultAccountWrapper, AmazonBillResultsDTO resultsDTO, GroupLevel awsAccountGroup, AccountingXmlDocumentEntry document, String awsAccount) { DefaultKfsAccountForAws defaultKfsAccount = findDefaultKfsAccountForAws(awsAccount, defaultAccountWrapper, resultsDTO); KualiDecimal targetLineTotal = KualiDecimal.ZERO; for (GroupLevel costCenterGroup : awsAccountGroup.getNextLevel()) { if (KualiDecimal.ZERO.isLessThan(costCenterGroup.getCost())) { AccountingXmlDocumentAccountingLine targetLine = awsAccountingXmlDocumentAccountingLineService.createAccountingXmlDocumentAccountingLine(costCenterGroup, defaultKfsAccount); targetLineTotal = targetLineTotal.add(targetLine.getAmount()); document.getTargetAccountingLines().add(targetLine); } else { <START> LOG.error("buildAccountingXmlDocumentListWrapper, found a group with a cost of zero: " + costCenterGroup); <END> } } return targetLineTotal; }</code><technical_language>Wrong method name in log message</technical_language>

Target:
protected KualiDecimal addTargetLinesToDocument(DefaultKfsAccountForAwsResultWrapper defaultAccountWrapper, AmazonBillResultsDTO resultsDTO, GroupLevel awsAccountGroup, AccountingXmlDocumentEntry document, String awsAccount) { DefaultKfsAccountForAws defaultKfsAccount = findDefaultKfsAccountForAws(awsAccount, defaultAccountWrapper, resultsDTO); KualiDecimal targetLineTotal = KualiDecimal.ZERO; for (GroupLevel costCenterGroup : awsAccountGroup.getNextLevel()) { if (KualiDecimal.ZERO.isLessThan(costCenterGroup.getCost())) { AccountingXmlDocumentAccountingLine targetLine = awsAccountingXmlDocumentAccountingLineService.createAccountingXmlDocumentAccountingLine(costCenterGroup, defaultKfsAccount); targetLineTotal = targetLineTotal.add(targetLine.getAmount()); document.getTargetAccountingLines().add(targetLine); } else { LOG.error("addTargetLinesToDocument, found a group with a cost of zero: " + costCenterGroup); } } return targetLineTotal; }
Source:
<code>private static int getLocationOfYAfterConsonantCluster(String word) { for (int i = 0; i < word.length() - 1; i++) { if (word.substring(i, i + 1).matches(VOWELS_REGEX)) { return -1; <START> }else if ((i != 0) && word.substring(i, i + 1).equals("y")) { <END> return i; } } return -1; }</code><technical_language>a white space else word.charAt(i) in if else statements (e.g. word.charAt(i) == 'y') instead of substring, a bit more obvious</technical_language>

Target:
private static int getLocationOfYAfterConsonantCluster(String word) { for (int i = 0; i < word.length() - 1; i++) { if ((Character.toString(word.charAt(i)).matches(VOWELS_REGEX))) { return -1; } else if ((i != 0) && word.charAt(i) == 'y') { return i; } } return -1; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); if (gfRepo == null) { return null; } InputDialog inputDialog = new StartDialog( HandlerUtil.getActiveShell(event), UIText.HotfixStartHandler_provideHotfixName, UIText.HotfixStartHandler_pleaseProvideANameForTheNewHotfix, "", new HotfixNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return null; } final String hotfixName = inputDialog.getValue(); HotfixStartOperation hotfixStartOperation = new HotfixStartOperation( gfRepo, hotfixName); JobUtil.scheduleUserWorkspaceJob(hotfixStartOperation, UIText.HotfixStartHandler_startingNewHotfix, JobFamilies.GITFLOW_FAMILY); BranchOperationUI.handleSingleRepositoryCheckoutOperationResult( gfRepo.getRepository(), <START> hotfixStartOperation.getCheckoutResult(), <END> gfRepo.getConfig().getFullHotfixBranchName(hotfixName)); return null; }</code><technical_language>operation runs in a background thread; this access get checkout result work</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); if (gfRepo == null) { return null; } InputDialog inputDialog = new StartDialog( HandlerUtil.getActiveShell(event), UIText.HotfixStartHandler_provideHotfixName, UIText.HotfixStartHandler_pleaseProvideANameForTheNewHotfix, "", new HotfixNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return null; } final String hotfixName = inputDialog.getValue(); HotfixStartOperation operation = new HotfixStartOperation( gfRepo, hotfixName); String fullBranchName = gfRepo.getConfig() .getFullHotfixBranchName(hotfixName); JobUtil.scheduleUserWorkspaceJob(operation, UIText.HotfixStartHandler_startingNewHotfix, JobFamilies.GITFLOW_FAMILY, new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation)); return null; }
Source:
<code>public I_R_Request createRequestFromOrder(@NonNull final I_C_Order order) { <START> final int requestTypeId = docTypeDAO.getById(order.getC_DocTypeTarget_ID()).getR_RequestType_ID(); <END> final RequestCandidate requestCandidate = RequestCandidate.builder() .summary(order.getDescription() != null ? order.getDescription() : " ") .confidentialType(X_R_Request.CONFIDENTIALTYPE_Internal) .orgId(OrgId.ofRepoId(order.getAD_Org_ID())) .recordRef(TableRecordReference.of(order)) .requestTypeId(requestTypeId > 0 ? RequestTypeId.ofRepoId(requestTypeId) : getRequestTypeId(SOTrx.ofBoolean(order.isSOTrx()))) .partnerId(BPartnerId.ofRepoId(order.getC_BPartner_ID())) .userId(UserId.ofRepoIdOrNull(order.getAD_User_ID())) .dateDelivered(TimeUtil.asZonedDateTime(order.getDatePromised())) .build(); return createRequest(requestCandidate); }</code><technical_language>order.getC_DocType_ID()</technical_language>

Target:
public I_R_Request createRequestFromOrder(@NonNull final I_C_Order order) { final Optional<RequestTypeId> requestType = orderBL.getRequestTypeForCreatingNewRequestsAfterComplete(order); final RequestCandidate requestCandidate = RequestCandidate.builder() .summary(order.getDescription() != null ? order.getDescription() : " ") .confidentialType(X_R_Request.CONFIDENTIALTYPE_Internal) .orgId(OrgId.ofRepoId(order.getAD_Org_ID())) .recordRef(TableRecordReference.of(order)) .requestTypeId(requestType.orElseGet(() -> getRequestTypeId(SOTrx.ofBoolean(order.isSOTrx())))) .partnerId(BPartnerId.ofRepoId(order.getC_BPartner_ID())) .userId(UserId.ofRepoIdOrNull(order.getAD_User_ID())) .dateDelivered(TimeUtil.asZonedDateTime(order.getDatePromised())) .build(); return createRequest(requestCandidate); }
Source:
<code>private void preDeleteProject(IProject project) { binaryParsersMap.remove(project); removeBinaryRunner(project); <START> CCoreInternals.getPDOMManager().preDeleteProject(create(project)); <END> }</code><technical_language>sense move this too</technical_language>

Target:
private void preDeleteProject(IProject project) { CCoreInternals.getPDOMManager().preDeleteProject(create(project)); binaryParsersMap.remove(project); removeBinaryRunner(project); }
Source:
<code>public Observable<Void> delete(final T entity) { return wrap(new Callable<Void>() { @Override public Void call() throws Exception { mDao.delete(entity); <START> return null; <END> } }); }</code><technical_language>throws NPE Observable.concat. this methods return **null** value. return Void.TYPE.newInstance() better</technical_language>

Target:
public Observable<Void> delete(final T entity) { return wrap(new Callable<Void>() { @Override public Void call() throws Exception { mDao.delete(entity); return Void.TYPE.newInstance(); } }); }
Source:
<code>public void test_parsing_performance() throws IOException { String projectKey = "parsing-project"; <START> ORCHESTRATOR.getServer().provisionProject(projectKey, projectKey); <END> ORCHESTRATOR.getServer().associateProjectToQualityProfile(projectKey, "js", "no-rules"); build = getSonarScanner(projectKey); BuildResult result = ORCHESTRATOR.executeBuild(build); Assertions.assertThat(result.getLogs().contains("No new issue")).isTrue(); double expected = 141.0; double time = sensorTime(build.getProjectDir(), SENSOR, projectKey); Assertions.assertThat(time).isEqualTo(expected, offset(expected * 0.04)); }</code><technical_language>@vilchik-elena I remove a bit of duplication test_parsing_performance test_symbolic_engine_performance :) highlight differences</technical_language>

Target:
public void test_parsing_performance() throws IOException { test_performance("parsing-project", "no-rules", false, 141.0); }
Source:
<code>public void execute(PoolManager poolManager) { for (Pool pool : pools) { if (pool.isOverflowing()) { <START> pool = poolCurator.lockAndLoad(pool); <END> sharedPools.put(pool, poolCurator.listSharedPoolsOf(pool)); boolean needsToRevoke = reduceSharedPools(pool); if (needsToRevoke) { determineExcessEntitlements(pool); } } } poolManager.revokeEntitlements(new ArrayList<Entitlement>(entitlementsToRevoke)); for (Entitlement entitlement : entitlementsToAdjust.keySet()) { try { poolManager.adjustEntitlementQuantity(entitlement.getConsumer(), entitlement, entitlementsToAdjust.get(entitlement).intValue()); } catch (EntitlementRefusedException e) { throw new ForbiddenException(e.getResults().values().iterator().next().getErrors() .get(0).toString()); } } }</code><technical_language>please consider filtering out overflowing pools lock pools in a batch</technical_language>

Target:
public void execute(PoolManager poolManager) { Collection<Pool> overflowing = new ArrayList<Pool>(); for (Pool pool : pools) { if (pool.isOverflowing()) { overflowing.add(pool); } } if (overflowing.isEmpty()) { return; } overflowing = poolCurator.lockAndLoad(overflowing); for (Pool pool : overflowing) { poolNewConsumed.put(pool, pool.getConsumed()); List<Pool> shared = poolCurator.listSharedPoolsOf(pool); if (!shared.isEmpty()) { sharedPools.put(pool, shared); reduceSharedPools(pool); } determineExcessEntitlements(pool); } poolManager.revokeEntitlements(new ArrayList<Entitlement>(entitlementsToRevoke)); for (Entitlement entitlement : shareEntitlementsToAdjust.keySet()) { try { poolManager.adjustEntitlementQuantity(entitlement.getConsumer(), entitlement, shareEntitlementsToAdjust.get(entitlement).intValue()); } catch (EntitlementRefusedException e) { throw new ForbiddenException(e.getResults().values().iterator().next().getErrors() .get(0).toString()); } } }
Source:
<code>public List<InputField> getInputFields() { for (InputField field:inputFields) { RangeEditText ed=(RangeEditText) getActivity().findViewById(field.getId()); if(!isEmpty(ed)){ field.setValue(Double.parseDouble(ed.getText().toString())); <START> boolean isRed=(ed.getCurrentTextColor()==ContextCompat.getColor(OpenMRS.getInstance(), R.color.red))?true:false ; <END> field.setIsRed(isRed); } else{ field.setValue(-1.0); } } return inputFields; }</code><technical_language>?true:false is redundant</technical_language>

Target:
public List<InputField> getInputFields() { for (InputField field:inputFields) { RangeEditText ed=(RangeEditText) getActivity().findViewById(field.getId()); if(!isEmpty(ed)){ field.setValue(Double.parseDouble(ed.getText().toString())); boolean isRed = (ed.getCurrentTextColor()==ContextCompat.getColor(OpenMRS.getInstance(), R.color.red)); field.setIsRed(isRed); } else{ field.setValue(-1.0); } } return inputFields; }
Source:
<code>protected boolean validateMacAddress(List<VmNic> ifaces) { int freeMacs = 0; for (VmNic iface : ifaces) { if (!StringUtils.isEmpty(iface.getMacAddress())) { if(!VALIDATE_MAC_ADDRESS.matcher(iface.getMacAddress()).matches()) { addCanDoActionMessageVariable("IfaceName ", iface.getName()); addCanDoActionMessageVariable("MacAddress ", iface.getMacAddress()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID); return false; } } else { freeMacs++; } } <START> final MacPoolManagerStrategy macPool = getMacPool(); <END> if (freeMacs > 0 && !(macPool.getAvailableMacsCount() >= freeMacs)) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }</code><technical_language>need extract variable</technical_language>

Target:
protected boolean validateMacAddress(List<VmNic> ifaces) { int freeMacs = 0; for (VmNic iface : ifaces) { if (!StringUtils.isEmpty(iface.getMacAddress())) { if(!VALIDATE_MAC_ADDRESS.matcher(iface.getMacAddress()).matches()) { addCanDoActionMessageVariable("IfaceName ", iface.getName()); addCanDoActionMessageVariable("MacAddress ", iface.getMacAddress()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID); return false; } } else { freeMacs++; } } if (freeMacs > 0 && !(getMacPool().getAvailableMacsCount() >= freeMacs)) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }
Source:
<code>protected void executeQueryCommand() { VDSBrokerFrontend vdsBroker = getVdsBroker(); VDSReturnValue imagesListResult = vdsBroker.RunVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(getStorageDomainId(), getStoragePoolId())); @SuppressWarnings("unchecked") List<Guid> imagesList = (List<Guid>) imagesListResult.getReturnValue(); List<DiskImage> fromDao = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getStorageDomainId()); for (DiskImage image : fromDao) { imagesList.remove(image.getId()); } List<Disk> unregisteredDisks = new ArrayList<Disk>(); for (Guid unregisteredDiskId : imagesList) { String sessionId = getParameters().getSessionId(); if (sessionId == null) { <START> sessionId = ThreadLocalParamsContainer.getHttpSessionId(); <END> } GetUnregisteredDiskQueryParameters unregQueryParams = new GetUnregisteredDiskQueryParameters( unregisteredDiskId, getStorageDomainId()); VdcQueryReturnValue unregQueryReturn = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisk, unregQueryParams); if (unregQueryReturn.getSucceeded()) { unregisteredDisks.add((Disk) unregQueryReturn.getReturnValue()); } else { System.out.println("Could not get populated disk, reason: " + unregQueryReturn.getExceptionString()); } } getQueryReturnValue().setReturnValue(unregisteredDisks); }</code><technical_language>I is purpose of 3 lines sessionId</technical_language>

Target:
protected void executeQueryCommand() { VDSBrokerFrontend vdsBroker = getVdsBroker(); VDSReturnValue imagesListResult = vdsBroker.RunVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(getStorageDomainId(), getStoragePoolId())); @SuppressWarnings("unchecked") List<Guid> imagesList = (List<Guid>) imagesListResult.getReturnValue(); List<DiskImage> fromDao = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getStorageDomainId()); for (DiskImage image : fromDao) { imagesList.remove(image.getId()); } List<Disk> unregisteredDisks = new ArrayList<Disk>(); for (Guid unregisteredDiskId : imagesList) { GetUnregisteredDiskQueryParameters unregQueryParams = new GetUnregisteredDiskQueryParameters( unregisteredDiskId, getStorageDomainId(), getStoragePoolId()); VdcQueryReturnValue unregQueryReturn = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisk, unregQueryParams); if (unregQueryReturn.getSucceeded()) { unregisteredDisks.add((Disk) unregQueryReturn.getReturnValue()); } else { log.error("Could not get populated disk, reason: " + unregQueryReturn.getExceptionString()); } } getQueryReturnValue().setReturnValue(unregisteredDisks); }
Source:
<code>private static String getHostAddress(final int port) { if (port < 0) { return ""; } String hostAddress = ""; try { final Enumeration e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { final NetworkInterface n = (NetworkInterface) e.nextElement(); if (n.isLoopback() || n.isVirtual() || !n.isUp()) { continue; } final Enumeration ee = n.getInetAddresses(); while (ee.hasMoreElements()) { final InetAddress i = (InetAddress) ee.nextElement(); if (i.isLinkLocalAddress()) { continue; } hostAddress = i.getHostAddress(); break; } } } catch (Exception e) { <START> throw new RuntimeException("Network Error", e); <END> } if (hostAddress.isEmpty()) { LOG.log(Level.WARNING, "Fail to find local host address"); return ""; } try { (new Socket(hostAddress, port)).close(); LOG.log(Level.WARNING, "Port number already in use"); return ""; } catch (ConnectException connectException) { LOG.log(Level.INFO, "URL found: " + hostAddress + ":" + port); return hostAddress; } catch (Exception e) { LOG.log(Level.INFO, "Invalid port number"); return ""; } }</code><technical_language>I a good idea throw a RuntimeException here; entire application fails if fails connect dashboard server. sense app running, leaving a log message inform failure users</technical_language>

Target:
private static String getHostAddress(final int port) throws IOException { String hostAddress = ""; final Enumeration e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { final NetworkInterface n = (NetworkInterface) e.nextElement(); if (n.isLoopback() || n.isVirtual() || !n.isUp()) { continue; } final Enumeration ee = n.getInetAddresses(); while (ee.hasMoreElements()) { final InetAddress i = (InetAddress) ee.nextElement(); if (i.isLinkLocalAddress()) { continue; } hostAddress = i.getHostAddress(); break; } } try { (new Socket(hostAddress, port)).close(); LOG.log(Level.WARNING, "Port number already in use."); throw new IOException("Port number already in use."); } catch (ConnectException connectException) { LOG.log(Level.INFO, "URL found: {0}:{1}", new Object[]{hostAddress, port}); return hostAddress; } }
Source:
<code>public SystemData scheduleAndLog() { log.trace("runTestConnection()..."); boolean result = false; try { result = testConnection(); } catch (RuntimeException e) { <START> log.debug("Could not connect to Cache" + e.getMessage()); <END> } cache.setConnectionTested(result); log.debug("Testing Couchbase connection: {}", result); return null; }</code><technical_language>is this log right level ? line 41</technical_language>

Target:
public SystemData scheduleAndLog() { log.trace("runTestConnection()..."); boolean result = false; try { result = testConnection(); } catch (RuntimeException e) { log.error("Could not connect to Cache" + e.getMessage()); } cache.setConnectionTested(result); log.debug("Testing Couchbase connection: {}", result); return null; }
Source:
<code>public void testAddConfigFields() throws IOException { System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); ClusterConfig oldConfig = getClusterConfigFromRest(cluster); ClusterConfig configDelta = new ClusterConfig(cluster); configDelta.getRecord().setSimpleField("newField", "newValue"); configDelta.getRecord().setListField("newList", Arrays.asList("newValue1", "newValue2")); configDelta.getRecord().setMapField("newMap", new HashMap<String, String>() { { put("newkey1", "newvalue1"); put("newkey2", "newvalue2"); } }); updateClusterConfigFromRest(cluster, configDelta, Command.update); ClusterConfig newConfig = getClusterConfigFromRest(cluster); oldConfig.getRecord().update(configDelta.getRecord()); Assert.assertEquals(newConfig, oldConfig, "cluster config from response: " + newConfig + " vs cluster config actually: " + oldConfig); <START> System.out.println("new config:" + newConfig.toString()); <END> System.out.println("End test :" + TestHelper.getTestMethodName()); }</code><technical_language>printout if is equal</technical_language>

Target:
public void testAddConfigFields() throws IOException { System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); ClusterConfig oldConfig = getClusterConfigFromRest(cluster); ClusterConfig configDelta = new ClusterConfig(cluster); configDelta.getRecord().setSimpleField("newField", "newValue"); configDelta.getRecord().setListField("newList", Arrays.asList("newValue1", "newValue2")); configDelta.getRecord().setMapField("newMap", new HashMap<String, String>() { { put("newkey1", "newvalue1"); put("newkey2", "newvalue2"); } }); updateClusterConfigFromRest(cluster, configDelta, Command.update); ClusterConfig newConfig = getClusterConfigFromRest(cluster); oldConfig.getRecord().update(configDelta.getRecord()); Assert.assertEquals(newConfig, oldConfig, "cluster config from response: " + newConfig + " vs cluster config actually: " + oldConfig); System.out.println("End test :" + TestHelper.getTestMethodName()); }
Source:
<code>public Iterable<TokenCacheItem> getAll() { argumentCheck(); @SuppressWarnings("unchecked") Map<String, String> results = (Map<String, String>)mPrefs.getAll(); ArrayList<TokenCacheItem> tokens = new ArrayList<TokenCacheItem>(results.values().size()); Iterator<Entry<String, String>> tokenResultEntrySet = results.entrySet().iterator(); while (tokenResultEntrySet.hasNext()) { final Entry<String, String> tokenEntry = tokenResultEntrySet.next(); final String tokenKey = tokenEntry.getKey(); final String tokenValue = tokenEntry.getValue(); final String decryptedValue = decrypt(tokenKey, tokenValue); if (decryptedValue != null) { final TokenCacheItem tokenCacheItem = mGson.fromJson(decryptedValue, TokenCacheItem.class); tokens.add(tokenCacheItem); } } <START> return tokens; <END> }</code><technical_language>code appears 'nulls' in Iterable<TokenCacheItem> returned. create collection ArrayList<TokenCacheItem> tokens = new ArrayList<TokenCacheItem>(results.values().size()); If decrypt fails, add tokenCacheItem</technical_language>

Target:
public Iterator<TokenCacheItem> getAll() { @SuppressWarnings("unchecked") Map<String, String> results = (Map<String, String>)mPrefs.getAll(); ArrayList<TokenCacheItem> tokens = new ArrayList<TokenCacheItem>(results.values().size()); Iterator<Entry<String, String>> tokenResultEntrySet = results.entrySet().iterator(); while (tokenResultEntrySet.hasNext()) { final Entry<String, String> tokenEntry = tokenResultEntrySet.next(); final String tokenKey = tokenEntry.getKey(); final String tokenValue = tokenEntry.getValue(); final String decryptedValue = decrypt(tokenKey, tokenValue); if (decryptedValue != null) { final TokenCacheItem tokenCacheItem = mGson.fromJson(decryptedValue, TokenCacheItem.class); tokens.add(tokenCacheItem); } } return tokens.iterator(); }
Source:
<code>public void testParameterizedBuildSelector() throws Exception { WorkflowJob copiee = createWorkflow( "copiee", "writeFile text: 'foobar', file: 'artifact.txt';" + "archive includes: 'artifact.txt';" ); jenkinsRule.assertBuildStatusSuccess(copiee.scheduleBuild2(0)); WorkflowJob copier = createWorkflow( "copier", <START> "step(copyArtifacts(projectName: 'copiee', selector: buildParameter('<StatusBuildSelector/>')));" <END> + "echo readFile('artifact.txt');" ); jenkinsRule.assertLogContains("foobar", jenkinsRule.assertBuildStatusSuccess(copier.scheduleBuild2(0))); }</code><technical_language>What?! is this XML argument</technical_language>

Target:
public void testParameterizedBuildSelector() throws Exception { WorkflowJob copiee = jenkinsRule.createWorkflow( "copiee", "writeFile text: 'foobar', file: 'artifact.txt';" + "archive includes: 'artifact.txt';" ); jenkinsRule.assertBuildStatusSuccess(copiee.scheduleBuild2(0)); WorkflowJob copier = jenkinsRule.createWorkflow( "copier", "copyArtifacts(projectName: 'copiee', selector: buildParameter(\"${SELECTOR}\"));" + "echo readFile('artifact.txt');" ); copier.addProperty(new ParametersDefinitionProperty( new BuildSelectorParameter( "SELECTOR", new StatusBuildSelector(), "" ) )); JenkinsRule.WebClient wc = jenkinsRule.createAllow405WebClient(); jenkinsRule.submit(wc.getPage(copier, "build").getFormByName("parameters")); jenkinsRule.waitUntilNoActivity(); jenkinsRule.assertLogContains("foobar", jenkinsRule.assertBuildStatusSuccess(copier.getLastBuild())); }
Source:
<code>public boolean isEnabled() { Repository repo = getRepository(); if (repo == null) return false; RepositoryState state = repo.getRepositoryState(); <START> return state == RepositoryState.SAFE || isRebasing(state); <END> }</code><technical_language>This enables rebase a detached head? If ss good, a common case grabbing stuff Gerrit</technical_language>

Target:
public boolean isEnabled() { Repository repo = getRepository(); if (repo == null) return false; RepositoryState state = repo.getRepositoryState(); return state.isRebasing() || RebaseCurrentRefCommand.isEnabledForState(repo, state); }
Source:
<code>private void applyMcastAddition(MacLocation ml) { log.debug("Adding MCAST remote MAC to the VTEP: " + ml); Status st; vtepDataClient.deleteAllMcastMacRemote(ml.logicalSwitchName(), <START> VtepMAC.UNKNOWN_DST()); <END> st = vtepDataClient.addMcastMacRemote(ml.logicalSwitchName(), ml.mac(), ml.vxlanTunnelEndpoint()); if (!st.isSuccess() ) { if (st.getCode().equals(StatusCode.CONFLICT)) { log.info("Conflict writing {}, not expected", ml); } else { throw new VxLanPeerSyncException("OVSDB error: " + st.getCode() + ", " + st.getDescription(), ml, st.getCode()); } } }</code><technical_language>removing UNKNOWN_DST? remove ml.mac</technical_language>

Target:
private void applyMcastAddition(MacLocation ml) { log.debug("Adding MCAST remote MAC to the VTEP: " + ml); Status st; vtepDataClient.deleteAllMcastMacRemote(ml.logicalSwitchName(), ml.mac()); st = vtepDataClient.addMcastMacRemote(ml.logicalSwitchName(), ml.mac(), ml.vxlanTunnelEndpoint()); if (!st.isSuccess() ) { if (st.getCode().equals(StatusCode.CONFLICT)) { log.info("Conflict writing {}, not expected", ml); } else { throw new VxLanPeerSyncException("OVSDB error: " + st.getCode() + ", " + st.getDescription(), ml, st.getCode()); } } }
Source:
<code>protected void executeReport(Locale locale) throws MavenReportException { getLog().info("Report Version: " + reportVersion); getLog().info("Results Pattern: " + resultsPattern); File[] reportDirectories = getReportDirectories(projectBaseDirectory, resultsPattern); getLog().info(String.format("Found [%s] results directories by pattern [%s]", reportDirectories.length, resultsPattern)); if (reportDirectories.length == 0) { throw new MavenReportException(String.format("Can't find any results directories by pattern [%s]", resultsPattern)); } try { Aether aether = Aether.aether(repoSystem, repoSession, projectRepos); AllureReportBuilder builder = new AllureReportBuilder(reportVersion, outputDirectory, aether); getLog().info("Generate report to " + outputDirectory); builder.processResults(reportDirectories); if (failReportIfEmpty && isReportEmpty()) { <START> throw new MavenReportException("There are no test cases info in given result" + <END> " directories found"); } getLog().info("Report data generated successfully. Unpack report face..."); builder.unpackFace(); getLog().info("Report unpacked successfully."); render(getSink(), getName(locale)); } catch (AllureReportBuilderException e) { getLog().error("Can't generate allure report data", e); throw new MavenReportException("Can't generate allure report data", e); } }</code><technical_language>directory is given</technical_language>

Target:
protected void executeReport(Locale locale) throws MavenReportException { getLog().info("Report Version: " + reportVersion); getLog().info("Results Pattern: " + resultsPattern); File[] reportDirectories = getReportDirectories(projectBaseDirectory, resultsPattern); getLog().info(String.format("Found [%s] results directories by pattern [%s]", reportDirectories.length, resultsPattern)); logDirectories(reportDirectories); if (reportDirectories.length == 0) { throw new MavenReportException(String.format("Can't find any results directories by pattern [%s]", resultsPattern)); } try { Aether aether = Aether.aether(repoSystem, repoSession, projectRepos); AllureReportBuilder builder = new AllureReportBuilder(reportVersion, outputDirectory, aether); getLog().info("Generate report to " + outputDirectory); builder.processResults(reportDirectories); if (failReportIfEmpty && isReportEmpty()) { throw new MavenReportException("There are no allure results found."); } getLog().info("Report data generated successfully. Unpack report face..."); builder.unpackFace(); getLog().info("Report unpacked successfully."); render(getSink(), getName(locale)); } catch (AllureReportBuilderException e) { getLog().error("Can't generate allure report data", e); throw new MavenReportException("Can't generate allure report data", e); } }
Source:
<code>public String getCsvSeparator() { String csvSeparatorValue = getControllerProperties().getProperty( PROP_CONTROLLER_CSV_SEPARATOR, "comma"); if (csvSeparatorValue.equals("comma")) { csvSeparatorValue = ","; } else if (csvSeparatorValue.equals("tab")) { csvSeparatorValue = "\t"; } else { <START> csvSeparatorValue = ";"; <END> } return csvSeparatorValue; }</code><technical_language>default "," if wrong is csvSeparator "," semicolon explicitly specified. if ("tab".equals(csvSeparator)) { csvSeparator= "\t"; } else if ("semicolon".equals(csvSeparator)) { csvSeparator = ";"; } else { csvSeparator = ","; }</technical_language>

Target:
public String getCsvSeparator() { String csvSeparator = getControllerProperties().getProperty(PROP_CONTROLLER_CSV_SEPARATOR); if (("tab").equals(csvSeparator)) { csvSeparator = "\t"; } else if (("semicolon").equals(csvSeparator)) { csvSeparator = ";"; } else { csvSeparator = ","; } return csvSeparator; }
Source:
<code>public static void warnIfDeprecatedDnsLookupValue(AbstractConfig config) { String clientDnsLookupValue = config.getString(CLIENT_DNS_LOOKUP_CONFIG); if (clientDnsLookupValue.equals(ClientDnsLookup.DEFAULT.toString())) log.warn("Configuration '{}' with value '{}' is deprecated and will be removed in " + "future version. Please use '{}' or another non-deprecated value.", <START> CLIENT_DNS_LOOKUP_CONFIG, ClientDnsLookup.DEFAULT.toString(), <END> ClientDnsLookup.USE_ALL_DNS_IPS); }</code><technical_language>need call toString()</technical_language>

Target:
public static void warnIfDeprecatedDnsLookupValue(AbstractConfig config) { String clientDnsLookupValue = config.getString(CLIENT_DNS_LOOKUP_CONFIG); if (clientDnsLookupValue.equals(ClientDnsLookup.DEFAULT.toString())) log.warn("Configuration '{}' with value '{}' is deprecated and will be removed in " + "future version. Please use '{}' or another non-deprecated value.", CLIENT_DNS_LOOKUP_CONFIG, ClientDnsLookup.DEFAULT, ClientDnsLookup.USE_ALL_DNS_IPS); }
Source:
<code><START> public static boolean hasElytraFlightAbility(EntityLivingBase player, ItemStack itemstack) { <END> if(!(player instanceof EntityPlayer)) return false; boolean vanillaElytra = itemstack.getItem() == Items.ELYTRA && ItemElytra.isUsable(itemstack); double attributeValue = player.getEntityAttribute(SharedMonsterAttributes.ELYTRA_FLIGHT).getAttributeValue(); return attributeValue>1.0D || (vanillaElytra && attributeValue >=1.0D); }</code><technical_language>Please follow formatting in project. Braces a new line, spaces if parenthesis, spaces comparison operators, etc</technical_language>

Target:
public static boolean hasElytraFlightAbility(EntityLivingBase player, ItemStack itemstack) { boolean vanillaElytra = itemstack.getItem() == Items.ELYTRA && ItemElytra.isUsable(itemstack); if (!(player instanceof EntityPlayer)) { return vanillaElytra; } double attributeValue = player.getEntityAttribute(EntityPlayer.ELYTRA_FLIGHT).getAttributeValue(); return attributeValue > 1.0D || (vanillaElytra && attributeValue >= 1.0D); }