auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Action rejectExceptionalMessage(final long messageType, final int refTagId, final long position) { if (messageType == LOGON_MESSAGE_TYPE) { final Action action = onExceptionalMessage(logon.header(), refTagId, position); if (action != ABORT) { session.logoutAndDisconnect(); <START> } <END> } else if (messageType == LOGOUT_MESSAGE_TYPE) { return onExceptionalMessage(logout.header(), refTagId, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { return onExceptionalMessage(heartbeat.header(), refTagId, position); } else if (messageType == REJECT_MESSAGE_TYPE) { return onExceptionalMessage(reject.header(), refTagId, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { return onExceptionalMessage(testRequest.header(), refTagId, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { return onExceptionalMessage(sequenceReset.header(), refTagId, position); } return onExceptionalMessage(header, refTagId, position); }</code><technical_language>This block return action, fall-through. in case of back-pressure time try send reject fall-through onExceptionalMessage() call end of method</technical_language>

Target:
private Action rejectExceptionalMessage(final long messageType, final int refTagId, final long position) { if (messageType == LOGON_MESSAGE_TYPE) { final Action action = onExceptionalMessage(logon.header(), refTagId, position); if (action != ABORT) { session.logoutAndDisconnect(); } return action; } else if (messageType == LOGOUT_MESSAGE_TYPE) { return onExceptionalMessage(logout.header(), refTagId, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { return onExceptionalMessage(heartbeat.header(), refTagId, position); } else if (messageType == REJECT_MESSAGE_TYPE) { return onExceptionalMessage(reject.header(), refTagId, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { return onExceptionalMessage(testRequest.header(), refTagId, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { return onExceptionalMessage(sequenceReset.header(), refTagId, position); } return onExceptionalMessage(header, refTagId, position); }
Source:
<code>protected Predicate<String> provideServerStartedPredicate(final DimensionDataCloudControlApi api, final ComputeServiceConstants.Timeouts timeouts, final ComputeServiceConstants.PollPeriod pollPeriod) { <START> return retry(new ServerStatus(api.getServerApi(), true, true), timeouts.imageAvailable, <END> pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod); }</code><technical_language>timeouts.nodeRunning</technical_language>

Target:
protected Predicate<String> provideServerStartedPredicate(final DimensionDataCloudControlApi api, final ComputeServiceConstants.Timeouts timeouts, final ComputeServiceConstants.PollPeriod pollPeriod) { return retry(new ServerStatus(api.getServerApi(), true, true), timeouts.nodeRunning, pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod); }
Source:
<code>public boolean onLongClick(final View arg0) { if (progress.isShowing()) { showToast(res.getString(R.string.err_detail_still_working)); return false; } if (Settings.getChooseList()) { new StoredList.UserInterface(getActivity()).promptForListSelection(R.string.list_title, new Action1<Integer>() { @Override public void call(final Integer selectedListId) { storeCache(selectedListId); } }, true, cache.getLists()); } else { <START> storeCache(StoredList.TEMPORARY_LIST.id); <END> } return true; }</code><technical_language>StoredList.STANDARD_LIST_ID, #5646</technical_language>

Target:
public boolean onLongClick(final View arg0) { manageLists(true); return true; }
Source:
<code>private void monitorLocks() { lockMonitorFuture = Optional.of(lockMonitorScheduler.scheduleWithFixedDelay( () -> { try { Collection<LockId> locksWithExpiredLeases = lockStore.filterLocksWithExpiredLeases(locks.keySet()); for(LockId lockId : locksWithExpiredLeases) { log.debug("LockClient: lease revoked for lock {}", lockId.getLockName()); locks.get(lockId).input(LockEvent.LEASE_REVOKED); } } catch (WrongClusterException wce) { log.error("Lock client is connected to a wrong cluster:", clientId, wce); throw wce; } <START> catch (Exception ex) { <END> } }, DurationBetweenLockMonitorRuns, DurationBetweenLockMonitorRuns, TimeUnit.SECONDS )); }</code><technical_language>log</technical_language>

Target:
private void monitorLocks() { lockMonitorFuture = Optional.of(lockMonitorScheduler.scheduleWithFixedDelay( () -> { try { Collection<LockId> locksWithExpiredLeases = lockStore.filterLocksWithExpiredLeases(locks.keySet()); for(LockId lockId : locksWithExpiredLeases) { log.debug("LockClient: lease revoked for lock {}", lockId.getLockName()); locks.get(lockId).input(LockEvent.LEASE_REVOKED); } } catch (Exception ex) { log.error("Caught exception while monitoring locks.", ex); } }, DurationBetweenLockMonitorRuns, DurationBetweenLockMonitorRuns, TimeUnit.SECONDS )); }
Source:
<code><START> public void testEquals(){ <END> VariableIdentifier v1 = getInstance(); assertEquals(v1, v1); VariableIdentifier v2 = new VariableIdentifier(getNamespaceIdentifierInstance(), "foo"); assertEquals(v1, v2); VariableIdentifier v3 = new VariableIdentifier(getNamespaceIdentifierInstance(), "bar"); assertNotEquals(v1, v3); ArrayList<String> name = new ArrayList<String>(1); name.add("bogus"); NamespaceIdentifier n4 = new NamespaceIdentifier(name); VariableIdentifier v4 = new VariableIdentifier(n4, "foo"); assertNotEquals(v1, v4); }</code><technical_language>This</technical_language>

Target:
public void testEquals() { VariableIdentifier v = new VariableIdentifier( getNamespaceIdentifierInstance(), "foo" ); assertEquals(getInstance(), v); }
Source:
<code>private String obtainFailureMessage(@Nullable GerritTriggeredEvent event, @Nonnull Run build, @Nullable TaskListener listener) throws IOException, InterruptedException { Job project = build.getParent(); String content = null; GerritTrigger trigger = GerritTrigger.getTrigger(project); if (trigger != null) { String filepath = trigger.getBuildUnsuccessfulFilepath(); logger.debug("Looking for failure message in file glob: {}", filepath); if (filepath != null && !filepath.isEmpty()) { EnvVars envVars; if (listener == null) { envVars = build.getEnvironment(); } else { envVars = build.getEnvironment(listener); } filepath = envVars.expand(filepath); <START> if (build instanceof AbstractBuild) { <END> FilePath[] matches = this.getMatchingWorkspaceFiles(((AbstractBuild)build).getWorkspace(), filepath); logger.debug("Found matching workspace files: {}", matches); if (matches.length > 0) { FilePath path = matches[0]; content = this.getExpandedContent(path, envVars); logger.info("Obtained failure message from file: {}", content); } } else { logger.info("Unable to find matching workspace files for job type {}", build.getClass().getName()); } } } return content; }</code><technical_language>is solve this for a workflow? If config page reflect that</technical_language>

Target:
private String obtainFailureMessage(@Nullable GerritTriggeredEvent event, @Nonnull Run build, @Nullable TaskListener listener) throws IOException, InterruptedException { Job project = build.getParent(); String content = null; GerritTrigger trigger = GerritTrigger.getTrigger(project); if (trigger != null) { String filepath = trigger.getBuildUnsuccessfulFilepath(); logger.debug("Looking for failure message in file glob: {}", filepath); if (filepath != null && !filepath.isEmpty()) { EnvVars envVars; if (listener == null) { envVars = build.getEnvironment(); } else { envVars = build.getEnvironment(listener); } filepath = envVars.expand(filepath); if (build instanceof AbstractBuild) { FilePath[] matches = this.getMatchingWorkspaceFiles(((AbstractBuild)build).getWorkspace(), filepath); logger.debug("Found matching workspace files: {}", matches); if (matches.length > 0) { FilePath path = matches[0]; content = this.getExpandedContent(path, envVars); logger.info("Obtained failure message from file: {}", content); } } else { logger.warn("Unable to find matching workspace files for job {}, type {}", build.getDisplayName(), build.getClass().getName()); } } } return content; }
Source:
<code>public String getPath() { <START> try { return file.toURI().getPath(); } catch (URISyntaxException e) { return file.getFile(); } <END> }</code><technical_language>please set instruction file.getPath () in case of errors instead of file.getFile()</technical_language>

Target:
public String getPath() { try { return file.toURI().getPath(); } catch (URISyntaxException e) { return file.getPath(); } }
Source:
<code>public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } <START> Schema.Type outFieldType = outSchemaMap. get(name); <END> if (!deCompMap.containsKey(name) || deCompMap.get(name) == DecompressorType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.BYTES){ obj = in.get(name); } else { LOG.error("Input field '" + name + "' should be of type BYTES to decompress. It's currently of type" + "'" + field.getSchema().getType().toString()); } byte[] outValue = new byte[0]; DecompressorType type = deCompMap.get(name); if (type == DecompressorType.SNAPPY) { outValue = Snappy.uncompress(obj); } else if (type == DecompressorType.ZIP) { outValue = unzip(obj); } else if (type == DecompressorType.GZIP) { outValue = ungzip(obj); } if (outValue != null) { if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, Bytes.toString(outValue)); } } } } emitter.emit(builder.build()); }</code><technical_language>nit: extra space</technical_language>

Target:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!deCompMap.containsKey(name) || deCompMap.get(name) == DecompressorType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.BYTES){ obj = in.get(name); } else { LOG.error("Input field '" + name + "' should be of type BYTES to decompress. It's currently of type" + "'" + field.getSchema().getType().toString()); break; } byte[] outValue = new byte[0]; DecompressorType type = deCompMap.get(name); if (type == DecompressorType.SNAPPY) { outValue = Snappy.uncompress(obj); } else if (type == DecompressorType.ZIP) { outValue = unzip(obj); } else if (type == DecompressorType.GZIP) { outValue = ungzip(obj); } if (outValue != null) { if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue, "UTF-8")); } } } } emitter.emit(builder.build()); }
Source:
<code>private void importFormList(CommcareFormList formList) { for (CommcareForm form : Lists.reverse(formList.getObjects())) { FullFormEvent formEvent = new FullFormEvent(form.getForm(), form.getReceivedOn(), form.getConfigName()); <START> lastStartedImportingFormId = form.getId(); <END> eventRelay.sendEventMessage(formEvent.toMotechEvent()); lastImportedDate = form.getReceivedOn(); lastImportedFormId = form.getId(); importCount++; LOGGER.info("Imported form with ID: {}, received on: {}", form.getId(), form.getReceivedOn()); } }</code><technical_language>do need this? is this "lastImportedFormId"</technical_language>

Target:
private void importFormList(CommcareFormList formList) { for (CommcareForm form : Lists.reverse(formList.getObjects())) { FullFormEvent formEvent = new FullFormEvent(form.getForm(), form.getReceivedOn(), form.getConfigName()); lastFormXMLNSToBeImported = formEvent.getAttributes().get("xmlns"); eventRelay.sendEventMessage(formEvent.toMotechEvent()); lastImportedDate = form.getReceivedOn(); lastImportedFormId = form.getId(); importCount++; LOGGER.info("Imported form with ID: {}, received on: {}", form.getId(), form.getReceivedOn()); } }
Source:
<code>public void afterPropertiesSet() throws Exception { ThymeleafViewResolver viewResolver = applicationContext.getBean(ThymeleafViewResolver.class); if (viewResolver == null) { LOG.warn( "Cannot adjust ThymeleafViewResolver: " + "bean of this type wasn't found in application context" ); return; } boolean productionEnv = environment.acceptsProfiles("prod"); <START> Boolean useCdn = environment.getProperty("app.use-cdn", Boolean.class, Boolean.TRUE); <END> viewResolver.setStaticVariables(resourcesAsMap(productionEnv, useCdn)); }</code><technical_language>If want, try boolean useCdn = ... here. work</technical_language>

Target:
public void afterPropertiesSet() throws Exception { ThymeleafViewResolver viewResolver = applicationContext.getBean(ThymeleafViewResolver.class); if (viewResolver == null) { LOG.warn( "Cannot adjust ThymeleafViewResolver: " + "bean of this type wasn't found in application context" ); return; } boolean productionEnv = environment.acceptsProfiles("prod"); boolean useCdn = environment.getProperty("app.use-cdn", Boolean.class, Boolean.TRUE); viewResolver.setStaticVariables(resourcesAsMap(productionEnv, useCdn)); }
Source:
<code><START> private static List<String> findAppFiles(@NotNull Collection<String> removedFiles) { <END> return ContainerUtil.filter(removedFiles, new Condition<String>() { @Override public boolean value(String filePath) { return isAppConfigFileName(filePath); } }); }</code><technical_language>do rename extracted method's parameters appropriately</technical_language>

Target:
private static List<String> findAppFiles(@NotNull Collection<String> removedFiles) { return ContainerUtil.filter(removedFiles, new Condition<String>() { @Override public boolean value(String filePath) { return ErlangBuilderUtil.isAppConfigFileName(filePath); } }); }
Source:
<code>protected void initMetadataStore() throws FormatException { super.initMetadataStore(); MetadataStore store = makeFilterMetadata(); MetadataTools.populatePixels(store, this); if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) { Length sizeX = FormatTools.getPhysicalSizeX(pixelSizeX); Length sizeY = FormatTools.getPhysicalSizeY(pixelSizeY); Length sizeZ = FormatTools.getPhysicalSizeZ(pixelSizeZ); if (sizeX != null) { store.setPixelsPhysicalSizeX(sizeX, 0); } if (sizeY != null) { store.setPixelsPhysicalSizeY(sizeY, 0); } if (sizeZ != null) { store.setPixelsPhysicalSizeZ(sizeZ, 0); } store.setPixelsTimeIncrement(new Time(pixelSizeT / 1000000.0, UNITS.SECOND), 0); for (int i=0; i<getEffectiveSizeC(); i++) { if (cNames != null && i < cNames.length) { store.setChannelName(cNames[i], 0, i); } int index = getIndex(0, i, 0); <START> if (index < channelColors.size()) { <END> store.setChannelColor(channelColors.get(index), 0, i); } } store.setImageDescription("", 0); } }</code><technical_language>if (index < channelColors.size() && channelColors.get(index) != null</technical_language>

Target:
protected void initMetadataStore() throws FormatException { super.initMetadataStore(); MetadataStore store = makeFilterMetadata(); MetadataTools.populatePixels(store, this); if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) { Length sizeX = FormatTools.getPhysicalSizeX(pixelSizeX); Length sizeY = FormatTools.getPhysicalSizeY(pixelSizeY); Length sizeZ = FormatTools.getPhysicalSizeZ(pixelSizeZ); if (sizeX != null) { store.setPixelsPhysicalSizeX(sizeX, 0); } if (sizeY != null) { store.setPixelsPhysicalSizeY(sizeY, 0); } if (sizeZ != null) { store.setPixelsPhysicalSizeZ(sizeZ, 0); } store.setPixelsTimeIncrement(new Time(pixelSizeT / 1000000.0, UNITS.SECOND), 0); for (int i=0; i<getEffectiveSizeC(); i++) { if (cNames != null && i < cNames.length) { store.setChannelName(cNames[i], 0, i); } int index = getIndex(0, i, 0); if (index < channelColors.size() && channelColors.get(index) != null) { store.setChannelColor(channelColors.get(index), 0, i); } } store.setImageDescription("", 0); } }
Source:
<code><START> public PartialRecordCleanupResult cleanupPartialRecord() { <END> checkState(partialRecordLength >= 0, "Approximate local recovery does not yet work with unaligned checkpoint!"); if (partialRecordLength == 0 || !bufferConsumer.startOfDataBuffer()) { return new PartialRecordCleanupResult(build(), false); } checkState(partialRecordLength <= bufferConsumer.getBufferSize(), "Partial record length beyond max buffer capacity!"); if (partialRecordLength < bufferConsumer.getBufferSize()) { return new PartialRecordCleanupResult(bufferConsumer.skipBuild(partialRecordLength), false); } else { return new PartialRecordCleanupResult(bufferConsumer.skipBuild(partialRecordLength), true); } }</code><technical_language>Do need return buffer here? I a feeling simpler if: - this method returning true/false if cleanup finished not. - skipBuild(...) replaced skip(...), move offset, returning buffer - .build() call required afterwards, get remaining data</technical_language>

Target:
public boolean cleanupPartialRecord() { checkState(partialRecordLength >= 0, "Approximate local recovery does not yet work with unaligned checkpoint!"); if (partialRecordLength == 0 || !bufferConsumer.isStartOfDataBuffer()) { return true; } checkState(partialRecordLength <= bufferConsumer.getBufferSize(), "Partial record length beyond max buffer capacity!"); bufferConsumer.skip(partialRecordLength); if (partialRecordLength < bufferConsumer.getBufferSize()) { return true; } else { return false; } }
Source:
<code>protected boolean canDoAction() { NetworkValidator validatorNew = new NetworkValidator(getNetwork()); NetworkValidator validatorOld = new NetworkValidator(getOldNetwork()); return validate(validatorNew.dataCenterExists()) && validate(validatorNew.vmNetworkSetCorrectly()) && validate(validatorNew.stpForVmNetworkOnly()) && validate(validatorNew.mtuValid()) && validate(validatorNew.networkPrefixValid()) && validate(validatorNew.vlanIdNotUsed()) && validate(validatorOld.networkExists()) <START> && validate(validatorOld.notManagementNetwork()) <END> && validate(validatorNew.networkNameNotUsed()) && validate(validatorOld.networkNotUsedByVms()) && validate(validatorOld.networkNotUsedByTemplates()) && validate(validatorOld.networkNotUsedByHosts()); }</code><technical_language>This validation prevents updates management network. User able change network management configuration name. Please preserve previous validation</technical_language>

Target:
protected boolean canDoAction() { Network newNetwork = getNetwork(); Network oldNetwork = getOldNetwork(); NetworkValidator validatorNew = new NetworkValidator(newNetwork); NetworkValidator validatorOld = new NetworkValidator(oldNetwork); UpdateNetworkValidator validatorCombined = new UpdateNetworkValidator(newNetwork, oldNetwork); return validate(validatorNew.dataCenterExists()) && validate(validatorNew.vmNetworkSetCorrectly()) && validate(validatorNew.stpForVmNetworkOnly()) && validate(validatorNew.mtuValid()) && validate(validatorNew.networkPrefixValid()) && validate(validatorNew.vlanIdNotUsed()) && validate(validatorOld.networkExists()) && validate(validatorCombined.notChangingManagementNetwork()) && validate(validatorNew.networkNameNotUsed()) && validate(validatorOld.networkNotUsedByVms()) && validate(validatorOld.networkNotUsedByTemplates()) && validate(validatorOld.networkNotUsedByHosts()); }
Source:
<code>public void handleCustomEvent(UIEvent event) { <START> EventType<UIEvent> eventType = (EventType<UIEvent>) event <END> .getEventType(); }</code><technical_language>this variable is used, deleted</technical_language>

Target:
public void handleCustomEvent(UIEvent event) { }
Source:
<code>public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { UserLibrary other = (UserLibrary) obj; if (this.entries.length == other.entries.length && attributes.size() == other.attributes.size()) { <START> for (int i = 0; i < this.entries.length; i++) { <END> if (!this.entries[i].equals(other.entries[i])) { return false; } } for (String key : this.attributes.keySet()) { String thisValue = this.attributes.get(key); String otherValue = other.attributes.get(key); if (!(thisValue == null ? otherValue == null : thisValue .equals(otherValue))) { return false; } } return true; } } return false; }</code><technical_language>change this Arrays.equals()</technical_language>

Target:
public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { UserLibrary other = (UserLibrary) obj; if (this.entries.length == other.entries.length && this.isSystemLibrary == other.isSystemLibrary && attributes.size() == other.attributes.size()) { if (!Arrays.equals(this.entries, other.entries)) { return false; } if (!this.attributes.equals(other.attributes)) { return false; } return true; } } return false; }
Source:
<code>private boolean checkIfParameterizedTypeReferenceShouldBeUsed(TypeMirror returnType) { switch (returnType.getKind()) { case DECLARED: return !((DeclaredType) returnType).getTypeArguments().isEmpty(); case ARRAY: ArrayType arrayType = (ArrayType) returnType; TypeMirror componentType = arrayType.getComponentType(); <START> if (componentType.getKind() == TypeKind.DECLARED) { <END> return !((DeclaredType) componentType).getTypeArguments().isEmpty(); } else { return checkIfParameterizedTypeReferenceShouldBeUsed(componentType); } } return false; }</code><technical_language>returned checkIfParameterizedTypeReferenceShouldBeUsed(componentType); in if-else cases</technical_language>

Target:
private boolean checkIfParameterizedTypeReferenceShouldBeUsed(TypeMirror returnType) { switch (returnType.getKind()) { case DECLARED: return !((DeclaredType) returnType).getTypeArguments().isEmpty(); case ARRAY: ArrayType arrayType = (ArrayType) returnType; TypeMirror componentType = arrayType.getComponentType(); return checkIfParameterizedTypeReferenceShouldBeUsed(componentType); } return false; }
Source:
<code>private static IndexQuery.ExactPredicate[] assertOnlyExactPredicates( IndexQuery[] predicates ) { IndexQuery.ExactPredicate[] exactPredicates; if ( predicates.getClass() == IndexQuery.ExactPredicate[].class ) { exactPredicates = (IndexQuery.ExactPredicate[]) predicates; } else { exactPredicates = new IndexQuery.ExactPredicate[predicates.length]; for ( int i = 0; i < predicates.length; i++ ) { if ( predicates[i] instanceof IndexQuery.ExactPredicate ) { exactPredicates[i] = (IndexQuery.ExactPredicate) predicates[i]; } else { <START> throw new UnsupportedOperationException( "Query not supported: " + Arrays.toString( predicates ) ); <END> } } } return exactPredicates; }</code><technical_language>I IllegalArgumentException is least</technical_language>

Target:
private static IndexQuery.ExactPredicate[] assertOnlyExactPredicates( IndexQuery[] predicates ) { IndexQuery.ExactPredicate[] exactPredicates; if ( predicates.getClass() == IndexQuery.ExactPredicate[].class ) { exactPredicates = (IndexQuery.ExactPredicate[]) predicates; } else { exactPredicates = new IndexQuery.ExactPredicate[predicates.length]; for ( int i = 0; i < predicates.length; i++ ) { if ( predicates[i] instanceof IndexQuery.ExactPredicate ) { exactPredicates[i] = (IndexQuery.ExactPredicate) predicates[i]; } else { throw new IllegalArgumentException( "Query not supported: " + Arrays.toString( predicates ) ); } } } return exactPredicates; }
Source:
<code>private VirtualClassLoader getParentClassLoader(ClassLoaderIdentifier identifier) { final ClassLoaderIdentifier parentIdentifier = parentClassLoaderResolver.getParentClassLoaderIdentifier(identifier); VirtualClassLoader parent; <START> if (ClassLoaderIdentifier.GLOBAL.equals(identifier) || parentIdentifier == null) { <END> parent = getVirtualGlobalClassLoader(); } else { parent = getLocalClassLoader(parentIdentifier); } return parent; }</code><technical_language>I ClassLoaderIdentifier.GLOBAL.equals(**parentIdentifier**) instead of ClassLoaderIdentifier.GLOBAL.equals(**identifier**)</technical_language>

Target:
private VirtualClassLoader getParentClassLoader(ClassLoaderIdentifier identifier) { final ClassLoaderIdentifier parentIdentifier = parentClassLoaderResolver.getParentClassLoaderIdentifier(identifier); NullCheckingUtil.checkArgsNotNull(parentIdentifier); VirtualClassLoader parent; if (ClassLoaderIdentifier.GLOBAL.equals(parentIdentifier)) { parent = getVirtualGlobalClassLoader(); } else { parent = getLocalClassLoader(parentIdentifier); } return parent; }
Source:
<code>public static boolean isEmpty( IBaseResultSet set ) throws BirtException { if ( set instanceof IQueryResultSet ) { return ( (IQueryResultSet) set ).isEmpty( ); } else if ( set instanceof ICubeResultSet ) { CubeCursor cursor = (( (ICubeResultSet) set ).getCubeCursor()); <START> return cursor.getOrdinateEdge().size() != 0; <END> } return false; }</code><technical_language>Please call isEmpty() instead check null for cursor</technical_language>

Target:
public static boolean isEmpty( IBaseResultSet set ) throws BirtException { if ( set instanceof IQueryResultSet ) { return ( (IQueryResultSet) set ).isEmpty( ); } else if ( set instanceof ICubeResultSet ) { CubeCursor cursor = (( (ICubeResultSet) set ).getCubeCursor()); if(cursor != null) { List edges = cursor.getOrdinateEdge(); return edges != null && !edges.isEmpty(); } } return false; }
Source:
<code>protected BaseReceivePack(final Repository into) { db = into; walk = new RevWalk(db); final ReceiveConfig cfg = db.getConfig().get(ReceiveConfig.KEY); objectChecker = cfg.newObjectChecker(); allowCreates = cfg.allowCreates; allowAnyDeletes = true; allowBranchDeletes = cfg.allowDeletes; allowNonFastForwards = cfg.allowNonFastForwards; allowOfsDelta = cfg.allowOfsDelta; advertiseRefsHook = AdvertiseRefsHook.DEFAULT; refFilter = RefFilter.DEFAULT; advertisedHaves = new HashSet<ObjectId>(); clientShallowCommits = new HashSet<ObjectId>(); certNonceSeed = cfg.certNonceSeed; <START> if (!certNonceSeed.isEmpty()) <END> pushCertNonce = preparePushCertNonce( into.getDirectory().getPath(), new Date(0).getTime() / milliSecondsPerSecond); certNonceSlopLimit = cfg.certNonceSlopLimit; }</code><technical_language>!= null. config getString(a, b) form returns null if undefined</technical_language>

Target:
protected BaseReceivePack(final Repository into) { db = into; walk = new RevWalk(db); final ReceiveConfig cfg = db.getConfig().get(ReceiveConfig.KEY); objectChecker = cfg.newObjectChecker(); allowCreates = cfg.allowCreates; allowAnyDeletes = true; allowBranchDeletes = cfg.allowDeletes; allowNonFastForwards = cfg.allowNonFastForwards; allowOfsDelta = cfg.allowOfsDelta; advertiseRefsHook = AdvertiseRefsHook.DEFAULT; refFilter = RefFilter.DEFAULT; advertisedHaves = new HashSet<ObjectId>(); clientShallowCommits = new HashSet<ObjectId>(); String dirPath = db.getDirectory() != null ? db.getDirectory().getPath() : "" ; pushCertificateParser = new PushCertificateParser(cfg, dirPath); }
Source:
<code>private synchronized void refresh() { List<String> names; try { names = ZKUtil.listChildrenAndWatchForNewChildren(watcher, watcher.getZNodePaths().rsZNode); } catch (KeeperException e) { server.abort("Unexpected zk exception getting RS nodes", e); return; } <START> Set<ServerName> servers = CollectionUtils.isEmpty(names) ? Collections.EMPTY_SET : <END> names.stream().map(ServerName::parseServerName).collect(Collectors.toSet()); for (Iterator<ServerName> iter = regionServers.iterator(); iter.hasNext();) { ServerName sn = iter.next(); if (!servers.contains(sn)) { LOG.info("RegionServer ephemeral node deleted, processing expiration [{}]", sn); serverManager.expireServer(sn); iter.remove(); } } boolean newServerAdded = false; for (ServerName sn : servers) { if (regionServers.add(sn)) { newServerAdded = true; LOG.info("RegionServer ephemeral node created, adding [" + sn + "]"); } } if (newServerAdded && server.isInitialized()) { server.checkIfShouldMoveSystemRegionAsync(); } }</code><technical_language>Collections.emptySet(). EMPTY_SET introduce a warning</technical_language>

Target:
private synchronized void refresh() { List<String> names; try { names = ZKUtil.listChildrenAndWatchForNewChildren(watcher, watcher.getZNodePaths().rsZNode); } catch (KeeperException e) { server.abort("Unexpected zk exception getting RS nodes", e); return; } Set<ServerName> servers = CollectionUtils.isEmpty(names) ? Collections.emptySet() : names.stream().map(ServerName::parseServerName).collect(Collectors.toSet()); for (Iterator<ServerName> iter = regionServers.iterator(); iter.hasNext();) { ServerName sn = iter.next(); if (!servers.contains(sn)) { LOG.info("RegionServer ephemeral node deleted, processing expiration [{}]", sn); serverManager.expireServer(sn); iter.remove(); } } boolean newServerAdded = false; for (ServerName sn : servers) { if (regionServers.add(sn)) { newServerAdded = true; LOG.info("RegionServer ephemeral node created, adding [" + sn + "]"); } } if (newServerAdded && server.isInitialized()) { server.checkIfShouldMoveSystemRegionAsync(); } }
Source:
<code>private MemcachedOperation toRequest(String commandName, Boolean endOfOp, ByteBuf buffer) throws UnknownOperationException { if (isTrace) log.tracef("Operation: '%s'", commandName); switch (commandName) { case "get" : return MemcachedOperation.GetRequest; case "set" : return MemcachedOperation.PutRequest; case "add" : return MemcachedOperation.PutIfAbsentRequest; case "delete" : return MemcachedOperation.RemoveRequest; case "replace" : return MemcachedOperation.ReplaceRequest; case "cas" : return MemcachedOperation.ReplaceIfUnmodifiedRequest; case "append" : return MemcachedOperation.AppendRequest; case "prepend" : return MemcachedOperation.PrependRequest; case "gets" : return MemcachedOperation.GetWithVersionRequest; case "incr" : return MemcachedOperation.IncrementRequest; case "decr" : return MemcachedOperation.DecrementRequest; case "flush_all" : return MemcachedOperation.FlushAllRequest; case "version" : return MemcachedOperation.VersionRequest; case "stats" : return MemcachedOperation.StatsRequest; case "verbosity" : return MemcachedOperation.VerbosityRequest; case "quit" : return MemcachedOperation.QuitRequest; default : if (!endOfOp) { String line = readDiscardedLine(buffer); log.debugf("Unexpected operation '%s', rest of line contains: %s", commandName, line); } <START> System.out.printf("Readable bytes %d\n", buffer.readableBytes()); <END> throw new UnknownOperationException("Unknown operation: " + commandName); } }</code><technical_language>System.out</technical_language>

Target:
private MemcachedOperation toRequest(String commandName, Boolean endOfOp, ByteBuf buffer) throws UnknownOperationException { if (isTrace) log.tracef("Operation: '%s'", commandName); switch (commandName) { case "get" : return MemcachedOperation.GetRequest; case "set" : return MemcachedOperation.PutRequest; case "add" : return MemcachedOperation.PutIfAbsentRequest; case "delete" : return MemcachedOperation.RemoveRequest; case "replace" : return MemcachedOperation.ReplaceRequest; case "cas" : return MemcachedOperation.ReplaceIfUnmodifiedRequest; case "append" : return MemcachedOperation.AppendRequest; case "prepend" : return MemcachedOperation.PrependRequest; case "gets" : return MemcachedOperation.GetWithVersionRequest; case "incr" : return MemcachedOperation.IncrementRequest; case "decr" : return MemcachedOperation.DecrementRequest; case "flush_all" : return MemcachedOperation.FlushAllRequest; case "version" : return MemcachedOperation.VersionRequest; case "stats" : return MemcachedOperation.StatsRequest; case "verbosity" : return MemcachedOperation.VerbosityRequest; case "quit" : return MemcachedOperation.QuitRequest; default : if (!endOfOp) { String line = readDiscardedLine(buffer); log.debugf("Unexpected operation '%s', rest of line contains: %s", commandName, line); } throw new UnknownOperationException("Unknown operation: " + commandName); } }
Source:
<code>private static MerkleTree build(DirectoryTree tree, DigestUtil digestUtil) { Preconditions.checkNotNull(tree); if (tree.isEmpty()) { return new MerkleTree(ImmutableMap.of(), ImmutableMap.of(), digestUtil.compute(new byte[0]), 0, 0); } Map<Digest, Directory> digestDirectoryMap = Maps.newHashMapWithExpectedSize(tree.numDirectories()); Map<Digest, PathOrBytes> digestPathMap = Maps.newHashMapWithExpectedSize(tree.numFiles()); Map<PathFragment, Digest> m = new HashMap<>(); AtomicLong inputBytes = new AtomicLong(0); tree.visit( (dirname, files, dirs) -> { Directory.Builder b = Directory.newBuilder(); for (DirectoryTree.FileNode file : files) { b.addFiles(buildProto(file)); digestPathMap.put(file.getDigest(), toPathOrBytes(file)); inputBytes.addAndGet(file.getDigest().getSizeBytes()); } for (DirectoryTree.DirectoryNode dir : dirs) { PathFragment subDirname = dirname.getRelative(dir.getPathSegment()); Digest protoDirDigest = Preconditions.checkNotNull(m.remove(subDirname), "protoDirDigest was null"); b.addDirectories(buildProto(dir, protoDirDigest)); inputBytes.addAndGet(protoDirDigest.getSizeBytes()); } Directory protoDir = b.build(); Digest protoDirDigest = digestUtil.compute(protoDir); digestDirectoryMap.put(protoDirDigest, protoDir); m.put(dirname, protoDirDigest); }); Digest rootDigest = m.get(PathFragment.EMPTY_FRAGMENT); <START> return new MerkleTree(digestDirectoryMap, digestPathMap, rootDigest, tree.numFiles(), inputBytes.addAndGet(rootDigest.getSizeBytes())); <END> }</code><technical_language>I pull out inputBytes update a separate line</technical_language>

Target:
private static MerkleTree build(DirectoryTree tree, DigestUtil digestUtil) { Preconditions.checkNotNull(tree); if (tree.isEmpty()) { return new MerkleTree(ImmutableMap.of(), ImmutableMap.of(), digestUtil.compute(new byte[0]), 0, 0); } Map<Digest, Directory> digestDirectoryMap = Maps.newHashMapWithExpectedSize(tree.numDirectories()); Map<Digest, PathOrBytes> digestPathMap = Maps.newHashMapWithExpectedSize(tree.numFiles()); Map<PathFragment, Digest> m = new HashMap<>(); AtomicLong inputBytes = new AtomicLong(0); tree.visit( (dirname, files, dirs) -> { Directory.Builder b = Directory.newBuilder(); for (DirectoryTree.FileNode file : files) { b.addFiles(buildProto(file)); digestPathMap.put(file.getDigest(), toPathOrBytes(file)); inputBytes.addAndGet(file.getDigest().getSizeBytes()); } for (DirectoryTree.DirectoryNode dir : dirs) { PathFragment subDirname = dirname.getRelative(dir.getPathSegment()); Digest protoDirDigest = Preconditions.checkNotNull(m.remove(subDirname), "protoDirDigest was null"); b.addDirectories(buildProto(dir, protoDirDigest)); inputBytes.addAndGet(protoDirDigest.getSizeBytes()); } Directory protoDir = b.build(); Digest protoDirDigest = digestUtil.compute(protoDir); digestDirectoryMap.put(protoDirDigest, protoDir); m.put(dirname, protoDirDigest); }); Digest rootDigest = m.get(PathFragment.EMPTY_FRAGMENT); inputBytes.addAndGet(rootDigest.getSizeBytes()); return new MerkleTree(digestDirectoryMap, digestPathMap, rootDigest, tree.numFiles(), inputBytes.get()); }
Source:
<code>private boolean resolveIntent(Intent intent) { ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(intent, 0); <START> return (resolveInfo != null); <END> }</code><technical_language>need bracket</technical_language>

Target:
private boolean resolveIntent(Intent intent) { final ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(intent, 0); return resolveInfo != null; }
Source:
<code>public String getToolTipText(Object element) { if (element instanceof TestCaseElement) { String ignoreReason= ((TestCaseElement) element).getIgnoreReason(); if (ignoreReason != null && <START> ignoreReason.length() > 0) { <END> return ignoreReason; } } return super.getToolTipText(element); }</code><technical_language>!ignoreReason.isEmpty()</technical_language>

Target:
public String getToolTipText(Object element) { if (element instanceof TestCaseElement) { String ignoreReason= ((TestCaseElement) element).getIgnoreReason(); if (ignoreReason != null && !ignoreReason.isEmpty()) { return ignoreReason; } } return super.getToolTipText(element); }
Source:
<code>public PlacementResult<List<BookieSocketAddress>> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, Map<String, byte[]> customMetadata, Set<BookieSocketAddress> excludeBookies) throws BKNotEnoughBookiesException { rwLock.readLock().lock(); try { <START> Set<BookieSocketAddress> comprehensiveExclusionBookiesSet = addDefaultZoneBookiesIfMinNumRacksIsEnforced( <END> excludeBookies); PlacementResult<List<BookieSocketAddress>> newEnsembleResult = newEnsembleInternal(ensembleSize, writeQuorumSize, ackQuorumSize, comprehensiveExclusionBookiesSet, null, null); return newEnsembleResult; } finally { rwLock.readLock().unlock(); } }</code><technical_language>I a big fan of name. is specific is doing. Tomorrow add more criteria exclusion of bookies (Say based load etc); i OK as-is name "compileComprehensiveExclusionSet" is generic; Anyway.. a suggestion</technical_language>

Target:
public PlacementResult<List<BookieSocketAddress>> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, Map<String, byte[]> customMetadata, Set<BookieSocketAddress> excludeBookies) throws BKNotEnoughBookiesException { rwLock.readLock().lock(); try { Set<BookieSocketAddress> comprehensiveExclusionBookiesSet = addDefaultRackBookiesIfMinNumRacksIsEnforced( excludeBookies); PlacementResult<List<BookieSocketAddress>> newEnsembleResult = newEnsembleInternal(ensembleSize, writeQuorumSize, ackQuorumSize, comprehensiveExclusionBookiesSet, null, null); return newEnsembleResult; } finally { rwLock.readLock().unlock(); } }
Source:
<code>private List<DiskImage> getImagesToPreview() { if (imagesToPreview == null) { List<DiskImage> allSnapshotsForVm = diskImageDao.getAllSnapshotsForVmSnapshot(getDstSnapshot().getId()); if (getParameters().getDiskIds() != null) { Map<Guid, DiskImage> guidDiskImageMap = allSnapshotsForVm.stream() .collect(Collectors.toMap(BaseDisk::getId, <START> disk -> disk)); <END> diskImagesForDiskIds = guidDiskImageMap.entrySet().stream() .filter(entry -> getParameters().getDiskIds().contains(entry.getKey())) .map(Map.Entry::getValue) .collect(Collectors.toList()); imagesToPreview = diskImagesForDiskIds; } else { imagesToPreview = allSnapshotsForVm; } } return imagesToPreview; }</code><technical_language>Function.identity()</technical_language>

Target:
private List<DiskImage> getImagesToPreview() { if (imagesToPreview == null) { List<DiskImage> allSnapshotsForVm = diskImageDao.getAllSnapshotsForVmSnapshot(getDstSnapshot().getId()); if (getParameters().getDiskIds() != null) { Map<Guid, DiskImage> guidDiskImageMap = allSnapshotsForVm.stream() .collect(Collectors.toMap(BaseDisk::getId, Function.identity())); imagesToPreview = guidDiskImageMap.entrySet().stream() .filter(entry -> getParameters().getDiskIds().contains(entry.getKey())) .map(Map.Entry::getValue) .collect(Collectors.toList()); } else { imagesToPreview = allSnapshotsForVm; } } return imagesToPreview; }
Source:
<code><START> public void stopLoading() { <END> this.stoppingThread = Thread.currentThread(); this.running = false; synchronized(this.stoppingThread) { try { this.stoppingThread.wait(1000); } catch (InterruptedException e) { } } }</code><technical_language>I this is a place log is happening. Based understanding of code call stop loading a bunch do record it. magic number</technical_language>

Target:
public void stopLoading() { this.stoppingThread = Thread.currentThread(); this.running = false; synchronized(this.stoppingThread) { try { int waitTimeInMS = 1500; this.stoppingThread.wait(waitTimeInMS); } catch (InterruptedException e) { } } }
Source:
<code>private void tryFlushingUpdatesToSOR(Cache<Long, String> cache) { int retryCount = 1000; int i = 0; while (true) { String value = "flush_queue_" + i; cache.put(KEY, value); try { Thread.sleep(100); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } if (value.equals(loaderWriter.load(KEY))) break; if (i > retryCount) { throw new RuntimeException("Couldn't flush updates to SOR after " + retryCount + " tries"); } i++; } }</code><technical_language>No. more wanting fail here. throw. printStackTrace</technical_language>

Target:
private void tryFlushingUpdatesToSOR(Cache<Long, String> cache) throws Exception { int retryCount = 1000; int i = 0; while (true) { String value = "flush_queue_" + i; cache.put(KEY, value); Thread.sleep(100); String loadedValue = loaderWriter.load(KEY); if (loadedValue != null && loadedValue.startsWith("flush_queue")) { break; } if (i > retryCount) { throw new AssertionError("Couldn't flush updates to SOR after " + retryCount + " tries"); } i++; } }
Source:
<code>public String docs() { return "{type: <macro> The entity type of the projectile | shootertype: <macro> The entity type of the shooter | world: <macro>}" + " This event is called when a projectile is launched." + " Cancelling the event will only cancel the launching of the projectile." <START> + " For instance if a player shoot an arrow with a bow, the damages taken by its bow will not be cancelled." <END> + " {id: The entityID of the projectile | type: The entity type of the projectile |" + " shooter: The entityID of the shooter (null if the projectile is launched by a dispenser) |" + " shootertype: The entity type of the shooter (null if the projectile is launched by a dispenser) |" + " player: the player which has launched the projectile (null if the shooter is not a player) |" + " location: from where the projectile is launched | velocity: the velocity of the projectile}" + " {velocity}" + " {}"; }</code><technical_language>want change wording a little, "the bow damage use"</technical_language>

Target:
public String docs() { return "{type: <macro> The entity type of the projectile | shootertype: <macro> The entity type of the shooter | world: <macro>}" + " This event is called when a projectile is launched." + " Cancelling the event will only cancel the launching of the projectile." + " For instance when a player shoots an arrow with a bow, if the event is cancelled the bow will still take damage from use." + " {id: The entityID of the projectile | type: The entity type of the projectile |" + " shooter: The entityID of the shooter (null if the projectile is launched by a dispenser) |" + " shootertype: The entity type of the shooter (null if the projectile is launched by a dispenser) |" + " player: the player which has launched the projectile (null if the shooter is not a player) |" + " location: from where the projectile is launched | velocity: the velocity of the projectile}" + " {velocity}" + " {}"; }
Source:
<code>private boolean isUpdate(Connection connection, String project, String name) { try { <START> IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project, name); <END> IDeploymentImageChangeTrigger trigger = (IDeploymentImageChangeTrigger) dc.getTriggers().stream() .filter(t->DeploymentTriggerType.IMAGE_CHANGE.equals(t.getType())).findFirst().orElse(null); DockerImageURI isTag = trigger.getFrom(); DockerImageURI uri = new DockerImageURI(null, trigger.getNamespace(), isTag.getName(), isTag.getTag()); return trigger != null && findImageStreamFor(trigger.getNamespace(), uri) != null; }catch(NotFoundException e) { } return false; }</code><technical_language>dc null?</technical_language>

Target:
private boolean isUpdate(Connection connection, String project, String name) { try { IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project, name); IDeploymentImageChangeTrigger trigger = (IDeploymentImageChangeTrigger) dc.getTriggers().stream() .filter(t->DeploymentTriggerType.IMAGE_CHANGE.equals(t.getType())).findFirst().orElse(null); return trigger != null && ResourceKind.IMAGE_STREAM_TAG.equals(trigger.getKind()) && connection.getResource(ResourceKind.IMAGE_STREAM, trigger.getNamespace(), trigger.getFrom().getName()) != null; }catch(OpenShiftException e) { if(e.getStatus() != null && e.getStatus().getCode() == IHttpConstants.STATUS_NOT_FOUND) { return false; } throw e; } }
Source:
<code>public Map<String, String> getAgentProperties( @Valid final AgentClientMetadata agentClientMetadata ) { final HashSet<Tag> tags = Sets.newHashSet( Tag.of(AGENT_VERSION_METRIC_TAG_NAME, agentClientMetadata.getVersion().orElse("null")), <START> Tag.of(AGENT_HOST_METRIC_TAG_NAME, agentClientMetadata.getHostname().orElse("null")) <END> ); try { final Map<String, String> agentPropertiesMap = this.agentConfigurationService.getAgentProperties(); MetricsUtils.addSuccessTags(tags); return agentPropertiesMap; } catch (final Exception e) { MetricsUtils.addFailureTagsWithException(tags, e); throw e; } finally { this.meterRegistry.counter(GET_AGENT_PROPERTIES_COUNTER_METRIC_NAME, tags).increment(); } }</code><technical_language>I this is a bad idea for cardinality. sense in theory in reality get a lot of UUID's for host names containers</technical_language>

Target:
public Map<String, String> getAgentProperties( @Valid final AgentClientMetadata agentClientMetadata ) { final HashSet<Tag> tags = Sets.newHashSet( Tag.of(AGENT_VERSION_METRIC_TAG_NAME, agentClientMetadata.getVersion().orElse("null")) ); try { final Map<String, String> agentPropertiesMap = this.agentConfigurationService.getAgentProperties(); MetricsUtils.addSuccessTags(tags); return agentPropertiesMap; } catch (final Exception e) { MetricsUtils.addFailureTagsWithException(tags, e); throw e; } finally { this.meterRegistry.counter(GET_AGENT_PROPERTIES_COUNTER_METRIC_NAME, tags).increment(); } }
Source:
<code>public void preview(IReport report, IStatus status, String serverName, List<IProcessorDescriptor> descriptors, IEclipseContext context, Shell parent) { StringBuilder text = new StringBuilder(); text.append("The following will be send to: ").append(serverName).append("\n\n"); List<StyleRange> styleRanges = new ArrayList<>(); for (SectionsProvider sectionsProvider : sectionProviders) { for (Section section : sectionsProvider.createSections(report, status, serverName, descriptors, context, parent)) { if (text.length() > 0) { text.append("\n"); } if (section.getHeadlineStyleRanges().isEmpty()) { section.getHeadlineStyleRanges().add(createHeadlineStyleRange(section.getHeadline())); } section.getHeadlineStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getHeadlineStyleRanges()); <START> text.append(section.getHeadline()).append("\n\n"); <END> section.getTextStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getTextStyleRanges()); text.append(section.getText().trim()).append("\n\n"); } } styledText.setText(text.toString()); styledText.setStyleRanges(styleRanges.toArray(new StyleRange[0])); }</code><technical_language>System.lineSeparator() extract a constant</technical_language>

Target:
public void preview(IReport report, IStatus status, String serverName, List<IProcessorDescriptor> descriptors, IEclipseContext context, Shell parent) { StringBuilder text = new StringBuilder(); text.append("The following will be send to: ").append(serverName).append(LF + LF); List<StyleRange> styleRanges = new ArrayList<>(); for (SectionsProvider sectionsProvider : sectionProviders) { for (Section section : sectionsProvider.createSections(report, status, serverName, descriptors, context, parent)) { if (text.length() > 0) { text.append(LF); } if (section.getHeadlineStyleRanges().isEmpty()) { section.getHeadlineStyleRanges().add(createHeadlineStyleRange(section.getHeadline())); } section.getHeadlineStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getHeadlineStyleRanges()); text.append(section.getHeadline()).append(LF + LF); section.getTextStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getTextStyleRanges()); text.append(section.getText().trim()).append(LF + LF); } } styledText.setText(text.toString()); styledText.setStyleRanges(styleRanges.toArray(new StyleRange[0])); }