auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Integer deserializeValue(Map<String, Object> entry, String curveKey, int conversionRate) { Map<String, Double> parameters = (Map<String, Double>) entry.get(curveKey); if (parameters == null) { return null; } Double average = parameters.get(VdsProperties.HOST_QOS_AVERAGE); return (average == null) ? null : (int) (average / conversionRate); }

Target:
private Integer deserializeValue(Map<String, Object> entry, String curveKey, int conversionRate) { Map<String, Integer> parameters = (Map<String, Integer>) entry.get(curveKey); if (parameters == null) { return null; } Integer average = parameters.get(VdsProperties.HOST_QOS_AVERAGE); return (average == null) ? null : (average / conversionRate); }
Source:
private void finish() { rBuff = null ; nextIdx = -99 ; slot = null ; }

Target:
private void finish() { rBuff = null ; nextIdx = END ; slot = null ; }
Source:
public Page<UserImpl> getAll(int maxItems, long skipCount) throws ServerException { checkArgument(maxItems >= 0, "The number of items to return can't be negative."); checkArgument(skipCount >= 0, "The number of items to skip can't be negative."); if (skipCount > Integer.MAX_VALUE) { throw new IllegalArgumentException("Skip count parameter must not be more than " + Integer.MAX_VALUE); } try { final List<UserImpl> list = managerProvider.get() .createNamedQuery("User.getAll", UserImpl.class) .setMaxResults(maxItems) .setFirstResult((int)skipCount) .getResultList() .stream() .map(JpaUserDao::erasePassword) .collect(toList()); return new Page<>(list, skipCount, maxItems, getTotalCount()); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }

Target:
public Page<UserImpl> getAll(int maxItems, long skipCount) throws ServerException { checkArgument(maxItems >= 0, "The number of items to return can't be negative."); checkArgument(skipCount >= 0 && skipCount <= Integer.MAX_VALUE, "The number of items to skip can't be negative or greater than " + Integer.MAX_VALUE); try { final List<UserImpl> list = managerProvider.get() .createNamedQuery("User.getAll", UserImpl.class) .setMaxResults(maxItems) .setFirstResult((int)skipCount) .getResultList() .stream() .map(JpaUserDao::erasePassword) .collect(toList()); return new Page<>(list, skipCount, maxItems, getTotalCount()); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
private void handleTitle(List<StructuredProperty> titleList, DocumentMetadata.Builder metaBuilder) { 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()); } } if (!metaBuilder.hasTitle()) { for (StructuredProperty titleProp : titleList) { if (fieldApprover.approve(titleProp.getDataInfo())) { metaBuilder.setTitle(titleProp.getValue()); break; } } } } }

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:
protected boolean processUnlockedVendorMaintenanceDocument(StringBuffer documentNumbers, MaintenanceDocument vendorMaintDoc) throws WorkflowException { boolean isValid = true; 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; }

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:
public boolean renderClouds(int cloudTicks, float partialTicks) { net.minecraftforge.client.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); }

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:
protected String registryAuth(AuthConfig authConfig) { try { String json = authConfig == null ? "{}" : new ObjectMapper().writeValueAsString(authConfig); return Base64.encodeBase64String(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }

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:
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()) || possibleJoinNodes.isEmpty()) { return node.withDistributionType(PARTITIONED); } Ordering<PlanNodeWithCost> planNodeOrderings = costComparator.forSession(context.getSession()).onResultOf(PlanNodeWithCost::getCost); return planNodeOrderings.min(possibleJoinNodes).getPlanNode(); }

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:
private void checkIfTypeSupported(Class<?> javaType) { if (javaType != Long.class && 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)); } }

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:
public boolean isConcreteCollection() { return collectionPatterns.isEmpty() && collectionVariables.isEmpty() && collectionFunctions.isEmpty(); }

Target:
public final boolean isConcreteCollection() { return collectionPatterns.isEmpty() && collectionVariables.isEmpty() && collectionFunctions.isEmpty(); }
Source:
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) { throw new IllegalStateException("N or more quantifier is not set!"); } 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); }

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:
public FixedDoubleBreakdownHistogram( 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; }

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:
private void importAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.OPEN | SWT.MULTI); 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(); } } }

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:
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)? 11 : 13; }

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:
public void echo(final String echo) { System.out.println("EchoService: " + echo); 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); } }

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:
private ErrorType getErrorType(@NonNull Context context, @Nullable Throwable caught) { if (caught != null && !is404(context, caught)) { if (context instanceof PageActivity) { return ErrorType.PAGE_OFFLINE; } else { return ErrorType.OFFLINE; } } return ErrorType.GENERIC; }

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:
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, "App Manager"); Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); setResult(RESULT_OK, intent); finish(); }

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:
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()); } 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); }

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:
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.isEmpty() && !entries.elementAt(0).getCommandId().equals(currentCmd))) { return SessionFrame.STATE_COMMAND_ID; } else { return null; } }

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:
public void shouldAssignMoreTasksToClientWithMoreCapacity() { createClient(UUID_2, 2); createClient(UUID_1, 1); 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)); assertThat(followupRebalanceNeeded, is(false)); assertThat(clients.get(UUID_2).assignedTaskCount(), equalTo(8)); assertThat(clients.get(UUID_1).assignedTaskCount(), equalTo(4)); }

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:
protected void updateMetadataDevices() { if (getStorageDomain().getVgMetadataDevice() == null || getStorageDomain().getFirstMetadataDevice() == null) { blockStorageDomainHelper.fillMetadataDevicesInfo(getStorageDomain().getStorageStaticData(), getVds().getStoragePoolId()); storageDomainStaticDao.update(getStorageDomain().getStorageStaticData()); } }

Target:
protected void updateMetadataDevices() { if (getStorageDomain().getVgMetadataDevice() == null || getStorageDomain().getFirstMetadataDevice() == null) { blockStorageDomainHelper.fillMetadataDevicesInfo(getStorageDomain().getStorageStaticData(), getVds().getId()); storageDomainStaticDao.update(getStorageDomain().getStorageStaticData()); } }
Source:
public CommandCallback getCallback() { return Injector.injectMembers(new SerialChildCommandsExecutionCallback()); }

Target:
public CommandCallback getCallback() { return callbackProvider.get(); }
Source:
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); }

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:
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", newProjectPrivate ? "private" : "public") .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(); }

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:
public BrandingManager(final File etcDir) { brandingRootPath = new File(etcDir + BRANDING_PATH); }

Target:
public BrandingManager(final File etcDir) { brandingRootPath = new File(etcDir, BRANDING_PATH); }
Source:
DefaulHttpClientLogger(String filename, int maxHistory, int queueSize, long maxFileSizeInBytes, boolean compressionEnabled) { ContextBase context = new ContextBase(); HttpClientLogLayout httpLogLayout = new HttpClientLogLayout(); recoverTempFiles(filename); RollingFileAppender<HttpRequestEvent> fileAppender = new RollingFileAppender<>(); SizeAndTimeBasedFNATP<HttpRequestEvent> triggeringPolicy = new SizeAndTimeBasedFNATP<>(); TimeBasedRollingPolicy<HttpRequestEvent> rollingPolicy = new TimeBasedRollingPolicy<>(); rollingPolicy.setContext(context); rollingPolicy.setMaxHistory(maxHistory); rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(triggeringPolicy); rollingPolicy.setParent(fileAppender); if (compressionEnabled) { rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log.gz"); } else { rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log"); } triggeringPolicy.setContext(context); triggeringPolicy.setTimeBasedRollingPolicy(rollingPolicy); triggeringPolicy.setMaxFileSize(new FileSize(maxFileSizeInBytes)); fileAppender.setContext(context); fileAppender.setFile(filename); fileAppender.setAppend(true); fileAppender.setBufferSize(BUFFER_SIZE_IN_BYTES); fileAppender.setLayout(httpLogLayout); fileAppender.setRollingPolicy(rollingPolicy); asyncAppender = new AsyncAppenderBase<>(); asyncAppender.setContext(context); asyncAppender.setQueueSize(queueSize); asyncAppender.addAppender(fileAppender); rollingPolicy.start(); triggeringPolicy.start(); fileAppender.start(); asyncAppender.start(); }

Target:
DefaulHttpClientLogger(String filename, int maxHistory, int queueSize, long maxFileSizeInBytes, boolean compressionEnabled) { ContextBase context = new ContextBase(); HttpClientLogLayout httpLogLayout = new HttpClientLogLayout(); recoverTempFiles(filename); RollingFileAppender<HttpRequestEvent> fileAppender = new RollingFileAppender<>(); SizeAndTimeBasedFNATP<HttpRequestEvent> triggeringPolicy = new SizeAndTimeBasedFNATP<>(); TimeBasedRollingPolicy<HttpRequestEvent> rollingPolicy = new TimeBasedRollingPolicy<>(); rollingPolicy.setContext(context); rollingPolicy.setMaxHistory(maxHistory); rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(triggeringPolicy); rollingPolicy.setParent(fileAppender); rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log"); if (compressionEnabled) { rollingPolicy.setFileNamePattern(rollingPolicy.getFileNamePattern() + ".gz"); } triggeringPolicy.setContext(context); triggeringPolicy.setTimeBasedRollingPolicy(rollingPolicy); triggeringPolicy.setMaxFileSize(new FileSize(maxFileSizeInBytes)); fileAppender.setContext(context); fileAppender.setFile(filename); fileAppender.setAppend(true); fileAppender.setBufferSize(BUFFER_SIZE_IN_BYTES); fileAppender.setLayout(httpLogLayout); fileAppender.setRollingPolicy(rollingPolicy); asyncAppender = new AsyncAppenderBase<>(); asyncAppender.setContext(context); asyncAppender.setQueueSize(queueSize); asyncAppender.addAppender(fileAppender); rollingPolicy.start(); triggeringPolicy.start(); fileAppender.start(); asyncAppender.start(); }
Source:
public void run() { if (IGNORE_PATHS.contains(partition.getPath().getName())) { return; } if (!partition.isDir()) { return; } try { copyPartitionContents(); } catch (IOException e) { this.exception = e; } }

Target:
public void run() { try { copyPartitionContents(); } catch (IOException e) { this.exception = e; } }
Source:
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); fs.mkdirs(testPath); avroSchemaFile = createAvroSchemaFile(fs, testPath); initialize(cmRootPath.toString(),externalTableWarehouseRoot.toString(), warehouseRoot.toString(), overridesForHiveConf); }

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:
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) { return HypervisorHeartbeatUpdateJob.from(reporterId); }

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:
public int getTargetTaskThreadPoolSize(String instanceName) { InstanceConfig instanceConfig = _accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName)); if (instanceConfig == null) { throw new IllegalArgumentException( "Failed to find InstanceConfig with provided instance name " + instanceName); } return instanceConfig.getTargetTaskThreadPoolSize(); }

Target:
public int getTargetTaskThreadPoolSize(String instanceName) { InstanceConfig instanceConfig = getInstanceConfig(instanceName); return instanceConfig.getTargetTaskThreadPoolSize(); }
Source:
protected HttpEntity<String> 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)); 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); }

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:
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()) .required("condition").required("onsetDate"); }

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:
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); } 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()); AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr",mac); AuditLogDirector.log(logable, AuditLogType.FAILED_TO_FREE_MAC_ADDRESS); } finally { mLocObj.writeLock().unlock(); } }

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:
private boolean lastNameFilter(Citation citation, String lastName){ boolean keepCitation = true; if (lastName != null && !lastName.isEmpty()){ if (!lastName.toLowerCase().equals(citation.last_name.toLowerCase())){ keepCitation = false; } } return keepCitation; }

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:
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() ); sic.getInstance().getScoreWrapper().setScoreString( bestScore.toString() ); } } }

Target:
private void updateSolverInstance(SolverInstanceContext sic) { synchronized ( sic ) { Score bestScore = sic.getSolver().getBestScore(); sic.getInstance().setScoreWrapper( new ScoreWrapper( bestScore ) ); } }
Source:
public void testGetPropertyValueBeanAndPropertyNameNotNull() throws Exception { Object bean = mock(Object.class); ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); assertTrue(compareValidator.isValid(bean, context)); }

Target:
public void testGetPropertyValueBeanAndPropertyNameNotNull() throws Exception { FooBean foo = new FooBean(); foo.setBar("test"); Object o = ConstraintValidatorsUtils.getPropertyValue(foo, "bar"); assertThat(o, notNullValue()); }
Source:
public String save() { try { metadataPanel.preserveLogical(); metadataPanel.preservePhysical(); structurePanel.preserveLogical(); structurePanel.preservePhysical(); 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; } }

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:
public BasicRegisteredTypeLoadingContext(@Nullable RegisteredTypeLoadingContext source) { if (source==null) return; this.kind = source.getExpectedKind(); this.expectedSuperType = source.getExpectedJavaSuperType(); this.encounteredTypes = source.getAlreadyEncounteredTypes(); this.loader = (BrooklynClassLoadingContext) source.getLoader(); }

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:
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 (Throwable e) { System.err.printf("Warning: %s\n", e.getMessage()); } } return instance; }

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:
public @ResponseBody ProfilesNumberDto getDealsNumber(@RequestParam(value = "searchParam",required = false) String searchParam) { return profileFacade.getProfilesNumber(searchParam); }

Target:
public @ResponseBody Long getDealsNumber(@RequestParam(value = "searchParam",required = false) String searchParam) { return profileFacade.getProfilesNumber(searchParam); }
Source:
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_cover).setVisibility(View.GONE); ref.setRefreshing(false); ref.setEnabled(false); } } }); }

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:
private String formatSpoilers(String html, Matcher matcher) { while (matcher.find()) { String text = matcher.group(); String inner = "<a href=\"/spoiler\">spoiler&lt; [[s[ " + text + "]s]]</a>"; html = html.replace(text, inner); } return html; }

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:
public void serialDataReceived(String address, byte[] data) { System.out.println("Data received from " + address + ": " + new String(data)); }

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:
public static final byte[] getKeyFingerprintBytes(final PublicKey key) { 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); }

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:
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 ( value == null ) { value = "Unknown"; } envars.put( keyAlias[1].trim(), value ); } } ); }

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:
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); if (tmpRoot != null) { TestUtil.rm(tmpRoot.toFile()); } }

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); }