auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (isQuotaValidationNeeded()) { DiskImage oldDiskImage = (DiskImage) oldDisk; DiskImage newDiskImage = (DiskImage) newDisk; QuotaStorageConsumptionParameter consumptionRequest = new QuotaStorageConsumptionParameter( newDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.CONSUME, newDiskImage.getstorage_ids().get(0), (double)newDiskImage.getSizeInGigabytes()); QuotaStorageConsumptionParameter releaseRequest = new QuotaStorageConsumptionParameter( oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getstorage_ids().get(0), (double)oldDiskImage.getSizeInGigabytes()); if (oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId())) { list.add(consumptionRequest); } else { if (!oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId())) { list.add(consumptionRequest); list.add(releaseRequest); } } } return list; }

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (isQuotaValidationNeeded()) { DiskImage oldDiskImage = (DiskImage) oldDisk; DiskImage newDiskImage = (DiskImage) newDisk; QuotaStorageConsumptionParameter consumptionRequest = new QuotaStorageConsumptionParameter( newDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.CONSUME, newDiskImage.getstorage_ids().get(0), (double)newDiskImage.getSizeInGigabytes()); QuotaStorageConsumptionParameter releaseRequest = new QuotaStorageConsumptionParameter( oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getstorage_ids().get(0), (double)oldDiskImage.getSizeInGigabytes()); if (oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId())) { list.add(consumptionRequest); } else if (!oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId())) { list.add(consumptionRequest); list.add(releaseRequest); } } return list; }
Source:
private void addCheckBox(T checkBoxValue) { String checkBoxLabel = renderer.render(checkBoxValue); if (checkBoxLabel == null) { throw new IllegalArgumentException("null value is not permited"); } if (checkBoxes.containsKey(checkBoxValue)) { throw new IllegalArgumentException("Duplicate value: " + checkBoxLabel); } final CheckBox newCheckBox = buildCheckbox(checkBoxValue); checkBoxes.put(checkBoxValue, newCheckBox); }

Target:
private void addCheckBox(T checkBoxValue) { String checkBoxLabel = renderer.render(checkBoxValue); if (checkBoxLabel == null) { throw new IllegalArgumentException("null value is not permited"); } final CheckBox newCheckBox = buildCheckbox(checkBoxValue); checkBoxes.put(checkBoxValue, newCheckBox); }
Source:
public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState( superState ); ss.scale = getScale(); ss.savedCenterX = getScrollX() + getHalfWidth(); ss.savedCenterY = getScrollY() + getHalfHeight(); return ss; }

Target:
public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState( superState ); ss.mScale = getScale(); ss.mSavedCenterX = getScrollX() + getHalfWidth(); ss.mSavedCenterY = getScrollY() + getHalfHeight(); return ss; }
Source:
private IASTTranslationUnit getAST() { if (fTranslationUnit != null) return fTranslationUnit; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IEditorPart editor = page.getActiveEditor(); if (editor == null) return null; IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); ITranslationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); if (unit == null) return null; try { fTranslationUnit = unit.getAST(null, ITranslationUnit.AST_SKIP_ALL_HEADERS); return fTranslationUnit; } catch (CoreException e) { CUIPlugin.log(e); } return null; }

Target:
private IASTTranslationUnit getAST() { if (fTranslationUnit != null) return fTranslationUnit; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IEditorPart editor = page.getActiveEditor(); if (editor == null) return null; IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); ITranslationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); if (unit == null) return null; try { fTranslationUnit = unit.getAST(CCorePlugin.getIndexManager().getIndex(unit.getCProject()), ITranslationUnit.AST_SKIP_ALL_HEADERS); return fTranslationUnit; } catch (CoreException e) { CUIPlugin.log(e); } return null; }
Source:
public Pipe(LogTailer tailer, FileTailerSink sink, FileTailerMetricsProcessor metricsProcessor) { this.logTailer = tailer; this.sink = sink; this.metricsProcessor = metricsProcessor; }

Target:
public Pipe(LogTailer tailer, FileTailerSink sink, FileTailerMetricsProcessor metricsProcessor) { serviceManager = new ServiceManager(Arrays.asList(metricsProcessor, tailer, sink)); }
Source:
public void writeTo(AssetCursor cursor, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { MAPPER.writeValue(entityStream, cursor); }

Target:
public void writeTo(AssetCursor cursor, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { try (AssetCursor cursorToBeClosed = cursor) { MAPPER.writeValue(entityStream, cursorToBeClosed); } }
Source:
public String readFileContent(String filePath, int startFrom, int limit) throws MachineException { if (limit < 0) { throw new MachineException("Impossible to read " + limit + " lines"); } FormattedLineConsumer fileContent = new FormattedLineConsumer(); InstanceProcess process; String command; try { if (startFrom > 0) { command = String.format("sed -n \'%1$2s, %2$2sp\' %3$2s", startFrom, startFrom + limit, filePath); } else { command = "cat " + filePath; } process = createProcess(command); process.start(fileContent); } catch (ConflictException | MachineException e) { throw new MachineException("Impossible to read file content ", e); } String content = fileContent.getText(); if (content.contains("sed: can't read " + filePath + ": No such file or directory") || content.contains("cat: " + filePath + ": No such file or directory")) { throw new MachineException("File with path " + filePath + " not found"); } return content; }

Target:
public String readFileContent(String filePath, int startFrom, int limit) throws MachineException { if (limit <= 0 || startFrom <= 0) { throw new MachineException("Impossible to read file " + limit + " lines from " + startFrom + " line"); } String bashCommand = String.format("sed -n \'%1$2s, %2$2sp\' %3$2s", startFrom, startFrom + limit, filePath); final String[] command = {"/bin/bash", "-c", bashCommand}; ListLineConsumer lines = new ListLineConsumer(); try { Exec exec = docker.createExec(container, false, command); docker.startExec(exec.getId(), new LogMessagePrinter(lines, LogMessage::getContent)); } catch (IOException e) { throw new MachineException(String.format("Error occurs while initializing command %s in docker container %s: %s", Arrays.toString(command), container, e.getLocalizedMessage()), e); } String content = lines.getText(); if (content.contains("sed: can't read " + filePath + ": No such file or directory") || content.contains("cat: " + filePath + ": No such file or directory")) { throw new MachineException("File with path " + filePath + " not found"); } return content; }
Source:
public static Vector3d getAllWeatherZenith(float thetaSunAngle, float turbidity) { float thetaSun = (float) Math.acos(thetaSunAngle); Vector4f cx1 = new Vector4f(0.0f, 0.00209f, -0.00375f, 0.00165f); Vector4f cx2 = new Vector4f(0.00394f, -0.03202f, 0.06377f, -0.02903f); Vector4f cx3 = new Vector4f(0.25886f, 0.06052f, -0.21196f, 0.11693f); Vector4f cy1 = new Vector4f(0.0f, 0.00317f, -0.00610f, 0.00275f); Vector4f cy2 = new Vector4f(0.00516f, -0.04153f, 0.08970f, -0.04214f); Vector4f cy3 = new Vector4f(0.26688f, 0.06670f, -0.26756f, 0.15346f); float t2 = turbidity * turbidity; float chi = (4.0f / 9.0f - turbidity / 120.0f) * ((float) Math.PI - 2.0f * thetaSun); Vector4f theta = new Vector4f(1, thetaSun, thetaSun * thetaSun, thetaSun * thetaSun * thetaSun); float why = (4.0453f * turbidity - 4.9710f) * (float) Math.tan(chi) - 0.2155f * turbidity + 2.4192f; float x = t2 * cx1.dot(theta) + turbidity * cx2.dot(theta) + cx3.dot(theta); float y = t2 * cy1.dot(theta) + turbidity * cy2.dot(theta) + cy3.dot(theta); return new Vector3d(why, x, y); }

Target:
static Vector3f getAllWeatherZenith(float thetaSunAngle, float turbidity) { float thetaSun = (float) Math.acos(thetaSunAngle); Vector4f cx1 = new Vector4f(0.0f, 0.00209f, -0.00375f, 0.00165f); Vector4f cx2 = new Vector4f(0.00394f, -0.03202f, 0.06377f, -0.02903f); Vector4f cx3 = new Vector4f(0.25886f, 0.06052f, -0.21196f, 0.11693f); Vector4f cy1 = new Vector4f(0.0f, 0.00317f, -0.00610f, 0.00275f); Vector4f cy2 = new Vector4f(0.00516f, -0.04153f, 0.08970f, -0.04214f); Vector4f cy3 = new Vector4f(0.26688f, 0.06670f, -0.26756f, 0.15346f); float t2 = turbidity * turbidity; float chi = (4.0f / 9.0f - turbidity / 120.0f) * ((float) Math.PI - 2.0f * thetaSun); Vector4f theta = new Vector4f(1, thetaSun, thetaSun * thetaSun, thetaSun * thetaSun * thetaSun); float why = (4.0453f * turbidity - 4.9710f) * (float) Math.tan(chi) - 0.2155f * turbidity + 2.4192f; float x = t2 * cx1.dot(theta) + turbidity * cx2.dot(theta) + cx3.dot(theta); float y = t2 * cy1.dot(theta) + turbidity * cy2.dot(theta) + cy3.dot(theta); return new Vector3f(why, x, y); }
Source:
public void addPatientUserDoesNotHaveAccess() throws XWikiRestException { WebApplicationException exception = new WebApplicationException(); doReturn(false).when(this.access).hasAccess(eq(Right.EDIT), any(DocumentReference.class), any(EntityReference.class)); try { Response response = this.patientsResource.addPatient(""); } catch (WebApplicationException ex){ exception = ex; } Assert.assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), exception.getResponse().getStatus()); }

Target:
public void addPatientUserDoesNotHaveAccess() { WebApplicationException exception = null; doReturn(false).when(this.access).hasAccess(eq(Right.EDIT), any(DocumentReference.class), any(EntityReference.class)); try { Response response = this.patientsResource.addPatient(""); } catch (WebApplicationException ex){ exception = ex; } Assert.assertNotNull(exception); Assert.assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), exception.getResponse().getStatus()); }
Source:
private void export() { form.disableUI(); terminationFuture.reset(); forms.getSelectedForms() .parallelStream() .peek(FormStatus::clearStatusHistory) .forEach(form -> { String formId = form.getFormDefinition().getFormId(); ExportConfiguration configuration = forms.getConfiguration(formId); if (configuration.resolvePullBefore()) forms.getTransferSettings(formId).ifPresent(sci -> NewTransferAction.transferServerToBriefcase( sci, terminationFuture, Collections.singletonList(form) )); ExportAction.export( (BriefcaseFormDefinition) form.getFormDefinition(), configuration, terminationFuture ); }); form.enableUI(); form.hideExporting(); }

Target:
private void export() { form.disableUI(); terminationFuture.reset(); forms.getSelectedForms() .parallelStream() .peek(FormStatus::clearStatusHistory) .forEach(form -> { String formId = form.getFormDefinition().getFormId(); ExportConfiguration configuration = forms.getConfiguration(formId); if (configuration.resolvePullBefore()) forms.getTransferSettings(formId).ifPresent(sci -> NewTransferAction.transferServerToBriefcase( sci, terminationFuture, Collections.singletonList(form) )); ExportAction.export( (BriefcaseFormDefinition) form.getFormDefinition(), configuration, terminationFuture ); }); form.enableUI(); }
Source:
public UpdateVmCommand(T parameters, CommandContext commandContext) { super(parameters, commandContext); if (getVdsGroup() != null) { setStoragePoolId(getVdsGroup().getStoragePoolId()); } if (isVmExist()) { Version compaVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compaVersion, parameters.getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compaVersion, getVm().getStaticData()); } VmHandler.updateDefaultTimeZone(parameters.getVmStaticData()); VmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getVdsGroup(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); }

Target:
public UpdateVmCommand(T parameters, CommandContext commandContext) { super(parameters, commandContext); if (getVdsGroup() != null) { setStoragePoolId(getVdsGroup().getStoragePoolId()); } if (isVmExist()) { Version compatibilityVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, parameters.getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, getVm().getStaticData()); } VmHandler.updateDefaultTimeZone(parameters.getVmStaticData()); VmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getVdsGroup(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); }
Source:
void destroyLocked() { if (sVerbose) Slog.v(TAG, "destroyLocked()"); final int numSessions = mSessions.size(); final ArraySet<RemoteFillService> remoteFillServices = new ArraySet<>(numSessions); for (int i = 0; i < numSessions; i++) { final RemoteFillService remoteFillService = mSessions.valueAt(i).destroyLocked(); if (remoteFillService != null) { remoteFillServices.add(remoteFillService); } } mSessions.clear(); for (int i = 0; i < remoteFillServices.size(); i++) { remoteFillServices.valueAt(i).destroy(); } sendStateToClients(true); if (mClients != null) { mClients.kill(); } }

Target:
void destroyLocked() { if (sVerbose) Slog.v(TAG, "destroyLocked()"); final int numSessions = mSessions.size(); final ArraySet<RemoteFillService> remoteFillServices = new ArraySet<>(numSessions); for (int i = 0; i < numSessions; i++) { final RemoteFillService remoteFillService = mSessions.valueAt(i).destroyLocked(); if (remoteFillService != null) { remoteFillServices.add(remoteFillService); } } mSessions.clear(); for (int i = 0; i < remoteFillServices.size(); i++) { remoteFillServices.valueAt(i).destroy(); } sendStateToClients(true); if (mClients != null) { mClients.kill(); mClients = null; } }
Source:
public IHost createHost(String hostName, String sysType, String[] configurationIds) throws AssertionFailedError { String profileName = getSystemProfileName(); IRSESystemType systemType = findSystemType(sysType); ArrayList<ISubSystemConfigurator> configuratorList = new ArrayList<ISubSystemConfigurator>(); for( int i = 0; i < configurationIds.length; i++ ) { configuratorList.add(createSubsystemConfigurator(configurationIds[i])); } ISubSystemConfigurator[] configurators = (ISubSystemConfigurator[]) configuratorList .toArray(new ISubSystemConfigurator[configuratorList.size()]); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); try { IHost host = sr.createHost(profileName, systemType, hostName, hostName, "test host", "", 0, configurators); return host; } catch(Exception e) { fail(e.getMessage()); } return null; }

Target:
public IHost createHost(String hostName, String sysType, String[] configurationIds) throws AssertionFailedError { String profileName = getOrCreateSystemProfileName(); IRSESystemType systemType = findSystemType(sysType); assertNotNull("System type not found: " + sysType); ArrayList<ISubSystemConfigurator> configuratorList = new ArrayList<ISubSystemConfigurator>(); for( int i = 0; i < configurationIds.length; i++ ) { configuratorList.add(createSubsystemConfigurator(configurationIds[i])); } ISubSystemConfigurator[] configurators = (ISubSystemConfigurator[]) configuratorList .toArray(new ISubSystemConfigurator[configuratorList.size()]); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); try { IHost host = sr.createHost(profileName, systemType, hostName, hostName, "test host", "", 0, configurators); return host; } catch(Exception e) { fail("Failed to create host: " + e.getMessage()); } return null; }
Source:
public String getType() { return type; }

Target:
private String getType() { return type; }
Source:
public Comparable next() { if (!hasNext()) { return null; } fetchNextIfNeeded(); isNextFetched = false; return next; }

Target:
public Comparable next() { if (!hasNext()) { throw new NoSuchElementException(); } fetchNextIfNeeded(); isNextFetched = false; return next; }
Source:
public boolean apply(Game game, Ability source) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); return activePlayer != null && game.getPlayer(game.getActivePlayerId()).hasOpponent(source.getControllerId(), game) && game.getPhase().getStep().getType().getIndex() < 5; }

Target:
public boolean apply(Game game, Ability source) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); return activePlayer != null && activePlayer.hasOpponent(source.getControllerId(), game) && game.getPhase().getStep().getType().getIndex() < 5; }
Source:
public SolrExplicitDateRange(String description, String startDate, String endDate) throws IOException { this.description = description; Calendar startCal = Calendar.getInstance(); Calendar endCal = Calendar.getInstance(); startCal.setTimeZone(TimeZone.getTimeZone("UTC")); endCal.setTimeZone(TimeZone.getTimeZone("UTC")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US); try { startCal.setTime(simpleDateFormat.parse(startDate)); endCal.setTime(simpleDateFormat.parse(endDate)); } catch (ParseException e) { throw new IOException(e); } this.startDate = startCal; this.endDate = endCal; }

Target:
public SolrExplicitDateRange(String description, String startDate, String endDate) { this.description = description; Calendar startCal = Calendar.getInstance(); Calendar endCal = Calendar.getInstance(); startCal.setTimeZone(TimeZone.getTimeZone("UTC")); endCal.setTimeZone(TimeZone.getTimeZone("UTC")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US); try { startCal.setTime(simpleDateFormat.parse(startDate)); endCal.setTime(simpleDateFormat.parse(endDate)); } catch (ParseException e) { throw new RuntimeException(e); } this.startDate = startCal; this.endDate = endCal; }
Source:
private List<ValidationResult> validateConfig(Xpp3Dom current) { if (current.getChildCount() > 0) { return Arrays.stream(current.getChildren()) .filter(child -> CONFIG_OPTION_TO_VALIDATE.equals(child.getName())) .map(this::validateConfig) .flatMap(Collection::stream) .collect(Collectors.toList()); } if (CONFIG_OPTION_TO_VALIDATE.equals(current.getName())) { List<ValidationResult> results = validateImports(current.getValue()); if (results.isEmpty()) { return Collections.singletonList(new ValidationResult("No Packages Imported", true)); } return results; } else { return Collections.emptyList(); } }

Target:
private List<ValidationResult> validateConfig(Xpp3Dom current) { if (current.getChildCount() > 0) { return Arrays.stream(current.getChildren()) .filter(child -> CONFIG_OPTION_TO_VALIDATE.equals(child.getName())) .map(this::validateConfig) .flatMap(Collection::stream) .collect(Collectors.toList()); } if (!CONFIG_OPTION_TO_VALIDATE.equals(current.getName())) { return Collections.emptyList(); } List<ValidationResult> results = validateImports(current.getValue()); if (results.isEmpty()) { return Collections.singletonList(new ValidationResult("No Packages Imported", true)); } return results; }
Source:
public void testMarkingAcl_emptyAcl_allowConstraintMask() throws Exception { Permissions testPerms = new Permissions(perms); Permissions.Acl acl = testPerms.getMarkingAcl(~VIEW_ACCESS_RIGHTS); assertEquals(ImmutableSet.<String>of(AUTHENTICATED_USERS), acl.getAllowGroups(PermissionSource.MARKING)); assertEquals(ImmutableSet.<String>of(AUTHENTICATED_USERS), acl.getAllowGroups()); assertTrue(acl.getAllowUsers().toString(), acl.getAllowUsers().isEmpty()); assertTrue(acl.getDenyUsers().toString(), acl.getDenyUsers().isEmpty()); assertTrue(acl.getDenyGroups().toString(), acl.getDenyGroups().isEmpty()); }

Target:
public void testMarkingAcl_emptyAcl_allowConstraintMask() throws Exception { Permissions testPerms = new Permissions(new AccessPermissionListMock()); Permissions.Acl acl = testPerms.getMarkingAcl(~VIEW_ACCESS_RIGHTS); assertEquals(ImmutableSet.of(AUTHENTICATED_USERS), acl.getAllowGroups(PermissionSource.MARKING)); assertEquals(ImmutableSet.of(AUTHENTICATED_USERS), acl.getAllowGroups()); assertEquals(ImmutableSet.of(), acl.getAllowUsers()); assertEquals(ImmutableSet.of(), acl.getDenyUsers()); assertEquals(ImmutableSet.of(), acl.getDenyGroups()); }
Source:
protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { if (isSelection || (start == end)) { return null; } TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); final SegmentStoreStatistics entry = module.getTotalStats(); if (entry != null) { List<ITmfTreeViewerEntry> entryList = root.getChildren(); TmfTreeViewerEntry aggregateEntry = new SegmentStoreStatisticsEntry(getTotalLabel(), entry); entryList.add(aggregateEntry); HiddenTreeViewerEntry category = new HiddenTreeViewerEntry(getHiddenTreeLabel()); aggregateEntry.addChild(category); Map<String, SegmentStoreStatistics> perSyscallStats = module.getPerSegmentTypeStats(); if (perSyscallStats != null) { for (Entry<String, SegmentStoreStatistics> statsEntry : perSyscallStats.entrySet()) { category.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue())); } } } return root; }

Target:
protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { if (isSelection || (start == end)) { return null; } TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); final SegmentStoreStatistics entry = module.getTotalStats(); if (entry != null) { List<ITmfTreeViewerEntry> entryList = root.getChildren(); TmfTreeViewerEntry aggregateEntry = new SegmentStoreStatisticsEntry(getTotalLabel(), entry); entryList.add(aggregateEntry); HiddenTreeViewerEntry category = new HiddenTreeViewerEntry(getTypeLabel()); aggregateEntry.addChild(category); Map<String, SegmentStoreStatistics> perSegmentStats = module.getPerSegmentTypeStats(); if (perSegmentStats != null) { for (Entry<String, SegmentStoreStatistics> statsEntry : perSegmentStats.entrySet()) { category.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue())); } } } return root; }
Source:
public static Set<String> getBrokerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) { return getBrokerInstanceConfigsForTenant(instanceConfigs, tenant).stream().map(InstanceConfig::getInstanceName).collect( Collectors.toSet()); }

Target:
public static Set<String> getBrokerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) { return new HashSet<>(getInstancesWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant))); }
Source:
public void accept(Event<T> structuredEvent) { try { T data = structuredEvent.getData(); CDPOperationDetails operation = data.getOperation(); CDPEventDataExtractor<T> extractor = eventDataExtractorMap.get(operation.getEventType().name().toLowerCase() + "CDPEventDataExtractor"); LOGGER.info("Extract audit event as {}", extractor); AuditEvent event = AuditEvent.builder() .withAccountId(operation.getAccountId()) .withActor(ActorCrn.builder().withActorCrn(operation.getUserCrn()).build()) .withEventData(extractor.eventData(data)) .withEventName(extractor.eventName(data)) .withEventSource(extractor.eventSource(data)) .withSourceIp(extractor.sourceIp(data)) .build(); auditClient.createAuditEvent(event); } catch (UnsupportedOperationException e) { LOGGER.debug("Audit log is unnecessary: {}", e.getMessage()); } catch (Exception e) { LOGGER.error("Cannot perform auditing: {}", e.getMessage(), e); } }

Target:
public void accept(Event<T> structuredEvent) { try { T data = structuredEvent.getData(); CDPOperationDetails operation = data.getOperation(); CDPEventDataExtractor<T> extractor = eventDataExtractorMap.get(operation.getEventType().name().toLowerCase() + "CDPEventDataExtractor"); LOGGER.info("Extract audit event as {}", extractor); AuditEvent event = AuditEvent.builder() .withAccountId(operation.getAccountId()) .withActor(ActorCrn.builder().withActorCrn(operation.getUserCrn()).build()) .withEventData(extractor.eventData(data)) .withEventName(extractor.eventName(data)) .withEventSource(extractor.eventSource(data)) .withSourceIp(extractor.sourceIp(data)) .build(); auditClient.createAuditEvent(event); } catch (UnsupportedOperationException e) { LOGGER.debug("Audit log is unnecessary: {}", e.getMessage()); } catch (Exception e) { LOGGER.warn("Cannot perform auditing: {}", e.getMessage(), e); } }
Source:
public String getSingleSlotValue(String customSlotName, IdentifiableType identifiableType) { if (identifiableType != null) { List<SlotType1> slots = identifiableType.getSlot(); for (SlotType1 s : slots) { if (StringUtils.equalsIgnoreCase(customSlotName, s.getName()) && s.getValueList() != null) { ValueListType vlt = s.getValueList(); if ((vlt.getValue() != null) && (!vlt.getValue().isEmpty())){ return vlt.getValue().get(0); } } } } return null; }

Target:
public String getSingleSlotValue(String customSlotName, IdentifiableType identifiableType) { if (identifiableType != null && (identifiableType.getSlot() != null)) { for (SlotType1 s : identifiableType.getSlot()) { if (StringUtils.equalsIgnoreCase(customSlotName, s.getName()) && s.getValueList() != null) { ValueListType vlt = s.getValueList(); if (vlt.getValue() != null && !vlt.getValue().isEmpty()){ return vlt.getValue().get(0); } } } } return null; }
Source:
protected void flushBufferedData() { if (buffer.isEmpty()) { return; } logger.debug("Writing buffered data. Buffer size: {}", buffer.size()); for (;;) { Map<String, Deque<DynamoDBItem<?>>> itemsByTable = readBuffer(); for (Entry<String, Deque<DynamoDBItem<?>>> entry : itemsByTable.entrySet()) { String tableName = entry.getKey(); Deque<DynamoDBItem<?>> batch = entry.getValue(); if (dbConfig.isAutoExpirationEnabled()){ for (DynamoDBItem<?> batchItem: batch){ Instant expiration = batchItem.getTime().toInstant().plus(dbConfig.getAutoExpirationDays(), ChronoUnit.DAYS); batchItem.setExpiration(expiration.getEpochSecond()); } } if (!batch.isEmpty()) { flushBatch(getDBMapper(tableName), batch); } } if (buffer.isEmpty()) { break; } } }

Target:
protected void flushBufferedData() { if (buffer.isEmpty()) { return; } logger.debug("Writing buffered data. Buffer size: {}", buffer.size()); for (;;) { Map<String, Deque<DynamoDBItem<?>>> itemsByTable = readBuffer(); for (Entry<String, Deque<DynamoDBItem<?>>> entry : itemsByTable.entrySet()) { String tableName = entry.getKey(); Deque<DynamoDBItem<?>> batch = entry.getValue(); if (dbConfig.isAutoExpirationEnabled()){ for (DynamoDBItem<?> batchItem: batch){ Instant expiration = batchItem.getTime().toInstant().plus(dbConfig.getAutoExpirationDays(), ChronoUnit.DAYS); batchItem.setExpirationDateEpochSeconds(expiration.getEpochSecond()); } } if (!batch.isEmpty()) { flushBatch(getDBMapper(tableName), batch); } } if (buffer.isEmpty()) { break; } } }
Source:
protected void addContent(HttpContent httpContent) throws RestServiceException { if (!getRestMethod().equals(RestMethod.POST) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { contentLock.lock(); try { if (!isOpen()) { nettyMetrics.requestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else if (writeChannel != null) { writeContent(writeChannel, callbackWrapper, httpContent); } else { requestContents.add(httpContent); ReferenceCountUtil.retain(httpContent); } } finally { contentLock.unlock(); } } }

Target:
protected void addContent(HttpContent httpContent) throws RestServiceException { if (!getRestMethod().equals(RestMethod.POST) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { contentLock.lock(); try { if (!isOpen()) { nettyMetrics.requestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else if (writeChannel != null) { writeContent(writeChannel, callbackWrapper, httpContent); } else { requestContents.add(ReferenceCountUtil.retain(httpContent)); } } finally { contentLock.unlock(); } } }
Source:
public void testNoEnforceValidityErrorsOrWarnings() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), false, false, getAdminConfig()); String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); }

Target:
public void testNoEnforceValidityErrorsOrWarnings() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), false, false, getAdminConfig()); try { String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); } finally { configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); } }
Source:
public <U> TupleDomain<U> transform(Function<T, U> function) { if (!domains.isPresent()) { return TupleDomain.none(); } LinkedHashMap<U, Domain> result = new LinkedHashMap<>(domains.get().size()); for (Map.Entry<T, Domain> entry : domains.get().entrySet()) { U key = function.apply(entry.getKey()); if (key == null) { continue; } Domain previous = result.put(key, entry.getValue()); if (previous != null) { throw new IllegalArgumentException(String.format("Every argument must have a unique mapping. %s maps to %s and %s", entry.getKey(), entry.getValue(), previous)); } } return TupleDomain.withColumnDomains(result); }

Target:
public <U> TupleDomain<U> transform(Function<T, U> function) { if (!domains.isPresent()) { return TupleDomain.none(); } HashMap<U, Domain> result = new LinkedHashMap<>(domains.get().size()); for (Map.Entry<T, Domain> entry : domains.get().entrySet()) { U key = function.apply(entry.getKey()); if (key == null) { continue; } Domain previous = result.put(key, entry.getValue()); if (previous != null) { throw new IllegalArgumentException(String.format("Every argument must have a unique mapping. %s maps to %s and %s", entry.getKey(), entry.getValue(), previous)); } } return TupleDomain.withColumnDomains(result); }
Source:
private String resolvePath() { String result = getResourcePath(); if (SystemUtils.IS_OS_WINDOWS && result.matches("^/[A-Z]:/dev/.*")) { result = result.replaceFirst("^/[A-Z]:", ""); } else if (SystemUtils.IS_OS_WINDOWS && result.startsWith("/")) { result = result.substring(1); } return result; }

Target:
private String resolvePath() { String result = getResourcePath(); if (SystemUtils.IS_OS_WINDOWS && result.startsWith("/")) { result = result.substring(1); } return result; }
Source:
public boolean isOwnedBy(String username) { return getAuthor().getUsername().compareTo(username) == 0; }

Target:
public boolean isOwnedBy(String username) { return getAuthor().getUsername().equals(username); }
Source:
protected void endMoveVmCommand() { incrementDbGeeneration(); endActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }

Target:
protected void endMoveVmCommand() { incrementDbGeneration(); endActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }
Source:
public static void setUp() throws Exception { conf = new HdfsConfiguration(); conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_REPLICATION_CONSIDERLOAD_KEY, false); localFileSys = FileSystem.getLocal(conf); Path workingDir = localFileSys.getWorkingDirectory(); dir = new Path(workingDir, "target/test/data" + "work-dir/decommission"); assertTrue(localFileSys.mkdirs(dir)); excludeFile = new Path(dir, "exclude"); conf.set(DFSConfigKeys.DFS_HOSTS_EXCLUDE, excludeFile.toUri().getPath()); Path includeFile = new Path(dir, "include"); conf.set(DFSConfigKeys.DFS_HOSTS, includeFile.toUri().getPath()); conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY, 4); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY, 1); conf.setLong(DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY, 1); writeConfigFile(localFileSys, excludeFile, null); writeConfigFile(localFileSys, includeFile, null); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes).build(); cluster.waitActive(); fileSys = cluster.getFileSystem(); cluster.getNamesystem().getBlockManager().getDatanodeManager() .setHeartbeatExpireInterval(3000); Logger.getLogger(DecommissionManager.class).setLevel(Level.DEBUG); }

Target:
public void setUp() throws Exception { conf = new HdfsConfiguration(); conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_REPLICATION_CONSIDERLOAD_KEY, false); localFileSys = FileSystem.getLocal(conf); Path workingDir = localFileSys.getWorkingDirectory(); dir = new Path(workingDir, "build/test/data/work-dir/decommission"); assertTrue(localFileSys.mkdirs(dir)); excludeFile = new Path(dir, "exclude"); conf.set(DFSConfigKeys.DFS_HOSTS_EXCLUDE, excludeFile.toUri().getPath()); Path includeFile = new Path(dir, "include"); conf.set(DFSConfigKeys.DFS_HOSTS, includeFile.toUri().getPath()); conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY, 4); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY, 1); conf.setLong(DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY, 1); writeConfigFile(localFileSys, excludeFile, null); writeConfigFile(localFileSys, includeFile, null); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes).build(); cluster.waitActive(); fileSys = cluster.getFileSystem(); cluster.getNamesystem().getBlockManager().getDatanodeManager() .setHeartbeatExpireInterval(3000); Logger.getLogger(DecommissionManager.class).setLevel(Level.DEBUG); }
Source:
public final PartitionMethodDesc getPartitionMethod(final String databaseName, final String tableName) throws UndefinedPartitionMethodException, UndefinedTableException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final GetPartitionMethodResponse response = stub.getPartitionMethodByTableName(null, request); throwsIfThisError(response.getState(), UndefinedPartitionMethodException.class); throwsIfThisError(response.getState(), UndefinedTableException.class); ensureOk(response.getState()); return CatalogUtil.newPartitionMethodDesc(response.getPartition()); } catch (ServiceException e) { throw new RuntimeException(e); } }

Target:
public final PartitionMethodDesc getPartitionMethod(final String databaseName, final String tableName) throws UndefinedPartitionMethodException, UndefinedDatabaseException, UndefinedTableException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final GetPartitionMethodResponse response = stub.getPartitionMethodByTableName(null, request); throwsIfThisError(response.getState(), UndefinedPartitionMethodException.class); throwsIfThisError(response.getState(), UndefinedDatabaseException.class); throwsIfThisError(response.getState(), UndefinedTableException.class); ensureOk(response.getState()); return CatalogUtil.newPartitionMethodDesc(response.getPartition()); } catch (ServiceException e) { throw new RuntimeException(e); } }
Source:
private void start() { if (!control.isDisposed()) { if (control instanceof Text) { ((Text) control).addVerifyListener(this); } else if (control instanceof Combo) { ((Combo) control).addVerifyListener(this); } } }

Target:
private void start() { if (control != null && !control.isDisposed()) { if (control instanceof Text) { ((Text) control).addVerifyListener(this); } else if (control instanceof Combo) { ((Combo) control).addVerifyListener(this); } } }
Source:
public void setVersion(long version) { OsObjectStore.setSchemaVersion(sharedRealm, version); }

Target:
void setVersion(long version) { OsObjectStore.setSchemaVersion(sharedRealm, version); }
Source:
public void processAll() { long timeStart = System.currentTimeMillis(); boolean done = false; while (!done) { done = true; for (int i = 0; i < this.stages.size(); ++i) { GeneratorStage stage = this.stages.get(i); int processed = processStage(stage); totalProcessed += processed; if (processed > 0) { done = false; break; } } } long timeDiff = System.currentTimeMillis() - timeStart; totalTime += timeDiff; this.report(); }

Target:
public void processAll() { boolean done = false; while (!done) { done = true; for (int i = 0; i < this.stages.size(); ++i) { GeneratorStage stage = this.stages.get(i); int processed = processStage(stage); if (processed > 0) { done = false; break; } } } this.ticksSinceReport = REPORT_INTERVAL; this.report(); }
Source:
public BackupMetrics(Registry registry){ validDownloads = registry.counter("priam.download.valid"); invalidDownloads = registry.counter("priam.download.invalid"); validUploads = registry.counter("priam.upload.valid"); invalidUploads = registry.counter("priam.upload.invalid"); backupUploadRateKbps = registry.counter("priam.backup.upload.rate.kbps"); awsSlowDownException = registry.counter("priam.aws.slowDown"); }

Target:
public BackupMetrics(Registry registry) { validDownloads = registry.counter(Metrics.METRIC_PREFIX + "download.valid"); invalidDownloads = registry.counter(Metrics.METRIC_PREFIX + "download.invalid"); validUploads = registry.counter(Metrics.METRIC_PREFIX + "upload.valid"); invalidUploads = registry.counter(Metrics.METRIC_PREFIX + "upload.invalid"); uploadRate = registry.distributionSummary(Metrics.METRIC_PREFIX + "upload.rate"); awsSlowDownException = registry.counter(Metrics.METRIC_PREFIX + "aws.slowDown"); snsNotificationSuccess = registry.counter(Metrics.METRIC_PREFIX + "sns.notification.success"); snsNotificationFailure = registry.counter(Metrics.METRIC_PREFIX + "sns.notification.failure"); }
Source:
private void killSoftly() { try { if (!p.sendCtrlC()) { return; } } catch (WinpException e) { return; } long deadline = System.nanoTime() + softkillWaitSeconds * 1000000000; do { if (!p.isRunning()) { break; } try { Thread.sleep(1000); } catch (InterruptedException e) { } } while (System.nanoTime() < deadline); }

Target:
private void killSoftly() throws InterruptedException { try { if (!p.sendCtrlC()) { return; } } catch (WinpException e) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Failed to send CTRL+C to pid=" + getPid(), e); } return; } long deadline = System.nanoTime() + softKillWaitSeconds * 1000000000; int sleepTime = 10; do { if (!p.isRunning()) { break; } Thread.sleep(sleepTime); sleepTime = Math.min(sleepTime * 2, 1000); } while (System.nanoTime() < deadline); }
Source:
public SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { waitForEnabled(); rightClick(); Rectangle location = widgetBounds(); return NatTableContextMenuFinder.contextMenu(widget, location.x + (location.width / 2), location.y + (location.height / 2)); }

Target:
public SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { waitForEnabled(); Rectangle location = widgetBounds(); return NatTableContextMenuFinder.contextMenu(widget, location.width / 2, location.height / 2); }
Source:
public void clickFanomVideoCard() { fandomVideoCard.click(); }

Target:
public FandomPageObject clickFanomVideoCard() { wait.forElementClickable(fandomVideoCard); fandomVideoCard.click(); return new FandomPageObject(); }
Source:
public void setup() { this.attachmentsRoot = new File(environment.get("attachments.root.fs.path")); }

Target:
public void setup() { this.attachmentsRoot = new File(fsPath); }
Source:
public Enum asJavaEnum() { return enumValue; }

Target:
public Enum<?> asJavaEnum() { return enumValue; }
Source:
private Map<Long, ILogData> waitOrHoleFill(RuntimeLayout runtimeLayout, Map<Long, LogData> readResult, boolean waitForWrite) { Map<Long, ILogData> returnResult = new TreeMap<>(readResult); if (!waitForWrite) { readResult.forEach((address, value) -> { if (value.isEmpty()) { holeFill(runtimeLayout, address); returnResult.put(address, peek(runtimeLayout, address)); } }); return returnResult; } boolean wait = true; for (Map.Entry<Long, LogData> entry : readResult.entrySet()) { long address = entry.getKey(); ILogData value = entry.getValue(); if (value.isEmpty()) { if (wait) { value = read(runtimeLayout, address); wait = false; } else { value = peek(runtimeLayout, address); if (value == null) { holeFill(runtimeLayout, address); value = peek(runtimeLayout, address); } } returnResult.put(address, value); } } return returnResult; }

Target:
private Map<Long, ILogData> waitOrHoleFill(RuntimeLayout runtimeLayout, Map<Long, LogData> readResult, boolean waitForWrite) { Map<Long, ILogData> returnResult = new HashMap<>(readResult); if (!waitForWrite) { readResult.forEach((address, value) -> { if (value.isEmpty()) { holeFill(runtimeLayout, address); returnResult.put(address, peek(runtimeLayout, address)); } }); return returnResult; } boolean wait = true; for (Map.Entry<Long, LogData> entry : readResult.entrySet()) { long address = entry.getKey(); ILogData value = entry.getValue(); if (value.isEmpty()) { if (wait) { value = read(runtimeLayout, address); wait = false; } else { value = peek(runtimeLayout, address); if (value == null) { holeFill(runtimeLayout, address); value = peek(runtimeLayout, address); } } returnResult.put(address, value); } } return returnResult; }
Source:
protected String getAppsDirectory() { if (appsDirectory != null && (appsDirectory.equals("apps") || appsDirectory.equals("dropins"))) return appsDirectory; File srcServerXML = getFileFromConfigDirectory("server.xml", configFile); if (srcServerXML != null && srcServerXML.exists()) { if (isAppConfigInSourceServerXml()) { appsDirectory = "apps"; } else { appsDirectory = "dropins"; } } else { appsDirectory = "dropins"; } return appsDirectory; }

Target:
protected String getAppsDirectory() { if (appsDirectory != null && !appsDirectory.isEmpty()) { if (appsDirectory.equals("dropins") || appsDirectory.equals("apps")) { return appsDirectory; } else { log.warn(MessageFormat.format(messages.getString("warn.invalid.app.directory"), appsDirectory)); } } appsDirectory = "dropins"; File srcServerXML = getFileFromConfigDirectory("server.xml", configFile); if (srcServerXML != null && srcServerXML.exists()) { if (isAnyAppConfiguredInSourceServerXml()) { appsDirectory = "apps"; } } log.info(MessageFormat.format(messages.getString("info.default.app.directory"), appsDirectory)); return appsDirectory; }