auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() == 0) { ExampleItemModel detailItem = dataSource.get(position); ViewHolder viewHolder = (ViewHolder) holder; if (Build.VERSION.SDK_INT >= detailItem.getMinSdkVersion()) { String imageUrl = context.getString(detailItem.getImageUrl()); if (!imageUrl.isEmpty()) { Picasso.with(context) .load(imageUrl) .into(viewHolder.imageView); } else { viewHolder.imageView.setImageDrawable(null); } if (detailItem.getShowNewIcon()) { viewHolder.newIconImageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.new_icon)); } else { viewHolder.newIconImageView.setImageDrawable(null); } viewHolder.titleTextView.setText(context.getString(detailItem.getTitle())); viewHolder.descriptionTextView.setText(context.getString(detailItem.getDescription())); } } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() != 0) { return; } ExampleItemModel detailItem = dataSource.get(position); ViewHolder viewHolder = (ViewHolder) holder; if (Build.VERSION.SDK_INT < detailItem.getMinSdkVersion()) { return; } String imageUrl = context.getString(detailItem.getImageUrl()); if (imageUrl.isEmpty()) { viewHolder.imageView.setImageDrawable(null); } else { Picasso.with(context) .load(imageUrl) .into(viewHolder.imageView); } if (detailItem.getShowNewIcon()) { viewHolder.newIconImageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.new_icon)); } else { viewHolder.newIconImageView.setImageDrawable(null); } viewHolder.titleTextView.setText(context.getString(detailItem.getTitle())); viewHolder.descriptionTextView.setText(context.getString(detailItem.getDescription())); }
Source:
private void initTable(final ApplicationConstants constants, final ApplicationMessages messages) { getTable().enableColumnResizing(); getTable().addColumn(new TextColumnWithTooltip<QuotaStorage>() { @Override public String getValue(QuotaStorage object) { return object.getStorageName() == null || object.getStorageName().equals("") ? constants.utlQuotaAllStoragesQuotaPopup() : object.getStorageName(); } }, constants.nameQuotaStorage(), "400px"); getTable().addColumn(new TextColumnWithEditableTooltip<QuotaStorage>() { @Override public String getValue(QuotaStorage object) { if (object.getStorageSizeGB() == null) { return ""; } else if (object.getStorageSizeGB().equals(QuotaStorage.UNLIMITED)) { return messages.unlimitedStorageConsumption(object.getStorageSizeGBUsage() == 0 ? "0" : diskSizeRenderer.render(object.getStorageSizeGBUsage())); } else { return messages.limitedStorageConsumption(object.getStorageSizeGBUsage() == 0 ? "0" : diskSizeRenderer.render(object.getStorageSizeGBUsage()) ,object.getStorageSizeGB()); } } @Override public TextCellWithEditableTooltip getCell() { TextCellWithEditableTooltip textCellWithEditableTooltip = super.getCell(); textCellWithEditableTooltip.setTooltip(constants.quotaCalculationsMessage()); return textCellWithEditableTooltip; } }, constants.usedStorageTotalQuotaStorage(), "400px"); }

Target:
private void initTable(final ApplicationConstants constants, final ApplicationMessages messages) { getTable().enableColumnResizing(); getTable().addColumn(new TextColumnWithTooltip<QuotaStorage>() { @Override public String getValue(QuotaStorage object) { return object.getStorageName() == null || object.getStorageName().equals("") ? constants.utlQuotaAllStoragesQuotaPopup() : object.getStorageName(); } }, constants.nameQuotaStorage(), "400px"); getTable().addColumn(new TextColumnWithEditableTooltip<QuotaStorage>() { @Override public String getValue(QuotaStorage object) { if (object.getStorageSizeGB() == null) { return ""; } else if (object.getStorageSizeGB().equals(QuotaStorage.UNLIMITED)) { return messages.unlimitedStorageConsumption(object.getStorageSizeGBUsage() == 0 ? "0" : diskSizeRenderer.render(object.getStorageSizeGBUsage())); } else { return messages.limitedStorageConsumption(object.getStorageSizeGBUsage() == 0 ? "0" : diskSizeRenderer.render(object.getStorageSizeGBUsage()) ,object.getStorageSizeGB()); } } @Override public TextCellWithEditableTooltip getCell() { TextCellWithEditableTooltip textCellWithEditableTooltip = super.getCell(); textCellWithEditableTooltip.setTitle(constants.quotaCalculationsMessage()); return textCellWithEditableTooltip; } }, constants.usedStorageTotalQuotaStorage(), "400px"); }
Source:
public void clickOnStackButton() { seleniumWebDriverHelper .waitVisibility(By.xpath(" .click(); }

Target:
public void clickOnStackButton() { seleniumWebDriverHelper.waitAndClick(By.xpath(" }
Source:
public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } XarSecurityRule rhs = (XarSecurityRule) object; return new EqualsBuilder() .appendSuper(super.equals(object)) .append(this.right, rhs.right) .append(this.simple, rhs.simple) .append(this.securityTool, rhs.securityTool) .isEquals(); }

Target:
public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof XarSecurityRule)) { return false; } XarSecurityRule rhs = (XarSecurityRule) object; return new EqualsBuilder() .append(this.right, rhs.right) .append(this.simple, rhs.simple) .isEquals(); }
Source:
public ListenableFuture<List<Pair<DataSegmentChangeRequest, Status>>> processBatch(List<DataSegmentChangeRequest> changeRequests) { boolean isAnyRequestDone = false; Map<DataSegmentChangeRequest, AtomicReference<Status>> statuses = new HashMap<>(changeRequests.size()); for (DataSegmentChangeRequest cr : changeRequests) { AtomicReference<Status> status = processRequest(cr); if (status.get().getState() != Status.STATE.PENDING) { isAnyRequestDone = true; } statuses.put(cr, status); } CustomSettableFuture future = new CustomSettableFuture(waitingFutures, statuses); if (isAnyRequestDone) { future.resolve(); } else { synchronized (waitingFutures) { waitingFutures.add(future); } } return future; }

Target:
public ListenableFuture<List<DataSegmentChangeRequestAndStatus>> processBatch(List<DataSegmentChangeRequest> changeRequests) { boolean isAnyRequestDone = false; Map<DataSegmentChangeRequest, AtomicReference<Status>> statuses = Maps.newHashMapWithExpectedSize(changeRequests.size()); for (DataSegmentChangeRequest cr : changeRequests) { AtomicReference<Status> status = processRequest(cr); if (status.get().getState() != Status.STATE.PENDING) { isAnyRequestDone = true; } statuses.put(cr, status); } CustomSettableFuture future = new CustomSettableFuture(waitingFutures, statuses); if (isAnyRequestDone) { future.resolve(); } else { synchronized (waitingFutures) { waitingFutures.add(future); } } return future; }
Source:
private void removeImageFromDB() { final DiskImage diskImage = getDiskImage(); final List<Snapshot> updatedSnapshots; try { VM vm = getVmForNonShareableDiskImage(diskImage); if (getParameters().isRemoveFromSnapshots() && vm != null) { lockVmSnapshotsWithWait(vm); updatedSnapshots = prepareSnapshotConfigWithoutImage(diskImage.getId()); } else { updatedSnapshots = Collections.emptyList(); } TransactionSupport.executeInScope(TransactionScopeOption.Required, () -> { diskImageDynamicDao.remove(diskImage.getImageId()); Guid imageTemplate = diskImage.getImageTemplateId(); Guid currentGuid = diskImage.getImageId(); while (!currentGuid.equals(imageTemplate) && !currentGuid.equals(Guid.Empty)) { removeChildren(currentGuid); DiskImage image = diskImageDao.getSnapshotById(currentGuid); if (image != null) { removeSnapshot(image); currentGuid = image.getParentId(); } else { currentGuid = Guid.Empty; log.warn( "'image' (snapshot of image '{}') is null, cannot remove it.", diskImage.getImageId()); } } baseDiskDao.remove(diskImage.getId()); vmDeviceDao.remove(new VmDeviceId(diskImage.getId(), null)); updatedSnapshots.forEach(s -> snapshotDao.update(s)); return null; }); } finally { if (getSnapshotsEngineLock() != null) { lockManager.releaseLock(getSnapshotsEngineLock()); } } }

Target:
private void removeImageFromDB() { final DiskImage diskImage = getDiskImage(); final List<Snapshot> updatedSnapshots; try { VM vm = getVmForNonShareableDiskImage(diskImage); if (getParameters().isRemoveFromSnapshots() && vm != null) { lockVmSnapshotsWithWait(vm); updatedSnapshots = prepareSnapshotConfigWithoutImage(diskImage.getId()); } else { updatedSnapshots = Collections.emptyList(); } TransactionSupport.executeInScope(TransactionScopeOption.Required, () -> { diskImageDynamicDao.remove(diskImage.getImageId()); Guid imageTemplate = diskImage.getImageTemplateId(); Guid currentGuid = diskImage.getImageId(); while (!currentGuid.equals(imageTemplate) && !currentGuid.equals(Guid.Empty)) { removeChildren(currentGuid); DiskImage image = diskImageDao.getSnapshotById(currentGuid); if (image != null) { removeSnapshot(image); currentGuid = image.getParentId(); } else { currentGuid = Guid.Empty; log.warn( "'image' (snapshot of image '{}') is null, cannot remove it.", diskImage.getImageId()); } } baseDiskDao.remove(diskImage.getId()); vmDeviceDao.remove(new VmDeviceId(diskImage.getId(), null)); updatedSnapshots.forEach(snapshotDao::update); return null; }); } finally { if (getSnapshotsEngineLock() != null) { lockManager.releaseLock(getSnapshotsEngineLock()); } } }
Source:
public void revertBlock() { PaperLib.getChunkAtAsync(block.getLocation()).thenAccept(result -> this.state.update(true, physicsblocks.contains(this.state.getType())) ); instances.remove(this.block); REVERT_QUEUE.remove(this); if (this.revertTask != null) { this.revertTask.run(); } }

Target:
public void revertBlock() { PaperLib.getChunkAtAsync(block.getLocation()).thenAccept(result -> this.state.update(true, GeneralMethods.isLightEmitting(this.state.getType())) ); instances.remove(this.block); REVERT_QUEUE.remove(this); if (this.revertTask != null) { this.revertTask.run(); } }
Source:
private boolean shouldSynthesizeBrand(BtVodDataRow row) { return canParseBrandFromEpisode(row) || canParseBrandFromSeries(row); }

Target:
private boolean shouldSynthesizeBrand(BtVodDataRow row) { return !isBrand(row) && (canParseBrandFromEpisode(row) || canParseBrandFromSeries(row)); }
Source:
public void arrayEquals(String message, Object expecteds, Object actuals) throws ArrayComparisonFailure { if (expecteds == actuals || Arrays.deepEquals(new Object[] {expecteds}, new Object[] {actuals})) { return; } String header = message == null ? "" : message + ": "; if (expecteds == null) { Assert.fail(header + "expected array was null"); } if (actuals == null) { Assert.fail(header + "actual array was null"); } int actualsLength = Array.getLength(actuals); int expectedsLength = Array.getLength(expecteds); if (actualsLength != expectedsLength) { header = header + "array lengths differed, expected.length=" + expectedsLength + " actual.length=" + actualsLength + "; "; } int prefixLength = Math.min(actualsLength, expectedsLength); for (int i = 0; i < prefixLength; i++) { Object expected = Array.get(expecteds, i); Object actual = Array.get(actuals, i); if (isArray(expected) && isArray(actual)) { try { arrayEquals(message, expected, actual); } catch (ArrayComparisonFailure e) { e.addDimension(i); throw e; } } else { try { assertElementsEqual(expected, actual); } catch (AssertionError e) { throw new ArrayComparisonFailure(header, e, i); } } } if (actualsLength != expectedsLength) { Object expected = getArrayElementOrSentinel(expecteds, expectedsLength, prefixLength); Object actual = getArrayElementOrSentinel(actuals, actualsLength, prefixLength); try { Assert.assertEquals(expected, actual); } catch (AssertionError e) { throw new ArrayComparisonFailure(header, e, prefixLength); } } }

Target:
public void arrayEquals(String message, Object expecteds, Object actuals) throws ArrayComparisonFailure { if (expecteds == actuals || Arrays.deepEquals(new Object[] {expecteds}, new Object[] {actuals})) { return; } String header = message == null ? "" : message + ": "; if (expecteds == null) { Assert.fail(header + "expected array was null"); } if (actuals == null) { Assert.fail(header + "actual array was null"); } int actualsLength = Array.getLength(actuals); int expectedsLength = Array.getLength(expecteds); if (actualsLength != expectedsLength) { header = header + "array lengths differed, expected.length=" + expectedsLength + " actual.length=" + actualsLength + "; "; } int prefixLength = Math.min(actualsLength, expectedsLength); for (int i = 0; i < prefixLength; i++) { Object expected = Array.get(expecteds, i); Object actual = Array.get(actuals, i); if (isArray(expected) && isArray(actual)) { try { arrayEquals(message, expected, actual); } catch (ArrayComparisonFailure e) { e.addDimension(i); throw e; } } else { try { assertElementsEqual(expected, actual); } catch (AssertionError e) { throw new ArrayComparisonFailure(header, e, i); } } } if (actualsLength != expectedsLength) { Object expected = getToStringableArrayElement(expecteds, expectedsLength, prefixLength); Object actual = getToStringableArrayElement(actuals, actualsLength, prefixLength); try { Assert.assertEquals(expected, actual); } catch (AssertionError e) { throw new ArrayComparisonFailure(header, e, prefixLength); } } }
Source:
public static Object valueToLocalDateTime(ValueTimestamp value) throws SQLException { long dateValue = value.getDateValue(); long timeNanos = value.getTimeNanos(); try { Object localDate = localDateFromDateValue(dateValue); Object localDateTime = LOCAL_DATE_AT_START_OF_DAY.invoke(localDate); return LOCAL_DATE_TIME_PLUS_NANOS.invoke(localDateTime, timeNanos); } catch (IllegalAccessException e) { throw DbException.convert(e); } catch (InvocationTargetException e) { throw DbException.convertInvocation(e, "timestampe conversion failed"); } }

Target:
public static Object valueToLocalDateTime(ValueTimestamp value) throws SQLException { long dateValue = value.getDateValue(); long timeNanos = value.getTimeNanos(); try { Object localDate = localDateFromDateValue(dateValue); Object localDateTime = LOCAL_DATE_AT_START_OF_DAY.invoke(localDate); return LOCAL_DATE_TIME_PLUS_NANOS.invoke(localDateTime, timeNanos); } catch (IllegalAccessException e) { throw DbException.convert(e); } catch (InvocationTargetException e) { throw DbException.convertInvocation(e, "timestamp conversion failed"); } }
Source:
public void accept(MessageSendingResult result) { timer.stop(); if (result.succeeded()) { rateLimiter.registerSuccessfulSending(); handleMessageSendingSuccess(message, result); } else { handleFailedSending(message, result); if (!isTtlExceeded(message) && shouldRetrySending(result)) { retrySingleThreadExecutor.schedule(() -> retrySending(result), extractRetryDelay(result), TimeUnit.MILLISECONDS); } else { handleMessageDiscarding(message, result); } } }

Target:
public void accept(MessageSendingResult result) { timer.stop(); if (result.succeeded()) { rateLimiter.registerSuccessfulSending(); handleMessageSendingSuccess(message, result); } else { handleFailedSending(message, result); if (!attemptResending(result)) { handleMessageDiscarding(message, result); } } }
Source:
public void removeEntry(String type, String value) throws Exception { if (type.compareTo("provider") == 0) { for (int i = 0; i < this.providers.size(); ++i) { if (this.providers.get(i).compareTo(value) == 0) { this.removeEntry(i); i--; } } } else if (type.compareTo("client") == 0) { for (int i = 0; i < this.clients.size(); ++i) { if (this.clients.get(i).compareTo(value) == 0) { this.removeEntry(i); i--; } } } else if (type.compareTo("server") == 0) { for (int i = 0; i < this.servers.size(); ++i) { if (this.servers.get(i).compareTo(value) == 0) { this.removeEntry(i); i--; } } } else if (type.compareTo("secret") == 0) { for (int i = 0; i < this.secrets.size(); ++i) { if (this.secrets.get(i).compareTo(value) == 0) { this.removeEntry(i); i--; } } } else if (type.compareTo("ipAddress") == 0) { for (int i = 0; i < this.ipAddresses.size(); ++i) { if (this.ipAddresses.get(i).compareTo(value) == 0) { this.removeEntry(i); i--; } } } else { } writeToFile(); }

Target:
public void removeEntry(String type, String value) throws Exception { if ("provider".equals(type)) { checkAndRemove(this.providers, value); } else if ("client".equals(type)) { checkAndRemove(this.clients, value); } else if ("server".equals(type)) { checkAndRemove(this.servers, value); } else if ("secret".equals(type)) { checkAndRemove(this.secrets, value); } else if ("ipAddress".equals(type)) { checkAndRemove(this.ipAddresses, value); } else { } writeToFile(); }
Source:
public void run(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { if (!input.isEmpty()) { final Schema inputSchema = input.first().getSchema(); final Map<String, Integer> featuresList = SparkUtils.getFeatureList(inputSchema, config.featureFieldsToInclude, config.featureFieldsToExclude, config.labelField); JavaRDD<LabeledPoint> trainingData = input.map(new Function<StructuredRecord, LabeledPoint>() { @Override public LabeledPoint call(StructuredRecord record) throws Exception { List<Double> featureList = new ArrayList<>(); List<Integer> featureIndex = new ArrayList<>(); int counter = 0; for (String field : featuresList.keySet()) { if (record.get(field) != null) { featureList.add(((Number) record.get(field)).doubleValue()); featureIndex.add(counter); } counter++; } Double prediction = record.get(config.labelField); if (prediction == null) { throw new IllegalArgumentException(String.format("Value of Label field %s value must not be null.", config.labelField)); } return new LabeledPoint(prediction, Vectors.sparse(counter, Ints.toArray(featureIndex), Doubles.toArray(featureList))); } }); trainingData.cache(); FileSet outputFS = context.getDataset(config.fileSetName); trainModel(context.getSparkContext().sc(), null, trainingData, outputFS.getBaseLocation().append(config.path).toURI().getPath()); } }

Target:
public void run(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { if (!input.isEmpty()) { final Schema inputSchema = input.first().getSchema(); final Map<String, Integer> featuresList = SparkUtils.getFeatureList(inputSchema, config.featureFieldsToInclude, config.featureFieldsToExclude, config.labelField); JavaRDD<StructuredRecord> filteredData = input.filter(new Function<StructuredRecord, Boolean>() { @Override public Boolean call(StructuredRecord record) throws Exception { if (record.get(config.labelField) == null) { return false; } return true; } }); JavaRDD<LabeledPoint> trainingData = filteredData.map(new Function<StructuredRecord, LabeledPoint>() { @Override public LabeledPoint call(StructuredRecord record) throws Exception { List<Double> featureList = new ArrayList<>(); List<Integer> featureIndex = new ArrayList<>(); int counter = 0; for (String field : featuresList.keySet()) { if (record.get(field) != null) { featureList.add(((Number) record.get(field)).doubleValue()); featureIndex.add(counter); } counter++; } return new LabeledPoint((Double) record.get(config.labelField), Vectors.sparse(counter, Ints.toArray(featureIndex), Doubles.toArray(featureList))); } }); trainingData.cache(); FileSet outputFS = context.getDataset(config.fileSetName); trainModel(context.getSparkContext().sc(), inputSchema, trainingData, outputFS.getBaseLocation().append(config.path).toURI().getPath()); } }
Source:
private boolean checkCanPerformRegularUpdate(List<VM> vmsDiskPluggedTo) { for (VM vm : vmsDiskPluggedTo) { Guid vmId = vm.getId(); if (oldDisk.getDiskInterface() != newDisk.getDiskInterface()) { List<VmNetworkInterface> allVmInterfaces = getVmNetworkInterfaceDao().getAllForVm(vmId); List<Disk> allVmDisks = new LinkedList<Disk>(getOtherVmDisks(vmId)); allVmDisks.add(newDisk); if (!checkPciAndIdeLimit(vm.getNumOfMonitors(), allVmInterfaces, allVmDisks, getReturnValue().getCanDoActionMessages())) { return false; } } } if (newDisk.isBoot()) { if (!isVMsContainingBootableDisks(newDisk, vmsDiskPluggedTo)) { return false; } } return true; }

Target:
private boolean checkCanPerformRegularUpdate(List<VM> vmsDiskPluggedTo) { for (VM vm : vmsDiskPluggedTo) { Guid vmId = vm.getId(); if (oldDisk.getDiskInterface() != newDisk.getDiskInterface()) { List<VmNetworkInterface> allVmInterfaces = getVmNetworkInterfaceDao().getAllForVm(vmId); List<Disk> allVmDisks = new LinkedList<Disk>(getOtherVmDisks(vmId)); allVmDisks.add(newDisk); if (!checkPciAndIdeLimit(vm.getNumOfMonitors(), allVmInterfaces, allVmDisks, getReturnValue().getCanDoActionMessages())) { return false; } } } if (newDisk.isBoot()) { if (!validate(noVmsContainBootableDisks(vmsDiskPluggedTo))) { return false; } } return true; }
Source:
public void gauge(String label, double value, String topic) { String key = label + "_" + topic; if (mGaugeCache.size() <= mConfig.getMicroMeterCacheSize()) { mGaugeCache.put(key, value); } else { LOG.error("Gauge cache size reached maximum, this may result in inaccurate metrics, " + "you can increase cache size by changing " + "\"secor.monitoring.metrics.collector.micrometer.cache.size\" property."); } Metrics.gauge(label, Collections.singletonList( Tag.of("topic", topic)), mGaugeCache, g -> g.get(key)); }

Target:
public void gauge(String label, double value, String topic) { String key = label + "_" + topic; if (!mGaugeCache.containsKey(key) && mGaugeCache.size() >= mConfig.getMicroMeterCacheSize()) { LOG.error("Gauge cache size reached maximum, this may result in inaccurate metrics, " + "you can increase cache size by changing " + "\"secor.monitoring.metrics.collector.micrometer.cache.size\" property."); return; } mGaugeCache.put(key, value); Metrics.gauge(label, Collections.singletonList( Tag.of("topic", topic)), mGaugeCache, g -> g.get(key)); }
Source:
public synchronized void setLastPacketReceivedTimestamp(double currentTimestamp) { connectionLatch.setValue((currentTimestamp - lastPacketReceivedTimestamp) < timeOut.get()); this.lastPacketReceivedTimestamp = currentTimestamp; }

Target:
public void setLastPacketReceivedTimestamp(double currentTimestamp) { if (lastPacketReceivedTimestamp != null) { connectionLatch.setValue((currentTimestamp - lastPacketReceivedTimestamp) < timeOut.get()); } this.lastPacketReceivedTimestamp = currentTimestamp; }
Source:
protected boolean checkNumaValid() { List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); if (vmNumaNodes == null || vmNumaNodes.size() == 0) { return true; } VM vm = getVm(); Guid vdsId = vm.getDedicatedVmForVds(); if (pinHost && vdsId == null) { return failCanDoAction(VdcBllMessages.VM_NUMA_PINNED_VDS_NOT_EXIST); } List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (pinHost) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); if (vdsNumaNodes == null || vdsNumaNodes.size() == 0) { return failCanDoAction(VdcBllMessages.VM_NUMA_PINNED_VDS_NODE_EMPTY); } } boolean memStrict = vm.getNumaTuneMode() == NumaTuneMode.STRICT; for (VmNumaNode vmNumaNode : vmNumaNodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair == null || pair.getSecond() == null || pair.getSecond().getSecond() == null) { return failCanDoAction(VdcBllMessages.VM_NUMA_NODE_PINNED_INDEX_ERROR); } Integer index = pair.getSecond().getSecond(); for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { if (memStrict && vmNumaNode.getMemTotal() > vdsNumaNode.getMemTotal()) { return failCanDoAction(VdcBllMessages.VM_NUMA_NODE_MEMRORY_ERROR); } break; } } } } return true; }

Target:
protected boolean checkNumaValid() { List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); if (vmNumaNodes == null || vmNumaNodes.size() == 0) { return true; } VM vm = getVm(); boolean pinHost = vm.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST; Guid vdsId = vm.getDedicatedVmForVds(); if (pinHost && vdsId == null) { return failCanDoAction(VdcBllMessages.VM_NUMA_PINNED_VDS_NOT_EXIST); } List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (pinHost) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); if (vdsNumaNodes == null || vdsNumaNodes.size() == 0) { return failCanDoAction(VdcBllMessages.VM_NUMA_PINNED_VDS_NODE_EMPTY); } } boolean memStrict = vm.getNumaTuneMode() == NumaTuneMode.STRICT; for (VmNumaNode vmNumaNode : vmNumaNodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair == null || pair.getSecond() == null || pair.getSecond().getSecond() == null) { return failCanDoAction(VdcBllMessages.VM_NUMA_NODE_PINNED_INDEX_ERROR); } Integer index = pair.getSecond().getSecond(); for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { if (memStrict && vmNumaNode.getMemTotal() > vdsNumaNode.getMemTotal()) { return failCanDoAction(VdcBllMessages.VM_NUMA_NODE_MEMRORY_ERROR); } break; } } } } return true; }
Source:
public void testSendFilterAnnotation() throws Exception { AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); AmqpSender sender = session.createSender(getQueueName()); AmqpMessage message = new AmqpMessage(); message.setMessageId("msg" + 1); message.setMessageAnnotation("serialNo", 1); message.setText("Test-Message"); sender.send(message); message = new AmqpMessage(); message.setMessageId("msg" + 2); message.setMessageAnnotation("serialNo", 2); message.setText("Test-Message 2"); sender.send(message); sender.close(); LOG.debug("Attempting to read message with receiver"); AmqpReceiver receiver = session.createReceiver(getQueueName(), "\"m.serialNo\"=2"); receiver.flow(2); AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS); assertNotNull("Should have read message", received); assertEquals("msg2", received.getMessageId()); received.accept(); Assert.assertNull(receiver.receiveNoWait()); receiver.close(); connection.close(); }

Target:
public void testSendFilterAnnotation() throws Exception { AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); AmqpSender sender = session.createSender(getQueueName()); AmqpMessage message = new AmqpMessage(); message.setMessageId("msg" + 1); message.setMessageAnnotation("x-opt-serialNo", 1); message.setText("Test-Message"); sender.send(message); message = new AmqpMessage(); message.setMessageId("msg" + 2); message.setMessageAnnotation("x-opt-serialNo", 2); message.setText("Test-Message 2"); sender.send(message); sender.close(); LOG.debug("Attempting to read message with receiver"); AmqpReceiver receiver = session.createReceiver(getQueueName(), "\"m.x-opt-serialNo\"=2"); receiver.flow(2); AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS); assertNotNull("Should have read message", received); assertEquals("msg2", received.getMessageId()); received.accept(); Assert.assertNull(receiver.receiveNoWait()); receiver.close(); connection.close(); }
Source:
public long appendFrom(ReadableByteChannel channel, long size) throws IOException { logger.trace("Log : currentWriteOffset capacityInBytes sizeToAppend {}", file.getAbsolutePath(), currentWriteOffset, capacityInBytes, size); if (currentWriteOffset.get() + size > capacityInBytes) { metrics.overflowWriteError.inc(1); throw new IllegalArgumentException("Log : " + file.getAbsolutePath() + " error trying to append to log " + "from channel since new data size " + size + "exceeds total log size " + capacityInBytes); } long bytesWritten = 0; while(bytesWritten < size) { bytesWritten += fileChannel.transferFrom(channel, currentWriteOffset.get() + bytesWritten, size - bytesWritten); } if(bytesWritten != size) { throw new IOException("Couldn't read entire bytes. Read only " + bytesWritten +", expected to be read " + size); } currentWriteOffset.addAndGet(bytesWritten); logger.trace("Log : bytes appended to the log from read channel bytesWritten: {}", file.getAbsolutePath(), bytesWritten); return bytesWritten; }

Target:
public void appendFrom(ReadableByteChannel channel, long size) throws IOException { logger.trace("Log : currentWriteOffset capacityInBytes sizeToAppend {}", file.getAbsolutePath(), currentWriteOffset, capacityInBytes, size); if (currentWriteOffset.get() + size > capacityInBytes) { metrics.overflowWriteError.inc(1); throw new IllegalArgumentException("Log : " + file.getAbsolutePath() + " error trying to append to log " + "from channel since new data size " + size + "exceeds total log size " + capacityInBytes); } long bytesWritten = 0; while (bytesWritten < size) { bytesWritten += fileChannel.transferFrom(channel, currentWriteOffset.get() + bytesWritten, size - bytesWritten); } currentWriteOffset.addAndGet(bytesWritten); logger.trace("Log : bytes appended to the log from read channel bytesWritten: {}", file.getAbsolutePath(), bytesWritten); }
Source:
public OrcLocalMemoryContext newOrcLocalMemoryContext(String allocationTag) { return new NoopOrcLocalMemoryContext(); }

Target:
public OrcLocalMemoryContext newOrcLocalMemoryContext(String allocationTag) { return NOOP_ORC_LOCAL_MEMORY_CONTEXT; }
Source:
public void didChange(DidChangeTextDocumentParams params) throws NullPointerException { String uri = params.getTextDocument().getUri(); TextDocumentContentChangeEvent contentChange = params.getContentChanges().get(0); if (contentChange == null) { throw new NullPointerException("Event change param cannot be null"); } String input = params.getContentChanges().get(0).getText(); fFiltersInputs.put(uri, input); try { List<Diagnostic> diagnostics = FilterValidation.validate(input); PublishDiagnosticsParams pd = new PublishDiagnosticsParams(uri, diagnostics); pd.setDiagnostics(diagnostics); LanguageClient client = fLSPServer.getClient(); if (client != null) { client.publishDiagnostics(pd); } } catch (RecognitionException error) { Activator.getInstance().logError(error.getMessage()); } catch (IOException error) { Activator.getInstance().logError(error.getMessage()); } }

Target:
public void didChange(DidChangeTextDocumentParams params) throws NullPointerException { String uri = params.getTextDocument().getUri(); TextDocumentContentChangeEvent contentChange = params.getContentChanges().get(0); if (contentChange == null) { throw new NullPointerException("Event change param cannot be null"); } String input = params.getContentChanges().get(0).getText(); fFiltersInputs.put(uri, input); try { List<Diagnostic> diagnostics = FilterValidation.validate(input); PublishDiagnosticsParams pd = new PublishDiagnosticsParams(uri, diagnostics); pd.setDiagnostics(diagnostics); LanguageClient client = fLSPServer.getClient(); if (client != null) { client.publishDiagnostics(pd); } } catch (RecognitionException | IOException error) { Activator.getInstance().logError(error.getMessage()); } }
Source:
private void updateLocalStorageRef(AgentResponse rsp, LocalStorageHostRefVO ref) { if (ref.getAvailablePhysicalCapacity() == rsp.getAvailableCapacity() && ref.getTotalPhysicalCapacity() == rsp.getTotalCapacity()) { return; } long originalPhysicalTotal = ref.getTotalPhysicalCapacity(); long originalPhysicalAvailable = ref.getAvailablePhysicalCapacity(); ref.setTotalPhysicalCapacity(rsp.getTotalCapacity()); ref.setAvailablePhysicalCapacity(rsp.getAvailableCapacity()); dbf.updateAndRefresh(ref); if (logger.isTraceEnabled()) { logger.trace(String.format("[Local Storage Capacity] changed the physical capacity of the host[uuid:%s] of " + "the local primary storage[uuid:%s] as:\n" + "physical total: %s --> %s\n" + "physical available: %s --> %s\n", ref.getHostUuid(), ref.getPrimaryStorageUuid(), originalPhysicalTotal, ref.getTotalPhysicalCapacity(), originalPhysicalAvailable, ref.getAvailablePhysicalCapacity())); } }

Target:
private void updateLocalStorageRef(AgentResponse rsp, LocalStorageHostRefVO ref) { if (ref.getAvailablePhysicalCapacity() == rsp.getAvailableCapacity() && ref.getTotalPhysicalCapacity() == rsp.getTotalCapacity()) { return; } long originalPhysicalTotal = ref.getTotalPhysicalCapacity(); long originalPhysicalAvailable = ref.getAvailablePhysicalCapacity(); ref.setTotalPhysicalCapacity(rsp.getTotalCapacity()); ref.setAvailablePhysicalCapacity(rsp.getAvailableCapacity()); dbf.getEntityManager().merge(ref); if (logger.isTraceEnabled()) { logger.trace(String.format("[Local Storage Capacity] changed the physical capacity of the host[uuid:%s] of " + "the local primary storage[uuid:%s] as:\n" + "physical total: %s --> %s\n" + "physical available: %s --> %s\n", ref.getHostUuid(), ref.getPrimaryStorageUuid(), originalPhysicalTotal, ref.getTotalPhysicalCapacity(), originalPhysicalAvailable, ref.getAvailablePhysicalCapacity())); } }
Source:
public SpeechletResponse onIntent(final IntentRequest request, final Session session) throws SpeechletException { populateAttributes(session); Intent intent = request.getIntent(); if (HELP.equals(intent.getName())) { PlainTextOutputSpeech out = new PlainTextOutputSpeech(); out.setText("The OneBusAway skill will tell you upcoming transit arrivals " + "at a stop of your choice. You've already configured your region and stop, " + "so just open the skill or ask me for arrivals. " + "You can also ask me to change your city or stop."); return SpeechletResponse.newTellResponse(out); } else if (REPEAT.equals(intent.getName())) { PlainTextOutputSpeech out = new PlainTextOutputSpeech(); out.setText(getCachedResponse(session)); return SpeechletResponse.newTellResponse(out); } else if (SET_CITY.equals(intent.getName())) { return anonSpeechlet.onIntent(request, session); } else if (GET_CITY.equals(intent.getName())) { return getCity(); } else if (SET_STOP_NUMBER.equals(intent.getName()) || YES.equals(intent.getName()) || NO.equals(intent.getName())) { return anonSpeechlet.onIntent(request, session); } else if (GET_STOP_NUMBER.equals(intent.getName())) { return getStopDetails(); } else if (GET_ARRIVALS.equals(intent.getName())) { return tellArrivals(); } else if (STOP.equals(intent.getName())) { return goodbye(); } else { throw new SpeechletException("Did not recognize intent name"); } }

Target:
public SpeechletResponse onIntent(final IntentRequest request, final Session session) throws SpeechletException { populateAttributes(session); Intent intent = request.getIntent(); if (HELP.equals(intent.getName())) { PlainTextOutputSpeech out = new PlainTextOutputSpeech(); out.setText("The OneBusAway skill will tell you upcoming transit arrivals " + "at a stop of your choice. You've already configured your region and stop, " + "so just open the skill or ask me for arrivals. " + "You can also ask me to change your city or stop."); return SpeechletResponse.newTellResponse(out); } else if (REPEAT.equals(intent.getName())) { PlainTextOutputSpeech out = new PlainTextOutputSpeech(); out.setText(getCachedResponse(session)); return SpeechletResponse.newTellResponse(out); } else if (SET_CITY.equals(intent.getName())) { return anonSpeechlet.onIntent(request, session); } else if (GET_CITY.equals(intent.getName())) { return getCity(); } else if (SET_STOP_NUMBER.equals(intent.getName())) { return anonSpeechlet.onIntent(request, session); } else if (YES.equals(intent.getName())) { return anonSpeechlet.onIntent(request, session); } else if (NO.equals(intent.getName())) { return anonSpeechlet.onIntent(request, session); } else if (GET_STOP_NUMBER.equals(intent.getName())) { return getStopDetails(); } else if (GET_ARRIVALS.equals(intent.getName())) { return tellArrivals(); } else if (STOP.equals(intent.getName())) { return goodbye(); } else { throw new SpeechletException("Did not recognize intent name"); } }
Source:
public void testActionBeginOrJoinAndNoTx() throws Exception { MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_BEGIN_OR_JOIN); ExecutionTemplate executionTemplate = createExecutionTemplate(config); config.setFactory(new TestTransactionFactory(mockTransaction)); Object result = executionTemplate.execute(getEmptyTransactionCallback()); assertThat(result, is(RETURN_VALUE)); verify(mockTransaction).commit(); verify(mockTransaction, never()).rollback(); assertThat(TransactionCoordination.getInstance().getTransaction(), IsNull.nullValue()); }

Target:
public void testActionBeginOrJoinAndNoTx() throws Exception { MuleTransactionConfig config = new MuleTransactionConfig(ACTION_BEGIN_OR_JOIN); ExecutionTemplate executionTemplate = createExecutionTemplate(config); config.setFactory(new TestTransactionFactory(mockTransaction)); Object result = executionTemplate.execute(getEmptyTransactionCallback()); assertThat(result, is(RETURN_VALUE)); verify(mockTransaction).commit(); verify(mockTransaction, never()).rollback(); assertThat(getInstance().getTransaction(), nullValue()); }
Source:
protected Validator getValidator(final TaskRepository repository) { return new org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.Validator() { @Override public void run(IProgressMonitor monitor) throws CoreException { RepositoryInfo repositoryInfo = connector.validateRepository(repository, monitor); setStatus(new Status(IStatus.OK, TasksUiPlugin.ID_PLUGIN, "Settings are valid (repository has version " + repositoryInfo.getVersion() + ")")); } }; }

Target:
protected Validator getValidator(final TaskRepository repository) { return new org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.Validator() { @Override public void run(IProgressMonitor monitor) throws CoreException { RepositoryInfo repositoryInfo = connector.validateRepository(repository, monitor); setStatus(new Status(IStatus.OK, TasksUiPlugin.ID_PLUGIN, NLS.bind( Messages.AbstractRepositorySettingsPage_Settings_are_valid_version, repositoryInfo.getVersion()))); } }; }
Source:
public BasicAuthTestResourceConfig() { super(); register(AuthResource.class); }

Target:
public BasicAuthTestResourceConfig() { register(AuthResource.class); }
Source:
protected void reInitializeColumnsWidth() { final List<IAxis> notationColumnsAxisList = tableManager.getTable().getCurrentColumnAxisProvider().getAxis(); final DataLayer tableBodyLayer = tableManager.getBodyLayerStack().getBodyDataLayer(); for (int index = 0; index < notationColumnsAxisList.size(); index++) { final IAxis currentColumnAxis = notationColumnsAxisList.get(index); if (!tableManager.getTable().isInvertAxis()) { final int axisWidth = tableBodyLayer.getColumnWidthByPosition(index); final IntValueStyle value = (IntValueStyle) currentColumnAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.AXIS_WIDTH); if (null != value) { tableBodyLayer.setColumnWidthByPosition(index, value.getIntValue(), false); } else if (axisWidth != DefaultSizeUtils.getDefaultCellWidth()) { tableBodyLayer.setColumnWidthByPosition(index, DefaultSizeUtils.getDefaultCellWidth(), false); } } } }

Target:
protected void reInitializeColumnsWidth() { final List<IAxis> notationAxisList = ((isRowsReordering && !tableManager.getTable().isInvertAxis()) || (!isRowsReordering && tableManager.getTable().isInvertAxis())) ? tableManager.getTable().getCurrentRowAxisProvider().getAxis() : tableManager.getTable().getCurrentColumnAxisProvider().getAxis(); final DataLayer tableBodyLayer = tableManager.getBodyLayerStack().getBodyDataLayer(); for (int index = 0; index < notationAxisList.size(); index++) { final IAxis currentAxis = notationAxisList.get(index); if (!tableManager.getTable().isInvertAxis()) { if (isRowsReordering) { final int axisHeight = tableBodyLayer.getRowHeightByPosition(index); final IntValueStyle value = (IntValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.AXIS_HEIGHT); if (null != value) { tableBodyLayer.setRowHeightByPosition(index, value.getIntValue(), false); } else if (axisHeight != DefaultSizeUtils.getDefaultCellHeight()) { tableBodyLayer.setRowHeightByPosition(index, DefaultSizeUtils.getDefaultCellHeight(), false); } } else { final int axisWidth = tableBodyLayer.getColumnWidthByPosition(index); final IntValueStyle value = (IntValueStyle) currentAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.AXIS_WIDTH); if (null != value) { tableBodyLayer.setColumnWidthByPosition(index, value.getIntValue(), false); } else if (axisWidth != DefaultSizeUtils.getDefaultCellWidth()) { tableBodyLayer.setColumnWidthByPosition(index, DefaultSizeUtils.getDefaultCellWidth(), false); } } } } }
Source:
public void apply() throws ConnectException { try { if (!storage.exists(logFile)) { return; } FileStatus[] statuses = storage.listStatus(logFile); if (statuses.length != 1) { throw new ConnectException("Expected only one WAL file: " + logFile); } if (statuses[0].getLen() == 0) { log.warn("Skip empty WAL file: " + logFile); return; } acquireLease(); if (reader == null) { reader = new WALFile.Reader(conf, Reader.file(new Path(logFile))); } Map<WALEntry, WALEntry> entries = new HashMap<>(); WALEntry key = new WALEntry(); WALEntry value = new WALEntry(); while (reader.next(key, value)) { String keyName = key.getName(); if (keyName.equals(beginMarker)) { entries.clear(); } else if (keyName.equals(endMarker)) { for (Map.Entry<WALEntry, WALEntry> entry: entries.entrySet()) { String tempFile = entry.getKey().getName(); String committedFile = entry.getValue().getName(); if (!storage.exists(committedFile)) { storage.commit(tempFile, committedFile); } } } else { WALEntry mapKey = new WALEntry(key.getName()); WALEntry mapValue = new WALEntry(value.getName()); entries.put(mapKey, mapValue); } } } catch (IOException e) { throw new ConnectException(e); } }

Target:
public void apply() throws ConnectException { try { if (!storage.exists(logFile)) { return; } acquireLease(); FileStatus[] statuses = storage.listStatus(logFile); if (statuses.length != 1) { throw new ConnectException("Expect only one WAL file: " + logFile); } if (statuses[0].getLen() == 0) { log.warn("Skip empty WAL file: " + logFile); return; } if (reader == null) { reader = new WALFile.Reader(conf, Reader.file(new Path(logFile))); } Map<WALEntry, WALEntry> entries = new HashMap<>(); WALEntry key = new WALEntry(); WALEntry value = new WALEntry(); while (reader.next(key, value)) { String keyName = key.getName(); if (keyName.equals(beginMarker)) { entries.clear(); } else if (keyName.equals(endMarker)) { for (Map.Entry<WALEntry, WALEntry> entry: entries.entrySet()) { String tempFile = entry.getKey().getName(); String committedFile = entry.getValue().getName(); if (!storage.exists(committedFile)) { storage.commit(tempFile, committedFile); } } } else { WALEntry mapKey = new WALEntry(key.getName()); WALEntry mapValue = new WALEntry(value.getName()); entries.put(mapKey, mapValue); } } } catch (IOException e) { throw new ConnectException(e); } }
Source:
protected void executeCommand() { List<String> macsToRemove = getVmNicDao().getAllMacsByDataCenter(getStoragePool().getId()); removeNetworks(); List<StorageDomain> storageDomains = getStorageDomainDAO().getAllForStoragePool(getStoragePool().getId()); Collections.sort(storageDomains, new Comparator<StorageDomain>() { @Override public int compare(StorageDomain o1, StorageDomain o2) { return o1.getStorageDomainType().compareTo(o2.getStorageDomainType()); } }); if (storageDomains.size() > 0) { if (!getParameters().getForceDelete() && getAllRunningVdssInPool().size() > 0) { if(!regularRemoveStorageDomains(storageDomains)) { setSucceeded(false); return; } } else if (getParameters().getForceDelete()) { forceRemoveStorageDomains(storageDomains); } else { return; } } removeDataCenter(); getMacPoolForDataCenter().freeMacs(macsToRemove); MacPoolPerDc.getInstance().removePool(getStoragePoolId()); setSucceeded(true); }

Target:
protected void executeCommand() { List<String> macsToRemove = getVmNicDao().getAllMacsByDataCenter(getStoragePool().getId()); removeNetworks(); List<StorageDomain> storageDomains = getStorageDomainDAO().getAllForStoragePool(getStoragePool().getId()); Collections.sort(storageDomains, new Comparator<StorageDomain>() { @Override public int compare(StorageDomain o1, StorageDomain o2) { return o1.getStorageDomainType().compareTo(o2.getStorageDomainType()); } }); if (storageDomains.size() > 0) { if (!getParameters().getForceDelete() && getAllRunningVdssInPool().size() > 0) { if(!regularRemoveStorageDomains(storageDomains)) { setSucceeded(false); return; } } else if (getParameters().getForceDelete()) { forceRemoveStorageDomains(storageDomains); } else { return; } } removeDataCenter(); getMacPool().freeMacs(macsToRemove); setSucceeded(true); }
Source:
private IgniteCheckedException closeEx(boolean cancel, IgniteCheckedException err) throws IgniteCheckedException { if (!closed.compareAndSet(false, true)) return null; busyLock.writeLock(); try { if (log.isDebugEnabled()) log.debug("Closing data streamer [ldr=" + this + ", cancel=" + cancel + ']'); try { if (cancel) { cancelled = true; flushAllThreadsBufs(); for (Buffer buf : bufMappings.values()) buf.cancelAll(err); } else doFlush(); ctx.event().removeLocalEventListener(discoLsnr); ctx.io().removeMessageListener(topic); } catch (IgniteCheckedException | IgniteDataStreamerTimeoutException e) { fut.onDone(e); throw e; } long failed = failCntr.longValue(); if (failed > 0 && err == null) err = new IgniteCheckedException("Some of DataStreamer operations failed [failedCount=" + failed + "]"); fut.onDone(err); return err; } finally { busyLock.writeUnlock(); } }

Target:
private IgniteCheckedException closeEx(boolean cancel, IgniteCheckedException err) throws IgniteCheckedException { if (!closed.compareAndSet(false, true)) return null; busyLock.writeLock(); try { if (log.isDebugEnabled()) log.debug("Closing data streamer [ldr=" + this + ", cancel=" + cancel + ']'); try { if (cancel) { cancelled = true; IgniteCheckedException cancellationErr = err; if (cancellationErr == null) cancellationErr = new IgniteCheckedException("Data streamer has been cancelled: " + DataStreamerImpl.this); for (ThreadBuffer buf : threadBufMap.values()) { GridFutureAdapter internalFut = (GridFutureAdapter)buf.getFut().internalFuture(); internalFut.onDone(cancellationErr); } for (Buffer buf : bufMappings.values()) buf.cancelAll(cancellationErr); } else doFlush(); ctx.event().removeLocalEventListener(discoLsnr); ctx.io().removeMessageListener(topic); } catch (IgniteCheckedException | IgniteDataStreamerTimeoutException e) { fut.onDone(e); throw e; } long failed = failCntr.longValue(); if (failed > 0 && err == null) err = new IgniteCheckedException("Some of DataStreamer operations failed [failedCount=" + failed + "]"); fut.onDone(err); return err; } finally { busyLock.writeUnlock(); } }
Source:
public void testLifeCycleResetOnCopy() throws OperationException { String initialLifeCycleState = source.getCurrentLifeCycleState(); source.followTransition("approve"); source = session.saveDocument(source); txFeature.nextTransaction(); Map<String, Serializable> params = new HashMap<>(); params.put(TARGET_PROPERTY_KEY, COPY_PATH); params.put(NAME_PROPERTY_KEY, COPY_DOC_NAME); params.put(CoreEventConstants.RESET_LIFECYCLE, Boolean.FALSE); context.setInput(source); DocumentModel result = (DocumentModel) service.run(context, CopyDocument.ID, params); txFeature.nextTransaction(); result = session.getDocument(result.getRef()); assertEquals("approved", result.getCurrentLifeCycleState()); params = new HashMap<>(); params.put(TARGET_PROPERTY_KEY, COPY_PATH); params.put(NAME_PROPERTY_KEY, COPY_DOC_NAME); params.put(CoreEventConstants.RESET_LIFECYCLE, Boolean.TRUE); context.setInput(source); result = (DocumentModel) service.run(context, CopyDocument.ID, params); txFeature.nextTransaction(); result = session.getDocument(result.getRef()); assertEquals(initialLifeCycleState, result.getCurrentLifeCycleState()); }

Target:
public void testLifeCycleResetOnCopy() throws OperationException { DocumentModel source = session.createDocumentModel(ROOT, "Source", FILE); source = session.createDocument(source); String initialLifeCycleState = source.getCurrentLifeCycleState(); source.followTransition("approve"); source = session.getDocument(source.getRef()); Map<String, Serializable> params = Map.of(TARGET_PROPERTY_KEY, ROOT, NAME_PROPERTY_KEY, COPY_DOC_NAME); try (OperationContext context = new OperationContext(session)) { context.setInput(source); DocumentModel result = (DocumentModel) automationService.run(context, CopyDocument.ID, params); txFeature.nextTransaction(); result = session.getDocument(result.getRef()); assertEquals("approved", result.getCurrentLifeCycleState()); } params = Map.of(TARGET_PROPERTY_KEY, ROOT, NAME_PROPERTY_KEY, COPY_DOC_NAME, "resetLifeCycle", true); try (OperationContext context = new OperationContext(session)) { context.setInput(source); DocumentModel result = (DocumentModel) automationService.run(context, CopyDocument.ID, params); txFeature.nextTransaction(); result = session.getDocument(result.getRef()); assertEquals(initialLifeCycleState, result.getCurrentLifeCycleState()); } }