auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleTitle(List<StructuredProperty> titleList, DocumentMetadata.Builder metaBuilder) { <START> if (CollectionUtils.isNotEmpty(titleList)) { for (StructuredProperty titleProp : titleList) { if (titleProp.getQualifier() != null && InfoSpaceConstants.SEMANTIC_CLASS_MAIN_TITLE.equals(titleProp.getQualifier().getClassid()) && fieldApprover.approve(titleProp.getDataInfo())) { metaBuilder.setTitle(titleProp.getValue()); } <END> } if (!metaBuilder.hasTitle()) { for (StructuredProperty titleProp : titleList) { if (fieldApprover.approve(titleProp.getDataInfo())) { metaBuilder.setTitle(titleProp.getValue()); break; } } } } }</code><technical_language>I stream iteration java titleList.stream() .filter(x -> Objects.nonNull(x.getQualifier())) .filter(x -> InfoSpaceConstants.SEMANTIC_CLASS_MAIN_TITLE.equals(x.getQualifier().getClassid())) .filter(x -> fieldApprover.approve(x.getDataInfo())) .forEach(x -> metaBuilder.setTitle(x.getValue()));</technical_language>

Target:
private void handleTitle(List<StructuredProperty> titleList, DocumentMetadata.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(titleList)) { titleList.stream().filter(x -> Objects.nonNull(x.getQualifier())) .filter(x -> InfoSpaceConstants.SEMANTIC_CLASS_MAIN_TITLE.equals(x.getQualifier().getClassid())) .filter(x -> fieldApprover.approve(x.getDataInfo())).findFirst() .ifPresent(x -> metaBuilder.setTitle(x.getValue())); if (!metaBuilder.hasTitle()) { titleList.stream().filter(x -> fieldApprover.approve(x.getDataInfo())).findFirst() .ifPresent(x -> metaBuilder.setTitle(x.getValue())); } } }
Source:
<code>protected boolean processUnlockedVendorMaintenanceDocument(StringBuffer documentNumbers, MaintenanceDocument vendorMaintDoc) throws WorkflowException { <START> boolean isValid = true; <END> boolean isRouted = false; try { vendorMaintDoc.validateBusinessRules(new RouteDocumentEvent(vendorMaintDoc)); } catch (ValidationException ve) { LOG.error("Failed to route Vendor Edit document due to business rule error(s): " + new PaymentWorksUtil().getAutoPopulatingErrorMessages(GlobalVariables.getMessageMap().getErrorMessages())); isValid = false; } if (isValid) { documentService.routeDocument(vendorMaintDoc, null, null); isRouted = true; documentNumbers.append(vendorMaintDoc.getDocumentNumber() + ","); } return isRouted; }</code><technical_language>this is a personal preference, I drop "is" prefix boolean variables - if (valid), if (routed) more natural</technical_language>

Target:
protected boolean processUnlockedVendorMaintenanceDocument(StringBuffer documentNumbers, MaintenanceDocument vendorMaintDoc) throws WorkflowException { boolean routed = false; try { vendorMaintDoc.validateBusinessRules(new RouteDocumentEvent(vendorMaintDoc)); documentService.routeDocument(vendorMaintDoc, null, null); routed = true; documentNumbers.append(vendorMaintDoc.getDocumentNumber() + ","); } catch (ValidationException ve) { LOG.error("Failed to route Vendor Edit document due to business rule error(s): " + getPaymentWorksUtilityService().getAutoPopulatingErrorMessages(GlobalVariables.getMessageMap().getErrorMessages())); } return routed; }
Source:
<code>public boolean renderClouds(int cloudTicks, float partialTicks) { <START> net.minecraftforge.client.IRenderHandler renderer = this.client.world.provider.getCloudRenderer(); <END> if (renderer != null) { renderer.render(partialTicks, this.client.world, this.client); return true; } return cloudRenderer.render(cloudTicks, partialTicks); }</code><technical_language>IRenderHandler (use import)</technical_language>

Target:
public boolean renderClouds(int cloudTicks, float partialTicks) { IRenderHandler renderer = this.client.world.provider.getCloudRenderer(); if (renderer != null) { renderer.render(partialTicks, this.client.world, this.client); return true; } return cloudRenderer.render(cloudTicks, partialTicks); }
Source:
<code>protected String registryAuth(AuthConfig authConfig) { try { <START> String json = authConfig == null ? "{}" : new ObjectMapper().writeValueAsString(authConfig); <END> return Base64.encodeBase64String(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>move static field public static final String EMPTY_JSON = "{}"</technical_language>

Target:
protected String registryAuth(AuthConfig authConfig) { try { String json = authConfig == null ? EMPTY_JSON : new ObjectMapper().writeValueAsString(authConfig); return Base64.encodeBase64String(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private PlanNode getCostBasedDistributionType(SemiJoinNode node, Context context) { if (!canReplicate(node, context)) { return node.withDistributionType(PARTITIONED); } List<PlanNodeWithCost> possibleJoinNodes = new ArrayList<>(); possibleJoinNodes.add(getSemiJoinNodeWithCost(node.withDistributionType(REPLICATED), context)); possibleJoinNodes.add(getSemiJoinNodeWithCost(node.withDistributionType(PARTITIONED), context)); <START> if (possibleJoinNodes.stream().anyMatch(result -> result.getCost().hasUnknownComponents()) || possibleJoinNodes.isEmpty()) { <END> return node.withDistributionType(PARTITIONED); } Ordering<PlanNodeWithCost> planNodeOrderings = costComparator.forSession(context.getSession()).onResultOf(PlanNodeWithCost::getCost); return planNodeOrderings.min(possibleJoinNodes).getPlanNode(); }</code><technical_language>nit: empty</technical_language>

Target:
private PlanNode getCostBasedDistributionType(SemiJoinNode node, Context context) { if (!canReplicate(node, context)) { return node.withDistributionType(PARTITIONED); } List<PlanNodeWithCost> possibleJoinNodes = new ArrayList<>(); possibleJoinNodes.add(getSemiJoinNodeWithCost(node.withDistributionType(REPLICATED), context)); possibleJoinNodes.add(getSemiJoinNodeWithCost(node.withDistributionType(PARTITIONED), context)); if (possibleJoinNodes.stream().anyMatch(result -> result.getCost().hasUnknownComponents())) { return node.withDistributionType(PARTITIONED); } Ordering<PlanNodeWithCost> planNodeOrderings = costComparator.forSession(context.getSession()).onResultOf(PlanNodeWithCost::getCost); return planNodeOrderings.min(possibleJoinNodes).getPlanNode(); }
Source:
<code>private void checkIfTypeSupported(Class<?> javaType) { <START> if (javaType != Long.class <END> && javaType != Double.class && javaType != Integer.class && javaType != Boolean.class && javaType != String.class) { throw new UnsupportedOperationException(String.format("Java type %s is not supported to be passed to thrift header", javaType)); } }</code><technical_language>checkArgument() java private static final Set<Class<?>> SUPPORTED_TYPES = ImmutableSet.of(Integer.class, Long.class, Double.class, Boolean.class, String.class); checkArgument(SUPPORTED_TYPES.contains(javaType), "Java type %s a Thrift header value", javaType.getName());</technical_language>

Target:
private void checkIfTypeSupported(Class<?> javaType) { checkArgument(SUPPORTED_TYPES.contains(javaType), "Java type %s is not supported to be passed to thrift header", javaType); }
Source:
<code><START> public boolean isConcreteCollection() { <END> return collectionPatterns.isEmpty() && collectionVariables.isEmpty() && collectionFunctions.isEmpty(); }</code><technical_language>final</technical_language>

Target:
public final boolean isConcreteCollection() { return collectionPatterns.isEmpty() && collectionVariables.isEmpty() && collectionFunctions.isEmpty(); }
Source:
<code>public CepEvent<T> build() { if (eventName == null || continuity == null || condition == null || classType == null) { throw new IllegalStateException("One of event name, condition, class type is null!"); } if (stopCondition != null && maxTimes != -1) { <START> throw new IllegalStateException("N or more quantifier is not set!"); <END> } if (innerContinuity == null) { innerContinuity = DEFAULT_INNER_CONTINUITY; } if (stopCondition == null) { stopCondition = DEFAULT_STOPCONDITION; } return new CepEvent(eventName, condition, continuity, optional, times, minTimes, maxTimes, innerContinuity, stopCondition, classType); }</code><technical_language>I exception message is good</technical_language>

Target:
public CepEvent<T> build() { if (eventName == null || contiguity == null || condition == null || classType == null) { throw new IllegalStateException("One of event name, condition, class type is null!"); } return new CepEvent(eventName, condition, contiguity, optional, times, minTimes, maxTimes, innerContiguity, stopCondition, classType); }
Source:
<code><START> public FixedDoubleBreakdownHistogram( <END> int bucketCount, double min, double max, int[] indices, double[] weights, long[] counts) { verifyParameters(bucketCount, min, max); this.bucketCount = bucketCount; this.min = min; this.max = max; this.indices = indices; this.weights = weights; this.counts = counts; }</code><technical_language>this private move public constructor</technical_language>

Target:
private FixedDoubleBreakdownHistogram( int bucketCount, double min, double max, int[] indices, double[] weights, long[] counts) { validateParameters(bucketCount, min, max); this.bucketCount = bucketCount; this.min = min; this.max = max; this.indices = requireNonNull(indices, "indices is null"); this.weights = requireNonNull(weights, "weights is null"); this.counts = requireNonNull(counts, "counts is null"); }
Source:
<code>private void importAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.OPEN | <START> SWT.MULTI); <END> dialog.setText(Messages.ManageXMLAnalysisDialog_SelectFileImport); dialog.setFilterNames(new String[] { Messages.ManageXMLAnalysisDialog_ImportXmlFile + " (" + XML_FILTER_EXTENSION + ")" }); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION }); String path = dialog.open(); if (path != null) { File file = new File(path); if (loadXmlFile(file, true)) { fillAnalysesTable(); } } }</code><technical_language>need for Multi dialog.open returns path</technical_language>

Target:
private void importAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.OPEN); dialog.setText(Messages.ManageXMLAnalysisDialog_SelectFileImport); dialog.setFilterNames(new String[] { Messages.ManageXMLAnalysisDialog_ImportXmlFile + " (" + XML_FILTER_EXTENSION + ")" }); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION }); String path = dialog.open(); if (path != null) { File file = new File(path); if (loadXmlFile(file, true)) { fillAnalysesTable(); } } }
Source:
<code>public static void setDisplayBasedMinimumZoomLevel(Context c) { WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics outMetrics = new DisplayMetrics(); display.getMetrics(outMetrics); <START> sMinZoomLevelOfMapDisplaySizeBased = (outMetrics.widthPixels < 500)? 11 : 13; <END> }</code><technical_language>11 13 pulled out constants. SMALL_SCREEN_MIN_ZOOM LARGE_SCREEN_MIN_ZOOM</technical_language>

Target:
public static void setDisplayBasedMinimumZoomLevel(Context c) { WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics outMetrics = new DisplayMetrics(); display.getMetrics(outMetrics); sMinZoomLevelOfMapDisplaySizeBased = (outMetrics.widthPixels < 500)? SMALL_SCREEN_MIN_ZOOM : LARGE_SCREEN_MIN_ZOOM; }
Source:
<code>public void echo(final String echo) { <START> System.out.println("EchoService: " + echo); <END> System.out.println("Principal: " + wsCtx.getUserPrincipal()); System.out.println("Principal.getName(): " + wsCtx.getUserPrincipal().getName()); System.out.println("wctx isUserInRole('testRole'): " + wsCtx.isUserInRole("testRole")); System.out.println("ejbctx isUserInRole('testRole'): " + ejbCtx.isCallerInRole("testRole")); try { Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); System.out.println("Found subject in web service call: " + subject); SecurityContext current = SecurityContextAssociation.getSecurityContext(); System.out.println("Found security context in web service call: " + current); System.out.println("Security domain in web service call: " + current.getSecurityDomain()); System.out.println("Subject info in web service call: " + current.getSubjectInfo()); } catch (PolicyContextException e) { throw new IllegalStateException(e); } }</code><technical_language>here. If want log debug trace level, tests produce output normal circumstances</technical_language>

Target:
public void echo(final String echo) { try { Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); SecurityContext current = SecurityContextAssociation.getSecurityContext(); } catch (PolicyContextException e) { throw new IllegalStateException(e); } }
Source:
<code>private ErrorType getErrorType(@NonNull Context context, @Nullable Throwable caught) { if (caught != null && !is404(context, caught)) { if (context instanceof PageActivity) { return ErrorType.PAGE_OFFLINE; } <START> else { <END> return ErrorType.OFFLINE; } } return ErrorType.GENERIC; }</code><technical_language>Needless else :]</technical_language>

Target:
private ErrorType getErrorType(@NonNull Context context, @Nullable Throwable caught) { if (caught != null && !is404(context, caught)) { if (context instanceof PageActivity) { return ErrorType.PAGE_OFFLINE; } return ErrorType.OFFLINE; } return ErrorType.GENERIC; }
Source:
<code>public void onCreate(Bundle bundle) { super.onCreate(bundle); Intent shortcutIntent = new Intent(getApplicationContext(), AppManagerActivity.class); shortcutIntent.addCategory(Intent.CATEGORY_HOME); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); <START> intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "App Manager"); <END> Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); setResult(RESULT_OK, intent); finish(); }</code><technical_language>Localized in Android framework</technical_language>

Target:
public void onCreate(Bundle bundle) { super.onCreate(bundle); Intent shortcutIntent = new Intent(getApplicationContext(), AppManagerActivity.class); shortcutIntent.addCategory(Intent.CATEGORY_HOME); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, R.string.manager_activity_name); Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); setResult(RESULT_OK, intent); finish(); }
Source:
<code>private void fetchInformation() throws CommitStepException { SonarQubeServer tmpServer = model.createServerWithoutOrganization(); InformationFetchTask task = new InformationFetchTask(tmpServer); ProgressManager.getInstance().run(task); if (task.getException() == null) { model.setOrganizationList(task.organizations()); if (task.organizations().size() == 1) { model.setOrganization(task.organizations().iterator().next().getKey()); } <START> if (task.organizations().isEmpty()) { <END> model.setOrganization(null); } model.setNotificationsSupported(task.notificationsSupported()); return; } String msg = "Failed to fetch information from the server. Please check the configuration and try again."; if (task.getException().getMessage() != null) { msg = msg + " Error: " + task.getException().getMessage(); } throw new CommitStepException(msg); }</code><technical_language>else if</technical_language>

Target:
private void fetchInformation() throws CommitStepException { SonarQubeServer tmpServer = model.createServerWithoutOrganization(); InformationFetchTask task = new InformationFetchTask(tmpServer); ProgressManager.getInstance().run(task); if (task.getException() == null) { model.setOrganizationList(task.organizations()); if (task.organizations().size() == 1) { model.setOrganization(task.organizations().iterator().next().getKey()); } else if (task.organizations().isEmpty()) { model.setOrganization(null); } model.setNotificationsSupported(task.notificationsSupported()); return; } String msg = "Failed to fetch information from the server. Please check the configuration and try again."; if (task.getException().getMessage() != null) { msg = msg + " Error: " + task.getException().getMessage(); } throw new CommitStepException(msg); }
Source:
<code>public String getNeededData(EvaluationContext evalContext) { if (currentCmd == null) { return SessionFrame.STATE_COMMAND_ID; } Vector<Entry> entries = getEntriesForCommand(currentCmd, collectedDatums); String needDatum = getDataNeededByAllEntries(entries); if (needDatum != null) { return needDatum; } else if (entries.size() == 1 && entries.elementAt(0) instanceof SyncEntry && ((SyncEntry)entries.elementAt(0)).getSyncPost().isRelevant(evalContext)) { return SessionFrame.STATE_SYNC_REQUEST; } else if (entries.size() > 1 || <START> (!entries.isEmpty() && !entries.elementAt(0).getCommandId().equals(currentCmd))) { <END> return SessionFrame.STATE_COMMAND_ID; } else { return null; } }</code><technical_language>this crash ACRA</technical_language>

Target:
public String getNeededData(EvaluationContext evalContext) { if (currentCmd == null) { return SessionFrame.STATE_COMMAND_ID; } Vector<Entry> entries = getEntriesForCommand(currentCmd, collectedDatums); String needDatum = getDataNeededByAllEntries(entries); if (needDatum != null) { return needDatum; } else if (entries.size() == 1 && entries.elementAt(0) instanceof SyncEntry && ((SyncEntry)entries.elementAt(0)).getSyncPost().isRelevant(evalContext)) { return SessionFrame.STATE_SYNC_REQUEST; } else if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(currentCmd)) { return SessionFrame.STATE_COMMAND_ID; } else { return null; } }
Source:
<code>public void shouldAssignMoreTasksToClientWithMoreCapacity() { createClient(UUID_2, 2); createClient(UUID_1, 1); <START> final boolean followupRebalanceNeeded = assign(TASK_0_0, TASK_0_1, TASK_0_2, new TaskId(1, 0), new TaskId(1, 1), new TaskId(1, 2), new TaskId(2, 0), new TaskId(2, 1), new TaskId(2, 2), new TaskId(3, 0), new TaskId(3, 1), new TaskId(3, 2)); <END> assertThat(followupRebalanceNeeded, is(false)); assertThat(clients.get(UUID_2).assignedTaskCount(), equalTo(8)); assertThat(clients.get(UUID_1).assignedTaskCount(), equalTo(4)); }</code><technical_language>prop: suggestion final boolean followupRebalanceNeeded = assign( TASK_0_0, TASK_0_1, TASK_0_2, new TaskId(1, 0), new TaskId(1, 1), new TaskId(1, 2), new TaskId(2, 0), new TaskId(2, 1), new TaskId(2, 2), new TaskId(3, 0), new TaskId(3, 1), new TaskId(3, 2) );</technical_language>

Target:
public void shouldAssignMoreTasksToClientWithMoreCapacity() { createClient(UUID_2, 2); createClient(UUID_1, 1); final boolean probingRebalanceNeeded = assign( TASK_0_0, TASK_0_1, TASK_0_2, new TaskId(1, 0), new TaskId(1, 1), new TaskId(1, 2), new TaskId(2, 0), new TaskId(2, 1), new TaskId(2, 2), new TaskId(3, 0), new TaskId(3, 1), new TaskId(3, 2) ); assertThat(probingRebalanceNeeded, is(false)); assertThat(clients.get(UUID_2).assignedTaskCount(), equalTo(8)); assertThat(clients.get(UUID_1).assignedTaskCount(), equalTo(4)); }
Source:
<code>protected void updateMetadataDevices() { if (getStorageDomain().getVgMetadataDevice() == null || getStorageDomain().getFirstMetadataDevice() == null) { blockStorageDomainHelper.fillMetadataDevicesInfo(getStorageDomain().getStorageStaticData(), <START> getVds().getStoragePoolId()); <END> storageDomainStaticDao.update(getStorageDomain().getStorageStaticData()); } }</code><technical_language>work import storage domain. process of import is done host calling HSMGetStorageDomainInfo done this Host</technical_language>

Target:
protected void updateMetadataDevices() { if (getStorageDomain().getVgMetadataDevice() == null || getStorageDomain().getFirstMetadataDevice() == null) { blockStorageDomainHelper.fillMetadataDevicesInfo(getStorageDomain().getStorageStaticData(), getVds().getId()); storageDomainStaticDao.update(getStorageDomain().getStorageStaticData()); } }
Source:
<code>public CommandCallback getCallback() { <START> return Injector.injectMembers(new SerialChildCommandsExecutionCallback()); <END> }</code><technical_language>hope works for this class</technical_language>

Target:
public CommandCallback getCallback() { return callbackProvider.get(); }
Source:
<code>public void setEntity(EntityLocal entity) { <START> if (configsInternal.getConfigRaw(RESIZE_OPERATOR, true).isPresentAndNonNull()) { <END> Preconditions.checkArgument(entity instanceof Resizable, "Provided entity must be an instance of Resizable, because no custom-resizer operator supplied"); } super.setEntity(entity); this.poolEntity = entity; if (getMetric() != null) { Entity entityToSubscribeTo = (getEntityWithMetric() != null) ? getEntityWithMetric() : entity; subscribe(entityToSubscribeTo, getMetric(), metricEventHandler); } subscribe(poolEntity, getPoolColdSensor(), utilizationEventHandler); subscribe(poolEntity, getPoolHotSensor(), utilizationEventHandler); subscribe(poolEntity, getPoolOkSensor(), utilizationEventHandler); }</code><technical_language>This reversed logic. previously checking entity instanceof Resizable if resize_operator == null isPresentAndNonNull</technical_language>

Target:
public void setEntity(EntityLocal entity) { if (!configsInternal.getConfigRaw(RESIZE_OPERATOR, true).isPresentAndNonNull()) { Preconditions.checkArgument(entity instanceof Resizable, "Provided entity must be an instance of Resizable, because no custom-resizer operator supplied"); } super.setEntity(entity); this.poolEntity = entity; if (getMetric() != null) { Entity entityToSubscribeTo = (getEntityWithMetric() != null) ? getEntityWithMetric() : entity; subscribe(entityToSubscribeTo, getMetric(), metricEventHandler); } subscribe(poolEntity, getPoolColdSensor(), utilizationEventHandler); subscribe(poolEntity, getPoolHotSensor(), utilizationEventHandler); subscribe(poolEntity, getPoolOkSensor(), utilizationEventHandler); }
Source:
<code>private void writeOrganization(JsonWriter json, OrganizationDto organization, boolean newProjectPrivate) { json.name("organization") .beginObject() .prop("canAdmin", userSession.hasPermission(ADMINISTER, organization)) .prop("canProvisionProjects", userSession.hasPermission(PROVISION_PROJECTS, organization)) .prop("canDelete", organization.isGuarded() ? userSession.isSystemAdministrator() : userSession.hasPermission(ADMINISTER, organization)) .prop("isDefault", organization.getKey().equals(defaultOrganizationProvider.get().getKey())) <START> .prop("projectVisibility", newProjectPrivate ? "private" : "public") <END> .prop("canUpdateProjectsVisibilityToPrivate", userSession.hasPermission(ADMINISTER, organization) && billingValidations.canUpdateProjectsVisibilityToPrivate(new BillingValidations.Organization(organization.getKey(), organization.getUuid()))); Predicate<Page> personalOrgForBilling = page -> organization.getUserId() == null || !page.getKey().startsWith("billing/"); List<Page> pages = pageRepository.getOrganizationPages(false).stream().filter(personalOrgForBilling).collect(toList()); json.name("pages"); writePages(json, pages); if (userSession.hasPermission(ADMINISTER, organization)) { List<Page> adminPages = pageRepository.getOrganizationPages(true).stream().filter(personalOrgForBilling).collect(toList()); json.name("adminPages"); writePages(json, adminPages); } json.endObject(); }</code><technical_language>Daniel's enum organization visibility for other places "private" "public"</technical_language>

Target:
private void writeOrganization(JsonWriter json, OrganizationDto organization, boolean newProjectPrivate) { json.name("organization") .beginObject() .prop("canAdmin", userSession.hasPermission(ADMINISTER, organization)) .prop("canProvisionProjects", userSession.hasPermission(PROVISION_PROJECTS, organization)) .prop("canDelete", organization.isGuarded() ? userSession.isSystemAdministrator() : userSession.hasPermission(ADMINISTER, organization)) .prop("isDefault", organization.getKey().equals(defaultOrganizationProvider.get().getKey())) .prop("projectVisibility", Visibility.getLabel(newProjectPrivate)) .prop("canUpdateProjectsVisibilityToPrivate", userSession.hasPermission(ADMINISTER, organization) && billingValidations.canUpdateProjectVisibilityToPrivate(new BillingValidations.Organization(organization.getKey(), organization.getUuid()))); Predicate<Page> personalOrgForBilling = page -> organization.getUserId() == null || !page.getKey().startsWith("billing/"); List<Page> pages = pageRepository.getOrganizationPages(false).stream().filter(personalOrgForBilling).collect(toList()); json.name("pages"); writePages(json, pages); if (userSession.hasPermission(ADMINISTER, organization)) { List<Page> adminPages = pageRepository.getOrganizationPages(true).stream().filter(personalOrgForBilling).collect(toList()); json.name("adminPages"); writePages(json, adminPages); } json.endObject(); }
Source:
<code>public BrandingManager(final File etcDir) { <START> brandingRootPath = new File(etcDir + BRANDING_PATH); <END> }</code><technical_language>new File(etcDir, BRANDING_PATH) remove / BRANDING_PATH</technical_language>

Target:
public BrandingManager(final File etcDir) { brandingRootPath = new File(etcDir, BRANDING_PATH); }
Source:
<code><START> public void run() { <END> if (IGNORE_PATHS.contains(partition.getPath().getName())) { return; } if (!partition.isDir()) { return; } try { copyPartitionContents(); } catch (IOException e) { this.exception = e; } }</code><technical_language>Instead of break points, I core of method wrapped in if statement combines checks. easier read</technical_language>

Target:
public void run() { try { copyPartitionContents(); } catch (IOException e) { this.exception = e; } }
Source:
<code>WarehouseInstance(Logger logger, MiniDFSCluster cluster, Map<String, String> overridesForHiveConf, String keyNameForEncryptedZone) throws Exception { this.logger = logger; this.miniDFSCluster = cluster; assert miniDFSCluster.isClusterUp(); assert miniDFSCluster.isDataNodeUp(); DistributedFileSystem fs = miniDFSCluster.getFileSystem(); warehouseRoot = mkDir(fs, "/warehouse" + uniqueIdentifier); externalTableWarehouseRoot = mkDir(fs, "/external" + uniqueIdentifier); if (StringUtils.isNotEmpty(keyNameForEncryptedZone)) { fs.createEncryptionZone(warehouseRoot, keyNameForEncryptedZone); fs.createEncryptionZone(externalTableWarehouseRoot, keyNameForEncryptedZone); } Path cmRootPath = mkDir(fs, "/cmroot" + uniqueIdentifier); this.functionsRoot = mkDir(fs, "/functions" + uniqueIdentifier).toString(); String tmpDir = "/tmp/" + TestReplicationScenarios.class.getCanonicalName().replace('.', '_') + "_" + System.nanoTime(); this.repldDir = mkDir(fs, tmpDir + "/hrepl" + uniqueIdentifier + "/").toString(); Path testPath = new Path(tmpDir); <START> fs.mkdirs(testPath); <END> avroSchemaFile = createAvroSchemaFile(fs, testPath); initialize(cmRootPath.toString(),externalTableWarehouseRoot.toString(), warehouseRoot.toString(), overridesForHiveConf); }</code><technical_language>AFAIU, mkDir in turn calls mkdirs <tmpDir>/hrepl/... so, create tmpDir well. do need extra call fs.mkdirs(testPath)</technical_language>

Target:
WarehouseInstance(Logger logger, MiniDFSCluster cluster, Map<String, String> overridesForHiveConf, String keyNameForEncryptedZone) throws Exception { this.logger = logger; this.miniDFSCluster = cluster; assert miniDFSCluster.isClusterUp(); assert miniDFSCluster.isDataNodeUp(); DistributedFileSystem fs = miniDFSCluster.getFileSystem(); warehouseRoot = mkDir(fs, "/warehouse" + uniqueIdentifier); externalTableWarehouseRoot = mkDir(fs, "/external" + uniqueIdentifier); if (StringUtils.isNotEmpty(keyNameForEncryptedZone)) { fs.createEncryptionZone(warehouseRoot, keyNameForEncryptedZone); fs.createEncryptionZone(externalTableWarehouseRoot, keyNameForEncryptedZone); } Path cmRootPath = mkDir(fs, "/cmroot" + uniqueIdentifier); this.functionsRoot = mkDir(fs, "/functions" + uniqueIdentifier).toString(); String tmpDir = "/tmp/" + TestReplicationScenarios.class.getCanonicalName().replace('.', '_') + "_" + System.nanoTime(); this.repldDir = mkDir(fs, tmpDir + "/hrepl" + uniqueIdentifier + "/").toString(); initialize(cmRootPath.toString(), externalTableWarehouseRoot.toString(), warehouseRoot.toString(), overridesForHiveConf); }
Source:
<code>public JobDetail hypervisorHeartbeatUpdate( @PathParam("owner") @Verify(value = Owner.class, require = Access.READ_ONLY, subResource = SubResource.HYPERVISOR) final String ownerKey, @QueryParam("reporter_id") final String reporterId) { <START> return HypervisorHeartbeatUpdateJob.from(reporterId); <END> }</code><technical_language>is perform validation early in request for reporterId ownerKey here, throwing exceptions (e.g. IllegalArgumentException if argument is null/empty NotFoundException if is owner for owner key hypervisor for reporter id), move creating a job. Also, @ApiResponse updated list of response code/message pairs (404 for NotFoundException, "Owner found" message, etc.) users understand/handle it. If in doubt validate on, exception is appropriate, browsing *Resource.java classes help</technical_language>

Target:
public JobDetail hypervisorHeartbeatUpdate( @PathParam("owner") @Verify(value = Owner.class, require = Access.READ_ONLY, subResource = SubResource.HYPERVISOR) final String ownerKey, @QueryParam("reporter_id") final String reporterId) { if (reporterId == null || reporterId.isEmpty()) { throw new IllegalArgumentException("ReporterId is required!"); } final Owner owner = this.getOwner(ownerKey); return HypervisorHeartbeatUpdateJob.from(reporterId, owner); }
Source:
<code>public int getTargetTaskThreadPoolSize(String instanceName) { <START> InstanceConfig instanceConfig = <END> _accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName)); if (instanceConfig == null) { throw new IllegalArgumentException( "Failed to find InstanceConfig with provided instance name " + instanceName); } return instanceConfig.getTargetTaskThreadPoolSize(); }</code><technical_language>create a private method common lines avoid duplication</technical_language>

Target:
public int getTargetTaskThreadPoolSize(String instanceName) { InstanceConfig instanceConfig = getInstanceConfig(instanceName); return instanceConfig.getTargetTaskThreadPoolSize(); }
Source:
<code><START> protected HttpEntity<String> createMessage(Application app, String registeredTitle, <END> String activitySubtitle) { Message _message = new Message(); _message.setTitle(registeredTitle); _message.setSummary(messageSummary); _message.setThemeColor(themeColor); Section section = new Section(); section.setActivityTitle(app.getName()); section.setActivitySubtitle(activitySubtitle); List<Fact> facts = new ArrayList<>(); facts.add(new Fact(STATUS_KEY, app.getStatusInfo().getStatus())); facts.add(new Fact(SERVICE_URL_KEY, app.getServiceUrl())); facts.add(new Fact(HEALTH_URL_KEY, app.getHealthUrl())); facts.add(new Fact(MANAGEMENT_URL_KEY, app.getManagementUrl())); facts.add(new Fact(SOURCE_KEY, app.getSource())); section.setFacts(facts); _message.setSections(singletonList(section)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); JSONObject messageJson = null; try { messageJson = _message.toJson(); } catch (JSONException e) { LOGGER.warn( "Exception while trying to serialize Teams notification. Falling back by using an empty JSONObject.", e); messageJson = new JSONObject(); } setMessage(_message); return new HttpEntity<>(messageJson.toString(), headers); }</code><technical_language>pass Message object Spring's MessageConverter handle serialization</technical_language>

Target:
protected Message createMessage(Application app, String registeredTitle, String activitySubtitle) { Message message = new Message(); message.setTitle(registeredTitle); message.setSummary(messageSummary); message.setThemeColor(themeColor); Section section = new Section(); section.setActivityTitle(app.getName()); section.setActivitySubtitle(activitySubtitle); List<Fact> facts = new ArrayList<>(); facts.add(new Fact(STATUS_KEY, app.getStatusInfo().getStatus())); facts.add(new Fact(SERVICE_URL_KEY, app.getServiceUrl())); facts.add(new Fact(HEALTH_URL_KEY, app.getHealthUrl())); facts.add(new Fact(MANAGEMENT_URL_KEY, app.getManagementUrl())); facts.add(new Fact(SOURCE_KEY, app.getSource())); section.setFacts(facts); message.setSections(singletonList(section)); return message; }
Source:
<code>public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("condition", new StringProperty()) .property("patient", new StringProperty()) .property("clinicalStatus", new StringProperty()) .property("verificationStatus", new StringProperty()) .property("previousVersion", new StringProperty()) .property("onsetDate", new StringProperty()) <START> .required("condition").required("onsetDate"); <END> }</code><technical_language>line mean</technical_language>

Target:
public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("condition", new StringProperty()) .property("patient", new StringProperty().example("uuid")) .property("clinicalStatus", new StringProperty()) .property("verificationStatus", new StringProperty()) .property("previousVersion", new StringProperty()) .property("onsetDate", new StringProperty()); }
Source:
<code>public void freeMac(String mac) { log.infoFormat("MacPoolManager::freeMac(mac = '{0}') - entered", mac); mLocObj.writeLock().lock(); try { if (!mInitialized) { throw new VdcBLLException(VdcBllErrors.MAC_POOL_NOT_INITIALIZED); } internalFreeMac(mac); <START> } catch (Exception ex) { <END> log.debug("Failed to free MAC address",ex); log.errorFormat("Failed to free MAC address {0}. Exception message is {1}", mac, ex.getMessage()); AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr",mac); AuditLogDirector.log(logable, AuditLogType.FAILED_TO_FREE_MAC_ADDRESS); } finally { mLocObj.writeLock().unlock(); } }</code><technical_language>is throw exception catch in next line, do if else</technical_language>

Target:
public void freeMac(String mac) { log.infoFormat("MacPoolManager::freeMac(mac = '{0}') - entered", mac); mLocObj.writeLock().lock(); boolean error = false; try { error = !mInitialized; if (error) { log.error("The Mac pool is not initialized"); } internalFreeMac(mac); } catch (Exception ex) { log.debug("Failed to free MAC address",ex); log.errorFormat("Failed to free MAC address {0}. Exception message is {1}", mac, ex.getMessage()); } finally { if (error) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr",mac); AuditLogDirector.log(logable, AuditLogType.FAILED_TO_FREE_MAC_ADDRESS); } mLocObj.writeLock().unlock(); } }
Source:
<code>private boolean lastNameFilter(Citation citation, String lastName){ boolean keepCitation = true; if (lastName != null && !lastName.isEmpty()){ <START> if (!lastName.toLowerCase().equals(citation.last_name.toLowerCase())){ <END> keepCitation = false; } } return keepCitation; }</code><technical_language>wanted is a "equalsIgnoreCase" method trim this</technical_language>

Target:
private boolean lastNameFilter(Citation citation, String lastName){ boolean keepCitation = true; if (lastName != null && !lastName.isEmpty()){ if (!lastName.equalsIgnoreCase(citation.last_name)){ keepCitation = false; } } return keepCitation; }
Source:
<code>private void updateSolverInstance(SolverInstanceContext sic) { synchronized ( sic ) { Score bestScore = sic.getSolver().getBestScore(); if ( bestScore == null ) { sic.getInstance().setScoreWrapper( null ); } else { if ( sic.getInstance().getScoreWrapper() == null ) { sic.getInstance().setScoreWrapper( new ScoreWrapper() ); } sic.getInstance().getScoreWrapper().setScoreClass( bestScore.getClass() ); <START> sic.getInstance().getScoreWrapper().setScoreString( bestScore.toString() ); <END> } } }</code><technical_language>1) 2 methods setScore(Score) method wrapper split ScoreClass ScoreString. 2) is ScoreWrapper mutable? Score's immutable ror multi-threaded reasons. I ScoreWrapper immutable too, simply creating a new instance add a constructor new ScoreWrapper(score)</technical_language>

Target:
private void updateSolverInstance(SolverInstanceContext sic) { synchronized ( sic ) { Score bestScore = sic.getSolver().getBestScore(); sic.getInstance().setScoreWrapper( new ScoreWrapper( bestScore ) ); } }
Source:
<code>public void testGetPropertyValueBeanAndPropertyNameNotNull() throws Exception { Object bean = mock(Object.class); ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); <START> assertTrue(compareValidator.isValid(bean, context)); <END> }</code><technical_language>[x] I test cases fat. enough follows: java Object o = ConstraintValidatorsUtils.getPropertyValue(any object, property name); assertThat(o, notNullValue);</technical_language>

Target:
public void testGetPropertyValueBeanAndPropertyNameNotNull() throws Exception { FooBean foo = new FooBean(); foo.setBar("test"); Object o = ConstraintValidatorsUtils.getPropertyValue(foo, "bar"); assertThat(o, notNullValue()); }
Source:
<code>public String save() { try { metadataPanel.preserveLogical(); metadataPanel.preservePhysical(); structurePanel.preserveLogical(); <START> structurePanel.preservePhysical(); <END> try (OutputStream out = ServiceManager.getFileService().write(mainFileUri)) { ServiceManager.getMetsService().save(workpiece, out); } return close(); } catch (InvalidMetadataValueException | IOException | NoSuchMetadataFieldException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); return null; } }</code><technical_language>backwards: meta-data panel structure panel need preserved once, need store where. metadataPanel.preserve(); structurePanel.preserve();</technical_language>

Target:
public String save() { try { metadataPanel.preserve(); structurePanel.preserve(); try (OutputStream out = ServiceManager.getFileService().write(mainFileUri)) { ServiceManager.getMetsService().save(workpiece, out); } return close(); } catch (InvalidMetadataValueException | IOException | NoSuchMetadataFieldException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); return null; } }
Source:
<code>public BasicRegisteredTypeLoadingContext(@Nullable RegisteredTypeLoadingContext source) { if (source==null) return; this.kind = source.getExpectedKind(); this.expectedSuperType = source.getExpectedJavaSuperType(); this.encounteredTypes = source.getAlreadyEncounteredTypes(); <START> this.loader = (BrooklynClassLoadingContext) source.getLoader(); <END> }</code><technical_language>Cast needed</technical_language>

Target:
public BasicRegisteredTypeLoadingContext(@Nullable RegisteredTypeLoadingContext source) { if (source==null) return; this.kind = source.getExpectedKind(); this.expectedSuperType = source.getExpectedJavaSuperType(); this.encounteredTypes = source.getAlreadyEncounteredTypes(); this.loader = source.getLoader(); }
Source:
<code>private static JWTCallerPrincipalFactory loadSpi(ClassLoader cl) { if (cl == null) { return null; } JWTCallerPrincipalFactory instance = loadSpi(cl.getParent()); if (instance == null) { ServiceLoader<JWTCallerPrincipalFactory> sl = ServiceLoader.load(JWTCallerPrincipalFactory.class, cl); URL u = cl.getResource("/META-INF/services/org.apache.tomee.microprofile.jwt.JWTCallerPrincipalFactory"); System.out.printf("JWTCallerPrincipalFactory, cl=%s, u=%s, sl=%s\n", cl, u, sl); try { for (JWTCallerPrincipalFactory spi : sl) { if (instance != null) { throw new IllegalStateException( "Multiple JWTCallerPrincipalFactory implementations found: " + spi.getClass().getName() + " and " + instance.getClass().getName()); } else { <START> System.out.printf("sl=%s, loaded=%s\n", sl, spi); <END> instance = spi; } } } catch (Throwable e) { System.err.printf("Warning: %s\n", e.getMessage()); } } return instance; }</code><technical_language>Logging</technical_language>

Target:
private static JWTCallerPrincipalFactory loadSpi(ClassLoader cl) { if (cl == null) { return null; } JWTCallerPrincipalFactory instance = loadSpi(cl.getParent()); if (instance == null) { ServiceLoader<JWTCallerPrincipalFactory> sl = ServiceLoader.load(JWTCallerPrincipalFactory.class, cl); URL u = cl.getResource("/META-INF/services/org.apache.tomee.microprofile.jwt.JWTCallerPrincipalFactory"); System.out.printf("JWTCallerPrincipalFactory, cl=%s, u=%s, sl=%s\n", cl, u, sl); try { for (JWTCallerPrincipalFactory spi : sl) { if (instance != null) { throw new IllegalStateException( "Multiple JWTCallerPrincipalFactory implementations found: " + spi.getClass().getName() + " and " + instance.getClass().getName()); } else { System.out.printf("sl=%s, loaded=%s\n", sl, spi); instance = spi; } } } catch (final Throwable e) { System.err.printf("Warning: %s\n", e.getMessage()); } } return instance; }
Source:
<code>public @ResponseBody ProfilesNumberDto getDealsNumber(@RequestParam(value = "searchParam",required = false) String searchParam) { <START> return profileFacade.getProfilesNumber(searchParam); <END> }</code><technical_language>return Long type value, Dto</technical_language>

Target:
public @ResponseBody Long getDealsNumber(@RequestParam(value = "searchParam",required = false) String searchParam) { return profileFacade.getProfilesNumber(searchParam); }
Source:
<code>private void setUpWebView() { webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.toLowerCase().startsWith(wikiUrl.toLowerCase()) && listener != null) { String pagePiece = url.toLowerCase().replace(wikiUrl.toLowerCase(), "") .split("/")[0] .split("#")[0]; listener.embeddedWikiLinkClicked(pagePiece); } else { OpenRedditLink.openUrl(getContext(), url, true); } return true; } <START> <END> @Override public void onPageFinished(WebView webView, String url) { super.onPageFinished(webView, url); if (getView() != null) { getView().findViewById(R.id.wiki_web_view_cover).setVisibility(View.GONE); ref.setRefreshing(false); ref.setEnabled(false); } } }); }</code><technical_language>I a get rid of white flashes, adding: java @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { webView.setBackgroundColor(Color.TRANSPARENT); super.onPageStarted(view, url, favicon); } care of for me. more performant set correct background colour transparent I figure out class for that. some duplicated Palette.java ColorPreferences.java</technical_language>

Target:
private void setUpWebView() { webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.toLowerCase().startsWith(wikiUrl.toLowerCase()) && listener != null) { String pagePiece = url.toLowerCase().replace(wikiUrl.toLowerCase(), "") .split("/")[0] .split("#")[0]; listener.embeddedWikiLinkClicked(pagePiece); } else { OpenRedditLink.openUrl(getContext(), url, true); } return true; } @Override public void onPageFinished(WebView webView, String url) { super.onPageFinished(webView, url); if (getView() != null) { getView().findViewById(R.id.wiki_web_view).setVisibility(View.VISIBLE); ref.setRefreshing(false); ref.setEnabled(false); } } }); }
Source:
<code>private String formatSpoilers(String html, Matcher matcher) { while (matcher.find()) { <START> String text = matcher.group(); <END> String inner = "<a href=\"/spoiler\">spoiler&lt; [[s[ " + text + "]s]]</a>"; html = html.replace(text, inner); } return html; }</code><technical_language>this .group(1)</technical_language>

Target:
private String formatSpoilers(String html, Matcher matcher) { while (matcher.find()) { String text = matcher.group(1); String inner = "<a href=\"/spoiler\">spoiler&lt; [[s[ " + text + "]s]]</a>"; html = html.replace(text, inner); } return html; }
Source:
<code>public void serialDataReceived(String address, byte[] data) { <START> System.out.println("Data received from " + address + ": " + new String(data)); <END> }</code><technical_language>I expectign get address of sender a string, a 64b address. Also, I expecting app display data in hex ascii format. this... 0013A200:40AA33C6 -> 89 fa 76 43 23 23 43 56 76 54 34 23 23 34 | world! 0013A200:40AA2434 -> bb cc dd ee ff aa 11 22 33 | guys ... output properly tab formated</technical_language>

Target:
public void serialDataReceived(String address, byte[] data) { System.out.format("Data received from %s >> %s | %s%n", address, HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data)), new String(data)); }
Source:
<code><START> public static final byte[] getKeyFingerprintBytes(final PublicKey key) { <END> if (!(key instanceof RSAPublicKey)) { log.error("The key algorithm \"" + key.getAlgorithm() + "\" is not supported, will return null."); return null; } final byte[] keyBytes = getKeyBytes(key); if (keyBytes == null) { return null; } MessageDigest digest = null; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException exception) { log.error("Can't create MD5 digest to compute key fingerprint, will return null.", exception); return null; } return digest.digest(keyBytes); }</code><technical_language>please add some debug messages is relevant methods well</technical_language>

Target:
public static final byte[] getKeyFingerprintBytes(final PublicKey key) { final byte[] keyBytes = getKeyBytes(key); if (keyBytes == null) { log.error("Can't get key bytes, will return null."); return null; } MessageDigest digest = null; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException exception) { log.error("Can't create MD5 digest to compute key fingerprint, will return null.", exception); return null; } final byte[] fingerprintBytes = digest.digest(keyBytes); if (log.isDebugEnabled()) { log.debug("Fingerprint bytes are " + Hex.encodeHexString(fingerprintBytes) + "."); } return fingerprintBytes; }
Source:
<code>public void setEnvironmentMappings( final String environmentMappings ) { this.environmentMappings = environmentMappings; String[] mappings = environmentMappings == null ? new String[0] : environmentMappings.split( "\\s*,\\s*" ); envars = new HashMap<>(); Stream.of(mappings).forEach( kv ->{ String[] keyAlias = kv.split( "\\s*=\\s*" ); if ( keyAlias.length > 1 ) { String value = System.getenv( keyAlias[0].trim() ); <START> if ( value == null ) <END> { value = "Unknown"; } envars.put( keyAlias[1].trim(), value ); } } ); }</code><technical_language>nitpick. StringUtils.isEmpty(value)</technical_language>

Target:
public void setEnvironmentMappings( final String environmentMappings ) { this.environmentMappings = environmentMappings; String[] mappings = environmentMappings == null ? new String[0] : environmentMappings.split( "\\s*,\\s*" ); envars = new HashMap<>(); Stream.of(mappings).forEach( kv ->{ String[] keyAlias = kv.split( "\\s*=\\s*" ); if ( keyAlias.length > 1 ) { String value = System.getenv( keyAlias[0].trim() ); if ( StringUtils.isEmpty( value ) ) { value = "Unknown"; } envars.put( keyAlias[1].trim(), value ); } } ); }
Source:
<code>public void loadProjectClassloaderTest() throws Exception { CompilationResponse res = compileProjectInRepo(MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE, MavenCLIArgs.INSTALL); if (!res.isSuccessful()) { TestUtil.writeMavenOutputIntoTargetFolder(tmp, res.getMavenOutput(), "KieClassLoaderProviderTest.loadProjectClassloaderTest"); } assertThat(res.isSuccessful()).isTrue(); List<String> pomList = MavenUtils.searchPoms(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_CLASSLOADER_DIR)); Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(pomList, mavenRepo.toAbsolutePath().toString()); assertThat(clazzLoader).isNotNull(); assertThat(clazzLoader.isPresent()).isTrue(); ClassLoader prjClassloader = clazzLoader.get(); LoadProjectDependencyUtil.loadLoggerFactory(prjClassloader); <START> if (tmpRoot != null) { <END> TestUtil.rm(tmpRoot.toFile()); } }</code><technical_language>in @After</technical_language>

Target:
public void loadProjectClassloaderTest() throws Exception { CompilationResponse res = compileProjectInRepo(MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE, MavenCLIArgs.INSTALL); TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName); assertThat(res.isSuccessful()).isTrue(); List<String> pomList = MavenUtils.searchPoms(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_CLASSLOADER_DIR)); Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(pomList, mavenRepo.toAbsolutePath().toString()); assertThat(clazzLoader).isPresent(); ClassLoader prjClassloader = clazzLoader.get(); LoadProjectDependencyUtil.loadLoggerFactory(prjClassloader); }