auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(trainingOperationResponse -> { <START> System.out.println("Polling completed successfully"); <END> trainingOperationResponse.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> { USReceipt usReceipt = ReceiptExtensions.asUSReceipt(recognizedReceipt); System.out.printf("Page Number: %s%n", usReceipt.getMerchantName().getPageNumber()); System.out.printf("Merchant Name %s%n", usReceipt.getMerchantName().getName()); System.out.printf("Merchant Name Value: %s%n", usReceipt.getMerchantName().getFieldValue()); System.out.printf("Merchant Address %s%n", usReceipt.getMerchantAddress().getName()); System.out.printf("Merchant Address Value: %s%n", usReceipt.getMerchantAddress().getFieldValue()); System.out.printf("Total: %s%n", usReceipt.getTotal().getName()); System.out.printf("Total Value: %s%n", usReceipt.getTotal().getFieldValue()); })); }); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeReceiptsFromUrl#string }</code><technical_language>remove</technical_language>

Target:
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> { USReceipt usReceipt = ReceiptExtensions.asUSReceipt(recognizedReceipt); System.out.printf("Page Number: %s%n", usReceipt.getMerchantName().getPageNumber()); System.out.printf("Merchant Name: %s, confidence: %.2f%n", usReceipt.getMerchantName().getFieldValue(), usReceipt.getMerchantName().getConfidence()); System.out.printf("Merchant Address: %s, confidence: %.2f%n", usReceipt.getMerchantAddress().getFieldValue(), usReceipt.getMerchantAddress().getConfidence()); System.out.printf("Merchant Phone Number %s, confidence: %.2f%n", usReceipt.getMerchantPhoneNumber().getFieldValue(), usReceipt.getMerchantPhoneNumber().getConfidence()); System.out.printf("Total: %.2f, confidence: %.2f%n", usReceipt.getTotal().getFieldValue(), usReceipt.getTotal().getConfidence()); })); }); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeReceiptsFromUrl#string }
Source:
<code>public Response apiPoliciesGet(String xWSO2Tenant, String policyName, MessageContext messageContext) { SubscriptionValidationDAO subscriptionValidationDAO = new SubscriptionValidationDAO(); xWSO2Tenant = InternalServiceDataUtil.validateTenantDomain(xWSO2Tenant); if (InternalServiceDataUtil.isUserAuthorizedToTenant(xWSO2Tenant)) { if (StringUtils.isNotEmpty(xWSO2Tenant)) { if (StringUtils.isNotEmpty(policyName)) { List<APIPolicy> model = new ArrayList<>(); APIPolicy apiPolicy = subscriptionValidationDAO. getApiPolicyByNameForTenant(policyName, xWSO2Tenant); if (apiPolicy != null) { model.add(apiPolicy); } return Response.ok().entity(InternalServiceDataUtil. fromApiPolicyToApiPolicyListDTO(model)).build(); } else { return Response.ok().entity(InternalServiceDataUtil. fromApiPolicyToApiPolicyListDTO(subscriptionValidationDAO. getAllApiPolicies(xWSO2Tenant))).build(); } } else { if (StringUtils.isNotEmpty(policyName)) { return Response.status(Response.Status.BAD_REQUEST.getStatusCode(), <START> "X-WSo2-Tenant header is missing.").build(); <END> } } return Response.ok().entity(InternalServiceDataUtil. fromApiPolicyToApiPolicyListDTO(subscriptionValidationDAO. getAllApiPolicies())).build(); } return null; }</code><technical_language>WSO2</technical_language>

Target:
public Response apiPoliciesGet(String xWSO2Tenant, String policyName, MessageContext messageContext) { SubscriptionValidationDAO subscriptionValidationDAO = new SubscriptionValidationDAO(); xWSO2Tenant = InternalServiceDataUtil.validateTenantDomain(xWSO2Tenant); if (InternalServiceDataUtil.isUserAuthorizedToTenant(xWSO2Tenant)) { if (StringUtils.isNotEmpty(xWSO2Tenant)) { if (StringUtils.isNotEmpty(policyName)) { List<APIPolicy> model = new ArrayList<>(); APIPolicy apiPolicy = subscriptionValidationDAO. getApiPolicyByNameForTenant(policyName, xWSO2Tenant); if (apiPolicy != null) { model.add(apiPolicy); } return Response.ok().entity(InternalServiceDataUtil. fromApiPolicyToApiPolicyListDTO(model)).build(); } else { return Response.ok().entity(InternalServiceDataUtil. fromApiPolicyToApiPolicyListDTO(subscriptionValidationDAO. getAllApiPolicies(xWSO2Tenant))).build(); } } else { if (StringUtils.isNotEmpty(policyName)) { return Response.status(Response.Status.BAD_REQUEST.getStatusCode(), "X-WSO2-Tenant header is missing.").build(); } } return Response.ok().entity(InternalServiceDataUtil. fromApiPolicyToApiPolicyListDTO(subscriptionValidationDAO. getAllApiPolicies())).build(); } return null; }
Source:
<code><START> cancelSearchOperation() { <END> return (pollingContext, firstResponse) -> { cancelSearch(pollingContext.getActivationResponse().getValue().getSearchId()); return Mono.just(new PhoneNumberSearch()); }; }</code><technical_language>change this pollingContext ill result anymore</technical_language>

Target:
cancelSearchOperation() { return (pollingContext, firstResponse) -> { cancelSearch(pollingContext.getLatestResponse().getValue().getSearchId()); return Mono.just(pollingContext.getLatestResponse().getValue()); }; }
Source:
<code>public abstract void update(UV value) throws Exception; public abstract GV get() throws Exception; public abstract Object getOriginal() throws Exception; public boolean isOriginalEmptyValue() throws Exception { <START> return getOriginal() == emptyValue || getOriginal().equals(emptyValue); <END> }</code><technical_language>Objects.equals(emptyValue, getOriginal())</technical_language>

Target:
public abstract void update(UV value) throws Exception; public abstract GV get() throws Exception; public abstract Object getOriginal() throws Exception; public boolean isOriginalEmptyValue() throws Exception { return Objects.equals(emptyValue, getOriginal()); }
Source:
<code>private List<DeveloperEntity> getAllEntitiesIncludingDeleted() { List<DeveloperEntity> result = entityManager.createQuery( "SELECT v from " + "DeveloperEntity v " + "LEFT OUTER JOIN FETCH v.address " + "LEFT OUTER JOIN FETCH v.contact " <START> + "LEFT OUTER JOIN FETCH v.developerCertificationStatuses ", DeveloperEntity.class).getResultList(); <END> return result; }</code><technical_language>joining in developerCertificationStatuses here. in report this code is for</technical_language>

Target:
private List<DeveloperEntity> getAllEntitiesIncludingDeleted() { List<DeveloperEntity> result = entityManager.createQuery( "SELECT v from " + "DeveloperEntity v " + "LEFT OUTER JOIN FETCH v.address " + "LEFT OUTER JOIN FETCH v.contact ", DeveloperEntity.class).getResultList(); return result; }
Source:
<code>public final boolean addEdge(final V source, final V destination) { <START> try { <END> internalGraph.addEdge(source, destination); sources.remove(destination); sinks.remove(source); return true; } catch (IllegalArgumentException e) { return false; } }</code><technical_language>a try .. catch block instead of pre-checking contains is bad code style _fail fast_</technical_language>

Target:
public final boolean addEdge(final V source, final V destination) { if (internalGraph.containsVertex(source) && internalGraph.containsVertex(destination)) { internalGraph.addEdge(source, destination); sources.remove(destination); sinks.remove(source); return true; } else { throw new IllegalArgumentException( "Source or destination not in graph."); } }
Source:
<code>public void testCreate() throws InterruptedException { server.enqueue( new MockResponse().setBody(stringFromResource("/publicip/get.json")) ); PublicIp response = publicIpApi().create(PublicIp.CreatePublicIp.create("reverseDns", "datacentarId", Types.IPType.IPV4)); assertNotNull(response); assertEquals(server.getRequestCount(), 1); <START> assertSent(server, "POST", "/public_ips"); <END> }</code><technical_language>verify payload of request</technical_language>

Target:
public void testCreate() throws InterruptedException { server.enqueue( new MockResponse().setBody(stringFromResource("/publicip/get.json")) ); PublicIp response = publicIpApi().create(PublicIp.CreatePublicIp.create("reverseDns", "datacentarId", Types.IPType.IPV4)); assertNotNull(response); assertEquals(server.getRequestCount(), 1); assertSent(server, "POST", "/public_ips", "{\"reverse_dns\":\"reverseDns\",\"datacenter_id\":\"datacentarId\",\"type\":\"IPV4\"}"); }
Source:
<code>private void extendModelWithCcmConnectivity(InstanceGroupType type, CcmConnectivityParameters ccmConnectivityParameters, Map<String, Object> model) { if (CcmConnectivityMode.CCMV1.equals(ccmConnectivityParameters.getConnectivityMode())) { <START> CcmParameters.addToTemplateModel(type, ccmConnectivityParameters.getCcmParameters(), model); <END> } else if (CcmConnectivityMode.CCMV2.equals(ccmConnectivityParameters.getConnectivityMode())) { CcmV2Parameters.addToTemplateModel(type, ccmConnectivityParameters.getCcmV2Parameters(), model); } }</code><technical_language>question, break if add CCMv1 false model</technical_language>

Target:
private void extendModelWithCcmConnectivity(InstanceGroupType type, CcmConnectivityParameters ccmConnectivityParameters, Map<String, Object> model) { if (CcmConnectivityMode.CCMV1.equals(ccmConnectivityParameters.getConnectivityMode())) { CcmParameters.addToTemplateModel(type, ccmConnectivityParameters.getCcmParameters(), model); } else if (CcmConnectivityMode.CCMV2.equals(ccmConnectivityParameters.getConnectivityMode())) { CcmV2Parameters.addToTemplateModel(type, ccmConnectivityParameters.getCcmV2Parameters(), model); } else { model.put(CcmParameterConstants.CCM_ENABLED_KEY, Boolean.FALSE); model.put(CcmV2ParameterConstants.CCM_V2_ENABLED_KEY, Boolean.FALSE); } }
Source:
<code>private boolean updateMetricsFromNotification(Run source, Run target) { if (source.getMetrics() != null && source.getMetrics().equals(target.getMetrics())) return false; if (source.getMetrics() == null && target.getMetrics() != null) { return false; } if (source.getMetrics() != null && target.getMetrics() == null) { target.setMetrics(source.getMetrics()); return true; } ObjectMapper mapper = new ObjectMapper(); ArrayNode sourceMetrics; try { sourceMetrics = mapper.readValue(source.getMetrics(), ArrayNode.class); } catch (IOException e) { <START> log.debug("Impossible junk metrics were passed in for run " + target.getId(), e); <END> return false; } ArrayNode targetMetrics; try { targetMetrics = mapper.readValue(target.getMetrics(), ArrayNode.class); } catch (IOException e) { log.debug("The database is full of garbage metrics for run " + target.getId(), e); return false; } Map<String, JsonNode> sourceMetricsMap = parseMetrics(sourceMetrics); Map<String, JsonNode> targetMetricsMap = parseMetrics(targetMetrics); if (sourceMetricsMap.equals(targetMetricsMap)) return false; targetMetricsMap.putAll(sourceMetricsMap); ArrayNode combinedMetrics = mapper.createArrayNode(); combinedMetrics.addAll(targetMetricsMap.values()); try { target.setMetrics(mapper.writeValueAsString(combinedMetrics)); } catch (JsonProcessingException e) { log.error("Failed to save data just unserialised.", e); return false; } return false; }</code><technical_language>concerning. IOException thrown for other reasons too. Log error level</technical_language>

Target:
private boolean updateMetricsFromNotification(Run source, Run target) { if (source.getMetrics() != null && source.getMetrics().equals(target.getMetrics())) return false; if (source.getMetrics() == null) { return false; } if (source.getMetrics() != null && target.getMetrics() == null) { target.setMetrics(source.getMetrics()); return true; } ObjectMapper mapper = new ObjectMapper(); ArrayNode sourceMetrics; try { sourceMetrics = mapper.readValue(source.getMetrics(), ArrayNode.class); } catch (IOException e) { log.error("Impossible junk metrics were passed in for run " + target.getId(), e); return false; } ArrayNode targetMetrics; try { targetMetrics = mapper.readValue(target.getMetrics(), ArrayNode.class); } catch (IOException e) { log.error("The database is full of garbage metrics for run " + target.getId(), e); return false; } Map<String, JsonNode> sourceMetricsMap = parseMetrics(sourceMetrics); Map<String, JsonNode> targetMetricsMap = parseMetrics(targetMetrics); if (sourceMetricsMap.equals(targetMetricsMap)) return false; targetMetricsMap.putAll(sourceMetricsMap); ArrayNode combinedMetrics = mapper.createArrayNode(); combinedMetrics.addAll(targetMetricsMap.values()); try { target.setMetrics(mapper.writeValueAsString(combinedMetrics)); } catch (JsonProcessingException e) { log.error("Failed to save data just unserialised.", e); return false; } return true; }
Source:
<code>public RiakTsPB.TsCell getPbCell() { final RiakTsPB.TsCell.Builder builder = RiakTsPB.TsCell.newBuilder(); if (hasVarcharValue()) { builder.setVarcharValue(ByteString.copyFromUtf8(varcharValue)); } <START> if (hasLong()) <END> { builder.setSint64Value(sint64Value); } if (hasTimestamp()) { builder.setTimestampValue(timestampValue); } if (hasBoolean()) { builder.setBooleanValue(booleanValue); } if (hasDouble()) { builder.setDoubleValue(doubleValue); } return builder.build(); }</code><technical_language>else if a pretty serious error for more set</technical_language>

Target:
RiakTsPB.TsCell getPbCell() { final RiakTsPB.TsCell.Builder builder = RiakTsPB.TsCell.newBuilder(); if (hasVarcharValue()) { builder.setVarcharValue(ByteString.copyFromUtf8(varcharValue)); } else if (hasLong()) { builder.setSint64Value(sint64Value); } else if (hasTimestamp()) { builder.setTimestampValue(timestampValue); } else if (hasBoolean()) { builder.setBooleanValue(booleanValue); } else if (hasDouble()) { builder.setDoubleValue(doubleValue); } return builder.build(); }
Source:
<code>protected @CheckForNull MimeMessage createMail(Run<?,?> build, TaskListener listener) throws MessagingException, UnsupportedEncodingException, InterruptedException { try { Method m = getClass().getDeclaredMethod("getMail", AbstractBuild.class, BuildListener.class); if (m.getDeclaringClass() != MailSender.class) { if (build instanceof AbstractBuild && listener instanceof BuildListener) { return getMail((AbstractBuild) build, (BuildListener) listener); } else { throw new AbstractMethodError("you must override createMail rather than getMail"); } } } catch (NoSuchMethodException x) { } if (build.getResult() == Result.FAILURE) { return createFailureMail(build, listener); } if (build.getResult() == Result.UNSTABLE) { if (!dontNotifyEveryUnstableBuild) { return createUnstableMail(build, listener); } Result prev = findPreviousBuildResult(build); if (prev == Result.SUCCESS || prev == null) { return createUnstableMail(build, listener); } } if (build.getResult() == Result.SUCCESS) { Result prev = findPreviousBuildResult(build); if (prev == Result.FAILURE) { return createBackToNormalMail(build, Messages.MailSender_BackToNormal_Normal(), listener); } if (prev == Result.UNSTABLE) { return createBackToNormalMail(build, Messages.MailSender_BackToNormal_Stable(), listener); } } <START> System.out.println("Not sending any mail as BuildResult is not set at all."); <END> return null; }</code><technical_language>a logger here</technical_language>

Target:
protected @CheckForNull MimeMessage createMail(Run<?,?> build, TaskListener listener) throws MessagingException, UnsupportedEncodingException, InterruptedException { try { Method m = getClass().getDeclaredMethod("getMail", AbstractBuild.class, BuildListener.class); if (m.getDeclaringClass() != MailSender.class) { if (build instanceof AbstractBuild && listener instanceof BuildListener) { return getMail((AbstractBuild) build, (BuildListener) listener); } else { throw new AbstractMethodError("you must override createMail rather than getMail"); } } } catch (NoSuchMethodException x) { } if (build.getResult() == Result.FAILURE) { return createFailureMail(build, listener); } if (build.getResult() == Result.UNSTABLE) { if (!dontNotifyEveryUnstableBuild) { return createUnstableMail(build, listener); } Result prev = findPreviousBuildResult(build); if (prev == Result.SUCCESS || prev == null) { return createUnstableMail(build, listener); } } if (build.getResult() == Result.SUCCESS) { Result prev = findPreviousBuildResult(build); if (prev == Result.FAILURE) { return createBackToNormalMail(build, Messages.MailSender_BackToNormal_Normal(), listener); } if (prev == Result.UNSTABLE) { return createBackToNormalMail(build, Messages.MailSender_BackToNormal_Stable(), listener); } } listener.getLogger().println("No mail will be sent out, as '" + build.getFullDisplayName() + "' does not have a result yet. Please make sure you set a proper result in case of pipeline/build scripts."); return null; }
Source:
<code>public CategoryTree createSubtree(final CategoryTree categoryTree, final Collection<? extends Identifiable<Category>> subtreeRoots) { final List<Category> subtreeRootsCategories = subtreeRoots.stream() .map(identifiable -> getCategoryOrThrow(identifiable, categoryTree)) .collect(toList()); final List<String> subtreeRootIds = subtreeRoots.parallelStream().map(Identifiable::getId).collect(toList()); subtreeRootsCategories.forEach(subtreeRoot -> { final Optional<String> rootAncestorOptional = subtreeRoot.getAncestors() .stream() .map(x -> x.getId()) .filter(ancestorId -> subtreeRootIds.contains(ancestorId)) .findFirst(); if (rootAncestorOptional.isPresent()) { <START> throw new IllegalArgumentException(String.format("category of ID [%s] cannot be subtree root and decedent of [%s]", subtreeRoot.getId(), rootAncestorOptional.get())); <END> } }); final List<Category> includedCategories = new LinkedList<>(); subtreeRootsCategories.forEach(parentCategory -> { includedCategories.add(parentCategory); final List<Category> children = categoryTree.findChildren(parentCategory); includedCategories.addAll(getSubtreeAsFlatList(categoryTree, children)); }); final List<Category> roots = findRoots(includedCategories); return create(includedCategories, roots, subtreeRootsCategories); }</code><technical_language>*decedent = descendant</technical_language>

Target:
public CategoryTree createSubtree(final CategoryTree categoryTree, final Collection<? extends Identifiable<Category>> subtreeRoots) { final List<Category> subtreeRootsCategories = subtreeRoots.stream() .map(identifiable -> getCategoryOrThrow(identifiable, categoryTree)) .collect(toList()); final List<String> subtreeRootIds = subtreeRoots.parallelStream().map(Identifiable::getId).collect(toList()); subtreeRootsCategories.forEach(subtreeRoot -> { final Optional<String> rootAncestorOptional = subtreeRoot.getAncestors() .stream() .map(x -> x.getId()) .filter(ancestorId -> subtreeRootIds.contains(ancestorId)) .findFirst(); if (rootAncestorOptional.isPresent()) { throw new IllegalArgumentException(String.format("category of ID [%s] cannot be subtree root and descendant of [%s]", subtreeRoot.getId(), rootAncestorOptional.get())); } }); final List<Category> includedCategories = new LinkedList<>(); subtreeRootsCategories.forEach(parentCategory -> { includedCategories.add(parentCategory); final List<Category> children = categoryTree.findChildren(parentCategory); includedCategories.addAll(getSubtreeAsFlatList(categoryTree, children)); }); final List<Category> roots = findRoots(includedCategories); return create(includedCategories, roots, subtreeRootsCategories); }
Source:
<code><START> public static void register(){ <END> CapabilityManager.INSTANCE.register(IGuiProvider.class, new Capability.IStorage<IGuiProvider>() { @Override public NBTBase writeNBT(Capability<IGuiProvider> capability, IGuiProvider instance, EnumFacing side) { return null; } @Override public void readNBT(Capability<IGuiProvider> capability, IGuiProvider instance, EnumFacing side, NBTBase nbt) { } }, new Callable<IGuiProvider>() { @Override public IGuiProvider call() throws Exception { return new GuiProviderBlank(); } }); }</code><technical_language>brace new line</technical_language>

Target:
public static void register() { CapabilityManager.INSTANCE.register(IGuiProvider.class, new Capability.IStorage<IGuiProvider>() { @Override public NBTBase writeNBT(Capability<IGuiProvider> capability, IGuiProvider instance, EnumFacing side) { return null; } @Override public void readNBT(Capability<IGuiProvider> capability, IGuiProvider instance, EnumFacing side, NBTBase nbt) { } }, new Callable<IGuiProvider>() { @Override public IGuiProvider call() throws Exception { return new GuiProviderBase(); } }); }
Source:
<code>public boolean isNull() { <START> return objectValue == null; <END> }</code><technical_language>return false</technical_language>

Target:
public boolean isNull() { return false; }
Source:
<code>public static boolean isValidVideoUrl(@NonNull String videoUrl) { <START> if (videoUrl.contains("edx-course-videos")) { <END> return true; } for (final String format : AppConstants.SUPPORTED_VIDEO_FORMATS) { if (isVideoHasFormat(videoUrl, format)) { return true; } } return false; }</code><technical_language>need for this check! (Ticket for this string's removal iOS follow)</technical_language>

Target:
public static boolean isValidVideoUrl(@NonNull String videoUrl) { return isSupportedVideoFormat(videoUrl, SUPPORTED_VIDEO_FORMATS); }
Source:
<code>public void testFinalFunction() throws Exception { String code = getAboveComment(); IASTTranslationUnit tu = parseAndCheckBindings(code); ICPPASTCompositeTypeSpecifier typeDeclarationS = getCompositeType(tu, 0); <START> IASTSimpleDeclaration functionDeclaration = getDeclaration(typeDeclarationS, 0); <END> IASTDeclarator[] functionDeclarators = functionDeclaration.getDeclarators(); assertEquals(1, functionDeclarators.length); assertInstance(functionDeclarators[0], ICPPASTFunctionDeclarator.class); assertVirtualSpecifiers((ICPPASTFunctionDeclarator)functionDeclarators[0], false, true); ICPPASTFunctionDefinition functionDefinition = getDeclaration(typeDeclarationS, 1); IASTFunctionDeclarator declarator = functionDefinition.getDeclarator(); assertInstance(declarator, ICPPASTFunctionDeclarator.class); assertVirtualSpecifiers((ICPPASTFunctionDeclarator)declarator, false, true); BindingAssertionHelper bh= new BindingAssertionHelper(code, true); ICPPMethod funcDecl = bh.assertNonProblem("mFuncDecl()", 9); assertFalse(funcDecl.isOverride()); assertTrue(funcDecl.isFinal()); ICPPMethod funcDef = bh.assertNonProblem("mFuncDef()", 8); assertFalse(funcDef.isOverride()); assertTrue(funcDef.isFinal()); }</code><technical_language>Code more readable easier maintain if declaration obtained binding. in other similar tests</technical_language>

Target:
public void testFinalFunction() throws Exception { String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true); CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl()", 9); assertFalse(functionDeclarationBinding.isOverride()); assertTrue(functionDeclarationBinding.isFinal()); IASTNode[] functionDeclarators = functionDeclarationBinding.getDeclarations(); assertEquals(1, functionDeclarators.length); assertInstance(functionDeclarators[0], ICPPASTFunctionDeclarator.class); assertVirtualSpecifiers((ICPPASTFunctionDeclarator)functionDeclarators[0], false, true); CPPMethod functionDefinitionBinding = bindingHelper.assertNonProblem("mFuncDef()", 8); assertFalse(functionDefinitionBinding.isOverride()); assertTrue(functionDefinitionBinding.isFinal()); IASTFunctionDeclarator declarator = functionDefinitionBinding.getDefinition(); assertInstance(declarator, ICPPASTFunctionDeclarator.class); assertVirtualSpecifiers((ICPPASTFunctionDeclarator)declarator, false, true); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); <START> long budgetId = intent.getLongExtra("BUDGET_ID", -1); <END> int cycle = intent.getIntExtra("BUDGET_CYCLE", -1); for (Budget b : Budget.getBudgets()) { if (b.getId() == budgetId) { myBudget = b; break; } } if (myBudget == null) { throw new IllegalArgumentException(); } if (cycle == -1) { if (myBudget.isRecurring()) { cycle = myBudget.getCurrentCycle(); } else { cycle = 0; } } myEntries = new ArrayList<Entry>(); for (Entry e : myBudget.getEntries()) { if (e.getDate().isAfter(myBudget.getStartDate(cycle)) && e.getDate().isBefore(myBudget.getEndDate(cycle)) || e.getDate().isEqual(myBudget.getEndDate(cycle)) || e.getDate().isEqual(myBudget.getStartDate(cycle))) { myEntries.add(e); } } setContentView(R.layout.activity_budget_summary); budgetName = (TextView) findViewById(R.id.budget_name); budgetTotal = (TextView) findViewById(R.id.budget_total); budgetSpent = (TextView) findViewById(R.id.budget_spent); budgetBalance = (TextView) findViewById(R.id.budget_balance); Collections.sort(myEntries, new EntryLogAdapter.EntryDateComparator()); Collections.reverse(myEntries); ((DrawBudgetGraph) findViewById(R.id.BudgetGraph)).setProperties(myEntries, myBudget, cycle); }</code><technical_language>I changed in pull request (which I should've done in another branch) follow a bit more. Instead of calling getXExtra Intent, this: java Bundle bundle = getIntent().getExtras(); // get budget id intent long budgetId = bundle.getLong("BudgetId", -1); int cycle = bundle.getInt("BudgetCycle", -1);</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getIntent().getExtras(); long budgetId = bundle.getLong("BudgetId", -1); int cycle = bundle.getInt("BudgetCycle", -1); myBudget = Budget.getBudgetById(budgetId); if (cycle == -1) { if (myBudget.isRecurring()) { cycle = myBudget.getCurrentCycle(); } else { cycle = 0; } } myEntries = new ArrayList<Entry>(); for (Entry e : myBudget.getEntries()) { if (e.getDate().isAfter(myBudget.getStartDate(cycle)) && e.getDate().isBefore(myBudget.getEndDate(cycle)) || e.getDate().isEqual(myBudget.getEndDate(cycle)) || e.getDate().isEqual(myBudget.getStartDate(cycle))) { myEntries.add(e); } } setContentView(R.layout.activity_budget_summary); budgetName = (TextView) findViewById(R.id.budget_name); budgetTotal = (TextView) findViewById(R.id.budget_total); budgetSpent = (TextView) findViewById(R.id.budget_spent); budgetBalance = (TextView) findViewById(R.id.budget_balance); Collections.sort(myEntries, new EntryLogAdapter.EntryDateComparator()); Collections.reverse(myEntries); ((DrawBudgetGraph) findViewById(R.id.BudgetGraph)).setProperties(myEntries, myBudget, cycle); }
Source:
<code>private StoreKey getKeyAt(ByteBuffer mmap, int index) throws IOException { <START> mmap.position(firstKeyRelativeOffset + (index * (persistedEntrySize))); <END> return factory.getStoreKey(new DataInputStream(new ByteBufferInputStream(mmap))); }</code><technical_language>minor: parentheses persistedEntrySize required</technical_language>

Target:
private StoreKey getKeyAt(ByteBuffer mmap, int index) throws IOException { mmap.position(firstKeyRelativeOffset + index * persistedEntrySize); return factory.getStoreKey(new DataInputStream(new ByteBufferInputStream(mmap))); }
Source:
<code>public void persist_shouldSearchHistoryByChargeId() { ChargeEntity chargeEntity = new ChargeEntity(); chargeEntity.setId(chargeTestRecord.getChargeId()); <START> RefundEntity refundEntity = new RefundEntity(chargeEntity, 100L, null); <END> refundEntity.setStatus(RefundStatus.REFUND_SUBMITTED); refundEntity.setReference("test-refund-entity"); refundDao.persist(refundEntity); List<RefundHistory> refundHistoryList = refundDao.searchHistoryByChargeId(chargeEntity.getId()); assertThat(refundHistoryList.size(), is(1)); RefundHistory refundHistory = refundHistoryList.get(0); assertThat(refundHistory.getId(), is(refundEntity.getId())); assertThat(refundHistory.getExternalId(), is(refundEntity.getExternalId())); assertThat(refundHistory.getAmount(), is(refundEntity.getAmount())); assertThat(refundHistory.getStatus(), is(refundEntity.getStatus())); assertNotNull(refundHistory.getChargeEntity()); assertThat(refundHistory.getChargeEntity().getId(), is(refundEntity.getChargeEntity().getId())); assertThat(refundHistory.getCreatedDate(), is(refundEntity.getCreatedDate())); assertThat(refundHistory.getVersion(), is(refundEntity.getVersion())); assertThat(refundHistory.getReference(), is(refundEntity.getReference())); }</code><technical_language>Again, this actual assert refund stores this</technical_language>

Target:
public void persist_shouldSearchHistoryByChargeId() { ChargeEntity chargeEntity = new ChargeEntity(); chargeEntity.setId(chargeTestRecord.getChargeId()); RefundEntity refundEntity = new RefundEntity(chargeEntity, 100L, userExternalId); refundEntity.setStatus(RefundStatus.REFUND_SUBMITTED); refundEntity.setReference("test-refund-entity"); refundDao.persist(refundEntity); List<RefundHistory> refundHistoryList = refundDao.searchHistoryByChargeId(chargeEntity.getId()); assertThat(refundHistoryList.size(), is(1)); RefundHistory refundHistory = refundHistoryList.get(0); assertThat(refundHistory.getId(), is(refundEntity.getId())); assertThat(refundHistory.getExternalId(), is(refundEntity.getExternalId())); assertThat(refundHistory.getAmount(), is(refundEntity.getAmount())); assertThat(refundHistory.getStatus(), is(refundEntity.getStatus())); assertNotNull(refundHistory.getChargeEntity()); assertThat(refundHistory.getChargeEntity().getId(), is(refundEntity.getChargeEntity().getId())); assertThat(refundHistory.getCreatedDate(), is(refundEntity.getCreatedDate())); assertThat(refundHistory.getVersion(), is(refundEntity.getVersion())); assertThat(refundHistory.getReference(), is(refundEntity.getReference())); assertThat(refundEntity.getUserExternalId(), is(userExternalId)); assertThat(refundHistory.getUserExternalId(), is(refundEntity.getUserExternalId())); }
Source:
<code>public void shouldNotMakeRemoteCallsInAReadonlyTransactionIfNoWorkIsDone() { TimestampService mockTimestampService = mock(TimestampService.class); LockService mockLockService = mock(LockService.class); TransactionManager txnManagerWithMocks = new SerializableTransactionManager(getKeyValueService(), mockTimestampService, LockClient.of("foo"), mockLockService, transactionService, () -> AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS, <START> conflictDetectionManager, sweepStrategyManager, NoOpCleaner.INSTANCE, 16, 4); <END> when(mockTimestampService.getFreshTimestamp()).thenReturn(1L); when(mockLockService.getMinLockedInVersionId("foo")).thenReturn(1L); txnManagerWithMocks.getImmutableTimestamp(); verify(mockTimestampService).getFreshTimestamp(); verify(mockLockService).getMinLockedInVersionId("foo"); txnManagerWithMocks.runTaskReadOnly(txn -> null); verifyNoMoreInteractions(mockLockService); verifyNoMoreInteractions(mockTimestampService); }</code><technical_language>Reuse constants AbstractTransactionTest</technical_language>

Target:
public void shouldNotMakeRemoteCallsInAReadonlyTransactionIfNoWorkIsDone() { TimestampService mockTimestampService = mock(TimestampService.class); LockService mockLockService = mock(LockService.class); TransactionManager txnManagerWithMocks = new SerializableTransactionManager(getKeyValueService(), mockTimestampService, LockClient.of("foo"), mockLockService, transactionService, () -> AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS, conflictDetectionManager, sweepStrategyManager, NoOpCleaner.INSTANCE, AbstractTransactionTest.GET_RANGES_THREAD_POOL_SIZE, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY); when(mockTimestampService.getFreshTimestamp()).thenReturn(1L); when(mockLockService.getMinLockedInVersionId("foo")).thenReturn(1L); txnManagerWithMocks.getImmutableTimestamp(); verify(mockTimestampService).getFreshTimestamp(); verify(mockLockService).getMinLockedInVersionId("foo"); txnManagerWithMocks.runTaskReadOnly(txn -> null); verifyNoMoreInteractions(mockLockService); verifyNoMoreInteractions(mockTimestampService); }
Source:
<code>private File createNewSplitSegmentFile(Integer zipSplitSegmentSuffixIndex) throws IOException { int newZipSplitSegmentSuffixIndex = zipSplitSegmentSuffixIndex == null ? (currentSplitSegmentIndex + 2) : zipSplitSegmentSuffixIndex; String baseName = FileNameUtil.getBaseName(zipFile.getName()); String extension = ".z"; if (newZipSplitSegmentSuffixIndex <= 9) { extension += "0" + newZipSplitSegmentSuffixIndex; } else { extension += newZipSplitSegmentSuffixIndex; } String newFileName = zipFile.getParent() + File.separatorChar + baseName + extension; <START> File newFile = new File(newFileName); <END> if (newFile.exists()) { throw new IOException("split zip segment " + newFileName + " already exists"); } return newFile; }</code><technical_language>new File(zipFile.getParent(), baseName + extension) concatenating path segments manually</technical_language>

Target:
private File createNewSplitSegmentFile(Integer zipSplitSegmentSuffixIndex) throws IOException { int newZipSplitSegmentSuffixIndex = zipSplitSegmentSuffixIndex == null ? (currentSplitSegmentIndex + 2) : zipSplitSegmentSuffixIndex; String baseName = FileNameUtils.getBaseName(zipFile.getName()); String extension = ".z"; if (newZipSplitSegmentSuffixIndex <= 9) { extension += "0" + newZipSplitSegmentSuffixIndex; } else { extension += newZipSplitSegmentSuffixIndex; } File newFile = new File(zipFile.getParent(), baseName + extension); if (newFile.exists()) { throw new IOException("split zip segment " + baseName + extension + " already exists"); } return newFile; }
Source:
<code>public void run() { Map<Project, File> directoriesOnFs = getProjectDirectoriesOnFileSystem(); <START> if (directoriesOnFs.size() != mDb.getNumProjects() || mDb.projectsNeedingResync(directoriesOnFs.keySet()).size() > 0) { <END> fullResync(mDb, directoriesOnFs); } mDb.close(); onTaskCompleteDelegator(); }</code><technical_language>line length</technical_language>

Target:
public void run() { Map<Project, File> directoriesOnFs = getProjectDirectoriesOnFileSystem(); boolean projectCountDiffers = directoriesOnFs.size() != db.getNumProjects(); boolean projectsNeedResync = db.projectsNeedingResync(directoriesOnFs.keySet()).size() > 0; if (projectCountDiffers || projectsNeedResync) { fullResync(directoriesOnFs); } onTaskCompleteDelegator(); }
Source:
<code>protected List<ITimeEvent> createTimeEvents(TimeGraphEntry entry, List<ITimeGraphState> values) { List<ITimeEvent> events = new ArrayList<>(values.size()); ITimeEvent prev = null; for (ITimeGraphState state : values) { ITimeEvent event = createTimeEvent(entry, state); if (prev != null) { long prevEnd = prev.getTime() + prev.getDuration(); <START> if (prevEnd < event.getTime() && !prev.isPropertyActive(IFilterProperty.isDimmed()) && !event.isPropertyActive(IFilterProperty.isDimmed())) { <END> events.add(new TimeEvent(entry, prevEnd, event.getTime() - prevEnd)); } } prev = event; events.add(event); } return events; }</code><technical_language>gap event included dimmed if a search is active. included if a saved filter is active</technical_language>

Target:
protected List<ITimeEvent> createTimeEvents(TimeGraphEntry entry, List<ITimeGraphState> values) { List<ITimeEvent> events = new ArrayList<>(values.size()); ITimeEvent prev = null; for (ITimeGraphState state : values) { ITimeEvent event = createTimeEvent(entry, state); if (prev != null) { long prevEnd = prev.getTime() + prev.getDuration(); if (prevEnd < event.getTime() && (getTimeEventFilterDialog() == null || !getTimeEventFilterDialog().hasActiveSavedFilters())) { TimeEvent timeEvent = new TimeEvent(entry, prevEnd, event.getTime() - prevEnd); if (getTimeEventFilterDialog() != null && getTimeEventFilterDialog().isFilterActive()) { timeEvent.setProperty(IFilterProperty.isDimmed(), true); } events.add(timeEvent); } } prev = event; events.add(event); } return events; }
Source:
<code>public byte[] readHeader() { LOGGER.fine("Reading header"); Request request = new Request.Builder() .url(uri.toString()) .header("range", "bytes=" + 0 + "-" + (headerLength - 1)) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { <START> throw new IOException(); <END> } String contentRange = response.header(CONTENT_RANGE_HEADER); if (contentRange.contains("/")) { String length = contentRange.split("/")[1]; try { filesize = Integer.parseInt(length); buffer = ByteBuffer.allocate(filesize); } catch (Exception e) { e.printStackTrace(); } } byte[] headerBytes = response.body().bytes(); writeValue(0, headerBytes); return headerBytes; } catch (IOException e) { LOGGER.severe("Unable to read header for " + uri); throw new RuntimeException("Unable to read header for " + uri, e); } }</code><technical_language>I add a message in IOException</technical_language>

Target:
public byte[] readHeader() { LOGGER.fine("Reading header"); Request.Builder requestBuilder = new Request.Builder() .url(uri.toString()) .header("range", "bytes=" + 0 + "-" + (headerLength - 1)); if (credentials != null) { requestBuilder.header("Authorization", credentials); } Request request = requestBuilder.build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("Unable to read header for " + uri + ". " + "Code: " + response.code() + ". Reason: " + response.message()); } byte[] headerBytes = response.body().bytes(); data.put(0L, headerBytes); return headerBytes; } catch (IOException e) { throw new RuntimeException("Unable to read header for " + uri, e); } }
Source:
<code>private static String buildOutput( String message, LiveChatMessageAuthorDetails author, LiveChatSuperChatDetails superChatDetails) { StringBuilder output = new StringBuilder(); if (superChatDetails != null) { output.append(superChatDetails.getAmountDisplayString()); output.append("SUPERCHAT RECEIVED FROM "); } output.append(author.getDisplayName()); if (author.getIsChatOwner() || author.getIsChatOwner() || author.getIsChatSponsor()) { output.append(" ("); boolean appendComma = false; if (author.getIsChatOwner()) { output.append("OWNER"); appendComma = true; } if (author.getIsChatModerator()) { if (appendComma) { output.append(", "); } output.append("MODERATOR"); appendComma = true; } if (author.getIsChatSponsor()) { if (appendComma) { output.append(", "); } <START> output.append("SPONSER"); <END> } output.append(")"); } if (message != null && !message.isEmpty()) { output.append(": "); output.append(message); } return output.toString(); }</code><technical_language>Fix typo (should "SPONSOR")</technical_language>

Target:
private static String buildOutput( String message, LiveChatMessageAuthorDetails author, LiveChatSuperChatDetails superChatDetails) { StringBuilder output = new StringBuilder(); if (superChatDetails != null) { output.append(superChatDetails.getAmountDisplayString()); output.append("SUPERCHAT RECEIVED FROM "); } output.append(author.getDisplayName()); List<String> roles = new ArrayList<String>(); if (author.getIsChatOwner()) { roles.add("OWNER"); } if (author.getIsChatModerator()) { roles.add("MODERATOR"); } if (author.getIsChatSponsor()) { roles.add("SPONSOR"); } if (roles.size() > 0) { output.append(" ("); String delim = ""; for (String role : roles) { output.append(delim).append(role); delim = ", "; } output.append(")"); } if (message != null && !message.isEmpty()) { output.append(": "); output.append(message); } return output.toString(); }
Source:
<code>public void testDefaults() { ConfigAssertions.assertRecordedDefaults(ConfigAssertions.recordDefaults(HttpServerConfig.class) .setHttpEnabled(true) .setHttpPort(8080) .setHttpAcceptQueueSize(8000) .setHttpsEnabled(false) .setHttpsPort(8443) .setSecureRandomAlgorithm(null) .setHttpsIncludedCipherSuites("") .setHttpsExcludedCipherSuites("") .setKeystorePath(null) .setKeystorePassword(null) .setKeyManagerPassword(null) .setLogPath("var/log/http-request.log") .setLogEnabled(true) .setLogMaxFileSize(new DataSize(Long.MAX_VALUE, BYTE)) .setLogHistory(15) .setQueueSize(10_000) .setHttpAcceptorThreads(null) .setHttpSelectorThreads(null) .setHttpsAcceptorThreads(null) .setHttpsSelectorThreads(null) .setMinThreads(2) .setMaxThreads(200) .setThreadMaxIdleTime(new Duration(1, MINUTES)) .setNetworkMaxIdleTime(new Duration(200, SECONDS)) .setUserAuthFile(null) .setAdminEnabled(true) .setAdminPort(0) .setAdminMinThreads(2) .setAdminMaxThreads(200) .setMaxRequestHeaderSize(null) .setHttp2MaxConcurrentStreams(16384) .setShowStackTrace(true) .setHttp2InitialSessionReceiveWindowSize(new DataSize(16, MEGABYTE)) .setHttp2InputBufferSize(new DataSize(8, KILOBYTE)) .setHttp2InitialStreamReceiveWindowSize(new DataSize(16, MEGABYTE)) .setHttp2StreamIdleTimeout(new Duration(15, SECONDS)) <START> .setLogCompressionEnabled(true)); <END> }</code><technical_language>Move next other log methods (same for in this class)</technical_language>

Target:
public void testDefaults() { ConfigAssertions.assertRecordedDefaults(ConfigAssertions.recordDefaults(HttpServerConfig.class) .setHttpEnabled(true) .setHttpPort(8080) .setHttpAcceptQueueSize(8000) .setHttpsEnabled(false) .setHttpsPort(8443) .setSecureRandomAlgorithm(null) .setHttpsIncludedCipherSuites("") .setHttpsExcludedCipherSuites("") .setKeystorePath(null) .setKeystorePassword(null) .setKeyManagerPassword(null) .setLogPath("var/log/http-request.log") .setLogEnabled(true) .setLogMaxFileSize(new DataSize(Long.MAX_VALUE, BYTE)) .setLogHistory(15) .setLogQueueSize(10_000) .setLogCompressionEnabled(true) .setHttpAcceptorThreads(null) .setHttpSelectorThreads(null) .setHttpsAcceptorThreads(null) .setHttpsSelectorThreads(null) .setMinThreads(2) .setMaxThreads(200) .setThreadMaxIdleTime(new Duration(1, MINUTES)) .setNetworkMaxIdleTime(new Duration(200, SECONDS)) .setUserAuthFile(null) .setAdminEnabled(true) .setAdminPort(0) .setAdminMinThreads(2) .setAdminMaxThreads(200) .setMaxRequestHeaderSize(null) .setHttp2MaxConcurrentStreams(16384) .setShowStackTrace(true) .setHttp2InitialSessionReceiveWindowSize(new DataSize(16, MEGABYTE)) .setHttp2InputBufferSize(new DataSize(8, KILOBYTE)) .setHttp2InitialStreamReceiveWindowSize(new DataSize(16, MEGABYTE)) .setHttp2StreamIdleTimeout(new Duration(15, SECONDS))); }
Source:
<code>public static IGraph<Diff> mapDifferencesWithSubDiffs(Collection<Diff> differences, IMerger.Registry mergerRegistry, boolean mergeRightToLeft, MergeMode mergeMode) { IGraph<Diff> differencesGraph = new Graph<Diff>(); final Predicate<? super Diff> filter; if (mergeMode == MergeMode.RIGHT_TO_LEFT) { filter = fromSide(DifferenceSource.RIGHT); } else if (mergeMode == MergeMode.LEFT_TO_RIGHT) { filter = fromSide(DifferenceSource.LEFT); } else { filter = Predicates.alwaysTrue(); } for (Diff diff : Iterables.filter(differences, filter)) { final IMerger merger = mergerRegistry.getHighestRankingMerger(diff); differencesGraph.add(diff); if (merger instanceof IMerger2) { <START> final Set<Diff> directMergeDependencies = ((IMerger2)merger).getDirectMergeDependencies(diff, <END> mergeRightToLeft); for (Diff dependency : directMergeDependencies) { differencesGraph.addChildren(dependency, Collections.singleton(diff)); } } if (MergerOptionsUtil.isSubDiffAware(merger)) { Set<Diff> subDiffs = Sets .newLinkedHashSet(ComparisonUtil.getDirectSubDiffs(!mergeRightToLeft).apply(diff)); differencesGraph.addChildren(diff, subDiffs); } } return differencesGraph; }</code><technical_language>I understand this work recursive: direct dependencies orphan parents? recurse parents, on</technical_language>

Target:
public static IGraph<Diff> mapDifferencesWithSubDiffs(Collection<Diff> differences, IMerger.Registry mergerRegistry, boolean mergeRightToLeft, MergeMode mergeMode) { IGraph<Diff> differencesGraph = new Graph<Diff>(); final Predicate<? super Diff> filter; if (mergeMode == MergeMode.RIGHT_TO_LEFT) { filter = fromSide(DifferenceSource.RIGHT); } else if (mergeMode == MergeMode.LEFT_TO_RIGHT) { filter = fromSide(DifferenceSource.LEFT); } else { filter = Predicates.alwaysTrue(); } for (Diff diff : Iterables.filter(differences, filter)) { addToGraph(mergerRegistry, differencesGraph, diff, mergeRightToLeft); } return differencesGraph; }
Source:
<code>public synchronized void stop() { <START> if (!isStarted) { throw new SystemProducerException("Attempting to stop a producer that was not started."); } if (isStopped) { throw new SystemProducerException("Attempting to stop an already stopped producer."); } try { writerMap.forEach((source, sourceWriterMap) -> flush(source)); <END> asyncBlobThreadPool.shutdown(); isStarted = false; } catch (Exception e) { throw new SystemProducerException("Stop failed with exception.", e); } finally { writerMap.clear(); isStopped = true; } }</code><technical_language>this throw exception in cases? do other SystemProducer impls do</technical_language>

Target:
public synchronized void stop() { if (!isStarted) { LOG.warn("Attempting to stop a producer that was not started."); return; } if (isStopped) { LOG.warn("Attempting to stop an already stopped producer."); return; } try { writerMap.forEach((source, sourceWriterMap) -> flush(source)); asyncBlobThreadPool.shutdown(); isStarted = false; } catch (Exception e) { throw new SystemProducerException("Stop failed with exception.", e); } finally { writerMap.clear(); isStopped = true; } }
Source:
<code>public void map(WALKey key, WALEdit value, Context context) throws IOException { context.getCounter(Counter.WALEDITS).increment(1); try { if (tables.isEmpty() || tables.containsKey(key.getTableName())) { TableName targetTable = tables.isEmpty() ? key.getTableName() : tables.get(key.getTableName()); ImmutableBytesWritable tableOut = new ImmutableBytesWritable(targetTable.getName()); Put put = null; Delete del = null; Cell lastCell = null; for (Cell cell : value.getCells()) { context.getCounter(Counter.CELLS_READ).increment(1); if (WALEdit.isMetaEditFamily(cell)) { continue; } if (filter(context, cell)) { if (lastCell == null || lastCell.getTypeByte() != cell.getTypeByte() || !CellUtil.matchingRows(lastCell, cell)) { if (put != null) { context.write(tableOut, put); context.getCounter(Counter.PUTS).increment(1); } if (del != null) { context.write(tableOut, del); context.getCounter(Counter.DELETES).increment(1); } if (CellUtil.isDelete(cell)) { del = new Delete(CellUtil.cloneRow(cell)); } else { put = new Put(CellUtil.cloneRow(cell)); } } if (CellUtil.isDelete(cell)) { context.getCounter(Counter.CELLS_WRITTEN).increment(1); del.add(cell); <START> } else { <END> context.getCounter(Counter.CELLS_WRITTEN).increment(1); put.add(cell); } } lastCell = cell; } if (put != null) { context.write(tableOut, put); context.getCounter(Counter.PUTS).increment(1); } if (del != null) { context.getCounter(Counter.DELETES).increment(1); context.write(tableOut, del); } } } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>Nit, "context.getCounter(Counter.CELLS_WRITTEN).increment(1);" moved of if else {}</technical_language>

Target:
public void map(WALKey key, WALEdit value, Context context) throws IOException { context.getCounter(Counter.WALEDITS).increment(1); try { if (tables.isEmpty() || tables.containsKey(key.getTableName())) { TableName targetTable = tables.isEmpty() ? key.getTableName() : tables.get(key.getTableName()); ImmutableBytesWritable tableOut = new ImmutableBytesWritable(targetTable.getName()); Put put = null; Delete del = null; Cell lastCell = null; for (Cell cell : value.getCells()) { context.getCounter(Counter.CELLS_READ).increment(1); if (WALEdit.isMetaEditFamily(cell)) { continue; } if (filter(context, cell)) { if (lastCell == null || lastCell.getTypeByte() != cell.getTypeByte() || !CellUtil.matchingRows(lastCell, cell)) { if (put != null) { context.write(tableOut, put); context.getCounter(Counter.PUTS).increment(1); } if (del != null) { context.write(tableOut, del); context.getCounter(Counter.DELETES).increment(1); } if (CellUtil.isDelete(cell)) { del = new Delete(CellUtil.cloneRow(cell)); } else { put = new Put(CellUtil.cloneRow(cell)); } } if (CellUtil.isDelete(cell)) { del.add(cell); } else { put.add(cell); } context.getCounter(Counter.CELLS_WRITTEN).increment(1); } lastCell = cell; } if (put != null) { context.write(tableOut, put); context.getCounter(Counter.PUTS).increment(1); } if (del != null) { context.getCounter(Counter.DELETES).increment(1); context.write(tableOut, del); } } } catch (InterruptedException e) { e.printStackTrace(); } }