auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkListingContainsPath(S3AFileSystem fs, Path filePath) throws IOException { final RemoteIterator<LocatedFileStatus> listIter = fs.listFiles(filePath.getParent(), false); boolean lfsHit = false; while (listIter.hasNext()) { final LocatedFileStatus lfs = listIter.next(); if (lfs.getPath().equals(filePath)) { lfsHit = true; LOG.info("{}; file found in listFiles as expected.", filePath); break; } } assertTrue("The file should be listed in fs.listFiles: ", lfsHit); boolean lsHit = false; final FileStatus[] fileStatuses = fs.listStatus(filePath.getParent()); for (FileStatus fileStatus : fileStatuses) { if (fileStatus.getPath().equals(filePath)) { lsHit = true; LOG.info("{}; file found in listStatus as expected.", filePath); break; } } assertTrue("The file should be listed in fs.listStatus: ", lsHit); }

Target:
private void checkListingContainsPath(S3AFileSystem fs, Path filePath) throws IOException { final RemoteIterator<LocatedFileStatus> listIter = fs.listFiles(filePath.getParent(), false); while (listIter.hasNext()) { final LocatedFileStatus lfs = listIter.next(); assertEquals(filePath, lfs.getPath()); } final FileStatus[] fileStatuses = fs.listStatus(filePath.getParent()); for (FileStatus fileStatus : fileStatuses) { assertEquals("The file should be listed in fs.listStatus", filePath, fileStatus.getPath()); } }
Source:
public void reevaluateAllRequests() { post(() -> { evalRequests(); }); }

Target:
protected void reevaluateAllRequests() { post(() -> { evalRequests(); }); }
Source:
protected Status doProcess() throws EventDeliveryException { long totalEventSent = counterGroup.addAndGet("events.total", lastSent); if ((maxTotalEvents >= 0 && totalEventSent >= maxTotalEvents) || (maxSuccessfulEvents >= 0 && counterGroup.get("events.successful") >= maxSuccessfulEvents)) { return Status.BACKOFF; } try { lastSent = batchSize; if (batchSize == 1) { if (limiter != null) { limiter.acquire(); } getChannelProcessor().processEvent(event); } else { long eventsLeft = maxTotalEvents - totalEventSent; if (maxTotalEvents >= 0 && eventsLeft < batchSize) { eventBatchListToProcess = eventBatchList.subList(0, (int)eventsLeft); } else { eventBatchListToProcess = eventBatchList; } lastSent = eventBatchListToProcess.size(); getChannelProcessor().processEventBatch(eventBatchListToProcess); } counterGroup.addAndGet("events.successful", lastSent); } catch (ChannelException ex) { counterGroup.addAndGet("events.failed", lastSent); return Status.BACKOFF; } return Status.READY; }

Target:
protected Status doProcess() throws EventDeliveryException { long totalEventSent = counterGroup.addAndGet("events.total", lastSent); if ((maxTotalEvents >= 0 && totalEventSent >= maxTotalEvents) || (maxSuccessfulEvents >= 0 && counterGroup.get("events.successful") >= maxSuccessfulEvents)) { return Status.BACKOFF; } try { lastSent = batchSize; if (batchSize == 1) { if (limiter != null) { limiter.acquire(); } getChannelProcessor().processEvent(event); } else { long eventsLeft = maxTotalEvents - totalEventSent; if (maxTotalEvents >= 0 && eventsLeft < batchSize) { eventBatchListToProcess = eventBatchList.subList(0, (int)eventsLeft); } else { eventBatchListToProcess = eventBatchList; } lastSent = eventBatchListToProcess.size(); if (limiter != null) { limiter.acquire((int)lastSent); } getChannelProcessor().processEventBatch(eventBatchListToProcess); } counterGroup.addAndGet("events.successful", lastSent); } catch (ChannelException ex) { counterGroup.addAndGet("events.failed", lastSent); return Status.BACKOFF; } return Status.READY; }
Source:
public void patchAddTitleOnSectionThatNotContainAttributeTitleTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .build(); WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1) .withIssueDate("2019-11-21") .withSubject("ExtraEntry") .build(); configurationService.setProperty("webui.submit.upload.required", false); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); List<Operation> addTitle = new ArrayList<Operation>(); List<Map<String, String>> values = new ArrayList<Map<String, String>>(); Map<String, String> value = new HashMap<String, String>(); value.put("value", "New Title"); values.add(value); addTitle.add(new AddOperation("/sections/traditionalpagetwo/dc.title", values)); String patchBody = getPatchContent(addTitle); getClient(authToken).perform(patch("/api/submission/workspaceitems/" + witem.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void patchAddTitleOnSectionThatNotContainAttributeTitleTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .build(); WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1) .withIssueDate("2019-11-21") .withSubject("ExtraEntry") .build(); configurationService.setProperty("webui.submit.upload.required", false); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); List<Operation> addTitle = new ArrayList<Operation>(); List<Map<String, String>> values = new ArrayList<Map<String, String>>(); Map<String, String> value = new HashMap<String, String>(); value.put("value", "New Title"); values.add(value); addTitle.add(new AddOperation("/sections/traditionalpagetwo/dc.title", values)); String patchBody = getPatchContent(addTitle); getClient(authToken).perform(patch("/api/submission/workspaceitems/" + witem.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(authToken).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.sections.traditionalpageone['dc.title']").doesNotExist()); }
Source:
public Builder addStep(final String stepClassName) { final Step.Factory factory = FACTORIES.get(stepClassName); if (null == factory) { LOGGER.error("No Factory exist that can create Step '{}'", stepClassName); } else { final Step step = factory.create(); if (null == step) { LOGGER.error("Step.Factory '{}' failed to create Step '{}'", factory, stepClassName); } else { LOGGER.info("Step.Factory '{}' created '{}'", factory, step); steps.add(step); } } return this; }

Target:
public Builder addStep(final String stepClassName) { final Step.Factory factory = FACTORIES.get(stepClassName); if (null == factory) { LOGGER.error("No Factory exists that can create Step '{}'", stepClassName); } else { final Step step = factory.create(); if (null == step) { LOGGER.error("Step.Factory '{}' failed to create Step '{}'", factory, stepClassName); } else { LOGGER.info("Step.Factory '{}' created '{}'", factory, step); steps.add(step); } } return this; }
Source:
protected void completeOperation(FutureResult futureResult, Callback callback, Object operationResult, Exception exception) { long postProcessingStartTime = System.currentTimeMillis(); try { futureResult.done(operationResult, exception); if (callback != null) { callback.onCompletion(operationResult, exception); } } catch (Exception e) { metrics.futureCallbackError.inc(); logger.error("Exception caught during future and callback completion", e); if (operationResult instanceof ReadableStreamChannel) { try { logger.trace("Closing readable stream channel due to exception"); ((ReadableStreamChannel) operationResult).close(); } catch (IOException e1) { logger.error("Ignoring IOException thrown during closing of readable stream channel on exception"); } } } finally { metrics.operationPostProcessingTimeInMs.update(System.currentTimeMillis() - postProcessingStartTime); } }

Target:
protected void completeOperation(FutureResult futureResult, Callback callback, Object operationResult, Exception exception) { long postProcessingStartTime = System.currentTimeMillis(); try { futureResult.done(operationResult, exception); if (callback != null) { callback.onCompletion(operationResult, exception); } } catch (Exception e) { metrics.futureCallbackError.inc(); logger.error("Exception caught during future and callback completion", e); if (operationResult instanceof ReadableStreamChannel) { try { logger.trace("Closing ReadableStreamChannel due to exception"); ((ReadableStreamChannel) operationResult).close(); } catch (IOException channelCloseException) { logger.error("Ignoring IOException during ReadableStreamChannel close"); } } } finally { metrics.operationPostProcessingTimeInMs.update(System.currentTimeMillis() - postProcessingStartTime); } }
Source:
private int drawDescription(Canvas canvas, String description, int top) { final int marginBottom = 3; final int maxHeight = 23; final int maxLines = 2; final float maxFontSize = 15.0f; final float minFontSize = 10.0f; TextPaint textPaint = new TextPaint(); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setTextSize(maxFontSize); textPaint.setStyle(Paint.Style.FILL); textPaint.setShadowLayer(1.0f, 0.0f, 0.0f, Color.GRAY); StaticLayout textLayout = optimizeTextSize( new TextLayoutParams(description, textPaint, DESCRIPTION_WIDTH, SPACING_MULTIPLIER), maxHeight, maxLines, maxFontSize, minFontSize); int left = HORIZONTAL_PADDING; if (isArticleRTL) { left = WIDTH - HORIZONTAL_PADDING - textLayout.getWidth(); } top = top - (int)(marginBottom * displayDensity) - textLayout.getHeight(); canvas.save(); canvas.translate(left, top); textLayout.draw(canvas); canvas.restore(); return top; }

Target:
private int drawDescription(Canvas canvas, String description, int top) { final int marginBottom = 4; final int maxHeight = 23; final int maxLines = 2; final float maxFontSize = 15.0f; final float minFontSize = 10.0f; if (TextUtils.isEmpty(description)) { return marginBottom; } TextPaint textPaint = new TextPaint(); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setTextSize(maxFontSize); textPaint.setStyle(Paint.Style.FILL); textPaint.setShadowLayer(1.0f, 0.0f, 0.0f, Color.GRAY); StaticLayout textLayout = optimizeTextSize( new TextLayoutParams(description, textPaint, DESCRIPTION_WIDTH, SPACING_MULTIPLIER), maxHeight, maxLines, maxFontSize, minFontSize); int left = HORIZONTAL_PADDING; if (isArticleRTL) { left = WIDTH - HORIZONTAL_PADDING - textLayout.getWidth(); } top = top - marginBottom - textLayout.getHeight(); canvas.save(); canvas.translate(left, top); textLayout.draw(canvas); canvas.restore(); return top; }
Source:
public TermQueryConverter(TermQuery query, FieldConverter fieldConverter) { this.query = query; this.fieldConverter = fieldConverter; this.basicAttrs = Arrays.asList(MetaObject.META_OBJECT_ID, MetaObject.META_OBJECT_TYPE, MetaObject.META_OBJECT_CLUSTER_ID, MetaObject.META_OBJECT_SEGMENT_ID, MetaObject.META_OBJECT_KEY); }

Target:
public TermQueryConverter(TermQuery query, FieldConverter fieldConverter) { this.query = query; this.fieldConverter = fieldConverter; }
Source:
public static boolean isExtension(String filename, String extension) { if (filename == null) { return false; } if ((extension == null) || extension.isEmpty()) { return false; } return getExtension(filename).equals(extension); }

Target:
public static boolean isExtension(String filename, String extension) { if (filename == null) { return false; } if (extension == null || extension.isEmpty()) { return false; } return getExtension(filename).equals(extension); }
Source:
public DerbyConnectorRule() { this(Suppliers.ofInstance(MetadataStorageTablesConfig.fromBase("druidTest" + dbSafeUUID()))); }

Target:
public DerbyConnectorRule() { this(Suppliers.ofInstance(MetadataStorageTablesConfig.fromBase("druidTest"))); }
Source:
protected Message doSendAndReceive(final String exchange, final String routingKey, final Message message) { if (!this.evaluatedFastReplyTo) { evaluateFastReplyTo(); } if (this.replyQueue == null || this.usingFastReplyTo) { return doSendAndReceiveWithTemporary(exchange, routingKey, message); } else { return doSendAndReceiveWithFixed(exchange, routingKey, message); } }

Target:
protected Message doSendAndReceive(final String exchange, final String routingKey, final Message message) { if (!this.evaluatedFastReplyTo) { synchronized(this) { if (!this.evaluatedFastReplyTo) { evaluateFastReplyTo(); } } } if (this.replyQueue == null || this.usingFastReplyTo) { return doSendAndReceiveWithTemporary(exchange, routingKey, message); } else { return doSendAndReceiveWithFixed(exchange, routingKey, message); } }
Source:
private static IFile createNewFile(IPath newFilePath, InputStream contents, boolean force, IProgressMonitor monitor) throws CoreException { int totalWork = 100; int createFileWork = totalWork; monitor.beginTask(NewFileWizardMessages.NewSourceFileGenerator_createFile_task, totalWork); IWorkspaceRoot root = CUIPlugin.getWorkspace().getRoot(); IFile newFile = root.getFileForLocation(newFilePath); if (newFile == null) newFile = root.getFile(newFilePath); if (newFile.exists()) { monitor.done(); return newFile; } if (newFilePath.segmentCount() > 1) { IPath containerPath = newFilePath.removeLastSegments(1); if (root.getContainerForLocation(containerPath) == null) { int containerWork = totalWork / 2; createFileWork = totalWork / 2; ContainerGenerator generator = new ContainerGenerator(containerPath); generator.generateContainer(SubMonitor.convert(monitor, containerWork)); } } createFile(newFile, contents, force, SubMonitor.convert(monitor, createFileWork)); monitor.done(); return newFile; }

Target:
private static IFile createNewFile(IPath newFilePath, InputStream contents, boolean force, IProgressMonitor monitor) throws CoreException { int totalWork = 100; int createFileWork = totalWork; monitor.beginTask(NewFileWizardMessages.NewSourceFileGenerator_createFile_task, totalWork); IWorkspaceRoot root = CUIPlugin.getWorkspace().getRoot(); IFile newFile = root.getFileForLocation(newFilePath); if (newFile == null) newFile = root.getFile(newFilePath); if (newFile.exists()) { monitor.done(); return newFile; } if (newFilePath.segmentCount() > 1) { IPath containerPath = newFilePath.removeLastSegments(1); if (root.getContainerForLocation(containerPath) == null) { int containerWork = totalWork / 2; createFileWork = totalWork / 2; ContainerGenerator generator = new ContainerGenerator(containerPath); generator.generateContainer(new SubProgressMonitor(monitor, containerWork)); } } createFile(newFile, contents, force, new SubProgressMonitor(monitor, createFileWork)); monitor.done(); return newFile; }
Source:
private PlanNodeStatsAssertion assertExpression(String expression) { System.out.println("Expression: " + expression); return assertExpression(expression(expression)); }

Target:
private PlanNodeStatsAssertion assertExpression(String expression) { return assertExpression(expression(expression)); }
Source:
private void assertEventIsReceived(UpdateEventType updateEventType, String channelID, String acceptedItemType) { Configuration configuration = new Configuration(); initialize(configuration, channelID, acceptedItemType, null, null); EventSubscriber eventSubscriberMock = mock(EventSubscriber.class); when(eventSubscriberMock.getSubscribedEventTypes()).thenReturn(Collections.singleton(ItemStateEvent.TYPE)); registerService(eventSubscriberMock); if (updateEventType.equals(UpdateEventType.HANDLE_COMMAND)) { ntpHandler.handleCommand(new ChannelUID("ntp:test:chan:1"), new StringType("test")); } else if (updateEventType.equals(UpdateEventType.CHANNEL_LINKED)) { ntpHandler.channelLinked(new ChannelUID("ntp:test:chan:1")); } waitForAssert(() -> { verify(eventSubscriberMock).receive(ArgumentMatchers.any(Event.class)); }); }

Target:
private void assertEventIsReceived(UpdateEventType updateEventType, String channelID, String acceptedItemType) { Configuration configuration = new Configuration(); initialize(configuration, channelID, acceptedItemType, null, null); EventSubscriber eventSubscriberMock = mock(EventSubscriber.class); when(eventSubscriberMock.getSubscribedEventTypes()).thenReturn(Collections.singleton(ItemStateEvent.TYPE)); registerService(eventSubscriberMock); if (updateEventType.equals(UpdateEventType.HANDLE_COMMAND)) { ntpHandler.handleCommand(new ChannelUID("ntp:test:chan:1"), new StringType("test")); } else if (updateEventType.equals(UpdateEventType.CHANNEL_LINKED)) { ntpHandler.channelLinked(new ChannelUID("ntp:test:chan:1")); } waitForAssert(() -> { verify(eventSubscriberMock, atLeastOnce()).receive(ArgumentMatchers.any(Event.class)); }); }
Source:
public PipelineTask(@JsonProperty("phases") @Nonnull StreamMapper[] phases, @JsonProperty("validateDirs") boolean validateDirs) { this.phases = phases; this.validateDirs = validateDirs; this.manager = new Thread(new PipelineTaskManager(), "PipelineTask"); String message = validateOutputDirectories(); if (message != null) { throw new IllegalStateException(message); } }

Target:
public PipelineTask(@JsonProperty("phases") @Nonnull StreamMapper[] phases, @JsonProperty("validateDirs") boolean validateDirs) { validateOutputDirectories(); this.phases = phases; this.validateDirs = validateDirs; this.phaseManagement = new CompletableFuture[Math.max(phases.length - 1, 0)]; for (int i = 0; i < phaseManagement.length; i++) { final int current = i; phaseManagement[i] = phases[i].onCompleteThenRun(() -> beginPhase(current + 1)); } }
Source:
public SwiftObject apply(InternalObject input) { String name = input.name==null?"":input.name; if (input.subdir != null) { return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(name).build()) .name(name) .etag(SUBDIR_ETAG) .payload(payload(input.bytes, input.hash, "application/directory", input.expires)) .lastModified(new Date(0)).build(); } String etag = input.hash==null?"":input.hash; Date date = input.last_modified==null?new Date(0):input.last_modified; return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(name).build()) .name(name) .etag(etag) .payload(payload(input.bytes, input.hash, input.content_type, input.expires)) .lastModified(date).build(); }

Target:
public SwiftObject apply(InternalObject input) { if (input.subdir != null) { return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(input.subdir).build()) .name(input.subdir) .etag(SUBDIR_ETAG) .payload(payload(input.bytes, input.hash, "application/directory", input.expires)) .lastModified(new Date(0)).build(); } String name = Strings.nullToEmpty(input.name); String etag = Strings.nullToEmpty(input.hash); Date lastModified = input.last_modified == null ? new Date() : input.last_modified; return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(input.name).build()) .name(name) .etag(etag) .payload(payload(input.bytes, etag, input.content_type, input.expires)) .lastModified(lastModified).build(); }
Source:
public DataTransactionResult remove(DataHolder dataHolder) { DataTransactionBuilder builder = DataTransactionBuilder.builder(); Optional<LockableData> oldData = from(dataHolder); if (oldData.isPresent()) { builder.replace(oldData.get().getValues()); } if (!((ItemStack) dataHolder).hasTagCompound()) { return builder.result(DataTransactionResult.Type.SUCCESS).build(); } try { final Optional<NBTTagCompound> mainCompound = NbtDataUtil.getItemCompound(((ItemStack) dataHolder)); if (mainCompound.isPresent()) { mainCompound.get().removeTag("Lock"); } return builder.result(DataTransactionResult.Type.SUCCESS).build(); } catch (Exception e) { return builder.result(DataTransactionResult.Type.ERROR).build(); } }

Target:
public DataTransactionResult remove(DataHolder dataHolder) { if (dataHolder instanceof ItemStack) { DataTransactionBuilder builder = DataTransactionBuilder.builder(); Optional<LockableData> oldData = from(dataHolder); if (oldData.isPresent()) { builder.replace(oldData.get().getValues()); } if (!((ItemStack) dataHolder).hasTagCompound()) { return builder.result(DataTransactionResult.Type.SUCCESS).build(); } try { final NBTTagCompound mainCompound = NbtDataUtil.getItemCompound(((ItemStack) dataHolder)).get(); if (mainCompound.hasKey(NbtDataUtil.BLOCK_ENTITY_TAG)) { NBTTagCompound tileCompound = mainCompound.getCompoundTag(NbtDataUtil.BLOCK_ENTITY_TAG); tileCompound.removeTag(NbtDataUtil.ITEM_LOCK); } return builder.result(DataTransactionResult.Type.SUCCESS).build(); } catch (Exception e) { return builder.result(DataTransactionResult.Type.ERROR).build(); } } return DataTransactionBuilder.failNoData(); }
Source:
public void testTableToString() { Table t = new Table(); t.addColumn(RealmFieldType.STRING, "stringCol"); t.addColumn(RealmFieldType.INTEGER, "intCol"); t.addColumn(RealmFieldType.BOOLEAN, "boolCol"); t.add("s1", 1, true); t.add("s2", 2, false); String expected = "Table contains 3 columns: stringCol, intCol, boolCol. And 2 rows."; assertEquals(expected, t.toString()); }

Target:
public void testTableToString() { Table t = new Table(); t.addColumn(RealmFieldType.STRING, "stringCol"); t.addColumn(RealmFieldType.INTEGER, "intCol"); t.addColumn(RealmFieldType.BOOLEAN, "boolCol"); t.add("s1", 1, true); t.add("s2", 2, false); String expected = "The Table contains 3 columns: stringCol, intCol, boolCol. And 2 rows."; assertEquals(expected, t.toString()); }
Source:
ServerResponse(ServerErrorCode serverErrorCode, StoreKey storeKey, BlobProperties blobProperties, byte[] userMetadata, byte[] blobData, ByteBuffer encryptionKeyBuffer) { this.serverErrorCode = serverErrorCode; this.storeKey = storeKey; this.blobProperties = blobProperties; this.userMetadata = userMetadata; this.blobData = blobData; this.encryptionKey = encryptionKeyBuffer != null ? encryptionKeyBuffer.array() : null; }

Target:
ServerResponse(ServerErrorCode serverErrorCode, StoreKey storeKey, BlobProperties blobProperties, byte[] userMetadata, byte[] blobData, ByteBuffer encryptionKeyBuffer) { this.serverErrorCode = serverErrorCode; this.storeKey = storeKey; this.blobProperties = blobProperties; this.userMetadata = userMetadata; this.blobData = blobData; this.encryptionKey = encryptionKeyBuffer; }
Source:
public static void main(String[] args) throws Exception { try (FluoClient client = FluoFactory.newClient(new FluoConfiguration(new File(args[0]))); Snapshot snap = client.newSnapshot()) { System.out.println("Scanning wait column ...."); ScannerConfiguration scanConfig = new ScannerConfiguration(); scanConfig.fetchColumn(Constants.COUNT_WAIT_COL.getFamily(), Constants.COUNT_WAIT_COL.getQualifier()); RowIterator rowIter = snap.get(scanConfig); int totalWait = 0; while (rowIter.hasNext()) { Entry<Bytes,ColumnIterator> rowEntry = rowIter.next(); ColumnIterator colIter = rowEntry.getValue(); while (colIter.hasNext()) { Entry<Column,Bytes> col = colIter.next(); totalWait += Integer.parseInt(col.getValue().toString()); } } System.out.println("Total wait : " + totalWait); String rootRow = Node.generateRootId(8); TypedSnapshot tsnap = Constants.TYPEL.wrap(snap); int total = tsnap.get().row(rootRow).col(Constants.COUNT_SEEN_COL).toInteger(0); System.out.println("Root value : " + total); } }

Target:
public static void main(String[] args) throws Exception { if (args.length != 2) { log.error("Usage: " + Print.class.getSimpleName() + "<fluo props> <node size>"); System.exit(-1); } int nodeSize = Integer.parseInt(args[1]); System.out.println("Scanning wait column ...."); Stats stats = getStats(new FluoConfiguration(new File(args[0])), nodeSize); for (Entry<Integer,Integer> entry : stats.levelWait.entrySet()) { System.out.println("Level " + entry.getKey() + " wait : " + entry.getValue() + " #nodes:" + stats.nodesPerLevel.get(entry.getKey())); } System.out.println("Total wait : " + stats.totalWait); System.out.println("Root value : " + stats.rootValue); if (stats.sawOtherNodes) { System.err.println("WARN : Other node sizes were seen and ignored."); } }
Source:
public void deletePatient(String id) { org.openmrs.Patient patient = Context.getPatientService().getPatientByUuid(id); if (patient == null) { throw new ResourceNotFoundException(new IdDt("Patient", id)); } try { Context.getPatientService().voidPatient(patient, "DELETED by FHIR request"); } catch (APIException ex) { throw new MethodNotAllowedException("The OpenMRS API refused to retire the Patient via the FHIR request."); } }

Target:
public void deletePatient(String id) { org.openmrs.Patient patient = Context.getPatientService().getPatientByUuid(id); if (patient == null) { throw new ResourceNotFoundException(new IdType(FHIRConstants.PATIENT, id)); } try { Context.getPatientService().voidPatient(patient, FHIRConstants.PATIENT_DELETE_MESSAGE); } catch (APIException ex) { throw new MethodNotAllowedException("The OpenMRS API refused to retire the Patient via the FHIR request."); } }
Source:
protected boolean canDoAction() { boolean returnValue = true; if (!Config.<Boolean> GetValue(ConfigValues.HotPlugEnabled, getVds().getvds_group_compatibility_version().getValue())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_SUPPORTED); } else if (getVm() == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } else if (getVm().getstatus() != VMStatus.Up) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_UP); } else if (getVm().getguest_os() == null || !Config.<String> GetValue(ConfigValues.HotPlugSupportedOsList) .toLowerCase() .contains(getVm().getguest_os().toLowerCase())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } else { VmHandler.updateDisksFromDb(getVm()); if (getVm().getDiskList() != null) { for (DiskImage image : getVm().getDiskList()) { if (image.getId().equals(getParameters().getDiskId())) { diskImage = image; break; } } } if (diskImage == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } else if (!DiskInterface.VirtIO.equals(diskImage.getdisk_interface())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_VIRTIO); } else if (VdcActionType.HotPlugDiskToVm == getActionType() && diskImage.getPlugged()) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_UNPLUGGED); } } return returnValue; }

Target:
protected boolean canDoAction() { boolean returnValue = true; if (!Config.<Boolean> GetValue(ConfigValues.HotPlugEnabled, getVds().getvds_group_compatibility_version().getValue())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_SUPPORTED); } else { VM vm = getVm(); if (vm == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } else if (vm.getstatus() != VMStatus.Up) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_UP); } else if (!isOsSupported(vm)) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } else { VmHandler.updateDisksFromDb(vm); if (vm.getDiskList() != null) { for (DiskImage image : vm.getDiskList()) { if (image.getId().equals(getParameters().getDiskId())) { diskImage = image; break; } } } if (diskImage == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } else if (!DiskInterface.VirtIO.equals(diskImage.getdisk_interface())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_VIRTIO); } else if (VdcActionType.HotPlugDiskToVm == getActionType() && diskImage.getPlugged()) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_UNPLUGGED); } } } return returnValue; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DruidServer that = (DruidServer) o; if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) { return false; } return true; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ImmutableDruidServer that = (ImmutableDruidServer) o; if (metadata.equals(that.metadata)) { return false; } return true; }
Source:
@Test public void testCastTimestampToTimestamp() throws SQLException { withJavaSqlDateTypes(connection -> { Statement statement = connection.createStatement(); final String sql = "select %s as EXPECTED, %s as ACTUAL from \"java_sql_date_types\""; for (int i = 3; i >= 0; i--) { final String castTo = format(Locale.ROOT, "TIMESTAMP(%d)", i); final String expected = format(Locale.ROOT, "cast(TIMESTAMP '2018-12-14 18:29:34.123' as %s)", castTo); final String actual = format(Locale.ROOT, "cast(\"ts\" as %s)", castTo); final ResultSet resultSet = statement.executeQuery( format(Locale.ROOT, sql, expected, actual)); resultSet.next(); assertEquals(format(Locale.ROOT, "cast(java.sql.Timestamp as %s)", castTo), resultSet.getTimestamp(1), resultSet.getTimestamp(2)); } }); }

Target:
@Test public void testCastTimestampToTimestamp() throws SQLException { withJavaSqlDateTypes(connection -> { Statement statement = connection.createStatement(); final Timestamp[] expectedTimestamps = { Timestamp.valueOf("2018-12-14 18:29:34"), Timestamp.valueOf("2018-12-14 18:29:34.1"), Timestamp.valueOf("2018-12-14 18:29:34.12"), Timestamp.valueOf("2018-12-14 18:29:34.123") }; for (int i = 3; i >= 0; i--) { final String castTo = "TIMESTAMP(" + i + ")"; final String sql = "select cast(\"ts\" as " + castTo + ") from \"java_sql_date_types\""; final ResultSet resultSet = statement.executeQuery(sql); resultSet.next(); assertEquals("cast(java.sql.Timestamp.valueOf(\"2018-12-14 18:29:34.123\")" + " as " + castTo + ")", expectedTimestamps[i], resultSet.getTimestamp(1)); } }); }
Source:
private void assertConversionFromAndToLegacyPreservesId(LockRefreshToken lockRefreshToken) { LockTokenV2 initialToken = new LegacyTimelockService.LockRefreshTokenV2Adapter(lockRefreshToken); LockTokenV2 serializable = LockTokenConvertingTimelockService.makeSerializable(initialToken); LockTokenV2 reconverted = LockTokenConvertingTimelockService.castToAdapter(serializable); assertThat(reconverted.getRequestId()).isEqualTo(initialToken.getRequestId()); assertThat(serializable.getRequestId()).isEqualTo(initialToken.getRequestId()); }

Target:
private void assertConversionFromAndToLegacyPreservesId(LockRefreshToken lockRefreshToken) { LockTokenV2 initialToken = new LegacyTimelockService.LockRefreshTokenV2Adapter(lockRefreshToken); LockTokenV2 serializable = LockTokenConvertingTimelockService.makeSerializable(initialToken); LockTokenV2 reconverted = LockTokenConvertingTimelockService.castToAdapter(serializable); assertThat(reconverted).isEqualTo(initialToken); assertThat(serializable.getRequestId()).isEqualTo(initialToken.getRequestId()); }
Source:
public List<SDVariable> doDiff(List<SDVariable> f1) { return null; }

Target:
public List<SDVariable> doDiff(List<SDVariable> f1) { throw new UnsupportedOperationException(); }
Source:
public BuildOptions patch(BuildOptions options) { if (executionPlatform == null) { return options; } BuildOptions execConfiguration = options.createHostOptions(); if (execConfiguration.get(CoreOptions.class) != null) { execConfiguration.get(CoreOptions.class).isHost = false; } if (execConfiguration.get(PlatformOptions.class) != null) { execConfiguration.get(PlatformOptions.class).platforms = ImmutableList.of(executionPlatform); } return execConfiguration; }

Target:
public BuildOptions patch(BuildOptions options) { if (executionPlatform == null) { return options; } BuildOptions execConfiguration = options.createHostOptions(); CoreOptions coreOptions = Preconditions.checkNotNull(execConfiguration.get(CoreOptions.class)); coreOptions.isHost = false; if (execConfiguration.get(PlatformOptions.class) != null) { execConfiguration.get(PlatformOptions.class).platforms = ImmutableList.of(executionPlatform); } return execConfiguration; }
Source:
default VectorValueSelector makeVectorValueSelector( final ReadableVectorOffset theOffset, final ImmutableBitmap nullValueBitmap ) { class ColumnarDoublesVectorValueSelector extends BaseDoubleVectorValueSelector { private final double[] doubleVector; private int id = ReadableVectorOffset.NULL_ID; private PeekableIntIterator nullIterator = nullValueBitmap.peekableIterator(); private int offsetMark = -1; @Nullable private boolean[] nullVector = null; private ColumnarDoublesVectorValueSelector() { super(theOffset); this.doubleVector = new double[offset.getMaxVectorSize()]; } @Nullable @Override public boolean[] getNullVector() { computeVectorsIfNeeded(); return nullVector; } @Override public double[] getDoubleVector() { computeVectorsIfNeeded(); return doubleVector; } private void computeVectorsIfNeeded() { if (id == offset.getId()) { return; } if (offset.isContiguous()) { if (offset.getStartOffset() < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offset.getStartOffset(); ColumnarDoubles.this.get(doubleVector, offset.getStartOffset(), offset.getCurrentVectorSize()); } else { final int[] offsets = offset.getOffsets(); if (offsets[0] < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offsets[0]; ColumnarDoubles.this.get(doubleVector, offsets, offset.getCurrentVectorSize()); } nullVector = VectorSelectorUtils.populateNullVector(nullVector, offset, nullIterator); id = offset.getId(); } } return new ColumnarDoublesVectorValueSelector(); }

Target:
default VectorValueSelector makeVectorValueSelector( final ReadableVectorOffset theOffset, final ImmutableBitmap nullValueBitmap ) { class ColumnarDoublesVectorValueSelector extends BaseDoubleVectorValueSelector { private final double[] doubleVector; private int id = ReadableVectorOffset.NULL_ID; private PeekableIntIterator nullIterator = nullValueBitmap.peekableIterator(); private int offsetMark = -1; @Nullable private boolean[] nullVector = null; private ColumnarDoublesVectorValueSelector() { super(theOffset); this.doubleVector = new double[offset.getMaxVectorSize()]; } @Nullable @Override public boolean[] getNullVector() { computeVectorsIfNeeded(); return nullVector; } @Override public double[] getDoubleVector() { computeVectorsIfNeeded(); return doubleVector; } private void computeVectorsIfNeeded() { if (id == offset.getId()) { return; } if (offset.isContiguous()) { if (offset.getStartOffset() < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offset.getStartOffset() + offset.getCurrentVectorSize(); ColumnarDoubles.this.get(doubleVector, offset.getStartOffset(), offset.getCurrentVectorSize()); } else { final int[] offsets = offset.getOffsets(); if (offsets[offsets.length - 1] < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offsets[offsets.length - 1]; ColumnarDoubles.this.get(doubleVector, offsets, offset.getCurrentVectorSize()); } nullVector = VectorSelectorUtils.populateNullVector(nullVector, offset, nullIterator); id = offset.getId(); } } return new ColumnarDoublesVectorValueSelector(); }
Source:
public JSONWithPadding reactivate( @Context UriInfo ui, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception { final boolean externalTokensEnabled = !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must reactiveate via " + properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); } logger.info( "Send activation email for user: {}" , user.getUuid() ); ApiResponse response = createApiResponse(); management.startAdminUserActivationFlow( user ); response.setAction( "reactivate user" ); return new JSONWithPadding( response, callback ); }

Target:
public JSONWithPadding reactivate( @Context UriInfo ui, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception { final boolean externalTokensEnabled = !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must reactivate via " + properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); } logger.info( "Send activation email for user: {}" , user.getUuid() ); ApiResponse response = createApiResponse(); management.startAdminUserActivationFlow( user ); response.setAction( "reactivate user" ); return new JSONWithPadding( response, callback ); }
Source:
public void decorate(Object element, IDecoration decoration) { ISarosSession currentSession = session; if (currentSession == null) return; IResource resource = (IResource) element; Set<IReferencePoint> referencePoints = session.getReferencePoints(); saros.filesystem.IResource resourceWrapper = ResourceConverter.convertToResource(referencePoints, resource); if (resourceWrapper == null || !currentSession.isShared(resourceWrapper)) return; decoration.addOverlay(SharedProjectDecorator.PROJECT_DESCRIPTOR, IDecoration.TOP_LEFT); if (resourceWrapper.getType() == Type.REFERENCE_POINT) { decoration.addSuffix(Messages.SharedProjectDecorator_shared); } }

Target:
public void decorate(Object element, IDecoration decoration) { ISarosSession currentSession = session; if (currentSession == null) return; IResource resource = (IResource) element; saros.filesystem.IResource resourceWrapper = getSarosResource(resource); if (resourceWrapper == null || !currentSession.isShared(resourceWrapper)) return; decoration.addOverlay(SharedProjectDecorator.PROJECT_DESCRIPTOR, IDecoration.TOP_LEFT); if (resourceWrapper.getType() == Type.REFERENCE_POINT) { decoration.addSuffix(Messages.SharedProjectDecorator_shared); } }
Source:
private Map<String, ResourceAssignment> getBaselineAssignment( AssignmentMetadataStore assignmentMetadataStore, CurrentStateOutput currentStateOutput, Set<String> resources) throws HelixRebalanceException { Map<String, ResourceAssignment> currentBaseline = new HashMap<>(); if (assignmentMetadataStore != null) { try { _stateReadLatency.startMeasuringLatency(); currentBaseline = new HashMap<>(assignmentMetadataStore.getBaseline()); _stateReadLatency.endMeasuringLatency(); } catch (Exception ex) { throw new HelixRebalanceException( "Failed to get the current baseline assignment because of unexpected error.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } currentBaseline.keySet().retainAll(resources); if (!currentBaseline.keySet().containsAll(resources)) { LOG.warn("The current baseline assignment record is empty. Use the current states instead."); for (Map.Entry<String, ResourceAssignment> entry : currentStateOutput.getAssignment(resources) .entrySet()) { if (resources.contains(entry.getKey()) && !currentBaseline.containsKey(entry.getKey())) { currentBaseline.put(entry.getKey(), entry.getValue()); } } } return currentBaseline; }

Target:
private Map<String, ResourceAssignment> getBaselineAssignment( AssignmentMetadataStore assignmentMetadataStore, CurrentStateOutput currentStateOutput, Set<String> resources) throws HelixRebalanceException { Map<String, ResourceAssignment> currentBaseline = new HashMap<>(); if (assignmentMetadataStore != null) { try { _stateReadLatency.startMeasuringLatency(); currentBaseline = new HashMap<>(assignmentMetadataStore.getBaseline()); _stateReadLatency.endMeasuringLatency(); } catch (Exception ex) { throw new HelixRebalanceException( "Failed to get the current baseline assignment because of unexpected error.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } currentBaseline.keySet().retainAll(resources); Set<String> missingResources = new HashSet<>(resources); missingResources.removeAll(currentBaseline.keySet()); currentBaseline.putAll(currentStateOutput.getAssignment(missingResources)); return currentBaseline; }
Source:
public void tokenize(SourceCode sourceCode, Tokens tokenEntries) throws IOException { String filename = sourceCode.getFileName(); String fullCode = StringUtils.join(sourceCode.getCode(), "\n"); Input.VirtualFile vf = new Input.VirtualFile(filename, fullCode); ScalametaTokenizer tokenizer = new ScalametaTokenizer(vf, dialect); scala.meta.tokens.Tokens tokens = tokenizer.tokenize(); List<scala.meta.tokens.Token> tokenList = JavaConverters.asJava(tokens.toList()); ScalaTokenFilter filter = new ScalaTokenFilter(tokenList); scala.meta.tokens.Token token; while ((token = filter.getNextToken()) != null) { String tokenText = token.text() != null ? token.text() : token.name(); TokenEntry cpdToken = new TokenEntry(tokenText, filename, token.pos().startLine()); tokenEntries.add(cpdToken); } }

Target:
public void tokenize(SourceCode sourceCode, Tokens tokenEntries) throws IOException { String filename = sourceCode.getFileName(); String fullCode = StringUtils.join(sourceCode.getCode(), "\n"); Input.VirtualFile vf = new Input.VirtualFile(filename, fullCode); ScalametaTokenizer tokenizer = new ScalametaTokenizer(vf, dialect); try { scala.meta.tokens.Tokens tokens = tokenizer.tokenize(); ScalaTokenFilter filter = new ScalaTokenFilter(tokens.iterator()); Token token; while ((token = filter.getNextToken()) != null) { String tokenText = token.text() != null ? token.text() : token.name(); TokenEntry cpdToken = new TokenEntry(tokenText, filename, token.pos().startLine()); tokenEntries.add(cpdToken); } } finally { tokenEntries.add(TokenEntry.getEOF()); } }
Source:
public Optional<Serializable> getProperty(String propertyKey) { return Optional.ofNullable(properties.get(propertyKey)); }

Target:
public Serializable getProperty(String propertyKey) { return properties.get(propertyKey); }
Source:
private boolean isRemoveLeaseNeeded(Guid srcLeaseDomainId, Guid dstLeaseDomainId) { if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return isLeaseStorageDomainsEquals(srcLeaseDomainId, dstLeaseDomainId) || (srcLeaseDomainId == null && dstLeaseDomainId != null); } if (getParameters().getSnapshotAction() == SnapshotActionEnum.COMMIT) { return isLeaseStorageDomainsEquals(srcLeaseDomainId, dstLeaseDomainId) || (srcLeaseDomainId != null && dstLeaseDomainId == null); } return false; }

Target:
private boolean isRemoveLeaseNeeded(Guid srcLeaseDomainId, Guid dstLeaseDomainId) { switch (getParameters().getSnapshotAction()) { case UNDO: return !Objects.equals(srcLeaseDomainId, dstLeaseDomainId) || (srcLeaseDomainId == null && dstLeaseDomainId != null); case COMMIT: return !Objects.equals(srcLeaseDomainId, dstLeaseDomainId) || (srcLeaseDomainId != null && dstLeaseDomainId == null); default: return false; } }
Source:
public static Context setNewLocale(Context context, String language) { Locale newLocale = WPPrefUtils.languageLocale(language); if (Locale.getDefault().toString().equals(newLocale.toString())) { removePersistedLanguage(context); } else { saveLanguageToPref(context, language); } return updateResources(context, language); }

Target:
public static void setNewLocale(Context context, String language) { if (isSameLanguage(language)) { return; } saveLanguageToPref(context, language); updateResources(context, language); }
Source:
public void testRestartWithAdvertisedAddressAsBookieID() throws Exception { String[] ledgerDirs = new String[] { newDirectory(), newDirectory(), newDirectory() }; String journalDir = newDirectory(); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration() .setZkServers(zkUtil.getZooKeeperConnectString()) .setJournalDirName(journalDir).setLedgerDirNames(ledgerDirs) .setBookiePort(bookiePort); conf.setUseHostNameAsBookieID(false); Bookie b = new Bookie(conf); b.start(); b.shutdown(); conf.setAdvertisedAddress("test.bookkeeper.com"); try { new Bookie(conf); fail("Should not start a bookie with ip if the bookie has been started with an ip"); } catch (InvalidCookieException e) { } }

Target:
public void testRestartWithAdvertisedAddressAsBookieID() throws Exception { String[] ledgerDirs = new String[] { newDirectory(), newDirectory(), newDirectory() }; String journalDir = newDirectory(); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration() .setZkServers(zkUtil.getZooKeeperConnectString()) .setJournalDirName(journalDir).setLedgerDirNames(ledgerDirs) .setBookiePort(bookiePort); conf.setUseHostNameAsBookieID(false); Bookie b = new Bookie(conf); b.start(); b.shutdown(); conf.setAdvertisedAddress("unknown"); try { new Bookie(conf); fail("Should not start a bookie with ip if the bookie has been started with an ip"); } catch (InvalidCookieException e) { } }
Source:
private void registerErrorChannel() { if (!this.beanFactory.containsBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)) { if (logger.isInfoEnabled()) { logger.info("No bean named '" + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME + "' has been explicitly defined. " + "Therefore, a default PublishSubscribeChannel will be created."); } this.registry.registerBeanDefinition(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME, new RootBeanDefinition(PublishSubscribeChannel.class)); BeanDefinition loggingHandler = BeanDefinitionBuilder.genericBeanDefinition(LoggingHandler.class) .addConstructorArgValue("ERROR") .getBeanDefinition(); String errorLoggerBeanName = IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME + IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX; this.registry.registerBeanDefinition(errorLoggerBeanName, loggingHandler); BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder.genericBeanDefinition(ConsumerEndpointFactoryBean.class) .addPropertyReference("handler", errorLoggerBeanName) .addPropertyValue("inputChannelName", IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); BeanComponentDefinition componentDefinition = new BeanComponentDefinition(loggingEndpointBuilder.getBeanDefinition(), "errorLogger", new String[] { IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME }); BeanDefinitionReaderUtils.registerBeanDefinition(componentDefinition, this.registry); } }

Target:
private void registerErrorChannel() { if (!this.beanFactory.containsBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)) { if (logger.isInfoEnabled()) { logger.info("No bean named '" + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME + "' has been explicitly defined. " + "Therefore, a default PublishSubscribeChannel will be created."); } this.registry.registerBeanDefinition(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME, new RootBeanDefinition(PublishSubscribeChannel.class)); BeanDefinition loggingHandler = BeanDefinitionBuilder.genericBeanDefinition(LoggingHandler.class) .addConstructorArgValue("ERROR") .getBeanDefinition(); String errorLoggerBeanName = IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME + IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX; this.registry.registerBeanDefinition(errorLoggerBeanName, loggingHandler); BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder.genericBeanDefinition(ConsumerEndpointFactoryBean.class) .addPropertyReference("handler", errorLoggerBeanName) .addPropertyValue("inputChannelName", IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); BeanComponentDefinition componentDefinition = new BeanComponentDefinition(loggingEndpointBuilder.getBeanDefinition(), IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME); BeanDefinitionReaderUtils.registerBeanDefinition(componentDefinition, this.registry); } }