auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void createColumns(List<TmfEventTableColumn> columns) { <END> int i = 0; for (TmfEventTableColumn column : columns) { TableColumn tableCol = new TableColumn(fTable, SWT.LEFT, i); tableCol.setText(column.getHeaderName()); String tooltip = column.getHeaderTooltip(); if (tooltip != null) { tableCol.setToolTipText(tooltip); } if (column instanceof TmfTimestampColumn) { tableCol.setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP); } else if (column instanceof TmfTypeColumn) { tableCol.setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TYPE); } else if (column instanceof TmfContentsColumn) { tableCol.setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_CONTENT); } tableCol.addControlListener(fResizeListener); tableCol.setWidth(100); i++; } }</code><technical_language>lose width alignment functionality. set manually table subclass. work if columns created a column chooser a plug-in extension (is planned?)</technical_language>

Target:
public void createColumns(List<TmfEventTableColumn> columns) { for (TmfEventTableColumn column : columns) { TableColumn tableCol = new TableColumn(fTable, SWT.LEFT); tableCol.setText(column.getHeaderName()); String tooltip = column.getHeaderTooltip(); if (tooltip != null) { tableCol.setToolTipText(tooltip); } tableCol.setData(Key.FIELD_ID, column.getFilterFieldId()); tableCol.addControlListener(fResizeListener); tableCol.pack(); } }
Source:
<code>private String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg) { String chStr = ctx.channel().toString(); int length = msg.readableBytes(); if (length == 0) { StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 4); buf.append(chStr).append(' ').append(eventName).append(": 0B"); return buf.toString(); } else { int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4; <START> StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + 10 + 1 + 2 + rows * 80); <END> buf.append(chStr).append(' ').append(eventName).append(": ").append(length).append('B'); if (byteBufFormat == ByteBufFormat.HEX_DUMP) { buf.append(NEWLINE); appendPrettyHexDump(buf, msg); } return buf.toString(); } }</code><technical_language>adjust StringBuilder capacity accordingly? (same for ByteBufHolder case below) kind of separate this change I if InternalThreadLocalMap#stringBuilder() in methods (maybe care allocations in cases this amount of logging is enabled)</technical_language>

Target:
private String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg) { String chStr = ctx.channel().toString(); int length = msg.readableBytes(); if (length == 0) { StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 4); buf.append(chStr).append(' ').append(eventName).append(": 0B"); return buf.toString(); } else { int outputLength = chStr.length() + 1 + eventName.length() + 2 + 10 + 1; if (byteBufFormat == ByteBufFormat.HEX_DUMP) { int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4; int hexDumpLength = 2 + rows * 80; outputLength += hexDumpLength; } StringBuilder buf = new StringBuilder(outputLength); buf.append(chStr).append(' ').append(eventName).append(": ").append(length).append('B'); if (byteBufFormat == ByteBufFormat.HEX_DUMP) { buf.append(NEWLINE); appendPrettyHexDump(buf, msg); } return buf.toString(); } }
Source:
<code><START> void setActiveSegment(String name) { <END> if (!segmentsByName.containsKey(name)) { throw new IllegalArgumentException("There is no log segment with name: " + name); } activeSegment = segmentsByName.get(name); }</code><technical_language>this remain package private next PR well? a private one</technical_language>

Target:
void setActiveSegment(String name) throws IOException { if (!segmentsByName.containsKey(name)) { throw new IllegalArgumentException("There is no log segment with name: " + name); } ConcurrentNavigableMap<String, LogSegment> extraSegments = segmentsByName.tailMap(name, false); Iterator<Map.Entry<String, LogSegment>> iterator = extraSegments.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, LogSegment> entry = iterator.next(); logger.info("Freeing extra segment with name ", entry.getValue().getName()); free(entry.getValue()); iterator.remove(); } logger.info("Setting active segment to [{}]", name); activeSegment = segmentsByName.get(name); }
Source:
<code>public void invoke(String value) throws Exception { <START> assert value.equals(RECORD); <END> }</code><technical_language>change assertEquals</technical_language>

Target:
public void invoke(String value) throws Exception { assertEquals(RECORD, value); }
Source:
<code>private static Certificate readX509Certificate(Path certificateFilePath) { try { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); Certificate certificate; try (InputStream stream = Files.newInputStream(certificateFilePath)) { certificate = certFactory.generateCertificate(stream); } return certificate; } catch (GeneralSecurityException | IOException e) { <START> throw Throwables.propagate(e); <END> } }</code><technical_language>this file name</technical_language>

Target:
private static Certificate readX509Certificate(Path certificateFilePath) { try { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); Certificate certificate; try (InputStream stream = Files.newInputStream(certificateFilePath)) { certificate = certFactory.generateCertificate(stream); } return certificate; } catch (GeneralSecurityException | IOException e) { throw new RuntimeException(String.format("Could not read file at \"%s\" as an X.509 certificate", certificateFilePath.toAbsolutePath()), e); } }
Source:
<code>public GlusterHooksListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); if (mStatus.mCode != 0) { return; } Object[] hooksArr = (Object[]) innerMap.get(HOOKS_LIST); if (hooksArr != null) { <START> for (int i = 0; i < hooksArr.length; i++) { <END> this.hooks.add(getHook((Map<String, Object>) hooksArr[i])); } } }</code><technical_language>this changed foreach sytle</technical_language>

Target:
public GlusterHooksListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); if (mStatus.mCode != 0) { return; } Object[] hooksArr = (Object[]) innerMap.get(HOOKS_LIST); if (hooksArr != null) { for (Object hookMap : hooksArr) { this.hooks.add(getHook((Map<String, Object>)hookMap)); } } }
Source:
<code>public static String getStyledText(Iterable<StyleRangeEntry> entries, String text) { if (text == null) { return null; } char[] chars = text.toCharArray(); boolean[] mask = new boolean[chars.length]; Arrays.fill(mask, true); <START> boolean _isEmpty = true; <END> for (StyleRangeEntry entry : entries) { _isEmpty = false; int start = entry.getStart(); Arrays.fill(mask, 0, start, false); } StringBuilder styledResult = new StringBuilder(); if (!_isEmpty) { for (int i = 0; i < chars.length; i++) { if (mask[i]) { styledResult.append(chars[i]); } } } return styledResult.toString(); }</code><technical_language>Please <LINK_0> for naming conventions. "isEmpty"</technical_language>

Target:
public static String getStyledText(Iterable<StyleRangeEntry> entries, String text) { if (text == null) { return null; } char[] chars = text.toCharArray(); boolean[] mask = new boolean[chars.length]; Arrays.fill(mask, false); boolean isEmpty = true; for (StyleRangeEntry entry : entries) { isEmpty = false; int start = entry.getStart(); Arrays.fill(mask, start, start + entry.getLength(), true); } StringBuilder styledResult = new StringBuilder(); if (!isEmpty) { for (int i = 0; i < chars.length; i++) { if (mask[i]) { styledResult.append(chars[i]); } } } return styledResult.toString(); }
Source:
<code>public static void trace(String option, String message, Throwable throwable) { String systemPrintableMessage = message; while (systemPrintableMessage.length() > 100) { String partial = systemPrintableMessage.substring(0, 100); systemPrintableMessage = systemPrintableMessage.substring(100); System.out.print(partial + "\\"); } <START> System.out.println(systemPrintableMessage); <END> if(fgDebugTrace != null) { fgDebugTrace.trace(option, message, throwable); } }</code><technical_language>changed wrong :) is while loop print()</technical_language>

Target:
public static void trace(String option, String message, Throwable throwable) { String systemPrintableMessage = message; while (systemPrintableMessage.length() > 100) { String partial = systemPrintableMessage.substring(0, 100); systemPrintableMessage = systemPrintableMessage.substring(100); System.out.println(partial + "\\"); } System.out.print(systemPrintableMessage); if(fgDebugTrace != null) { fgDebugTrace.trace(option, message, throwable); } }
Source:
<code>private void verifyAllManagedMemoryIsReleasedAfter(CompletableFuture<Void> after) { <START> FutureUtils.runAfterwardsAsync( after, () -> { if (!memoryManager.verifyEmpty()) { LOG.warn("Not all slot memory is freed, potential memory leak at {}", this); } }, asyncExecutor); <END> }</code><technical_language>sense run this action if completed normally. E.g. after.thenRunAsync(() -> ..., asyncExecutor)</technical_language>

Target:
private void verifyAllManagedMemoryIsReleasedAfter(CompletableFuture<Void> after) { after.thenRunAsync( () -> { if (!memoryManager.verifyEmpty()) { LOG.warn("Not all slot memory is freed, potential memory leak at {}", this); } }, asyncExecutor); }
Source:
<code>private static boolean performImportWithoutUI(VirtualFile importSource, Project destinationProject) throws IOException { for (ModuleImporter importer : ModuleImporter.getAllImporters(destinationProject)) { if (importer.canImport(importSource)) { <START> HashMap<String, VirtualFile> modules = Maps.newHashMap(); <END> for (ModuleToImport module : importer.findModules(importSource)) { modules.put(module.name, module.location); } importer.importProjects(modules); return true; } } return false; }</code><technical_language>Map instead of HashMap left hand side</technical_language>

Target:
private static boolean performImportWithoutUI(VirtualFile importSource, Project destinationProject) throws IOException { for (ModuleImporter importer : ModuleImporter.getAllImporters(destinationProject)) { if (importer.canImport(importSource)) { Map<String, VirtualFile> modules = Maps.newHashMap(); for (ModuleToImport module : importer.findModules(importSource)) { modules.put(module.name, module.location); } importer.importProjects(modules); return true; } } return false; }
Source:
<code>public static IValue getConditionDeclValue(ExecSimpleDeclaration conditionDeclExec, ActivationRecord record, ConstexprEvaluationContext context) { ICPPBinding declaredBinding = ((ExecDeclarator)conditionDeclExec.getDeclaratorExecutions()[0]).getDeclaredBinding(); conditionDeclExec.executeForFunctionCall(record, context.recordStep()); <START> return record.getVariable(declaredBinding).computeForFunctionCall(record, context).getValue(null); <END> }</code><technical_language>null -> context.getPoint()</technical_language>

Target:
public static IValue getConditionDeclValue(ExecSimpleDeclaration conditionDeclExec, ActivationRecord record, ConstexprEvaluationContext context) { ICPPBinding declaredBinding = ((ExecDeclarator)conditionDeclExec.getDeclaratorExecutions()[0]).getDeclaredBinding(); conditionDeclExec.executeForFunctionCall(record, context.recordStep()); return record.getVariable(declaredBinding).computeForFunctionCall(record, context).getValue(context.getPoint()); }
Source:
<code>public void add( String groupName, List<String> hostFQDNs, List<String> components) { hostGroups.put(groupName, ImmutableList.copyOf(components)); <START> hostGroupsToHosts.put(groupName, ImmutableList.copyOf(hostFQDNs)); <END> hasHosts = true; }</code><technical_language>Worth calling checkNotNull components hostFQDNs</technical_language>

Target:
public void add( String groupName, List<String> hostFQDNs, List<String> components) { Preconditions.checkNotNull(hostFQDNs, "No hosts in list"); Preconditions.checkNotNull(components, "No components to install"); hostGroups.put(groupName, ImmutableList.copyOf(components)); hostGroupsToHosts.put(groupName, ImmutableList.copyOf(hostFQDNs)); hasHosts = true; }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> if (EXECUTE.equals(getActionState()) && <END> getSucceeded()){ return outOfSyncHostsExist() ? CLUSTER_SYNC_ALL_NETWORKS_STARTED : CLUSTER_SYNC_NOTHING_TO_DO; } else if (EXECUTE.equals(getActionState()) && !getSucceeded()) { return CLUSTER_SYNC_ALL_NETWORKS_START_ERROR; } else if (END_SUCCESS.equals(getActionState())) { return CLUSTER_SYNC_ALL_NETWORKS_FINISHED; } return CLUSTER_SYNC_ALL_NETWORKS_FAILED; }</code><technical_language>I is more easy read if common code structure like: switch (getActionState()) { case EXECUTE: return getSucceeded() ? ..</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (!getSucceeded()){ return CLUSTER_SYNC_ALL_NETWORKS_START_ERROR; } else if (!outOfSyncHostsExist()){ return CLUSTER_SYNC_NOTHING_TO_DO; } else { return CLUSTER_SYNC_ALL_NETWORKS_STARTED; } case END_SUCCESS: return CLUSTER_SYNC_ALL_NETWORKS_FINISHED; } return CLUSTER_SYNC_ALL_NETWORKS_FAILED; }
Source:
<code>public void stop(boolean abort) { if (!setRunning(false)) { return; } LOG.info("Stopping the Region Procedure Store, isAbort={}", abort); <START> if (localStore != null) { <END> localStore.close(abort); } }</code><technical_language>Is this right place stop this? localStore Master, owned shutdown Master? passes in RPS use? Master shuts down. shut other users done it</technical_language>

Target:
public void stop(boolean abort) { if (!setRunning(false)) { return; } LOG.info("Stopping the Region Procedure Store, isAbort={}", abort); }
Source:
<code><START> public synchronized byte[] serialize(Message<?> message) throws SerializationException { <END> Kryo kryo = kryoInstance(); Output output = new Output(2048, -1); kryo.writeObjectOrNull(output, message, GenericMessage.class); return output.getBuffer(); }</code><technical_language>3 methods, I need synchronized. state appears in method-scope</technical_language>

Target:
public byte[] serialize(Message<?> message) throws SerializationException { Kryo kryo = kryoInstance(); Output output = new Output(2048, -1); kryo.writeObjectOrNull(output, message, GenericMessage.class); return output.getBuffer(); }
Source:
<code>public void prepare() { try { PluggableSCMMaterial material = (PluggableSCMMaterial) revision.getMaterial(); Modification latestModification = revision.getLatestModification(); SCMRevision scmRevision = new SCMRevision(latestModification.getRevision(), latestModification.getModifiedTime(), null, null, latestModification.getAdditionalDataMap(), null); File destinationFolder = material.workingDirectory(workingDirectory); Result result = scmExtension.checkout(material.getScmConfig().getPluginConfiguration().getId(), buildSCMPropertyConfigurations(material.getScmConfig()), destinationFolder.getAbsolutePath(), scmRevision); if (!result.isSuccessful()) { } } catch (Exception e) { <START> } <END> }</code><technical_language>gobble exceptions</technical_language>

Target:
public void prepare() { try { PluggableSCMMaterial material = (PluggableSCMMaterial) revision.getMaterial(); Modification latestModification = revision.getLatestModification(); SCMRevision scmRevision = new SCMRevision(latestModification.getRevision(), latestModification.getModifiedTime(), null, null, latestModification.getAdditionalDataMap(), null); File destinationFolder = material.workingDirectory(workingDirectory); Result result = scmExtension.checkout(material.getScmConfig().getPluginConfiguration().getId(), buildSCMPropertyConfigurations(material.getScmConfig()), destinationFolder.getAbsolutePath(), scmRevision); handleCheckoutResult(material, result); } catch (Exception e) { consumer.errOutput(String.format("Material %s checkout failed: %s", revision.getMaterial().getDisplayName(), e.getMessage())); } }
Source:
<code>public String getFailureMessage() { String result = null; if (checkHeight && checkWidth) { result = new ComparisonFailure("The expected bounds is not reached.", expectedBounds.toString(), getCurrentAbsoluteBounds().toString()).getMessage(); } else if (checkWidth) { result = new ComparisonFailure("The expected width is not reached.", Integer.toString(expectedBounds.width), Integer.toString(getCurrentAbsoluteBounds().width)).getMessage(); } else if (checkHeight) { result = new ComparisonFailure("The expected <START> width is <END> not reached.", Integer.toString(expectedBounds.height), Integer.toString(getCurrentAbsoluteBounds().height)).getMessage(); } else { result = "The expected location is not reached, expected:<" + expectedBounds.getLocation() + "> but was:<" + getCurrentAbsoluteBounds().getLocation() + ">"; } return result; }</code><technical_language>height</technical_language>

Target:
public String getFailureMessage() { String result = null; if (checkHeight && checkWidth) { result = new ComparisonFailure("The expected bounds is not reached.", expectedBounds.toString(), getCurrentAbsoluteBounds().toString()).getMessage(); } else if (checkWidth) { result = new ComparisonFailure("The expected width is not reached.", Integer.toString(expectedBounds.width), Integer.toString(getCurrentAbsoluteBounds().width)).getMessage(); } else if (checkHeight) { result = new ComparisonFailure("The expected height is not reached.", Integer.toString(expectedBounds.height), Integer.toString(getCurrentAbsoluteBounds().height)).getMessage(); } else { result = new ComparisonFailure("The expected location is not reached.", expectedBounds.getLocation().toString(), getCurrentAbsoluteBounds().getLocation().toString()).getMessage(); } return result; }
Source:
<code>public List<Map<String, String>> resultsFolderJson(@PathVariable("tenant") final String tenant, @RequestParam(value = "not_before", required = false) final String timestamp) { final TenantContext context = _tenantContextFactory.getContext(tenant); final Date searchedTimestamp; if (timestamp == null || Long.valueOf(timestamp) < 0) { searchedTimestamp = null; } else { searchedTimestamp = new Date(Long.valueOf(timestamp)); } final RepositoryFolder resultsFolder = context.getResultFolder(); final List<Map<String, String>> result = new ArrayList<>(); { final List<RepositoryFile> files = resultsFolder.getFiles(null, FileFilters.ANALYSIS_RESULT_SER.getExtension()); for (final RepositoryFile file : files) { final Map<String, String> map = new HashMap<>(); final String name = file.getName(); if (searchedTimestamp != null) { final String timestampString = name.substring(name.lastIndexOf("-") + 1, name.indexOf(".")); final Date jobDate = new Date(Long.valueOf(timestampString)); <START> if (jobDate.after(searchedTimestamp)) { <END> map.put("filename", name); map.put("repository_path", file.getQualifiedPath()); } } else { map.put("filename", name); map.put("repository_path", file.getQualifiedPath()); } if (map.size() > 0) { result.add(map); } } } return result; }</code><technical_language>lines in method, parsing of timestamp in beginning</technical_language>

Target:
public List<Map<String, String>> resultsFolderJson(@PathVariable("tenant") final String tenant, @RequestParam(value = "not_before", required = false) final String timestamp) { final TenantContext context = _tenantContextFactory.getContext(tenant); final RepositoryFolder resultsFolder = context.getResultFolder(); final List<Map<String, String>> result = new ArrayList<>(); { final List<RepositoryFile> files = resultsFolder.getFiles(null, FileFilters.ANALYSIS_RESULT_SER.getExtension()); for (final RepositoryFile file : files) { final Map<String, String> map = new HashMap<>(); final String name = file.getName(); if (isEligibleJob(timestamp, name)) { map.put("filename", name); map.put("repository_path", file.getQualifiedPath()); result.add(map); } } } return result; }
Source:
<code>public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request) { <START> if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.HIGH_LEVEL_API)) { <END> return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } try { return createSubscription(subscriptionBase, request); } catch (final DuplicatedSubscriptionException e) { try { return new ResponseEntity<>(getExistingSubscription(subscriptionBase), HttpStatus.OK); } catch (final NakadiException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return Responses.create(Response.Status.INTERNAL_SERVER_ERROR, ex.getProblemMessage(), request); } } catch (final InternalNakadiException e) { LOG.error("Error occurred during subscription creation", e); return Responses.create(e.asProblem(), request); } }</code><technical_language>I agree Viktor static imports, in of cases code laconic. I if of change move direction refactor other's code writing new code. For more fine if static imports in code create (until a coding guideline rule for that), I sense removing static imports in existing code</technical_language>

Target:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (errors.hasErrors()) { return create(new ValidationProblem(errors), request); } try { return createSubscription(subscriptionBase, request); } catch (final DuplicatedSubscriptionException e) { try { return new ResponseEntity<>(getExistingSubscription(subscriptionBase), HttpStatus.OK); } catch (final NakadiException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return create(INTERNAL_SERVER_ERROR, ex.getProblemMessage(), request); } } catch (final InternalNakadiException e) { LOG.error("Error occurred during subscription creation", e); return create(e.asProblem(), request); } }
Source:
<code>private void sendAllDeferred() { if (!deferredMessages.isEmpty()) logger.info("transmitting deferred messages now ..."); List<Message> localMessages = new ArrayList<>(); final List<Message> highPriority = new ArrayList<>(); for (final Message message : new ArrayList<>(deferredMessages)) { if (message.hasPart(MessageParts.PriorityProcessing)) { if (remotes.containsKey(message.getSubject())) { highPriority.add(message); } else { localMessages.add(message); } deferredMessages.remove(message); } } final List<Message> lowPriority = new ArrayList<>(); do { for (final Message message : new ArrayList<>(deferredMessages)) { if (remotes.containsKey(message.getSubject())) { lowPriority.add(message); localMessages.remove(message); } else { localMessages.add(message); } deferredMessages.remove(message); } } while (!deferredMessages.isEmpty()); try { transportHandler.transmit(highPriority); transportHandler.transmit(lowPriority); for (final Message message : localMessages) { String subject = message.getSubject(); <START> if(!localSubscriptions.containsKey(subject)) { <END> try { throw new NoSubscribersToDeliverTo(subject); } catch (NoSubscribersToDeliverTo ex) { if (message.getErrorCallback() != null) { message.getErrorCallback().error(message, ex); } } } } } finally { deferredMessages.clear(); } }</code><technical_language>This is there, I need change this condition this: !(localSubscriptions.containsKey(subject) || subscriptions.containsKey(subject) || shadowSubscriptions.containsKey(subject)) If in implementation of send method in bus. fields + remotes places a message delivered, if of contains a matching subject message subscribers</technical_language>

Target:
private void sendAllDeferred() { if (!deferredMessages.isEmpty()) logger.info("transmitting deferred messages now ..."); final List<Message> highPriority = new ArrayList<>(); for (final Message message : new ArrayList<>(deferredMessages)) { if (message.hasPart(MessageParts.PriorityProcessing)) { if (remotes.containsKey(message.getSubject())) { highPriority.add(message); deferredMessages.remove(message); } } } final List<Message> lowPriority = new ArrayList<>(); for (final Message message : new ArrayList<>(deferredMessages)) { if (remotes.containsKey(message.getSubject())) { lowPriority.add(message); deferredMessages.remove(message); } } try { transportHandler.transmit(highPriority); transportHandler.transmit(lowPriority); for (final Message message : deferredMessages) { String subject = message.getSubject(); if (!(localSubscriptions.containsKey(subject) || subscriptions.containsKey(subject) || shadowSubscriptions.containsKey(subject))) { try { throw new NoSubscribersToDeliverTo(subject); } catch (NoSubscribersToDeliverTo ex) { if (message.getErrorCallback() != null) { message.getErrorCallback().error(message, ex); } } } } } finally { deferredMessages.clear(); } }
Source:
<code>public Map<String, String> getDiskAddressMap(VmDevice vmDevice, DiskInterface diskInterface) { String address = vmDevice.getAddress(); if (diskInterface != DiskInterface.VirtIO_SCSI && diskInterface != DiskInterface.SPAPR_VSCSI) { if (StringUtils.isNotBlank(address)) { return XmlRpcStringUtils.string2Map(address); } } else { try { lockVmDiskHotPlugWithWait(); <START> VM vm = DbFacade.getInstance().getVmDao().get(getParameters().getVmId()); <END> Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); int sPaprVscsiIndex = controllerIndexMap.get(DiskInterface.SPAPR_VSCSI); if (diskInterface == DiskInterface.VirtIO_SCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForVirtioScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, virtioScsiIndex, false); } else if (diskInterface == DiskInterface.SPAPR_VSCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForSpaprScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, sPaprVscsiIndex, true); } } finally { LockManagerFactory.getLockManager().releaseLock(vmDiskHotPlugEngineLock); } } return null; }</code><technical_language>please injection for VmDao</technical_language>

Target:
public Map<String, String> getDiskAddressMap(VmDevice vmDevice, DiskInterface diskInterface) { String address = vmDevice.getAddress(); if (diskInterface != DiskInterface.VirtIO_SCSI && diskInterface != DiskInterface.SPAPR_VSCSI) { if (StringUtils.isNotBlank(address)) { return XmlRpcStringUtils.string2Map(address); } } else { EngineLock vmDiskHotPlugEngineLock = null; try { vmDiskHotPlugEngineLock = lockVmDiskHotPlugWithWait(); VM vm = vmDAO.get(getParameters().getVmId()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); int sPaprVscsiIndex = controllerIndexMap.get(DiskInterface.SPAPR_VSCSI); if (diskInterface == DiskInterface.VirtIO_SCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForVirtioScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, virtioScsiIndex, false); } else if (diskInterface == DiskInterface.SPAPR_VSCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForSpaprScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, sPaprVscsiIndex, true); } } finally { LockManagerFactory.getLockManager().releaseLock(vmDiskHotPlugEngineLock); } } return null; }
Source:
<code>private AtomicReference<Status> processRequest(DataSegmentChangeRequest changeRequest) { synchronized (requestStatusesLock) { if (requestStatuses.getIfPresent(changeRequest) == null) { <START> if (changeRequest instanceof SegmentChangeRequestLoad) { <END> requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); exec.submit( () -> SegmentLoadDropHandler.this.addSegment( ((SegmentChangeRequestLoad) changeRequest).getSegment(), DataSegmentChangeCallback.NOOP ) ); } else if (changeRequest instanceof SegmentChangeRequestDrop) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); SegmentLoadDropHandler.this.removeSegment( ((SegmentChangeRequestDrop) changeRequest).getSegment(), DataSegmentChangeCallback.NOOP, true ); } else { throw new IAE("Not a segment load/drop request[%s].", changeRequest.getClass().getName()); } } return requestStatuses.getIfPresent(changeRequest); } }</code><technical_language>Eliminate if checks, add a method go(SegmentLoadDropHandler handler, DataSegmentChangeCallback callback) DataSegmentChangeRequest that</technical_language>

Target:
private AtomicReference<Status> processRequest(DataSegmentChangeRequest changeRequest) { synchronized (requestStatusesLock) { if (requestStatuses.getIfPresent(changeRequest) == null) { changeRequest.go( new DataSegmentChangeHandler() { @Override public void addSegment(DataSegment segment, DataSegmentChangeCallback callback) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); exec.submit( () -> SegmentLoadDropHandler.this.addSegment( ((SegmentChangeRequestLoad) changeRequest).getSegment(), () -> resolveWaitingFutures() ) ); } @Override public void removeSegment(DataSegment segment, DataSegmentChangeCallback callback) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); SegmentLoadDropHandler.this.removeSegment( ((SegmentChangeRequestDrop) changeRequest).getSegment(), () -> resolveWaitingFutures(), true ); } }, () -> resolveWaitingFutures() ); } return requestStatuses.getIfPresent(changeRequest); } }
Source:
<code>public StreamSpec streamFromConfig(String streamId) { <START> StreamConfig streamConfig = new StreamConfig(config); <END> String system = streamConfig.getSystem(streamId); String physicalName = streamConfig.getPhysicalName(streamId, streamId); Map<String, String> properties = streamConfig.getStreamProperties(streamId); return new StreamSpec(streamId, physicalName, system, properties); }</code><technical_language>code simplified call next streamFromConfig(streamId, physicalName), e.g.; StreamSpec streamFromConfig(string streamId) { SteamConfig streamConfig = ... String physicalName = ... return streamFromConfig(streamId, physicalName); }</technical_language>

Target:
public StreamSpec streamFromConfig(String streamId) { StreamConfig streamConfig = new StreamConfig(config); String physicalName = streamConfig.getPhysicalName(streamId, streamId); return streamFromConfig(streamId, physicalName); }
Source:
<code>private Integer getPrecedenceLevel(RouterErrorCode routerErrorCode) { if (precedenceLevels.containsKey(routerErrorCode)) { return precedenceLevels.get(routerErrorCode); } else { <START> return Integer.MIN_VALUE; <END> } }</code><technical_language>If unknown error code is thrown, higher precedence set resolved error code. design this intentionally</technical_language>

Target:
private Integer getPrecedenceLevel(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobExpired: return 1; case AmbryUnavailable: return 2; case UnexpectedInternalError: return 3; case OperationTimedOut: return 4; case BlobDoesNotExist: return 5; default: return Integer.MIN_VALUE; } }
Source:
<code>public void testForValueOff() { final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.OFF; final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map( administrativeStatusType, AdministrativeStatusTypeDto.class); <START> assertNotNull(administrativeStatusType); <END> assertNotNull(administrativeStatusTypeDto); assertEquals(administrativeStatusType.value(), administrativeStatusTypeDto.value()); }</code><technical_language>useless check for administrativeStatusType null, assigned line 64</technical_language>

Target:
public void testForValueOff() { final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.OFF; final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map( administrativeStatusType, AdministrativeStatusTypeDto.class); assertNotNull(administrativeStatusTypeDto); assertEquals(administrativeStatusType.value(), administrativeStatusTypeDto.value()); }
Source:
<code>public PMML4Result evaluate(KiePMMLModel model, PMMLContext pmmlContext, String releaseId) { if (!(model instanceof KiePMMLDroolsModel)) { throw new KiePMMLModelException("Expected a KiePMMLDroolsModel, received a " + model.getClass().getName()); } <START> final KiePMMLDroolsModel drooledModel = (KiePMMLDroolsModel) model; <END> final Map<String, Object> requestData = getUnwrappedParametersMap(pmmlContext.getRequestData().getMappedRequestParams()); return (PMML4Result) drooledModel.evaluate(requestData); }</code><technical_language>Please rename droolsModel droolsPMMLModel for consistency</technical_language>

Target:
public PMML4Result evaluate(KiePMMLModel model, PMMLContext pmmlContext, String releaseId) { if (!(model instanceof KiePMMLDroolsModel)) { throw new KiePMMLModelException("Expected a KiePMMLDroolsModel, received a " + model.getClass().getName()); } final KiePMMLDroolsModel droolsModel = (KiePMMLDroolsModel) model; final Map<String, Object> requestData = getUnwrappedParametersMap(pmmlContext.getRequestData().getMappedRequestParams()); return (PMML4Result) droolsModel.evaluate(requestData); }
Source:
<code><START> public final I18nResolver getI18nResolver() { <END> return i18nResolver; }</code><technical_language>this method public visibility</technical_language>

Target:
protected final I18nResolver getI18nResolver() { return i18nResolver; }
Source:
<code>public int hashCode() { <START> return Objects.hash(getId()); <END> }</code><technical_language>consistent equals, of ID avoided</technical_language>

Target:
public int hashCode() { return Objects.hash(getName(), getPassPercentage(), getContent(), getDescription(), getProperties(), getState()); }
Source:
<code>public Build scheduleBuild(Map<String, ?> params) { <START> visit(""); <END> int nb = getJson().get("nextBuildNumber").intValue(); if (parameters.isEmpty()) { clickLink("Build Now"); } else { clickLink("Build with Parameters"); for (Parameter def : parameters) { Object v = params.get(def.getName()); if (v != null) { def.fillWith(v); } } clickButton("Build"); } return build(nb); }</code><technical_language>open()</technical_language>

Target:
public Build scheduleBuild(Map<String, ?> params) { open(); int nb = getJson().get("nextBuildNumber").intValue(); if (parameters.isEmpty()) { clickLink("Build Now"); } else { clickLink("Build with Parameters"); for (Parameter def : parameters) { Object v = params.get(def.getName()); if (v != null) { def.fillWith(v); } } clickButton("Build"); } return build(nb); }
Source:
<code>public static LocalPaxosServices createInstrumentedLocalServices( MetricsManager metricsManager, LeaderConfig config, UserAgent userAgent) { Set<String> remoteLeaderUris = Sets.newHashSet(config.leaders()); remoteLeaderUris.remove(config.localServer()); RemotePaxosServerSpec remotePaxosServerSpec = ImmutableRemotePaxosServerSpec.builder() .remoteLeaderUris(remoteLeaderUris) .remoteAcceptorUris(remoteLeaderUris) .remoteLearnerUris(remoteLeaderUris) .build(); return createInstrumentedLocalServices( metricsManager, config, remotePaxosServerSpec, <START> () -> RemotingClientConfig.ALWAYS_USE_LEGACY, END> userAgent, LeadershipObserver.NO_OP); }</code><technical_language>legacy</technical_language>

Target:
public static LocalPaxosServices createInstrumentedLocalServices( MetricsManager metricsManager, LeaderConfig config, UserAgent userAgent) { Set<String> remoteLeaderUris = Sets.newHashSet(config.leaders()); remoteLeaderUris.remove(config.localServer()); RemotePaxosServerSpec remotePaxosServerSpec = ImmutableRemotePaxosServerSpec.builder() .remoteLeaderUris(remoteLeaderUris) .remoteAcceptorUris(remoteLeaderUris) .remoteLearnerUris(remoteLeaderUris) .build(); return createInstrumentedLocalServices( metricsManager, config, remotePaxosServerSpec, () -> RemotingClientConfigs.ALWAYS_USE_LEGACY, userAgent, LeadershipObserver.NO_OP); }
Source:
<code>public void testVisitForHayes() { ConfigureForDosVisitor conDos = new ConfigureForDosVisitor(); <START> Hayes hayes = mock(Hayes.class); <END> ((HayesVisitor)conDos).visit(hayes); assertThat(logger.getLoggingEvents()).extracting("level", "message").contains( tuple(INFO, hayes + " used with Dos configurator.")); }</code><technical_language>changes</technical_language>

Target:
public void testVisitForHayes() { ConfigureForDosVisitor conDos = new ConfigureForDosVisitor(); Hayes hayes = new Hayes(); conDos.visit(hayes); assertThat(logger.getLoggingEvents()).extracting("level", "message").contains( tuple(INFO, hayes + " used with Dos configurator.")); }
Source:
<code>public void upgradeTo(final ChannelHandlerContext ctx, FullHttpRequest upgradeRequest) { int firstHandlerIdx = 0; try { ctx.pipeline().addAfter(ctx.name(), handlerName, connectionHandler); if (handlers != null && handlers.length > 0 && handlers[firstHandlerIdx] instanceof Http2MultiplexHandler) { ChannelHandlerContext connectionHandlerCtx = ctx.pipeline().context(connectionHandler); ctx.pipeline().addAfter(connectionHandlerCtx.name(), null, handlers[firstHandlerIdx++]); } connectionHandler.onHttpServerUpgrade(settings); } catch (Http2Exception e) { ctx.fireExceptionCaught(e); ctx.close(); return; } if (handlers != null) { final String name = ctx.pipeline().context(connectionHandler).name(); for (int i = handlers.length - 1; i >= firstHandlerIdx; i--) { <START> ctx.pipeline().addAfter(name, null, handlers[i]); <END> } } }</code><technical_language>I sort of understood changing behavior, working a bug. I of wrong adding other handlers, extra handlers in case is broken. So... signs point adding handlers first. I agree hesitant, unclear done initially</technical_language>

Target:
public void upgradeTo(final ChannelHandlerContext ctx, FullHttpRequest upgradeRequest) { try { ctx.pipeline().addAfter(ctx.name(), handlerName, connectionHandler); if (handlers != null) { final String name = ctx.pipeline().context(connectionHandler).name(); for (int i = handlers.length - 1; i >= 0; i--) { ctx.pipeline().addAfter(name, null, handlers[i]); } } connectionHandler.onHttpServerUpgrade(settings); } catch (Http2Exception e) { ctx.fireExceptionCaught(e); ctx.close(); } }
Source:
<code>public boolean isSubscribed() { <START> return conn.getStatus() == Status.CONNECTED && dispatcher.isActive(); <END> }</code><technical_language>I feel if check is dispatcher is null</technical_language>

Target:
public boolean isSubscribed() { return conn.getStatus() == Status.CONNECTED && dispatcher != null && dispatcher.isActive(); }
Source:
<code>private Map<String, Object> getCommonProperties() { Map<String, Object> properties = new HashMap<>(); properties.put(KEY_EDITOR, mCurrentEditor.toString().toLowerCase(Locale.ROOT)); properties.put(KEY_CONTENT_TYPE, mContentType); properties.put(KEY_POST_TYPE, mPostType); properties.put(KEY_BLOG_TYPE, mBlogType); properties.put(KEY_SESSION_ID, mSessionId); properties.put(KEY_HAS_UNSUPPORTED_BLOCKS, mHasUnsupportedBlocks ? "1" : "0"); if (mUnsupportedBlocks != null && mUnsupportedBlocks.size() > 0) { <START> properties.put(KEY_UNSUPPORTED_BLOCKS, mUnsupportedBlocks); <END> } return properties; }</code><technical_language>Question: Is OK/Better send this key if unsupported block sending empty array</technical_language>

Target:
private Map<String, Object> getCommonProperties() { Map<String, Object> properties = new HashMap<>(); properties.put(KEY_EDITOR, mCurrentEditor.toString().toLowerCase(Locale.ROOT)); properties.put(KEY_CONTENT_TYPE, mContentType); properties.put(KEY_POST_TYPE, mPostType); properties.put(KEY_BLOG_TYPE, mBlogType); properties.put(KEY_SESSION_ID, mSessionId); properties.put(KEY_HAS_UNSUPPORTED_BLOCKS, mHasUnsupportedBlocks ? "1" : "0"); return properties; }
Source:
<code>public void endToEndSSLReplicationWithMultiNodeSinglePartitionTest() throws InterruptedException, IOException, InstantiationException { DataNodeId dataNodeId = sslCluster.getFirstDataNode(); endToEndReplicationWithMultiNodeSinglePartitionTest(sslCluster, "DC2,DC3", dataNodeId.getPort(), new Port(dataNodeId.getSSLPort(), PortType.SSL), new Port(dataNodeId.getSSLPort() + 3, PortType.SSL), <START> new Port(dataNodeId.getSSLPort() + 6, PortType.SSL)); <END> }</code><technical_language>Instead of hard code 3 6 here, constant TOTAL_DATANODE_COUNT defined in MockClusterMap.java get values</technical_language>

Target:
public void endToEndSSLReplicationWithMultiNodeSinglePartitionTest() throws InterruptedException, IOException, InstantiationException { cluster = new MockCluster(notificationSystem, true, "DC1,DC2,DC3"); DataNodeId dataNodeId = cluster.getClusterMap().getDataNodeIds().get(0); ArrayList<String> dataCenterList = new ArrayList<String>(Arrays.asList("DC1", "DC2", "DC3")); List<DataNodeId> dataNodes = cluster.getOneDataNodeFromEachDatacenter(dataCenterList); endToEndReplicationWithMultiNodeSinglePartitionTest("DC1", "DC2,DC3", dataNodeId.getPort(), new Port(dataNodes.get(0).getSSLPort(), PortType.SSL), new Port(dataNodes.get(1).getSSLPort(), PortType.SSL), new Port(dataNodes.get(2).getSSLPort(), PortType.SSL)); }
Source:
<code>private long lastModified(String modelFilePath) { try { <START> System.currentTimeMillis(); <END> return Files.readAttributes(Paths.get(modelFilePath), BasicFileAttributes.class) .lastModifiedTime() .toMillis(); } catch (IOException e) { logger.error("Error reading file last modified time"); logger.debug("Error reading file last modified time", e); return -1; } }</code><technical_language>need this line, right</technical_language>

Target:
private long lastModified(String modelFilePath) { try { return Files.readAttributes(Paths.get(modelFilePath), BasicFileAttributes.class) .lastModifiedTime() .toMillis(); } catch (IOException e) { logger.error("Error reading file last modified time"); logger.debug("Error reading file last modified time", e); return -1; } }
Source:
<code>public SynchronizationResult synchronize(NewProjectHandler newProjectHandler, CancellationTokenSource tokenSource, IProgressMonitor monitor) { <START> synchronizingBuilds.add(this); <END> monitor = monitor != null ? monitor : new NullProgressMonitor(); SynchronizeOperation operation = new SynchronizeOperation(newProjectHandler); try { CorePlugin.operationManager().run(operation, tokenSource, monitor); return newSynchronizationResult(Status.OK_STATUS); } catch (CoreException e) { return newSynchronizationResult(e.getStatus()); } finally { synchronizingBuilds.remove(this); } }</code><technical_language>Is this method is called threads, e.g. synchronization is requested synchronously job scheduled? If so, check result of calling add() abort synchronization if is in progress</technical_language>

Target:
public SynchronizationResult synchronize(NewProjectHandler newProjectHandler, CancellationTokenSource tokenSource, IProgressMonitor monitor) { monitor = monitor != null ? monitor : new NullProgressMonitor(); SynchronizeOperation operation = new SynchronizeOperation(this.gradleBuild, newProjectHandler); SynchronizeOperation runningOperation = syncOperations.putIfAbsent(this, operation); if (runningOperation != null && (newProjectHandler == NewProjectHandler.NO_OP || Objects.equals(newProjectHandler, runningOperation.newProjectHandler))) { return newSynchronizationResult(Status.OK_STATUS); } try { CorePlugin.operationManager().run(operation, tokenSource, monitor); return newSynchronizationResult(Status.OK_STATUS); } catch (CoreException e) { return newSynchronizationResult(e.getStatus()); } finally { syncOperations.remove(this); } }
Source:
<code><START> private ResultQueueEntry<ReadRowsResponse> getNext() throws IOException, ScanTimeoutException { <END> ResultQueueEntry<ReadRowsResponse> queueEntry; try { queueEntry = resultQueue.poll(readPartialRowTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Interrupted while waiting for next result", e); } if (queueEntry == null) { throw new ScanTimeoutException("Timeout while merging responses."); } return queueEntry; }</code><technical_language>ScanTimeoutException is IOException, no</technical_language>

Target:
private ResultQueueEntry<ReadRowsResponse> getNext() throws IOException { ResultQueueEntry<ReadRowsResponse> queueEntry; try { queueEntry = resultQueue.poll(readPartialRowTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Interrupted while waiting for next result", e); } if (queueEntry == null) { throw new ScanTimeoutException("Timeout while merging responses."); } return queueEntry; }
Source:
<code>public final Optional<TYPE> first() { <START> List<TYPE> list = first(1).asList(); <END> if(list.isEmpty()) { return Optional.empty(); } return Optional.of(list.get(0)); }</code><technical_language>Logic: Similar change LazyFluentIterable#first()</technical_language>

Target:
public final Optional<TYPE> first() { Iterator<TYPE> resultIterator = first(1).iterator(); return resultIterator.hasNext() ? Optional.of(resultIterator.next()) : Optional.empty(); }
Source:
<code>public ValuedParameter[] getValuedParameters() { if (valuedParameters == null) { valuedParameters = new ValuedParameter[0]; <START> } <END> return valuedParameters; }</code><technical_language>empty array is null? AIOOBoundsEx is NullPEx? Is this if necessary</technical_language>

Target:
public ValuedParameter[] getValuedParameters() { createValuedParameter(controllerMethod); return valuedParameters; }
Source:
<code>public boolean configure(StaplerRequest req, JSONObject json) throws FormException { Jenkins j = Jenkins.getInstance(); try { String num = json.getString("numExecutors"); <START> if (!num.matches("^(\\d+)")) { <END> throw new FormException(Messages.Hudson_Computer_IncorrectNumberOfExecutors(),"numExecutors"); } j.setNumExecutors(json.getInt("numExecutors")); if (req.hasParameter("master.mode")) j.setMode(Mode.valueOf(req.getParameter("master.mode"))); else j.setMode(Mode.NORMAL); j.setLabelString(json.optString("labelString", "")); return true; } catch (IOException e) { throw new FormException(e,"numExecutors"); } }</code><technical_language>BTW ^ ( ) gratuitous here; simplified java if (!num.matches("\\d+")) {</technical_language>

Target:
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { Jenkins j = Jenkins.getInstance(); try { String num = json.getString("numExecutors"); if (!num.matches("\\d+")) { throw new FormException(Messages.Hudson_Computer_IncorrectNumberOfExecutors(),"numExecutors"); } j.setNumExecutors(json.getInt("numExecutors")); if (req.hasParameter("master.mode")) j.setMode(Mode.valueOf(req.getParameter("master.mode"))); else j.setMode(Mode.NORMAL); j.setLabelString(json.optString("labelString", "")); return true; } catch (IOException e) { throw new FormException(e,"numExecutors"); } }
Source:
<code><START> protected List<String> getConsoleDevicesForEntity(Guid id) { <END> return getEntity(List.class, VdcQueryType.GetConsoleDevices, new IdQueryParameters(id), null, true); }</code><technical_language>this method AbstractBackendResource relevant vm/template/vmpool only, reside in vm/template/vmpool parent</technical_language>

Target:
protected List<String> getConsoleDevicesForEntity(Guid id) { return getEntity(List.class, VdcQueryType.GetConsoleDevices, new IdQueryParameters(id), "GetConsoleDevices", true); }
Source:
<code>public RemoteDescriptorProvider(TaskRunner taskRunner, String url, String username, String password) { this.url = url; this.username = username; this.password = password; latch = new CountDownLatch(1); <START> taskRunner.run(new Task() { <END> @Override public void execute() throws Exception { try { downloadDescriptors(); } finally { latch.countDown(); } } }, null); }</code><technical_language>Instead of TaskRunner I suggest a LazyRef. task runner job-execution level in this case I guess _always_ want multithreading (whereas TaskRunner allows e.g. singlethreaded implementations). LazyRef a shared thread pool methods built-in for checking status, get rid of CountDownLatch in here</technical_language>

Target:
public RemoteDescriptorProvider(TaskRunner taskRunner, String url, String username, String password) { this.url = url; this.username = username; this.password = password; data.requestLoad(); }