auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int appendIndicator(Indicator indicator, boolean paramBoolean) { return 0; }

Target:
public int appendIndicator(Indicator indicator, boolean paramBoolean) { if (paramBoolean) { System.out.println("IndicatorManager.appendIndicator(L...Indicator;Z)I unexpected value"); } return 0; }
Source:
public static void writeOpenTag(final Response response, IValueMap attributes) { response.write(INLINE_OPEN_TAG_START); if (attributes != null) { response.write(" "+attributes.toString()); } response.write(">\n"); }

Target:
public static void writeOpenTag(final Response response, IValueMap attributes) { response.write(INLINE_OPEN_TAG_START); if (attributes != null) { response.write(" " + attributes); } response.write(">\n"); }
Source:
public HudsonModelJob getDownstreamJob(final HudsonModelJob job, final String id, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<HudsonModelJob>(client) { @Override protected HudsonModelJob execute() throws IOException, HudsonException, JAXBException { String jobTreeContent = String.format( "buildable,color,description,displayName,healthReport[score,description],inQueue,name,url"); String tree = String.format("%1$s", jobTreeContent); String url = HudsonUrl.create(getJobUrl(job) + id).tree(tree).toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected HudsonModelJob doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelJob buildPlan = unmarshal(parse(in, response.getRequestPath()), HudsonModelJob.class); return buildPlan; } }.run(); }

Target:
public HudsonModelJob getDownstreamJob(final HudsonModelJob job, final String id, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<HudsonModelJob>(client) { @Override protected HudsonModelJob execute() throws IOException, HudsonException, JAXBException { String tree = "buildable,color,description,displayName,healthReport[score,description],inQueue,name,url"; String url = HudsonUrl.create(getJobUrl(job) + id).tree(tree).toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected HudsonModelJob doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelJob buildPlan = unmarshal(parse(in, response.getRequestPath()), HudsonModelJob.class); return buildPlan; } }.run(); }
Source:
public LocalizationUtils(final String fileName) { log.info("Start initializing {}", getClass().getSimpleName()); messageSource = fileName.endsWith(".properties") ? fileName.substring(0, fileName.lastIndexOf(".properties")) : fileName; resourceBundlesByLocale = new HashMap<>(); getResourceBundle(Locale.getDefault()); log.info("Finished initializing {}", getClass().getSimpleName()); }

Target:
public LocalizationUtils(final String fileName) { log.info("Start initializing {}", getClass().getSimpleName()); messageSource = fileName.replaceAll("\\.properties$", ""); resourceBundlesByLocale = new HashMap<>(); for (Locale locale : Locale.getAvailableLocales()) { getResourceBundle(locale); } log.info("Finished initializing {}", getClass().getSimpleName()); }
Source:
public void testExecuteQueryGetUnregisteredTemplateNotFound() { setUpQueryEntitiesNotFound(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VmTemplate result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(null, result, "Wrong Templates entity in result"); }

Target:
public void testExecuteQueryGetUnregisteredTemplateNotFound() { setUpQueryEntitiesNotFound(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VmTemplate result = getQuery().getQueryReturnValue().getReturnValue(); assertNull(result, "Wrong Templates entity in result"); }
Source:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<>(); if (isDiskImage()) { DiskImage oldDiskImage = (DiskImage) getOldDisk(); DiskImage newDiskImage = (DiskImage) getNewDisk(); boolean emptyOldQuota = oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId()); boolean differentNewQuota = !emptyOldQuota && !oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId()); long diskExtendingDiff = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); if (emptyOldQuota || differentNewQuota ) { list.add(generateQuotaConsumeParameters(newDiskImage, newDiskImage.getSizeInGigabytes())); } else if (diskExtendingDiff != 0) { list.add(generateQuotaConsumeParameters(newDiskImage, diskExtendingDiff)); } if (differentNewQuota) { list.add(new QuotaStorageConsumptionParameter( oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getStorageIds().get(0), (double)oldDiskImage.getSizeInGigabytes())); } } return list; }

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<>(); if (isDiskImage()) { DiskImage oldDiskImage = (DiskImage) getOldDisk(); DiskImage newDiskImage = (DiskImage) getNewDisk(); boolean emptyOldQuota = oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId()); boolean differentNewQuota = !emptyOldQuota && !oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId()); long diskExtendingDiff = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); if (emptyOldQuota || differentNewQuota ) { list.add(generateQuotaConsumeParameters(newDiskImage, newDiskImage.getSizeInGigabytes())); } else if (diskExtendingDiff > 0L) { list.add(generateQuotaConsumeParameters(newDiskImage, diskExtendingDiff)); } if (differentNewQuota) { list.add(new QuotaStorageConsumptionParameter( oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getStorageIds().get(0), (double)oldDiskImage.getSizeInGigabytes())); } } return list; }
Source:
public void fail_when_missing_administer_quality_gate_permission() { OrganizationDto organization = db.organizations().insert(); userSession.addPermission(ADMINISTER_QUALITY_PROFILES, organization); QGateWithOrgDto qualityGate = db.qualityGates().insertQualityGate(organization); expectedException.expect(ForbiddenException.class); QualityGate response = ws.newRequest() .setParam(PARAM_ID, qualityGate.getId().toString()) .setParam(PARAM_NAME, "new-name") .setParam(PARAM_ORGANIZATION, organization.getKey()) .executeProtobuf(QualityGate.class); assertThat(response).isNotNull(); assertThat(response.getId()).isNotEqualTo(qualityGate.getId()); assertThat(response.getName()).isEqualTo("new-name"); }

Target:
public void fail_when_missing_administer_quality_gate_permission() { OrganizationDto organization = db.organizations().insert(); userSession.addPermission(ADMINISTER_QUALITY_PROFILES, organization); QGateWithOrgDto qualityGate = db.qualityGates().insertQualityGate(organization); expectedException.expect(ForbiddenException.class); ws.newRequest() .setParam(PARAM_ID, qualityGate.getId().toString()) .setParam(PARAM_NAME, "new-name") .setParam(PARAM_ORGANIZATION, organization.getKey()) .execute(); }
Source:
public String generateFragment() { if (!DownloadSettings.usePostBack()) { return ""; } if (neverUpdate) return ""; if (doesNotSupportPostMessage()) return ""; StringBuilder buf = new StringBuilder(); if(Jenkins.getInstance().hasPermission(Jenkins.READ)) { long now = System.currentTimeMillis(); for (Downloadable d : Downloadable.all()) { if(d.getDue()<now && d.lastAttempt+10*1000<now) { buf.append("<script>") .append("Behaviour.addLoadEvent(function() {") .append(" downloadService.download(") .append(QuotedStringTokenizer.quote(d.getId())) .append(',') .append(QuotedStringTokenizer.quote(mapHttps(d.getUrl()))) .append(',') .append("{version:"+QuotedStringTokenizer.quote(Jenkins.VERSION)+'}') .append(',') .append(QuotedStringTokenizer.quote(Stapler.getCurrentRequest().getContextPath()+'/'+getUrl()+"/byId/"+d.getId()+"/postBack")) .append(',') .append("null);") .append("});") .append("</script>"); d.lastAttempt = now; } } } return buf.toString(); }

Target:
public String generateFragment() { if (!DownloadSettings.usePostBack()) { return ""; } if (neverUpdate) return ""; if (doesNotSupportPostMessage()) return ""; StringBuilder buf = new StringBuilder(); if(Jenkins.getInstance().hasPermission(Jenkins.READ)) { long now = System.currentTimeMillis(); for (Downloadable d : Downloadable.all()) { if(d.getDue()<now && d.lastAttempt+TimeUnit.SECONDS.toMillis(10)<now) { buf.append("<script>") .append("Behaviour.addLoadEvent(function() {") .append(" downloadService.download(") .append(QuotedStringTokenizer.quote(d.getId())) .append(',') .append(QuotedStringTokenizer.quote(mapHttps(d.getUrl()))) .append(',') .append("{version:"+QuotedStringTokenizer.quote(Jenkins.VERSION)+'}') .append(',') .append(QuotedStringTokenizer.quote(Stapler.getCurrentRequest().getContextPath()+'/'+getUrl()+"/byId/"+d.getId()+"/postBack")) .append(',') .append("null);") .append("});") .append("</script>"); d.lastAttempt = now; } } } return buf.toString(); }
Source:
protected boolean canDoAction() { boolean retValue=true; OVirtNodeInfo[] info = OVirtNodeInfo.get(); if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); retValue = false; } else if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); retValue = false; } else if (isOvirtReInstallOrUpgrade()) { String isoFile = getParameters().getoVirtIsoFile(); if (getVds().getStatus() == VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); retValue = false; } RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); retValue = isIsoFileValid(isoFile, info, ovirtHostOsVersion); } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = true; List<OVirtNodeInfo> info = OVirtNodeInfo.get(); if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); retValue = false; } else if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); retValue = false; } else if (isOvirtReInstallOrUpgrade()) { StringBuilder isoFile = new StringBuilder(getParameters().getoVirtIsoFile()); if (getVds().getStatus() == VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); retValue = false; } VdsValidator.IsoValidStatus isoStat; RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); VdsValidator validator = new VdsValidator(getVds()); isoStat = validator.isIsoFileValid(isoFile, info, ovirtHostOsVersion); switch(isoStat) { case VALID: _isoFullPath = isoFile.toString(); retValue = true; break; case NOTCOMPATIBLE: addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION); addCanDoActionMessage(String.format("$IsoVersion %1$s", ovirtHostOsVersion.getMajor())); retValue = false; break; case MISSINGFILE: addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE); retValue = true; break; } } return retValue; }
Source:
private PDOMFile getBestFile(int linkageID, IIndexFileLocation location, ITranslationUnit tu) throws CoreException { IIndexFile[] files = getFiles(linkageID, location); IIndexFile best = null; int bestScore = -1; for (IIndexFile file : files) { int score = file.getMacros().length * 2; if (TranslationUnit.isSourceFile(TranslationUnit.getParsedInContext(file), tu)) score++; if (score > bestScore) { bestScore = score; best = file; } } return (PDOMFile) best; }

Target:
private PDOMFile getBestFile(int linkageID, IIndexFileLocation location, ITranslationUnit tu) throws CoreException { IIndexFile[] files = getFiles(linkageID, location); IIndexFile best = null; int bestScore = -1; for (IIndexFile file : files) { int score = file.getMacros().length * 2; if (TranslationUnit.isSourceFile(TranslationUnit.getParsedInContext(file), tu.getCProject().getProject())) score++; if (score > bestScore) { bestScore = score; best = file; } } return (PDOMFile) best; }
Source:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } LocalizedMessage that = (LocalizedMessage) o; if ( message != null ? !message.equals( that.message ) : that.message != null ) { return false; } if ( locale != null ? !locale.equals( that.locale ) : that.locale != null ) { return false; } return true; }

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } LocalizedMessage that = (LocalizedMessage) o; if ( !message.equals( that.message ) ) { return false; } if ( !locale.equals( that.locale ) ) { return false; } return true; }
Source:
private void configureImageTable() { if (imageTable.getColumnCount() > NUMBER_OF_VISIBLE_COLUMNS) { TableColumn columnToHide = imageTable.getColumn(imageTableModel.getColumnName(NUMBER_OF_VISIBLE_COLUMNS)); if (columnToHide != null) { imageTable.removeColumn(columnToHide); } imageTable.getRowSorter().addRowSorterListener(new RowSorterListener() { @Override public void sorterChanged(RowSorterEvent e) { imageTableSelect(); } }); imageTable.getRowSorter().toggleSortOrder(COLUMN_TO_SORT_ON_INDEX); imageTable.getRowSorter().toggleSortOrder(COLUMN_TO_SORT_ON_INDEX); } }

Target:
private void configureImageTable() { if (imageTable.getColumnCount() > NUMBER_OF_VISIBLE_COLUMNS) { TableColumn columnToHide = imageTable.getColumn(imageTableModel.getColumnName(NUMBER_OF_VISIBLE_COLUMNS)); if (columnToHide != null) { imageTable.removeColumn(columnToHide); } imageTable.getRowSorter().toggleSortOrder(COLUMN_TO_SORT_ON_INDEX); imageTable.getRowSorter().toggleSortOrder(COLUMN_TO_SORT_ON_INDEX); } }
Source:
public static ScrollBarPolicy getHorizontalBarPolicy(final View view) { final String verticalPolicy = NotationUtils.getStringValue(view, "horizontalScrollBar", null); ScrollBarPolicy scrollBarPolicy = ScrollBarPolicy.NEVER; if (verticalPolicy != null) { if ("always".equals(verticalPolicy)) { scrollBarPolicy = ScrollBarPolicy.ALWAYS; } else if ("asNeeded".equals(verticalPolicy)) { scrollBarPolicy = ScrollBarPolicy.AS_NEEDED; } else if ("never".equals(verticalPolicy)) { scrollBarPolicy = ScrollBarPolicy.NEVER; } } return scrollBarPolicy; }

Target:
public static ScrollBarPolicy getHorizontalBarPolicy(final View view) { final String verticalPolicy = NotationUtils.getStringValue(view, HORIZONTAL_SCROLL_BAR, null); ScrollBarPolicy scrollBarPolicy = ScrollBarPolicy.NEVER; if (verticalPolicy != null) { if (SCROLL_BAR_ALWAYS.equals(verticalPolicy)) { scrollBarPolicy = ScrollBarPolicy.ALWAYS; } else if (SCROLL_BAR_AUTO.equals(verticalPolicy)) { scrollBarPolicy = ScrollBarPolicy.AS_NEEDED; } else if (SCROLL_BAR_NEVER.equals(verticalPolicy)) { scrollBarPolicy = ScrollBarPolicy.NEVER; } } return scrollBarPolicy; }
Source:
public List<InvoiceItem> createExternalCharges(final Iterable<InvoiceItem> externalCharges, @Nullable final LocalDate requestedDate, final Boolean autoPay, final Boolean autoCommit, final String createdBy, final String reason, final String comment) throws KillBillClientException { return createExternalCharges(externalCharges, requestedDate, autoPay, autoCommit, null, null, RequestOptions.builder() .withCreatedBy(createdBy) .withReason(reason) .withComment(comment).build()); }

Target:
public List<InvoiceItem> createExternalCharges(final Iterable<InvoiceItem> externalCharges, @Nullable final LocalDate requestedDate, final Boolean autoPay, final Boolean autoCommit, final String createdBy, final String reason, final String comment) throws KillBillClientException { return createExternalCharges(externalCharges, requestedDate, autoPay, autoCommit, RequestOptions.builder() .withCreatedBy(createdBy) .withReason(reason) .withComment(comment).build()); }
Source:
protected void onDoneImpl(Exception e) { if (e != null) Exceptions.propagateIfFatal(e); List<Exception> allExceptions = Lists.newArrayList(); if (e != null) { allExceptions.add(e); } if (danglingRefFailureMode != RebindFailureMode.CONTINUE) { if (missingEntities.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced entit"+(missingEntities.size() == 1 ? "y" : "ies")+": "+missingEntities)); } if (missingLocations.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced location"+(missingLocations.size() == 1 ? "" : "s")+": "+missingLocations)); } if (missingPolicies.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced policy"+(missingPolicies.size() == 1 ? "" : "s")+": "+missingPolicies)); } if (missingEnrichers.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced enricher"+(missingEnrichers.size() == 1 ? "" : "s")+": "+missingEnrichers)); } } if (rebindFailureMode != RebindFailureMode.CONTINUE) { allExceptions.addAll(exceptions); } if (allExceptions.isEmpty()) { return; } else { CompoundRuntimeException compoundException = new CompoundRuntimeException("Problem"+(allExceptions.size() == 1 ? "" : "s")+" rebinding", allExceptions); LOG.info("RebindManager failed (throwing): "+compoundException.toString()); throw compoundException; } }

Target:
protected void onDoneImpl(Exception e) { if (e != null) Exceptions.propagateIfFatal(e); List<Exception> allExceptions = Lists.newArrayList(); if (e != null) { allExceptions.add(e); } if (danglingRefFailureMode != RebindFailureMode.CONTINUE) { if (missingEntities.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced entit"+(missingEntities.size() == 1 ? "y" : "ies")+": "+missingEntities)); } if (missingLocations.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced location"+(missingLocations.size() == 1 ? "" : "s")+": "+missingLocations)); } if (missingPolicies.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced polic"+(missingPolicies.size() == 1 ? "y" : "ies")+": "+missingPolicies)); } if (missingEnrichers.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced enricher"+(missingEnrichers.size() == 1 ? "" : "s")+": "+missingEnrichers)); } } if (rebindFailureMode != RebindFailureMode.CONTINUE) { allExceptions.addAll(exceptions); } if (allExceptions.isEmpty()) { return; } else { CompoundRuntimeException compoundException = new CompoundRuntimeException("Problem"+(allExceptions.size() == 1 ? "" : "s")+" rebinding", allExceptions); LOG.info("RebindManager failed (throwing): "+compoundException.toString()); throw compoundException; } }
Source:
protected void handleTMasterRegisterRequest( REQID rid, SocketChannel channel, CheckpointManager.RegisterTMasterRequest request ) { LOG.info("Got a register request from TMaster host:port " + channel.socket().getRemoteSocketAddress()); CheckpointManager.RegisterTMasterResponse.Builder responseBuilder = CheckpointManager.RegisterTMasterResponse.newBuilder(); if (!request.getTopologyName().equals(topologyName)) { LOG.severe("The register message was from a different topology: " + request.getTopologyName()); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else if (!request.getTopologyId().equals(topologyId)) { LOG.severe("The register message was from a different topology id: " + request.getTopologyName()); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else if (connection != null) { LOG.warning("We already have an active connection from the tmaster " + "Closing existing connection..."); try { connection.close(); } catch (IOException e) { LOG.warning("Failed to close connection from: " + connection.socket().getRemoteSocketAddress()); } connection = null; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else { connection = channel; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.OK)); } sendResponse(rid, channel, responseBuilder.build()); }

Target:
protected void handleTMasterRegisterRequest( REQID rid, SocketChannel channel, CheckpointManager.RegisterTMasterRequest request ) { LOG.info("Got a TMaster register request from TMaster host:port " + channel.socket().getRemoteSocketAddress()); CheckpointManager.RegisterTMasterResponse.Builder responseBuilder = CheckpointManager.RegisterTMasterResponse.newBuilder(); if (!checkRegistrationValidity(request.getTopologyName(), request.getTopologyId())) { String errorMessage = String.format("The TMaster register message came with a different " + "topologyName: %s and/or topologyId: %s", request.getTopologyName(), request.getTopologyId()); LOG.severe(errorMessage); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK) .setMessage(errorMessage)); } else if (!checkExistingConnection()) { String errorMessage = "Please try again"; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK) .setMessage(errorMessage)); } else { connection = channel; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.OK)); } sendResponse(rid, channel, responseBuilder.build()); }
Source:
public void testEnvironmentVariables() throws Exception { BundleContext bundleContext = CoreTestsActivator.getDefault().getBundleContext(); final String identifier = "getenv"; String filter = '(' + SystemSummaryStreamer.STREAMER_IDENTIFIER + '=' + identifier + ')'; Optional<ServiceReference<SystemSummaryStreamer>> first = bundleContext .getServiceReferences(SystemSummaryStreamer.class, filter).stream().findFirst(); assertTrue(first.isPresent()); ServiceReference<SystemSummaryStreamer> reference = first.get(); assertEquals(identifier, reference.getProperty(SystemSummaryStreamer.STREAMER_IDENTIFIER)); SystemSummaryStreamer service = bundleContext.getService(reference); String collected = service.stream().collect(Collectors.joining("\n")); System.getenv().keySet().forEach(key -> assertTrue(collected.contains(key))); }

Target:
public void testEnvironmentVariables() throws Exception { BundleContext bundleContext = FrameworkUtil.getBundle(AboutTest.class).getBundleContext(); Optional<ServiceReference<ESystemInformationService>> first = bundleContext .getServiceReferences(ESystemInformationService.class, About.createSectionFilter(About.SECTION_ENVIRONMENT)).stream().findFirst(); assertTrue(first.isPresent()); ServiceReference<ESystemInformationService> reference = first.get(); assertEquals(About.SECTION_ENVIRONMENT, reference.getProperty(About.SECTION)); ESystemInformationService service = bundleContext.getService(reference); String collected = service.stream().collect(Collectors.joining("\n")); System.getenv().keySet().forEach(key -> assertTrue(collected.contains(key))); }
Source:
public static ResourcePoolsBuilder newResourcePoolsBuilder(ResourcePools pools) { ResourcePoolsBuilder poolsBuilder = new ResourcePoolsBuilder(); if (pools.getPoolForResource(ResourceType.Core.HEAP) != null) { poolsBuilder = poolsBuilder.heap(pools.getPoolForResource(ResourceType.Core.HEAP).getSize(), pools.getPoolForResource(ResourceType.Core.HEAP).getUnit()); } if (pools.getPoolForResource(ResourceType.Core.OFFHEAP) != null) { poolsBuilder = poolsBuilder.offheap(pools.getPoolForResource(ResourceType.Core.OFFHEAP).getSize(), (MemoryUnit)pools.getPoolForResource(ResourceType.Core.OFFHEAP).getUnit()); } if (pools.getPoolForResource(ResourceType.Core.DISK) != null) { poolsBuilder = poolsBuilder.disk(pools.getPoolForResource(ResourceType.Core.DISK).getSize(), pools.getPoolForResource(ResourceType.Core.DISK).getUnit()); } return poolsBuilder; }

Target:
public static ResourcePoolsBuilder newResourcePoolsBuilder(ResourcePools pools) { ResourcePoolsBuilder poolsBuilder = new ResourcePoolsBuilder(); for (ResourceType currentResourceType : pools.getResourceTypeSet()) { poolsBuilder = poolsBuilder.with(currentResourceType, pools.getPoolForResource(currentResourceType).getSize(), pools.getPoolForResource(currentResourceType).getUnit(), pools.getPoolForResource(currentResourceType).isPersistent()); } return poolsBuilder; }
Source:
public static void resetAllNozzleTips() { for (Head head : Configuration.get().getMachine().getHeads()) { for (Nozzle nozzle : head.getNozzles()) { for (NozzleTip nt : nozzle.getCompatibleNozzleTips()) { if (nt instanceof ReferenceNozzleTip) { ReferenceNozzleTip rnt = (ReferenceNozzleTip)nt; rnt.getCalibration().reset(); } } } } }

Target:
public static void resetAllNozzleTips() { for (NozzleTip nt: Configuration.get().getMachine().getNozzleTips()) { if (nt instanceof ReferenceNozzleTip) { ((ReferenceNozzleTip)nt).getCalibration().resetAll(); } } }
Source:
public List<DispoItem> copyEntireSet(List<DispoItemData> destinationItems, Collection<DispoItem> sourceItems, boolean isCopySet) throws JSONException { List<DispoItem> modifiedItems = new ArrayList<DispoItem>(); HashMap<String, DispoItemData> nameToDestItems = createNameToItemList(destinationItems); for (DispoItem sourceItem : sourceItems) { DispoItemData destItem = nameToDestItems.get(sourceItem.getName()); if (destItem != null) { if (!destItem.getStatus().equals(DispoStrings.Item_Pass)) { DispoItemData newItem = createNewItemWithCopiedAnnotations(destItem, sourceItem, isCopySet); if (newItem != null) { if (destItem.getGuid() == null) { newItem.setGuid(sourceItem.getGuid()); } else { newItem.setGuid(destItem.getGuid()); } modifiedItems.add(newItem); } } else if (destItem.getGuid() == null && !sourceItem.getStatus().equals(DispoStrings.Item_Pass)) { destItem.setGuid(sourceItem.getGuid()); modifiedItems.add(destItem); } } } return modifiedItems; }

Target:
public List<DispoItem> copyEntireSet(List<DispoItemData> destinationItems, Collection<DispoItem> sourceItems, boolean isCopySet) throws JSONException { List<DispoItem> modifiedItems = new ArrayList<DispoItem>(); HashMap<String, DispoItemData> nameToDestItems = createNameToItemList(destinationItems); for (DispoItem sourceItem : sourceItems) { DispoItemData destItem = nameToDestItems.get(sourceItem.getName()); if (destItem != null) { if (!destItem.getStatus().equals(DispoStrings.Item_Pass)) { DispoItemData newItem = createNewItemWithCopiedAnnotations(destItem, sourceItem, isCopySet); if (newItem != null) { if (!Strings.isValid(destItem.getGuid())) { newItem.setGuid(sourceItem.getGuid()); } else { newItem.setGuid(destItem.getGuid()); } modifiedItems.add(newItem); } } else if (destItem.getGuid() == null && !sourceItem.getStatus().equals(DispoStrings.Item_Pass)) { destItem.setGuid(sourceItem.getGuid()); modifiedItems.add(destItem); } } } return modifiedItems; }
Source:
protected void createFieldEditors() { String providerId = ProviderFramework.getHighestProviderId(type); getPreferenceStore().setDefault( ProviderProfileConstants.PREFS_KEY + type, providerId); getPreferenceStore().setDefault(ProviderProfileConstants.PREFS_KEY, providerId); HashMap<String, String> map = ProviderFramework .getProviderNamesForType(type); String[][] providerList = new String[map.size()][2]; int i = 0; for (Entry<String, String> entry : map.entrySet()) { String toolId = entry.getValue(); String toolDescription = getToolInformationFromId(toolId, PROVIDER_ATT_DESC); String toolName = entry.getKey(); if (toolDescription != null && !toolDescription.equals("")) { toolName = toolName + " " + "[" + toolDescription + "]"; } providerList[i][0] = toolName; providerList[i][1] = toolId; i++; } RadioGroupFieldEditor editor = new RadioGroupFieldEditor( ProviderProfileConstants.PREFS_KEY + type, Messages.ProviderPreferencesPage_1, 1, providerList, getFieldEditorParent(), true); editor.setPreferenceStore(getPreferenceStore()); addField(editor); Composite radioBoxControl = editor .getRadioBoxControl(getFieldEditorParent()); Control[] providerOptions = radioBoxControl.getChildren(); for (Control control : providerOptions) { String curProviderId = (String) control.getData(); String toolDescription = getToolInformationFromId(curProviderId, PROVIDER_ATT_INFO); if (toolDescription != null && !toolDescription.equals("")) { control.setToolTipText(toolDescription); } } }

Target:
protected void createFieldEditors() { String providerId = ProviderFramework.getHighestProviderId(type); getPreferenceStore().setDefault( ProviderProfileConstants.PREFS_KEY + type, providerId); HashMap<String, String> map = ProviderFramework .getProviderNamesForType(type); String[][] providerList = new String[map.size()][2]; int i = 0; for (Entry<String, String> entry : map.entrySet()) { String toolId = entry.getValue(); String toolDescription = getToolInformationFromId(toolId, PROVIDER_ATT_DESC); String toolName = entry.getKey(); if (toolDescription != null && !toolDescription.equals("")) { toolName = toolName + " " + "[" + toolDescription + "]"; } providerList[i][0] = toolName; providerList[i][1] = toolId; i++; } RadioGroupFieldEditor editor = new RadioGroupFieldEditor( ProviderProfileConstants.PREFS_KEY + type, Messages.ProviderPreferencesPage_1, 1, providerList, getFieldEditorParent(), true); editor.setPreferenceStore(getPreferenceStore()); addField(editor); Composite radioBoxControl = editor .getRadioBoxControl(getFieldEditorParent()); Control[] providerOptions = radioBoxControl.getChildren(); for (Control control : providerOptions) { String curProviderId = (String) control.getData(); String toolDescription = getToolInformationFromId(curProviderId, PROVIDER_ATT_INFO); if (toolDescription != null && !toolDescription.equals("")) { control.setToolTipText(toolDescription); } } }
Source:
public Response viewDataverse(@PathParam("identifier") String idtf) { return allowCors(response(req -> ok( json(execCommand(new GetDataverseCommand(req, findDataverseOrDie(idtf))), false, settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) )))); }

Target:
public Response viewDataverse(@PathParam("identifier") String idtf) { return allowCors(response(req -> ok( json(execCommand(new GetDataverseCommand(req, findDataverseOrDie(idtf))), settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) )))); }
Source:
public void connect(SocketFactory socket_factory, String host, int port, int timeout) throws IOException { command = command.replace("%h", host); command = command.replace("%p", Integer.toString(port)); List<String> cmd = new ArgumentParser(command).getTokenList(); if (!connection.isOpen()) { try { connection.open(null); } catch (RemoteConnectionException e) { throw new IOException(e); } } IRemoteProcessBuilder pb = connection.getProcessBuilder(cmd); process = pb.start(); long endTime = System.currentTimeMillis() + timeout; while (getInputStream().available() == 0 && !process.isCompleted() && (timeout == 0 || System.currentTimeMillis() < endTime)) { try { Thread.sleep(20); } catch (InterruptedException e) { } } if (getInputStream().available() == 0) { throw new IOException(NLS.bind(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command, new BufferedReader(new InputStreamReader(process.getErrorStream())).readLine())); } errCopyThread = new StreamCopyThread(process.getErrorStream(), System.err); errCopyThread.start(); }

Target:
public void connect(SocketFactory socket_factory, String host, int port, int timeout) throws IOException { if (timeout == 0) { timeout = 10000; } final int waitTime = 50; final int waitSteps = timeout / waitTime; SubMonitor subMon; if (!connection.isOpen()) { subMon = SubMonitor.convert(monitor, waitSteps * 2); try { connection.open(subMon.newChild(waitSteps)); } catch (RemoteConnectionException e) { throw new IOException(e); } } else { subMon = SubMonitor.convert(monitor, waitSteps); } command = command.replace("%h", host); command = command.replace("%p", Integer.toString(port)); List<String> cmd = new ArgumentParser(command).getTokenList(); IRemoteProcessBuilder pb = connection.getProcessBuilder(cmd); process = pb.start(); long endTime = System.currentTimeMillis() + timeout; while (getInputStream().available() == 0 && !process.isCompleted() && System.currentTimeMillis() < endTime) { try { Thread.sleep(waitTime); subMon.worked(1); } catch (InterruptedException e) { } } final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream())); if (getInputStream().available() == 0) { throw new IOException(NLS.bind(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command, bufferedReader.readLine())); } new Thread() { @Override public void run() { final ILog log = Activator.getDefault().getLog(); String line; try { while ((line = bufferedReader.readLine()) != null) { log.log(new Status(IStatus.INFO, Activator.getUniqueIdentifier(), IStatus.OK, line, null)); } } catch (IOException e) { Activator.log(e); } }; }.start(); }
Source:
public String render(Model model, Lookup lookup, RequestLookup requestLookup, API api) { if (isSecured && !api.getSession().isPresent()) { if (requestLookup.tracker().isInPage() || requestLookup.tracker().isInLayout() || requestLookup.tracker().isInFragment()) { return ""; } else { throw new SessionNotFoundException( "Fragment '" + name + "' is secured and required an user session to render."); } } DebugLogger.startFragment(this); requestLookup.tracker().in(this); lookup.getComponent(requestLookup.tracker().getCurrentComponentName()) .map(component -> UriUtils.getPublicUri(component, this)) .ifPresent(requestLookup::pushToPublicUriStack); String output = renderer.render(model, lookup, requestLookup, api); requestLookup.popPublicUriStack(); requestLookup.tracker().out(this); DebugLogger.endFragment(this); return output; }

Target:
public String render(Model model, Lookup lookup, RequestLookup requestLookup, API api) { if (isSecured && !api.getSession().isPresent()) { if (requestLookup.tracker().isInPage() || requestLookup.tracker().isInLayout() || requestLookup.tracker().isInFragment()) { return ""; } else { throw new SessionNotFoundException( "Fragment '" + name + "' is secured and required an user session to render."); } } try { DebugLogger.startFragment(this); requestLookup.tracker().in(this); lookup.getComponent(requestLookup.tracker().getCurrentComponentName()) .map(component -> UriUtils.getPublicUri(component, this)) .ifPresent(requestLookup::pushToPublicUriStack); return renderer.render(model, lookup, requestLookup, api); } finally { requestLookup.popPublicUriStack(); requestLookup.tracker().out(this); DebugLogger.endFragment(this); } }
Source:
public Path readSymbolicLink(final Path link) { checkNotNull("link", link); checkFileNotExistThenThrow(link, true); throw new UnsupportedOperationException(); }

Target:
public Path readSymbolicLink(final Path link) throws UnsupportedOperationException, NotLinkException, IOException, SecurityException { checkNotNull("link", link); checkFileNotExistThenThrow(link, true); throw new UnsupportedOperationException(); }
Source:
public String build() { return String.format("{\"selector\": {%s}}", query.toString()); }

Target:
public String build() { String selectorString = selector.toString(); String fieldsString = this.fields == null ? null : Helpers.quote(this.fields); String sortString = this.sort == null ? null : quoteSort(this.sort); String limitString = this.limit == null ? null : Helpers.quote(this.limit); String skipString = this.skip == null ? null : Helpers.quote(this.skip); StringBuilder builder = new StringBuilder(); builder.append(String.format("\"selector\": {%s}", selectorString)); if (fieldsString != null) { builder.append(String.format(", \"fields\": %s", fieldsString)); } if (sortString != null) { builder.append(String.format(", \"sort\": %s", sortString)); } if (limitString != null) { builder.append(String.format(", \"limit\": %s", limitString)); } if (skipString != null) { builder.append(String.format(", \"skip\": %s", skipString)); } return String.format("{%s}", builder.toString()); }
Source:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); boolean isOpenOrPublishedEmailSentForTheCourse = logic.isOpenOrPublishedEmailSentForTheCourse(courseId); StudentEditDetails dataFormat = new StudentEditDetails(student, isOpenOrPublishedEmailSentForTheCourse); return new JsonResult(dataFormat); }

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } boolean isOpenOrPublishedEmailSentForTheCourse = logic.isOpenOrPublishedEmailSentForTheCourse(courseId); StudentEditDetails dataFormat = new StudentEditDetails(student, isOpenOrPublishedEmailSentForTheCourse); return new JsonResult(dataFormat); }
Source:
public void showDialog(Project project) { this.project = project; checkState(project != null, "Null project occurred"); checkState(project.getLocation().isPrefixOf(appContext.getResource().getLocation()), "Given selected item is not descendant of given project"); service.diff(appContext.getDevMachine(), project.getLocation(), null, NAME_STATUS, false, 0, "HEAD", false) .then(diff -> { if (diff.isEmpty()) { dialogFactory.createMessageDialog(constant.commitTitle(), constant.commitNothingToCommitMessageText(), null).show(); } else { final String[] changedFiles = diff.split("\n"); Map<String, Status> items = new HashMap<>(); for (String item : changedFiles) { items.put(item.substring(2, item.length()), defineStatus(item.substring(0, 1))); } filesToCommit.clear(); allFiles = items.keySet(); view.setEnableCommitButton(!view.getMessage().isEmpty()); view.focusInMessageField(); view.showDialog(); view.checkCheckBoxes(stream(appContext.getResources()).map(resource -> resource.getLocation().removeFirstSegments(1)) .collect(Collectors.toSet())); changedPanelPresenter.show(items, null); } }) .catchError(arg -> { notificationManager.notify(constant.diffFailed(), FAIL, FLOAT_MODE); }); service.branchList(appContext.getDevMachine(), project.getLocation(), LIST_REMOTE) .then(view::setRemoteBranchesList) .catchError(error -> { notificationManager.notify(constant.branchesListFailed(), FAIL, FLOAT_MODE); }); }

Target:
public void showDialog(Project project) { this.project = project; view.setValueToAmendCheckBox(false); view.setValueToPushAfterCommitCheckBox(false); view.setEnableAmendCheckBox(true); view.setEnablePushAfterCommitCheckBox(true); view.setEnableRemoteBranchesDropDownLis(false); service.diff(appContext.getDevMachine(), project.getLocation(), null, NAME_STATUS, false, 0, "HEAD", false) .then(diff -> { service.log(appContext.getDevMachine(), project.getLocation(), null, -1, 1, false) .then(arg -> { if (diff.isEmpty()) { showAskForAmendDialog(); } else { show(diff); } }) .catchError(error -> { if (getErrorCode(error.getCause()) == ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED) { service.getStatus(appContext.getDevMachine(), project.getLocation()).then( status -> { view.setEnableAmendCheckBox(false); view.setEnablePushAfterCommitCheckBox(false); List<String> newFiles = new ArrayList<>(); newFiles.addAll(status.getAdded()); newFiles.addAll(status.getUntracked()); show(newFiles.stream().collect(joining("\nA ", "A ", ""))); }); } }); }) .catchError(arg -> { notificationManager.notify(constant.diffFailed(), FAIL, FLOAT_MODE); }); service.branchList(appContext.getDevMachine(), project.getLocation(), LIST_REMOTE) .then(view::setRemoteBranchesList) .catchError(error -> { notificationManager.notify(constant.branchesListFailed(), FAIL, FLOAT_MODE); }); }
Source:
public ConstantExpression(final int value) { valueType = Type.INT_TYPE; this.value = String.valueOf(value); }

Target:
public ConstantExpression(final int value) { this(Type.INT_TYPE, String.valueOf(value)); }
Source:
public void createTopicWithTitleAndMessage_ShouldPass_JC_13() throws Exception { Users.signUpAndSignIn(); Topic topic = new Topic().withTitle("subject").withBody("message"); Topic createdTopic = Topics.createTopic(topic); Assert.assertTrue(Topics.isCreated(createdTopic)); }

Target:
public void createTopicWithTitleAndMessage_ShouldPass_JC_13() throws Exception { Users.signUpAndSignIn(); Topic topic = new Topic(); Topic createdTopic = Topics.createTopic(topic); Assert.assertTrue(Topics.isCreated(createdTopic)); }
Source:
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { mv.visitMethodInsn(opcode, owner, name, desc); if (constructor) { Type[] types = Type.getArgumentTypes(desc); for (Type type1 : types) { popValue(); if (type1.getSize() == 2) { popValue(); } } switch (opcode) { case INVOKEINTERFACE: case INVOKEVIRTUAL: popValue(); break; case INVOKESPECIAL: Object type = popValue(); if (type == THIS && !superInitialized) { onMethodEnter(); superInitialized = true; constructor = false; } break; } Type returnType = Type.getReturnType(desc); if (returnType != Type.VOID_TYPE) { pushValue(OTHER); if (returnType.getSize() == 2) { pushValue(OTHER); } } } }

Target:
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { mv.visitMethodInsn(opcode, owner, name, desc); if (constructor) { Type[] types = Type.getArgumentTypes(desc); for (Type eachType : types) { popValue(); if (eachType.getSize() == 2) { popValue(); } } switch (opcode) { case INVOKEINTERFACE: case INVOKEVIRTUAL: popValue(); break; case INVOKESPECIAL: Object type = popValue(); if (type == THIS && !superInitialized) { onMethodEnter(); superInitialized = true; constructor = false; } break; } Type returnType = Type.getReturnType(desc); if (returnType != Type.VOID_TYPE) { pushValue(OTHER); if (returnType.getSize() == 2) { pushValue(OTHER); } } } }
Source:
public ExecRow makeRow(boolean latestVersion, TupleDescriptor td, TupleDescriptor parent) throws StandardException { return makeEmptyRow(); }

Target:
public ExecRow makeRow(boolean latestVersion, TupleDescriptor td, TupleDescriptor parent) throws StandardException { if (td != null) { if (!(td instanceof SPSDescriptor)) throw new RuntimeException("Unexpected TupleDescriptor " + td.getClass().getName()); return makeSYSSTATEMENTSrow(latestVersion, (SPSDescriptor) td); } else { return makeEmptyRow(); } }
Source:
public void createIndex(String indexDefinition) { assertNotEmpty(indexDefinition, "indexDefinition"); InputStream putresp = null; URI uri = buildUri(getDBUri()).path("_index").build(); try { putresp = client.executeRequest(createPost(uri, null, "application/json")); String result = getAsString(putresp, "result"); if (result.equalsIgnoreCase("created")) { log.info(String.format("Created Index: '%s'", indexDefinition)); } else { log.warn(String.format("Index already exists : '%s'", indexDefinition)); } } finally { close(putresp); } }

Target:
public void createIndex(String indexDefinition) { assertNotEmpty(indexDefinition, "indexDefinition"); InputStream putresp = null; URI uri = buildUri(getDBUri()).path("_index").build(); try { putresp = client.executeRequest(createPost(uri, indexDefinition, "application/json")); String result = getAsString(putresp, "result"); if (result.equalsIgnoreCase("created")) { log.info(String.format("Created Index: '%s'", indexDefinition)); } else { log.warn(String.format("Index already exists : '%s'", indexDefinition)); } } finally { close(putresp); } }
Source:
public static void refreshEditor(DTreeEditor treeEditor, IStructuredSelection structuredSelection, IProgressMonitor theMonitor) { IProgressMonitor subMonitor = new SubProgressMonitor(theMonitor, 1); IRunnableWithProgress op = getRunnable(treeEditor, structuredSelection); if (op != null) { run(op, treeEditor); } try { subMonitor.worked(1); } finally { subMonitor.done(); } }

Target:
public static void refreshEditor(DTreeEditor treeEditor, IStructuredSelection structuredSelection, IProgressMonitor theMonitor) { theMonitor.beginTask("Refreshing", 1); IProgressMonitor subMonitor = new SubProgressMonitor(theMonitor, 1); IRunnableWithProgress op = getRunnable(treeEditor, structuredSelection); if (op != null) { run(op, treeEditor); } try { subMonitor.worked(1); } finally { subMonitor.done(); } }
Source:
protected FileTailingMessageProducerSupport createInstance() throws Exception { FileTailingMessageProducerSupport adapter; if (this.delay == null && this.end == null && this.reopen == null) { adapter = new OSDelegatingFileTailingMessageProducer(); if (this.nativeOptions != null) { ((OSDelegatingFileTailingMessageProducer) adapter).setOptions(this.nativeOptions); } } else { Assert.isNull(this.nativeOptions, "Cannot have 'delay', 'end' or 'reopen' with a native adapter"); adapter = new ApacheCommonsFileTailingMessageProducer(); if (this.delay != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setPollingDelay(this.delay); } if (this.end != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setEnd(this.end); } if (this.reopen != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setReopen(this.reopen); } } adapter.setFile(this.file); adapter.setTaskExecutor(this.taskExecutor); if (this.taskScheduler != null) { adapter.setTaskScheduler(this.taskScheduler); } if (this.fileDelay != null) { adapter.setTailAttemptsDelay(this.fileDelay); } adapter.setOutputChannel(outputChannel); adapter.setBeanName(this.beanName); if (this.autoStartup != null) { adapter.setAutoStartup(this.autoStartup); } if (this.phase != null) { adapter.setPhase(this.phase); } adapter.afterPropertiesSet(); this.adapter = adapter; return adapter; }

Target:
protected FileTailingMessageProducerSupport createInstance() throws Exception { FileTailingMessageProducerSupport adapter; if (this.delay == null && this.end == null && this.reopen == null) { adapter = new OSDelegatingFileTailingMessageProducer(); if (this.nativeOptions != null) { ((OSDelegatingFileTailingMessageProducer) adapter).setOptions(this.nativeOptions); } } else { if (this.nativeOptions != null && StringUtils.hasText(this.nativeOptions) && logger.isWarnEnabled()) { logger.warn("'native-options' are ignored with an Apache commons-io 'Tailer' adapter"); } adapter = new ApacheCommonsFileTailingMessageProducer(); if (this.delay != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setPollingDelay(this.delay); } if (this.end != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setEnd(this.end); } if (this.reopen != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setReopen(this.reopen); } } adapter.setFile(this.file); adapter.setTaskExecutor(this.taskExecutor); if (this.taskScheduler != null) { adapter.setTaskScheduler(this.taskScheduler); } if (this.fileDelay != null) { adapter.setTailAttemptsDelay(this.fileDelay); } adapter.setOutputChannel(outputChannel); adapter.setBeanName(this.beanName); if (this.autoStartup != null) { adapter.setAutoStartup(this.autoStartup); } if (this.phase != null) { adapter.setPhase(this.phase); } adapter.afterPropertiesSet(); this.adapter = adapter; return adapter; }