auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static long parseDateTime(@Nullable String dateTimeString, @Nullable String subSecs, @Nullable String offsetString) { if (dateTimeString == null || !sNonZeroTimePattern.matcher(dateTimeString).matches()) return INVALID_DATE_TIME; ParsePosition pos = new ParsePosition(0); try { Date datetime = sFormatter.parse(dateTimeString, pos); if (offsetString != null) { dateTimeString = dateTimeString + " " + offsetString; ParsePosition position = new ParsePosition(0); datetime = sFormatterTz.parse(dateTimeString, position); } if (datetime == null) return INVALID_DATE_TIME; long msecs = datetime.getTime(); if (subSecs != null) { try { long sub = Long.parseLong(subSecs); while (sub > 1000) { sub /= 10; } msecs += sub; } catch (NumberFormatException e) { } } return msecs; } catch (IllegalArgumentException e) { return INVALID_DATE_TIME; } }

Target:
private static long parseDateTime(@Nullable String dateTimeString, @Nullable String subSecs, @Nullable String offsetString) { if (dateTimeString == null || !sNonZeroTimePattern.matcher(dateTimeString).matches()) return INVALID_DATE_TIME; ParsePosition pos = new ParsePosition(0); try { Date datetime; if (offsetString != null) { dateTimeString = dateTimeString + " " + offsetString; ParsePosition position = new ParsePosition(0); datetime = sFormatterTz.parse(dateTimeString, position); } else { datetime = sFormatter.parse(dateTimeString, pos); } if (datetime == null) return INVALID_DATE_TIME; long msecs = datetime.getTime(); if (subSecs != null) { try { long sub = Long.parseLong(subSecs); while (sub > 1000) { sub /= 10; } msecs += sub; } catch (NumberFormatException e) { } } return msecs; } catch (IllegalArgumentException e) { return INVALID_DATE_TIME; } }
Source:
public static PrestoSparkSerializedPage toPrestoSparkSerializedPage(SerializedPage serializedPage) { Slice slice = serializedPage.getSlice(); checkArgument(slice.hasByteArray(), "slice is expected to be based on a byte array"); byte[] array = slice.byteArray(); if (slice.byteArrayOffset() != 0 || slice.length() != array.length) { array = copyOfRange(array, slice.byteArrayOffset(), slice.byteArrayOffset() + slice.length()); } return new PrestoSparkSerializedPage( array, serializedPage.getPositionCount(), serializedPage.getUncompressedSizeInBytes(), serializedPage.getPageCodecMarkers()); }

Target:
public static PrestoSparkSerializedPage toPrestoSparkSerializedPage(SerializedPage serializedPage) { Slice slice = serializedPage.getSlice(); checkArgument(slice.hasByteArray(), "slice is expected to be based on a byte array"); return new PrestoSparkSerializedPage( compactArray(slice.byteArray(), slice.byteArrayOffset(), slice.length()), serializedPage.getPositionCount(), serializedPage.getUncompressedSizeInBytes(), serializedPage.getPageCodecMarkers()); }
Source:
getResourceCalculatorProcessTree(String pId) { ResourceCalculatorProcessTree pt = null; if (processTreeClass == null && CGroupsResourceCalculator.isAvailable()) { try { pt = new CGroupsResourceCalculator(pId); } catch (YarnException e) { LOG.info("CGroupsResourceCalculator cannot be created", e); } } pt = ResourceCalculatorProcessTree. getResourceCalculatorProcessTree( pId, processTreeClass, conf); return pt; }

Target:
getResourceCalculatorProcessTree(String pId) { ResourceCalculatorProcessTree pt = null; if (processTreeClass == null && CGroupsResourceCalculator.isAvailable()) { try { pt = new CGroupsResourceCalculator(pId); } catch (YarnException e) { LOG.info("CGroupsResourceCalculator cannot be created", e); } } if (pt == null) { pt = ResourceCalculatorProcessTree. getResourceCalculatorProcessTree( pId, processTreeClass, conf); } return pt; }
Source:
public StreamInfo(Map<String,Object> map) { if (map!= null) { streamInfo = map; length = (Long) map.get(LENGTH); radixTreeKeys = (Long) map.get(RADIX_TREE_KEYS); radixTreeNodes = (Long) map.get(RADIX_TREE_NODES); groups = (Long) map.get(GROUPS); lastGeneratedId = (String) map.get(LAST_GENERATED_ID); firstEntry = (StreamEntry) map.get(FIRST_ENTRY); lastEntry = (StreamEntry) map.get(LAST_ENTRY); } else throw new IllegalArgumentException("InfoMap can not be null"); }

Target:
public StreamInfo(Map<String,Object> map) { streamInfo = map; length = (Long) map.get(LENGTH); radixTreeKeys = (Long) map.get(RADIX_TREE_KEYS); radixTreeNodes = (Long) map.get(RADIX_TREE_NODES); groups = (Long) map.get(GROUPS); lastGeneratedId = (StreamEntryID) map.get(LAST_GENERATED_ID); firstEntry = (StreamEntry) map.get(FIRST_ENTRY); lastEntry = (StreamEntry) map.get(LAST_ENTRY); }
Source:
public Object get(Object key) { BeanClass beanClass = (BeanClass) key; final Class<?> controller = beanClass.getType(); String interfaceName = controller.getName() + "$linkTo"; Class<?> linkToInterface; try { linkToInterface = Class.forName(interfaceName); } catch (ClassNotFoundException _) { linkToInterface = createLinkToInterface(controller, interfaceName); } return proxifier.proxify(linkToInterface, new MethodInvocation<Object>() { @Override public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) { String methodName = StringUtils.decapitalize(method.getName().replaceFirst("^get", "")); List<Object> params = args.length == 0 ? Collections.emptyList() : Arrays.asList((Object[]) args[0]); return new Linker(controller, methodName, params).toString(); } }); }

Target:
public Object get(Object key) { BeanClass beanClass = (BeanClass) key; final Class<?> controller = beanClass.getType(); Class<?> linkToInterface = interfaces.get(controller); if (linkToInterface == null) { lock.lock(); try { linkToInterface = interfaces.get(controller); if (linkToInterface == null) { String interfaceName = controller.getName() + "$linkTo"; linkToInterface = createLinkToInterface(controller, interfaceName); interfaces.put(controller, linkToInterface); } } finally { lock.unlock(); } } return proxifier.proxify(linkToInterface, new MethodInvocation<Object>() { @Override public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) { String methodName = StringUtils.decapitalize(method.getName().replaceFirst("^get", "")); List<Object> params = args.length == 0 ? Collections.emptyList() : Arrays.asList((Object[]) args[0]); return new Linker(controller, methodName, params).getLink(); } }); }
Source:
private void handleAnyMatch(MethodInvocationTree anyMatchMIT) { ExpressionTree predicate = anyMatchMIT.arguments().get(0); if (anyMatchMIT.parent().is(Tree.Kind.LOGICAL_COMPLEMENT)) { if (predicate.is(Tree.Kind.LAMBDA_EXPRESSION) && ((LambdaExpressionTree) predicate).body().is(Tree.Kind.LOGICAL_COMPLEMENT)) { context.reportIssue(this, MethodsHelper.methodName(anyMatchMIT), "Replace this double negation with \"allMatch()\" and positive predicate."); } else { context.reportIssue(this, MethodsHelper.methodName(anyMatchMIT), "Replace this negation and \"anyMatch()\" with \"noneMatch()\"."); } } if (predicate.is(Tree.Kind.METHOD_REFERENCE) && isBooleanValueReference((MethodReferenceTree) predicate)) { previousMITInChain(anyMatchMIT) .filter(MAP_METHODS::anyMatch) .ifPresent(mapMIT -> context.reportIssue(this, MethodsHelper.methodName(anyMatchMIT), "Use predicate from \"map()\" directly in \"anyMatch()\".")); } }

Target:
private void handleAnyMatch(MethodInvocationTree anyMatchMIT) { ExpressionTree predicate = anyMatchMIT.arguments().get(0); IdentifierTree reportTree = MethodsHelper.methodName(anyMatchMIT); if (anyMatchMIT.parent().is(Tree.Kind.LOGICAL_COMPLEMENT)) { if (predicate.is(Tree.Kind.LAMBDA_EXPRESSION) && ((LambdaExpressionTree) predicate).body().is(Tree.Kind.LOGICAL_COMPLEMENT)) { context.reportIssue(this, reportTree, "Replace this double negation with \"allMatch()\" and positive predicate."); } else { context.reportIssue(this, reportTree, "Replace this negation and \"anyMatch()\" with \"noneMatch()\"."); } } if (predicate.is(Tree.Kind.METHOD_REFERENCE) && isBooleanValueReference((MethodReferenceTree) predicate)) { previousMITInChain(anyMatchMIT) .filter(MAP_METHODS::anyMatch) .ifPresent(mapMIT -> context.reportIssue(this, reportTree, "Use mapper from \"map()\" directly as predicate in \"anyMatch()\".")); } }
Source:
private void createDiffLinkAndText(final RevCommit parent, final Diff diff) throws IOException { String parentName = parent.toObjectId().abbreviate(7).name(); EditList interestingDiff = getInterestingDiff(diff.getEditList()); final Integer parentLine; if (!interestingDiff.isEmpty()) parentLine = Integer.valueOf(interestingDiff.get(0).getBeginA()); else parentLine = null; Link link = new Link(diffComposite, SWT.NONE); link.setText(NLS.bind(UIText.BlameInformationControl_DiffLinkText, parentName)); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { blameParent(parent, diff, parentLine); } }); DiffViewer diffText = new DiffViewer(diffComposite, null, SWT.NONE); diffText.setEditable(false); diffText.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, true).create()); IDocument document = new Document(); DiffStyleRangeFormatter diffFormatter = new DiffStyleRangeFormatter( document); diffFormatter.setRepository(revision.getRepository()); diffFormatter.format(interestingDiff, diff.getOldText(), diff.getNewText()); diffText.setDocument(document); diffText.setFormatter(diffFormatter); }

Target:
private void createDiffLinkAndText(final RevCommit parent, final Diff diff) throws IOException { String parentId = parent.toObjectId().abbreviate(7).name(); String parentMessage = parent.getShortMessage(); EditList interestingDiff = getInterestingDiff(diff.getEditList()); final Integer parentLine; if (!interestingDiff.isEmpty()) parentLine = Integer.valueOf(interestingDiff.get(0).getBeginA()); else parentLine = null; Composite header = new Composite(diffComposite, SWT.NONE); header.setLayout(GridLayoutFactory.fillDefaults().numColumns(2) .create()); Label diffHeaderLabel = new Label(header, SWT.NONE); diffHeaderLabel.setText(NLS.bind( UIText.BlameInformationControl_DiffHeaderLabel, parentId, parentMessage)); Link showAnnotationsLink = new Link(header, SWT.NONE); showAnnotationsLink .setText(UIText.BlameInformationControl_ShowAnnotationsLink); showAnnotationsLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { blameParent(parent, diff, parentLine); } }); DiffViewer diffText = new DiffViewer(diffComposite, null, SWT.NONE); diffText.setEditable(false); diffText.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, true).create()); IDocument document = new Document(); DiffStyleRangeFormatter diffFormatter = new DiffStyleRangeFormatter( document); diffFormatter.setRepository(revision.getRepository()); diffFormatter.format(interestingDiff, diff.getOldText(), diff.getNewText()); diffText.setDocument(document); diffText.setFormatter(diffFormatter); }
Source:
private Optional<User> loadUserDetails(String username) { User user = strongboxUserManager.findByUserName(username); Date userLastUpdate = Optional.ofNullable(user) .flatMap(u -> Optional.ofNullable(u.getLastUpdate())) .orElse(Date.from(Instant.EPOCH)); Date userExpireDate = Date.from(Instant.ofEpochMilli(userLastUpdate.getTime()) .plusSeconds(externalUsersInvalidateSeconds)); Date nowDate = new Date(); if (user != null && (StringUtils.isBlank(user.getSourceId()) || nowDate.before(userExpireDate))) { return Optional.of(user); } for (Entry<String, UserDetailsService> userDetailsServiceEntry : userProviderMap.entrySet()) { String sourceId = userDetailsServiceEntry.getKey(); UserDetailsService userDetailsService = userDetailsServiceEntry.getValue(); try { return Optional.of(strongboxUserManager.updateExternalUserDetails(sourceId, userDetailsService.loadUserByUsername(username))); } catch (UsernameNotFoundException e) { continue; } } strongboxUserManager.deleteByUserName(username); return Optional.empty(); }

Target:
private Optional<User> loadUserDetails(String username) { User user = strongboxUserManager.findByUsername(username); Date userLastUpdate = Optional.ofNullable(user) .flatMap(u -> Optional.ofNullable(u.getLastUpdate())) .orElse(Date.from(Instant.EPOCH)); Date userExpireDate = Date.from(Instant.ofEpochMilli(userLastUpdate.getTime()) .plusSeconds(externalUsersInvalidateSeconds)); Date nowDate = new Date(); if (user != null && (StringUtils.isBlank(user.getSourceId()) || nowDate.before(userExpireDate))) { return Optional.of(user); } for (Entry<String, UserDetailsService> userDetailsServiceEntry : userProviderMap.entrySet()) { String sourceId = userDetailsServiceEntry.getKey(); UserDetailsService userDetailsService = userDetailsServiceEntry.getValue(); try { return Optional.of(strongboxUserManager.cacheExternalUserDetails(sourceId, userDetailsService.loadUserByUsername(username))); } catch (UsernameNotFoundException e) { continue; } } strongboxUserManager.deleteByUsername(username); return Optional.empty(); }
Source:
private void copyDiskDevicesFromTemplate() { List<VmDevice> disks = DbFacade.getInstance().getVmDeviceDao().getVmDeviceByVmIdAndType(getVmTemplateId(), VmDeviceGeneralType.DISK); VmDeviceUtils.copyVmDevices( vmDisksSource.getId(), getVmId(), getVm(), getVm().getStaticData(), true, disks, getSrcDeviceIdToTargetDeviceIdMapping(), false, false, false, false, false ); }

Target:
private void copyDiskDevicesFromTemplate() { List<VmDevice> disks = DbFacade.getInstance().getVmDeviceDao().getVmDeviceByVmIdAndType(vmDisksSource.getId(), VmDeviceGeneralType.DISK); VmDeviceUtils.copyVmDevices( vmDisksSource.getId(), getVmId(), getVm(), getVm().getStaticData(), true, disks, getSrcDeviceIdToTargetDeviceIdMapping(), false, false, false, false, false ); }
Source:
private int unsignedShortToInt(final byte[] bytes) { ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); return buffer.getInt(); }

Target:
private int unsignedShortToInt(final byte[] bytes) { final ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); return buffer.getInt(); }
Source:
public CheckPolicyResponseType checkPolicy(CheckPolicyRequestType request, AssertionType assertion) { LOG.trace("Begin AdapterPEPProxyWebServiceUnsecuredImpl.checkPolicy"); CheckPolicyResponseType checkPolicyResponse = new CheckPolicyResponseType(); String serviceName = NhincConstants.ADAPTER_PEP_SERVICE_NAME; try { LOG.debug("Before target system URL look up."); String url = oProxyHelper.getAdapterEndPointFromConnectionManager(serviceName); LOG.debug("After target system URL look up. URL for service: " + serviceName + " is: " + url); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AdapterPEPPortType> portDescriptor = new AdapterPEPServicePortDescriptor(); CONNECTClient<AdapterPEPPortType> client = getCONNECTClientUnsecured(portDescriptor, url, assertion); checkPolicyResponse = (CheckPolicyResponseType) client.invokePort(AdapterPEPPortType.class, "checkPolicy", request); } else { LOG.error("Failed to call the web service (" + serviceName + "). The URL is null."); } } catch (Exception ex) { String message = "Error occurred calling AdapterPEPProxyWebServiceUnsecuredImpl.checkPolicy. Error: " + ex.getMessage(); LOG.error(message, ex); throw new RuntimeException(message, ex); } LOG.trace("End AdapterPEPProxyWebServiceUnsecuredImpl.checkPolicy"); return checkPolicyResponse; }

Target:
public CheckPolicyResponseType checkPolicy(CheckPolicyRequestType request, AssertionType assertion) { LOG.trace("Begin AdapterPEPProxyWebServiceUnsecuredImpl.checkPolicy"); CheckPolicyResponseType checkPolicyResponse = new CheckPolicyResponseType(); String serviceName = NhincConstants.ADAPTER_PEP_SERVICE_NAME; try { LOG.debug("Before target system URL look up."); String url = oProxyHelper.getAdapterEndPointFromConnectionManager(serviceName); LOG.debug("After target system URL look up. URL for service: is: {}", serviceName, url); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AdapterPEPPortType> portDescriptor = new AdapterPEPServicePortDescriptor(); CONNECTClient<AdapterPEPPortType> client = getCONNECTClientUnsecured(portDescriptor, url, assertion); checkPolicyResponse = (CheckPolicyResponseType) client.invokePort(AdapterPEPPortType.class, "checkPolicy", request); } else { LOG.error("Failed to call the web service ({}). The URL is null.", serviceName); } } catch (Exception ex) { String message = "Error occurred calling AdapterPEPProxyWebServiceUnsecuredImpl.checkPolicy. Error: " + ex.getMessage(); throw new RuntimeException(message, ex); } LOG.trace("End AdapterPEPProxyWebServiceUnsecuredImpl.checkPolicy"); return checkPolicyResponse; }
Source:
public DatastreamTaskImpl(InternalDatastreamTask internalDatastreamTask, List<Datastream> datastreams, ZkAdapter zkAdapter) { this(internalDatastreamTask, datastreams); if (Strings.isNullOrEmpty(_transportProviderName)) { _transportProviderName = zkAdapter.getDefaultTransportProviderName(); } _zkAdapter = zkAdapter; }

Target:
public DatastreamTaskImpl(InternalDatastreamTask internalDatastreamTask, List<Datastream> datastreams, ZkAdapter zkAdapter) { this(internalDatastreamTask, datastreams); _zkAdapter = zkAdapter; }
Source:
public String getPayloadAsString() throws InvalidUtf8Exception { if (payload instanceof String) { return (String) payload; } else if (payload instanceof byte[]){ return Utf8Util.encodePayloadToUtf8ReplaceCharacters((byte[]) payload); } else { return ""; } }

Target:
public String getPayloadAsString(){ if (payload instanceof String) { return (String) payload; } else if (payload instanceof byte[]){ return new String((byte[]) payload, StandardCharsets.UTF_8); } else { return ""; } }
Source:
public static void beforeClass() throws IOException { SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); File parentDir = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.TRACE_EXPERIMENT.getTraceURL())); File[] traceFiles = parentDir.listFiles(); ITmfTrace traceValidator = new CtfTmfTrace(); fBot = new SWTWorkbenchBot(); SWTBotUtils.createProject(PROJECT_NAME); int openedTraces = 0; for (File traceFile : traceFiles) { String absolutePath = traceFile.getAbsolutePath(); if (traceValidator.validate(null, absolutePath).isOK()) { SWTBotUtils.openTrace(PROJECT_NAME, absolutePath, TRACE_TYPE); fBot.closeAllEditors(); openedTraces++; if (openedTraces >= NUM_TRACES) { break; } } } traceValidator.dispose(); WaitUtils.waitForJobs(); setup(); }

Target:
public static void beforeClass() throws IOException { SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 50000; fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); File parentDir = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.TRACE_EXPERIMENT.getTraceURL())); File[] traceFiles = parentDir.listFiles(); ITmfTrace traceValidator = new CtfTmfTrace(); fBot = new SWTWorkbenchBot(); SWTBotUtils.createProject(PROJECT_NAME); int openedTraces = 0; for (File traceFile : traceFiles) { String absolutePath = traceFile.getAbsolutePath(); if (traceValidator.validate(null, absolutePath).isOK()) { SWTBotUtils.openTrace(PROJECT_NAME, absolutePath, TRACE_TYPE); fBot.closeAllEditors(); openedTraces++; if (openedTraces >= NUM_TRACES) { break; } } } traceValidator.dispose(); WaitUtils.waitForJobs(); SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME); tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); SWTBotUtils.activateEditor(fBot, "Experiment"); SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, PROJECT_NAME); SWTBotTreeItem experimentItem = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment"); fexperimentItem = experimentItem; experimentItem.select(); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ftraceManager = traceManager; ITmfTrace trace = traceManager.getActiveTrace(); assertTrue(String.valueOf(trace), trace instanceof TmfExperiment); TmfExperiment experiment = (TmfExperiment) trace; assertNotNull(experiment); ITmfProjectModelElement elem = TmfProjectRegistry.findElement(experiment.getResource(), true); assertTrue(elem instanceof TmfExperimentElement); fOriginalExperiment = experiment; TmfTimeRange traceCutRange = getTraceCutRange(experiment); assertNotNull(traceCutRange); fRequestedTraceCutRange = traceCutRange; }
Source:
public static void handleKey(SelectionKey key) { ConnectionHandler handler = ((ConnectionHandler)key.attachment()); try { if (handler == null) return; if (!key.isValid()) { handler.closeConnection(); return; } if (key.isReadable()) { int read = handler.channel.read(handler.readBuff); if (read == 0) return; else if (read == -1) { key.cancel(); handler.closeConnection(); return; } handler.readBuff.flip(); int bytesConsumed = checkNotNull(handler.parser).receiveBytes(handler.readBuff); checkState(handler.readBuff.position() == bytesConsumed); handler.readBuff.compact(); } if (key.isWritable()) handler.tryWriteBytes(); } catch (Exception e) { log.error("Error handling SelectionKey: {}", Throwables.getRootCause(e).getMessage()); log.error("Error reason: ", e); handler.closeConnection(); } }

Target:
public static void handleKey(SelectionKey key) { ConnectionHandler handler = ((ConnectionHandler)key.attachment()); try { if (handler == null) return; if (!key.isValid()) { handler.closeConnection(); return; } if (key.isReadable()) { int read = handler.channel.read(handler.readBuff); if (read == 0) return; else if (read == -1) { key.cancel(); handler.closeConnection(); return; } handler.readBuff.flip(); int bytesConsumed = checkNotNull(handler.parser).receiveBytes(handler.readBuff); checkState(handler.readBuff.position() == bytesConsumed); handler.readBuff.compact(); } if (key.isWritable()) handler.tryWriteBytes(); } catch (Exception e) { Throwable t = Throwables.getRootCause(e); log.error("Error handling SelectionKey: {}", t.getMessage() != null ? t.getMessage() : t.getClass().getName()); handler.closeConnection(); } }
Source:
public void start() { String applicationName = ninjaProps.getWithDefault( NinjaConstant.applicationName, "Ninja"); if (ninjaProps.getBooleanWithDefault("metrics.jvm.enabled", false)) { registerAll("jvm.gc", new GarbageCollectorMetricSet()); registerAll("jvm.memory", new MemoryUsageGaugeSet()); registerAll("jvm.threads", new ThreadStatesGaugeSet()); registerAll("jvm.classes", new ClassLoadingGaugeSet()); log.debug("Registered JVM-Metrics integration"); } if (ninjaProps.getBooleanWithDefault("metrics.logback.enabled", false)) { final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory(); final ch.qos.logback.classic.Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME); final InstrumentedAppender appender = new InstrumentedAppender(metricRegistry); appender.setContext(root.getLoggerContext()); appender.start(); root.addAppender(appender); log.debug("Registered Logback-Metrics integration"); } if (ninjaProps.getBooleanWithDefault("metrics.jmx.enabled", true)) { JmxReporter reporter = JmxReporter.forRegistry(metricRegistry) .inDomain(applicationName).build(); reporter.start(); reporters.add(reporter); log.debug("Started Ninja Metrics JMX reporter"); } log.info("Ninja Metrics is ready for collection."); }

Target:
public void start() { String applicationName = ninjaProps.getWithDefault( NinjaConstant.applicationName, "Ninja"); if (ninjaProps.getBooleanWithDefault("metrics.jvm.enabled", false)) { registerAll("jvm.gc", new GarbageCollectorMetricSet()); registerAll("jvm.memory", new MemoryUsageGaugeSet()); registerAll("jvm.threads", new ThreadStatesGaugeSet()); registerAll("jvm.classes", new ClassLoadingGaugeSet()); log.debug("Registered JVM-Metrics integration"); } if (ninjaProps.getBooleanWithDefault("metrics.logback.enabled", false)) { final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory(); final ch.qos.logback.classic.Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME); final InstrumentedAppender appender = new InstrumentedAppender(metricRegistry); appender.setContext(root.getLoggerContext()); appender.start(); root.addAppender(appender); log.debug("Registered Logback-Metrics integration"); } if (ninjaProps.getBooleanWithDefault("metrics.mbeans.enabled", true)) { JmxReporter reporter = JmxReporter.forRegistry(metricRegistry) .inDomain(applicationName).build(); reporter.start(); reporters.add(reporter); log.debug("Started Ninja Metrics MBeans reporter"); } log.info("Ninja Metrics is ready for collection."); }
Source:
private void updateVmTemplate() { vmHandler.updateVmInitToDB(getVmTemplate(), getCompensationContextIfEnabledByCaller()); CompensationUtils.updateEntity(getVmTemplate(), vmTemplateDao, getCompensationContextIfEnabledByCaller()); getVmDeviceUtils().updateSmartcardDevice(getVmTemplateId(), getParameters().getVmTemplateData().isSmartcardEnabled()); getVmDeviceUtils().updateSoundDevice(oldTemplate, getVmTemplate(), getCluster(), getVmTemplate().getCompatibilityVersion(), getParameters().isSoundDeviceEnabled()); getVmDeviceUtils().updateConsoleDevice(getVmTemplateId(), getParameters().isConsoleEnabled()); if (oldTemplate.getUsbPolicy() != getVmTemplate().getUsbPolicy() || oldTemplate.getVmType() != getVmTemplate().getVmType()) { Cluster newCluster = getCluster(); Cluster oldCluster; if (oldTemplate.getClusterId() == newCluster.getId()) { oldCluster = newCluster; } else { oldCluster = oldTemplate.getClusterId() != null ? clusterDao.get(oldTemplate.getClusterId()) : null; } getVmDeviceUtils().updateUsbSlots(oldTemplate, oldCluster, getVmTemplate(), newCluster); } getVmDeviceUtils().updateVirtioScsiController(getVmTemplate(), getParameters().isVirtioScsiEnabled()); if (getParameters().isBalloonEnabled() != null) { getVmDeviceUtils().updateMemoryBalloon(getVmTemplateId(), getParameters().isBalloonEnabled()); } getVmDeviceUtils().updateVideoDevices(oldTemplate, getParameters().getVmTemplateData()); }

Target:
private void updateVmTemplate() { vmHandler.updateVmInitToDB(getVmTemplate(), getCompensationContextIfEnabledByCaller()); CompensationUtils.updateEntity(getVmTemplate(), vmTemplateDao, getCompensationContextIfEnabledByCaller()); getVmDeviceUtils().updateSmartcardDevice(getVmTemplateId(), getParameters().getVmTemplateData().isSmartcardEnabled()); getVmDeviceUtils().updateSoundDevice(oldTemplate, getVmTemplate(), getCluster(), getVmTemplate().getCompatibilityVersion(), getParameters().isSoundDeviceEnabled()); getVmDeviceUtils().updateConsoleDevice(getVmTemplateId(), getParameters().isConsoleEnabled()); if (oldTemplate.getUsbPolicy() != getVmTemplate().getUsbPolicy() || oldTemplate.getVmType() != getVmTemplate().getVmType()) { Cluster newCluster = getCluster(); Cluster oldCluster; if (oldTemplate.getClusterId().equals(newCluster.getId())) { oldCluster = newCluster; } else { oldCluster = oldTemplate.getClusterId() != null ? clusterDao.get(oldTemplate.getClusterId()) : null; } getVmDeviceUtils().updateUsbSlots(oldTemplate, oldCluster, getVmTemplate(), newCluster); } getVmDeviceUtils().updateVirtioScsiController(getVmTemplate(), getParameters().isVirtioScsiEnabled()); if (getParameters().isBalloonEnabled() != null) { getVmDeviceUtils().updateMemoryBalloon(getVmTemplateId(), getParameters().isBalloonEnabled()); } getVmDeviceUtils().updateVideoDevices(oldTemplate, getParameters().getVmTemplateData()); }
Source:
private boolean containOverlaps(Collection<LongRange> candidates) { List<LongRange> elected = new ArrayList<>(candidates.size()); return candidates.stream().anyMatch(candidate -> { if (elected.stream().anyMatch(elect -> elect.overlapsRange(candidate))) { return true; } elected.add(candidate); return false; }); }

Target:
private boolean containOverlaps(Collection<LongRange> candidates) { List<LongRange> elected = new ArrayList<>(candidates.size()); return candidates.stream().anyMatch(candidate -> { if (isRangeCollectionOverlappedByOtherRange(elected, candidate)) { return true; } elected.add(candidate); return false; }); }
Source:
public void requestPeriodicMeterReads(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final PeriodicMeterReadsRequest periodicMeterReadsRequest, final DeviceResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType) { LOGGER.info("requestPeriodicMeterReads called for device: for organisation: {}", deviceIdentification, organisationIdentification); try { final DlmsDevice device = this.domainHelperService.findDlmsDevice(deviceIdentification); final ClientConnection conn = this.dlmsConnectionFactory.getConnection(device); final PeriodicMeterReadsContainer periodicMeterReadsContainer; try { periodicMeterReadsContainer = this.getPeriodicMeterReadsCommandExecutor.execute(conn, periodicMeterReadsRequest); } finally { if (conn != null && conn.isConnected()) { conn.close(); } } this.sendResponseMessage(domain, domainVersion, messageType, correlationUid, organisationIdentification, deviceIdentification, ResponseMessageResultType.OK, null, responseMessageSender, periodicMeterReadsContainer); } catch (final Exception e) { LOGGER.error("Unexpected exception during requestPeriodicMeterReads", e); final OsgpException ex = this.ensureOsgpException(e); this.sendResponseMessage(domain, domainVersion, messageType, correlationUid, organisationIdentification, deviceIdentification, ResponseMessageResultType.NOT_OK, ex, responseMessageSender, null); } }

Target:
public void requestPeriodicMeterReads(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final PeriodicMeterReadsRequest periodicMeterReadsRequest, final DeviceResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType) { LOGGER.info("requestPeriodicMeterReads called for device: for organisation: {}", deviceIdentification, organisationIdentification); ClientConnection conn = null; try { final DlmsDevice device = this.domainHelperService.findDlmsDevice(deviceIdentification); conn = this.dlmsConnectionFactory.getConnection(device); final PeriodicMeterReadsContainer periodicMeterReadsContainer = this.getPeriodicMeterReadsCommandExecutor .execute(conn, periodicMeterReadsRequest); this.sendResponseMessage(domain, domainVersion, messageType, correlationUid, organisationIdentification, deviceIdentification, ResponseMessageResultType.OK, null, responseMessageSender, periodicMeterReadsContainer); } catch (final Exception e) { LOGGER.error("Unexpected exception during requestPeriodicMeterReads", e); final OsgpException ex = this.ensureOsgpException(e); this.sendResponseMessage(domain, domainVersion, messageType, correlationUid, organisationIdentification, deviceIdentification, ResponseMessageResultType.NOT_OK, ex, responseMessageSender, null); } finally { if (conn != null && conn.isConnected()) { conn.close(); } } }
Source:
public void unmarshallAccountSummaryBlankAccount() throws Exception { AccountSummary accountSummary = dao.unmarshallAccountSummary(makeValidHibernateAccount(false, false)); assertNotNull(accountSummary); }

Target:
public void unmarshallAccountSummaryBlankAccount() throws Exception { AccountSummary accountSummary = dao.unmarshallAccountSummary(new HibernateAccount()); assertNotNull(accountSummary); }
Source:
public void actionPerformed(ActionEvent e) { final Resource resource = appContext.getResource(); checkState(resource != null); final Project project = resource.getProject(); checkState(MAVEN_ID.equals(project.getType())); final String pathToProjectsDir = "/projects"; final String absolutePathToProjectPom = pathToProjectsDir + project.getLocation().toString() + "/pom.xml"; GetEffectivePomParameters paramsDto = dtoFactory .createDto(GetEffectivePomParameters.class) .withPathToProjectPom(absolutePathToProjectPom); javaLanguageExtensionServiceClient .effectivePom(paramsDto) .then( content -> { editorAgent.openEditor( new SyntheticFile( "pom.xml", project.getAttributes().get(MavenAttributes.ARTIFACT_ID).get(0) + " [effective pom]", content)); }) .catchError( error -> { notificationManager.notify( "Problem with generating effective pom file", error.getMessage(), FAIL, EMERGE_MODE); }); }

Target:
public void actionPerformed(ActionEvent e) { final Resource resource = appContext.getResource(); checkNotNull(resource); final Project project = resource.getProject(); checkState(MAVEN_ID.equals(project.getType())); javaLanguageExtensionServiceClient .effectivePom(project.getLocation().toString()) .then( content -> { showEffectivePomInEditor(project, content); }) .catchError( error -> { notificationManager.notify( "Problem with generating effective pom file", error.getMessage(), FAIL, EMERGE_MODE); }); }
Source:
private ThingUID getSceneUID(ThingTypeUID thingTypeUID, ThingUID thingUID, Configuration configuration, ThingUID bridgeUID) { if (thingUID == null) { String sceneID = SceneHandler.getSceneID(configuration, bridgeHandlers.get(bridgeUID)); switch (sceneID) { case SceneHandler.SCENE_WRONG: logger.error( "Configured scene '{}' does not exist or can not be used, please check your configuration.", configuration.get(DigitalSTROMBindingConstants.SCENE_ID)); break; case SceneHandler.ZONE_WRONG: logger.error("Configured zone '{}' does not exist, please check your configuration.", configuration.get(DigitalSTROMBindingConstants.ZONE_ID)); break; case SceneHandler.GROUP_WRONG: logger.error("Configured group '{}' does not exist, please check your configuration.", configuration.get(DigitalSTROMBindingConstants.GROUP_ID)); break; case SceneHandler.NO_STRUC_MAN: logger.error("Waiting for building digitalSTROM model."); break; case SceneHandler.NO_SCENE: logger.error("No Scene-ID is set!"); break; case SceneHandler.NO_BRIDGE: logger.error("No related bridge found!"); default: return new ThingUID(thingTypeUID, bridgeUID, sceneID); } } return thingUID; }

Target:
private ThingUID getSceneUID(ThingTypeUID thingTypeUID, ThingUID thingUID, Configuration configuration, ThingUID bridgeUID) { if (thingUID != null) { return thingUID; } String sceneID = SceneHandler.getSceneID(configuration, bridgeHandlers.get(bridgeUID)); switch (sceneID) { case SceneHandler.SCENE_WRONG: logger.error( "Configured scene '{}' does not exist or can not be used, please check your configuration.", configuration.get(DigitalSTROMBindingConstants.SCENE_ID)); break; case SceneHandler.ZONE_WRONG: logger.error("Configured zone '{}' does not exist, please check your configuration.", configuration.get(DigitalSTROMBindingConstants.ZONE_ID)); break; case SceneHandler.GROUP_WRONG: logger.error("Configured group '{}' does not exist, please check your configuration.", configuration.get(DigitalSTROMBindingConstants.GROUP_ID)); break; case SceneHandler.NO_STRUC_MAN: logger.error("Waiting for building digitalSTROM model."); break; case SceneHandler.NO_SCENE: logger.error("No Scene-ID is set!"); break; case SceneHandler.NO_BRIDGE: logger.error("No related bridge found!"); default: return new ThingUID(thingTypeUID, bridgeUID, sceneID); } return thingUID; }
Source:
static void updateFromSession(final HttpSession session) { final String json = (String) session.getAttribute(LOGGED_USER_AUTHENTICATION_CONTEXT_ATTRIBUTE); final AuthenticationContext authenticationContext = AuthenticationContext.importFromJson(json); final User user = authenticationContext.getUser(); if (user != null && FenixFramework.isDomainObjectValid(user)) { loggedUserContext.set(authenticationContext); } else { clear(); } }

Target:
static void updateFromSession(final HttpSession session) { if (session != null) { final AuthenticationContext authenticationContext = (AuthenticationContext) session.getAttribute(LOGGED_USER_AUTHENTICATION_CONTEXT_ATTRIBUTE); if (authenticationContext != null) { final User user = authenticationContext.getUser(); if (user != null && FenixFramework.isDomainObjectValid(user)) { loggedUserContext.set(authenticationContext); } else { clear(); } } } }
Source:
public Azure azure(AzureTokenCredentials credentials, AzureProperties azureProperties) throws IOException { RestClient restClient = new RestClient.Builder() .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials).withSerializerAdapter(new AzureJacksonAdapter()) .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) .withInterceptor(new ProviderRegistrationInterceptor(credentials)) .withInterceptor(new ResourceManagerThrottlingInterceptor()).withUserAgent(SPRING_CLOUD_USER_AGENT) .build(); if (azureProperties.getSubscriptionId() == null) { return Azure.authenticate(restClient, credentials.domain()) .withSubscription(credentials.defaultSubscriptionId()); } else { return Azure.authenticate(restClient, credentials.domain()) .withSubscription(azureProperties.getSubscriptionId()); } }

Target:
public Azure azure(AzureTokenCredentials credentials, AzureProperties azureProperties) throws IOException { RestClient restClient = new RestClient.Builder() .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials).withSerializerAdapter(new AzureJacksonAdapter()) .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) .withInterceptor(new ProviderRegistrationInterceptor(credentials)) .withInterceptor(new ResourceManagerThrottlingInterceptor()).withUserAgent(SPRING_CLOUD_USER_AGENT) .build(); String subscriptionId = Optional.of(azureProperties.getSubscriptionId()) .orElseGet(credentials::defaultSubscriptionId); return Azure.authenticate(restClient, credentials.domain()) .withSubscription(subscriptionId); }
Source:
private List getListOfMirrors() { try { Configuration config = new PropertiesConfiguration("src/main/resources/config.properties"); List mirrorList = config.getList("mirror1"); return mirrorList; } catch (ConfigurationException e1) { return new ArrayList<String>(); } }

Target:
private List<String> getListOfMirrors() { Properties prop = new Properties(); List<String> mirrorList = new ArrayList<String>(); try { prop.load(ClassLoader.getSystemResourceAsStream("config.properties")); int i = 1; while (prop.getProperty("mirror" + i) != null) { mirrorList.add(prop.getProperty("mirror" + i)); i++; } } catch (IOException e) { } return mirrorList; }
Source:
public HttpPanelSender(HttpPanelRequest requestPanel, HttpPanelResponse responsePanel) { this.responsePanel = responsePanel; requestPanel.addOptions( getButtonUseTrackingSessionState(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); requestPanel.addOptions(getButtonUseCookies(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); requestPanel.addOptions( getButtonFollowRedirects(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); requestPanel.addOptions(getButtonUseCsrf(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); final boolean isSessionTrackingEnabled = Model.getSingleton().getOptionsParam().getConnectionParam().isHttpStateEnabled(); getButtonUseTrackingSessionState().setEnabled(isSessionTrackingEnabled); }

Target:
public HttpPanelSender(HttpPanelRequest requestPanel, HttpPanelResponse responsePanel) { this.responsePanel = responsePanel; extAntiCSRF = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAntiCSRF.class); requestPanel.addOptions( getButtonUseTrackingSessionState(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); requestPanel.addOptions(getButtonUseCookies(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); requestPanel.addOptions( getButtonFollowRedirects(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); if (extAntiCSRF != null) { requestPanel.addOptions(getButtonUseCsrf(), HttpPanel.OptionsLocation.AFTER_COMPONENTS); } final boolean isSessionTrackingEnabled = Model.getSingleton().getOptionsParam().getConnectionParam().isHttpStateEnabled(); getButtonUseTrackingSessionState().setEnabled(isSessionTrackingEnabled); }
Source:
void initTableButtons() { getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.addDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getNewCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.removeDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getRemoveCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.moveDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getMoveCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.copyDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getCopyCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.getDiskAlignment(), CommandLocation.OnlyFromContext) { @Override protected UICommand resolveCommand() { return getMainModel().getScanAlignmentCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.uploadDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getUploadCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.assignQuota()) { @Override protected UICommand resolveCommand() { return getMainModel().getChangeQuotaCommand(); } }); }

Target:
void initTableButtons() { getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.addDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getNewCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.removeDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getRemoveCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.moveDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getMoveCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.copyDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getCopyCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.getDiskAlignment(), CommandLocation.OnlyFromContext) { @Override protected UICommand resolveCommand() { return getMainModel().getScanAlignmentCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.exportDisk()) { @Override protected UICommand resolveCommand() { return getMainModel().getExportCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Disk>(constants.assignQuota()) { @Override protected UICommand resolveCommand() { return getMainModel().getChangeQuotaCommand(); } }); }
Source:
public void writeMergeHeads(List<ObjectId> heads) throws IOException { File mergeHeadFile = new File(gitDir, Constants.MERGE_HEAD); if (heads != null) { FileOutputStream fos = new FileOutputStream(mergeHeadFile); try { boolean first = true; for (ObjectId id : heads) { if (first) first = false; else fos.write(10); fos.write(id.name().getBytes(Constants.CHARACTER_ENCODING)); } } finally { fos.close(); } } else { mergeHeadFile.delete(); } }

Target:
public void writeMergeHeads(List<ObjectId> heads) throws IOException { File mergeHeadFile = new File(gitDir, Constants.MERGE_HEAD); if (heads != null) { BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream(mergeHeadFile)); try { for (ObjectId id : heads) { id.copyTo(bos); bos.write('\n'); } } finally { bos.close(); } } else { mergeHeadFile.delete(); } }
Source:
public static CLProgram getProgram(String name) { if (programs.containsKey(name)) { return programs.get(name); } else { if (openCLDir.exists() && openCLDir.isDirectory()) { File file = new File(openCLDir, name); if (file.exists()) { try (InputStream input = new FileInputStream(file)) { CLProgram program = context.createProgram(input).build(); programs.put(name, program); return program; } catch (IOException ex) { GlowServer.logger.log(Level.WARNING, "Could not load custom OpenCL program. Trying builtins.", ex); } } else { try (InputStream input = CLASS_LOADER .getResourceAsStream("builtin/opencl/" + name)) { CLProgram program = context.createProgram(input).build(); programs.put(name, program); return program; } catch (IOException ex) { GlowServer.logger.log(Level.WARNING, "Could not load builtin OpenCL program.", ex); } } } } return null; }

Target:
public static CLProgram getProgram(String name) { if (programs.containsKey(name)) { return programs.get(name); } else { if (openCLDir.exists() && openCLDir.isDirectory()) { File file = new File(openCLDir, name); if (file.exists()) { try (InputStream input = new FileInputStream(file)) { CLProgram program = context.createProgram(input).build(); programs.put(name, program); return program; } catch (IOException ex) { GlowServer.logger.log(Level.WARNING, "Could not load custom OpenCL program.", ex); } } else { try (InputStream input = CLASS_LOADER .getResourceAsStream("builtin/opencl/" + name)) { CLProgram program = context.createProgram(input).build(); programs.put(name, program); return program; } catch (IOException ex) { GlowServer.logger.log(Level.WARNING, "Could not load builtin OpenCL program.", ex); } } } } return null; }
Source:
private void startTask(String timestampColumn, String incrementingColumn, String query, Long delay) { String mode = null; if (timestampColumn != null && incrementingColumn != null) { mode = JdbcSourceConnectorConfig.MODE_TIMESTAMP_INCREMENTING; } else if (timestampColumn != null) { mode = JdbcSourceConnectorConfig.MODE_TIMESTAMP; } else if (incrementingColumn != null) { mode = JdbcSourceConnectorConfig.MODE_INCREMENTING; } else { mode = JdbcSourceConnectorConfig.MODE_BULK; } initializeTask(); Map<String, String> taskConfig = singleTableConfig(); taskConfig.put(JdbcSourceConnectorConfig.MODE_CONFIG, mode); if (query != null) { taskConfig.put(JdbcSourceTaskConfig.QUERY_CONFIG, query); taskConfig.put(JdbcSourceTaskConfig.TABLES_CONFIG, ""); } if (timestampColumn != null) { taskConfig.put(JdbcSourceConnectorConfig.TIMESTAMP_COLUMN_NAME_CONFIG, timestampColumn); } if (incrementingColumn != null) { taskConfig.put(JdbcSourceConnectorConfig.INCREMENTING_COLUMN_NAME_CONFIG, incrementingColumn); } taskConfig.put(JdbcSourceConnectorConfig.TIMESTAMP_DELAY_INTERVAL_MS_CONFIG, delay.toString()); task.start(taskConfig); }

Target:
private void startTask(String timestampColumn, String incrementingColumn, String query, Long delay) { String mode = null; if (timestampColumn != null && incrementingColumn != null) { mode = JdbcSourceConnectorConfig.MODE_TIMESTAMP_INCREMENTING; } else if (timestampColumn != null) { mode = JdbcSourceConnectorConfig.MODE_TIMESTAMP; } else if (incrementingColumn != null) { mode = JdbcSourceConnectorConfig.MODE_INCREMENTING; } else { mode = JdbcSourceConnectorConfig.MODE_BULK; } initializeTask(); Map<String, String> taskConfig = singleTableConfig(); taskConfig.put(JdbcSourceConnectorConfig.MODE_CONFIG, mode); if (query != null) { taskConfig.put(JdbcSourceTaskConfig.QUERY_CONFIG, query); taskConfig.put(JdbcSourceTaskConfig.TABLES_CONFIG, ""); } if (timestampColumn != null) { taskConfig.put(JdbcSourceConnectorConfig.TIMESTAMP_COLUMN_NAME_CONFIG, timestampColumn); } if (incrementingColumn != null) { taskConfig.put(JdbcSourceConnectorConfig.INCREMENTING_COLUMN_NAME_CONFIG, incrementingColumn); } taskConfig.put(JdbcSourceConnectorConfig.TIMESTAMP_DELAY_INTERVAL_MS_CONFIG, delay == null ? "0" : delay.toString()); task.start(taskConfig); }