auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<OfflineSegmentZKMetadata> getOfflineSegmentZKMetadataListForTable( ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName) { String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName); String parentPath = constructPropertyStorePathForResource(offlineTableName); List<ZNRecord> znRecords = propertyStore.getChildren(parentPath, null, AccessOption.PERSISTENT, ZK_OP_RETRY_COUNT, ZK_OP_RETRY_INTERVAL_MS); if (znRecords != null) { int numZNRecords = znRecords.size(); List<OfflineSegmentZKMetadata> offlineSegmentZKMetadataList = new ArrayList<>(numZNRecords); for (ZNRecord znRecord : znRecords) { if (znRecord != null) { offlineSegmentZKMetadataList.add(new OfflineSegmentZKMetadata(znRecord)); } } int numNullZNRecords = numZNRecords - offlineSegmentZKMetadataList.size(); if (numNullZNRecords > 0) { LOGGER.warn("Failed to read {}/{} offline segment ZK metadata under path: {}", numZNRecords - numNullZNRecords, numZNRecords, parentPath); } return offlineSegmentZKMetadataList; } else { LOGGER.warn("Path: does not exist", parentPath); return Collections.emptyList(); } }

Target:
public static List<OfflineSegmentZKMetadata> getOfflineSegmentZKMetadataListForTable( ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName) { String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName); String parentPath = constructPropertyStorePathForResource(offlineTableName); List<ZNRecord> znRecords = propertyStore.getChildren(parentPath, null, AccessOption.PERSISTENT, CommonConstants.Helix.ZkClient.RETRY_COUNT, CommonConstants.Helix.ZkClient.RETRY_INTERVAL_MS); if (znRecords != null) { int numZNRecords = znRecords.size(); List<OfflineSegmentZKMetadata> offlineSegmentZKMetadataList = new ArrayList<>(numZNRecords); for (ZNRecord znRecord : znRecords) { if (znRecord != null) { offlineSegmentZKMetadataList.add(new OfflineSegmentZKMetadata(znRecord)); } } int numNullZNRecords = numZNRecords - offlineSegmentZKMetadataList.size(); if (numNullZNRecords > 0) { LOGGER.warn("Failed to read {}/{} offline segment ZK metadata under path: {}", numZNRecords - numNullZNRecords, numZNRecords, parentPath); } return offlineSegmentZKMetadataList; } else { LOGGER.warn("Path: does not exist", parentPath); return Collections.emptyList(); } }
Source:
private void writeEncryptedMapToJSON(String jsonMapName, LinkedHashMap<String, Object> data, boolean includeNullField, String encryption_key, String secret_key) throws IOException{ JsonGenerator generator = jsonGeneratorThreadLocal.get(); JSONObject obj = new JSONObject(); for (String key : data.keySet()) { Object value = data.get(key); if (value == null && !includeNullField) continue; if ( value instanceof List ) { List stringList = (List) value; obj.put(key, stringList); } else if (value instanceof RawJSONString) { obj.put(key, ((RawJSONString) value).json); } else { obj.put(key, value); } } generator.writeStringField(jsonMapName, RowEncrypt.encrypt(obj.toString(), encryption_key, secret_key)); }

Target:
private void writeEncryptedMapToJSON(String jsonMapName, LinkedHashMap<String, Object> data, boolean includeNullField, String encryption_key, String secret_key) throws IOException{ JsonGenerator generator = jsonGeneratorThreadLocal.get(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); JsonGenerator obj = jsonFactory.createGenerator(outputStream); obj.writeStartObject(); for (String key : data.keySet()) { Object value = data.get(key); if (value == null && !includeNullField) continue; if ( value instanceof List ) { List stringList = (List) value; obj.writeArrayFieldStart(key); for ( Object s : stringList ) { obj.writeObject(s); } obj.writeEndArray(); } else if (value instanceof RawJSONString) { obj.writeFieldName(key); obj.writeRawValue(((RawJSONString) value).json); } else { obj.writeObjectField(key, value); } } obj.writeEndObject(); obj.close(); outputStream.close(); generator.writeStringField(jsonMapName, RowEncrypt.encrypt(outputStream.toString(), encryption_key, secret_key)); }
Source:
public void validate_shouldRejectAVisitIfItHasMoreThanMaxOccursOfAnAttributeWhenExpectedExactlyOne() throws Exception { executeDataSet("org/openmrs/validator/include/VisitValidatorTest-additionalAttributeType1.xml"); Visit visit = makeVisit(); visit.addAttribute(makeAttribute("one")); visit.addAttribute(makeAttribute("two")); visit.addAttribute(makeAttribute("three")); visit.addAttribute(makeAttribute("four")); try { ValidateUtil.validate(visit); } catch (ValidationException e) { Errors errors = e.getErrors(); assertEquals(1, errors.getErrorCount()); assertEquals("attribute.error.maxOccurs", errors.getFieldError("activeAttributes").getCode()); } }

Target:
public void validate_shouldRejectAVisitIfItHasMoreThanMaxOccursOfAnAttributeWhenExpectedExactlyOne() throws Exception { executeDataSet("org/openmrs/validator/include/VisitValidatorTest-additionalAttributeType1.xml"); Visit visit = makeVisit(); visit.addAttribute(makeAttribute("one")); visit.addAttribute(makeAttribute("two")); visit.addAttribute(makeAttribute("three")); visit.addAttribute(makeAttribute("four")); try { ValidateUtil.validate(visit); fail(); } catch (ValidationException e) { Errors errors = e.getErrors(); assertEquals(1, errors.getErrorCount()); assertEquals("attribute.error.maxOccurs", errors.getFieldError("activeAttributes").getCode()); } }
Source:
public String toString() { return String.format("%30s: fboId: %s", this.getClass().getSimpleName(), fboId); }

Target:
public String toString() { return String.format("%30s: %s (fboId: %s)", this.getClass().getSimpleName(), fboName, fboId); }
Source:
public void doGradualExport() { busyIndicatorView.showBusyIndicator("Loading Export Wizard"); dataTransferServices.call((DataTransferAssets v) -> { busyIndicatorView.hideBusyIndicator(); exportWizard.start(v); }, (message, error) -> { busyIndicatorView.hideBusyIndicator(); view.exportError(error); return false; }).assetsToExport(); }

Target:
public void doGradualExport() { busyIndicatorView.showBusyIndicator(i18n.loadingExportWizard()); dataTransferServices.call((DataTransferAssets v) -> { busyIndicatorView.hideBusyIndicator(); exportWizard.start(v); }, (message, error) -> { busyIndicatorView.hideBusyIndicator(); view.exportError(error); return false; }).assetsToExport(); }
Source:
static CDIInterceptorWrapper createWrapper(Class<?> restClient) { try { return AccessController.doPrivileged((PrivilegedExceptionAction<CDIInterceptorWrapper>) () -> { Class<?> cdiClass = Class.forName("javax.enterprise.inject.spi.CDI", false, restClient.getClassLoader()); Method currentMethod = cdiClass.getMethod("current"); Object cdiCurrent = currentMethod.invoke(null); Method getBeanMgrMethod = cdiClass.getMethod("getBeanManager"); getBeanMgrMethod.invoke(cdiCurrent); return new CDIInterceptorWrapperImpl(restClient); }); } catch (PrivilegedActionException pae) { if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "Unable to load CDI SPI classes, assuming no CDI is available", pae); } return new BasicCDIInterceptorWrapper(); } }

Target:
static CDIInterceptorWrapper createWrapper(Class<?> restClient) { try { return AccessController.doPrivileged((PrivilegedExceptionAction<CDIInterceptorWrapper>) () -> { Class<?> cdiClass = Class.forName("javax.enterprise.inject.spi.CDI", false, restClient.getClassLoader()); Method currentMethod = cdiClass.getMethod("current"); Object cdiCurrent = currentMethod.invoke(null); Method getBeanMgrMethod = cdiClass.getMethod("getBeanManager"); return new CDIInterceptorWrapperImpl(restClient, getBeanMgrMethod.invoke(cdiCurrent)); }); } catch (PrivilegedActionException pae) { if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "Unable to load CDI SPI classes, assuming no CDI is available", pae); } return new BasicCDIInterceptorWrapper(); } }
Source:
private Job getProject(ItemGroup ctx, String projectName) { String[] parts = projectName.split("/"); for (String part : parts) { if (part == null) continue; Item i = ctx.getItem(part); if (i instanceof ItemGroup) ctx = (ItemGroup) i; if (i instanceof Job) { return (Job) i; } } return null; }

Target:
private Job getProject(ItemGroup ctx, String projectName) { String[] parts = projectName.split("/"); if (projectName.startsWith("/")) ctx = Jenkins.getInstance(); for (String part : parts) { if (part.length() == 0) continue; if (part.equals("..")) { ctx = ((Item) ctx).getParent(); continue; } Item i = ctx.getItem(part); if (i instanceof Job) return (Job) i; ctx = (ItemGroup) i; } return null; }
Source:
private void refreshConfig(TreeViewer tv, final TaskRepository repository) { clearError(); try { final GerritClient client = GerritCorePlugin.getGerritClient(repository); getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.GerritRepositorySearchPage_Refreshing + repository.getRepositoryLabel(), IProgressMonitor.UNKNOWN); try { client.refreshConfig(monitor); } catch (GerritException e) { throw new InvocationTargetException(e, e.getMessage()); } monitor.done(); } }); tv.refresh(repository); } catch (InvocationTargetException e) { showError(e, e.getMessage()); } catch (InterruptedException e) { } }

Target:
private void refreshConfig(TreeViewer tv, final TaskRepository repository) { clearError(); try { final GerritClient client = GerritCorePlugin.getGerritClient(repository); getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask( NLS.bind(Messages.GerritRepositorySearchPage_Refreshing_X, repository.getRepositoryLabel()), IProgressMonitor.UNKNOWN); try { client.refreshConfig(monitor); } catch (GerritException e) { throw new InvocationTargetException(e, e.getMessage()); } monitor.done(); } }); tv.refresh(repository); } catch (InvocationTargetException e) { showError(e, e.getMessage()); } catch (InterruptedException e) { } }
Source:
protected TreeViewer doCreateTreeViewer(Composite parent, int style) { return new TreeViewer(parent, style); }

Target:
protected TreeViewer doCreateTreeViewer(Composite parent, int style) { return new NotifyingTreeViewer(parent, style); }
Source:
public byte[] getData() { return data; }

Target:
public byte[] getData() { return data.clone(); }
Source:
public void bbCodesWithTextThatShouldFail(String postBody, String messageIfTestFails) throws Exception { info("Running a test case [" + messageIfTestFails + "]"); try { Topics.postAnswer(TEST_TOPIC, new Post(postBody)); fail(messageIfTestFails); } catch (ValidationException e) { } catch (CouldNotOpenPageException e) { fail("Something went wrong and user was thrown out of topic."); } }

Target:
public void bbCodesWithTextThatShouldFail(String postBody, String messageIfTestFails) throws Exception { info("Running a test case [" + messageIfTestFails + "]"); try { Topics.postAnswer(TEST_TOPIC, new Post(postBody)); fail(messageIfTestFails); } catch (ValidationException e) { } }
Source:
public MessageHandler transformer(BeanFactory beanFactory) throws Exception { FilterFactoryBean factoryBean = new FilterFactoryBean(); factoryBean.setBeanFactory(beanFactory); factoryBean.setOutputChannel(channels.output()); properties.configure(factoryBean); return factoryBean.getObject(); }

Target:
public MessageHandler transformer(BeanFactory beanFactory) throws Exception { FilterFactoryBean factoryBean = new FilterFactoryBean(); factoryBean.setBeanFactory(beanFactory); factoryBean.setOutputChannel(channels.output()); if (properties.getScript() != null) { GroovyScriptExecutingMessageProcessor processor = new GroovyScriptExecutingMessageProcessor( new ResourceScriptSource(properties.getScript()), scriptVariableGenerator); factoryBean.setTargetObject(processor); } else { factoryBean.setExpression(properties.getExpression()); } return factoryBean.getObject(); }
Source:
public ValidationResult isDiskAttachedToVm(VM vm) { List<VM> vms = getVmDao().getVmsListForDisk(disk.getId(), true); String[] replacements = {String.format(DISK_NAME_REPLACEMENT, disk.getDiskAlias()), String.format(VM_NAME_REPLACEMENT, vm.getName())}; return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_ATTACHED_TO_VM, replacements). when(vms.stream().noneMatch(vm1 -> vm1.getId().equals(vm.getId()))); }

Target:
public ValidationResult isDiskAttachedToVm(VM vm) { List<VM> vms = getVmDao().getVmsListForDisk(disk.getId(), true); String[] replacements = {ReplacementUtils.createSetVariableString(DISK_NAME_VARIABLE, disk.getDiskAlias()), ReplacementUtils.createSetVariableString(VM_NAME_VARIABLE, vm.getName())}; return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_ATTACHED_TO_VM, replacements). when(vms.stream().noneMatch(vm1 -> vm1.getId().equals(vm.getId()))); }
Source:
public static void handleSingleRepositoryCheckoutOperationResult( Repository repository, CheckoutResult result, String target) { if (result.getStatus() == CheckoutResult.Status.CONFLICTS) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); if (UIRepositoryUtils.showCleanupDialog(repository, result.getConflictList(), UIText.BranchResultDialog_CheckoutConflictsTitle, shell)) { BranchOperationUI.checkout(repository, target, false) .start(); } }); } else if (result.getStatus() == CheckoutResult.Status.NONDELETED) { boolean show = false; List<String> pathList = result.getUndeletedList(); for (String path : pathList) if (new File(repository.getWorkTree(), path).exists()) { show = true; break; } if (!show) { return; } PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new NonDeletedFilesDialog(shell, repository, result.getUndeletedList()).open(); }); } else if (result.getStatus() == CheckoutResult.Status.OK) { return; } else { String repoName = Activator.getDefault().getRepositoryUtil() .getRepositoryName(repository); String message = NLS.bind( UIText.BranchOperationUI_CheckoutError_DialogMessage, repoName, target); PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); MessageDialog.openError(shell, UIText.BranchOperationUI_CheckoutError_DialogTitle, message); }); } }

Target:
public static void handleSingleRepositoryCheckoutOperationResult( Repository repository, CheckoutResult result, String target) { switch (result.getStatus()) { case CONFLICTS: PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); if (UIRepositoryUtils.showCleanupDialog(repository, result.getConflictList(), UIText.BranchResultDialog_CheckoutConflictsTitle, shell)) { BranchOperationUI.checkout(repository, target, false) .start(); } }); break; case NONDELETED: boolean show = false; List<String> pathList = result.getUndeletedList(); for (String path : pathList) if (new File(repository.getWorkTree(), path).exists()) { show = true; break; } if (!show) { return; } PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new NonDeletedFilesDialog(shell, repository, result.getUndeletedList()).open(); }); break; case OK: return; case NOT_TRIED: case ERROR: String repoName = Activator.getDefault().getRepositoryUtil() .getRepositoryName(repository); String message = NLS.bind( UIText.BranchOperationUI_CheckoutError_DialogMessage, repoName, target); PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); MessageDialog.openError(shell, UIText.BranchOperationUI_CheckoutError_DialogTitle, message); }); } }
Source:
private void onFinish() { synchronized (processing) { processing.getAndDecrement(); if (processing.get() == 0) { serializer.store(rootFile.getName(), rootFile); } } }

Target:
private void onFinish() { synchronized (processingLock) { if (processing.decrementAndGet() == 0) { serializer.store(rootFile.getName(), rootFile); isProcessing = false; } } }
Source:
public int getSupportFlags() { return 0; }

Target:
public int getSupportFlags() { return SUPPORT_FLAG_ENDLESS_SCROLLING; }
Source:
public Value evaluate(ValueFactory valueFactory, Value... values) throws ValueExprEvaluationException { Preconditions.checkArgument(values.length == 4); Preconditions.checkArgument(values[0] instanceof Literal); Preconditions.checkArgument(values[1] instanceof Literal); Preconditions.checkArgument(values[2] instanceof Literal); Preconditions.checkArgument(values[3] instanceof URI); long epochTime1 = convertDatetimeToMillis((Literal) values[0]); long epochTime2 = convertDatetimeToMillis((Literal) values[1]); long periodMillis = convertPeriodToMillis((Literal) values[2], (URI) values[3]); return valueFactory.createLiteral(Math.abs(epochTime1 - epochTime2) < periodMillis); }

Target:
public Value evaluate(ValueFactory valueFactory, Value... values) throws ValueExprEvaluationException { checkNotNull(valueFactory); checkNotNull(values); try { checkArgument(values.length == 4); checkArgument(values[0] instanceof Literal); checkArgument(values[1] instanceof Literal); checkArgument(values[2] instanceof Literal); checkArgument(values[3] instanceof URI); Instant dateTime1 = convertToInstant((Literal) values[0]); Instant dateTime2 = convertToInstant((Literal) values[1]); long periodMillis = convertPeriodToMillis((Literal) values[2], (URI) values[3]); long timeBetween = Math.abs(Duration.between(dateTime1, dateTime2).toMillis()); return valueFactory.createLiteral(timeBetween < periodMillis); } catch (Exception e) { throw new ValueExprEvaluationException(e); } }
Source:
public JSONObject toJson() throws JSONException { JSONObject metadata = new JSONObject(); metadata.put(JSON_VERSION_KEY, CURRENT_JSON_VERSION); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(STATUS_KEY, status); metadata.put(DESCRIPTION_KEY, description); metadata.put(IS_PRIVATE_KEY, !cacheable); metadata.put(PARENT_ACCOUNT_ID_KEY, parentAccountId); return metadata; }

Target:
JSONObject toJson() throws JSONException { JSONObject metadata = new JSONObject(); switch (currentJsonVersion) { case JSON_VERSION_1: metadata.put(JSON_VERSION_KEY, JSON_VERSION_1); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(STATUS_KEY, status); metadata.put(DESCRIPTION_KEY, description); metadata.put(IS_PRIVATE_KEY, !cacheable); metadata.put(PARENT_ACCOUNT_ID_KEY, parentAccountId); break; case JSON_VERSION_2: metadata.put(Container.JSON_VERSION_KEY, JSON_VERSION_2); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(Container.STATUS_KEY, status); metadata.put(DESCRIPTION_KEY, description); metadata.put(ENCRYPTED_KEY, encrypted); metadata.put(PREVIOUSLY_ENCRYPTED_KEY, previouslyEncrypted); metadata.put(CACHEABLE_KEY, cacheable); metadata.put(MEDIA_SCAN_DISABLED, mediaScanDisabled); break; default: throw new IllegalStateException("Unsupported container json version=" + currentJsonVersion); } return metadata; }
Source:
public ListMultimap<Job, Future<Run>> perform2(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { ListMultimap<Job, Future<Run>> futures = super.perform2(build, launcher, listener); if(block==null) return ArrayListMultimap.create(); return futures; }

Target:
public ListMultimap<AbstractProject, Future<AbstractBuild>> perform2(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { ListMultimap<AbstractProject, Future<AbstractBuild>> futures = super.perform2(build, launcher, listener); if(block==null) return ArrayListMultimap.create(); return futures; }
Source:
private int openBrowser(String command, String... parameters) { try { String[] commandArray = new String[parameters.length + 1]; commandArray[0] = command; for (int i = 0; i < parameters.length; i++) { commandArray[i + 1] = parameters[i]; } Process pr = Runtime.getRuntime().exec(commandArray); StreamConsumer outputs = new StreamConsumer(pr.getInputStream()); (outputs).start(); StreamConsumer errors = new StreamConsumer(pr.getErrorStream()); (errors).start(); pr.waitFor(); int ret = pr.exitValue(); if (ret == 0 && errorsInOutput(outputs, errors)) { return -1; } return ret; } catch (InterruptedException e) { } catch (IOException e) { WebBrowserUIPlugin.logError("Launching " + executable + " has failed.", e); return 0; } return -1; }

Target:
private int openBrowser(String command, String... parameters) { try { String[] commandArray = new String[parameters.length + 1]; commandArray[0] = command; System.arraycopy(parameters, 0, commandArray, 1, parameters.length); Process pr = Runtime.getRuntime().exec(commandArray); StreamConsumer outputs = new StreamConsumer(pr.getInputStream()); (outputs).start(); StreamConsumer errors = new StreamConsumer(pr.getErrorStream()); (errors).start(); pr.waitFor(); int ret = pr.exitValue(); if (ret == 0 && errorsInOutput(outputs, errors)) { return -1; } return ret; } catch (InterruptedException e) { } catch (IOException e) { WebBrowserUIPlugin.logError("Launching " + executable + " has failed.", e); return 0; } return -1; }
Source:
public JavaKeyStoreSecureStoreConfig setPassword(String password) { checkNotNull(password, "Java Key Store password cannot be null!"); this.password = password; return this; }

Target:
public JavaKeyStoreSecureStoreConfig setPassword(String password) { this.password = password; return this; }
Source:
private synchronized boolean persist(GerritTriggeredEvent evt) { long ts = evt.getEventCreatedOn().getTime(); if (ts == 0) { logger.warn("Event CreatedOn is 0...Gerrit Server does not support attribute eventCreateOn. " + "Will NOT persist this event and Missed Events will be disabled!"); isSupported = false; return false; } if (serverTimestamp != null && ts < serverTimestamp.getTimeSlice()) { logger.debug("Event has same time slice or is earlier...NOT Updating time slice.", ts); } else { if (serverTimestamp == null) { serverTimestamp = new EventTimeSlice(ts); serverTimestamp.addEvent(evt); } else { if (ts > serverTimestamp.getTimeSlice()) { logger.debug("Current timestamp is GREATER than slice time {}.", ts, serverTimestamp.getTimeSlice()); serverTimestamp = new EventTimeSlice(ts); serverTimestamp.addEvent(evt); } else { if (ts == serverTimestamp.getTimeSlice()) { logger.debug("Current timestamp is EQUAL to slice time {}.", ts, serverTimestamp.getTimeSlice()); serverTimestamp.addEvent(evt); } } } } XmlFile config = getConfigXml(serverName); try { config.write(serverTimestamp); } catch (IOException e) { logger.error(e.getMessage(), e); return false; } return true; }

Target:
private synchronized boolean persist(GerritTriggeredEvent evt) { long ts = evt.getEventCreatedOn().getTime(); if (ts == 0) { logger.warn("Event CreatedOn is 0...Gerrit Server does not support attribute eventCreateOn. " + "Will NOT persist this event and Missed Events will be disabled!"); isSupported = false; return false; } if (serverTimestamp != null && ts < serverTimestamp.getTimeSlice()) { logger.debug("Event has same time slice or is earlier...NOT Updating time slice.", ts); return false; } else { if (serverTimestamp == null) { serverTimestamp = new EventTimeSlice(ts); serverTimestamp.addEvent(evt); } else { if (ts > serverTimestamp.getTimeSlice()) { logger.debug("Current timestamp is GREATER than slice time {}.", ts, serverTimestamp.getTimeSlice()); serverTimestamp = new EventTimeSlice(ts); serverTimestamp.addEvent(evt); } else { if (ts == serverTimestamp.getTimeSlice()) { logger.debug("Current timestamp is EQUAL to slice time {}.", ts, serverTimestamp.getTimeSlice()); serverTimestamp.addEvent(evt); } } } } try { XmlFile config = getConfigXml(serverName); config.write(serverTimestamp); } catch (IOException e) { logger.error(e.getMessage(), e); return false; } return true; }
Source:
public ApplePayConfig getApplePayConfig() { return applePay; }

Target:
public ApplePayConfig getApplePayConfig() { return applePayConfig; }
Source:
public void executeTool() { try { Configuration conf = HBaseConfiguration.addHbaseResources(getConf()); Connection conn = ConnectionUtil.getInputConnection(conf); ConnectionQueryServices queryServices = conn.unwrap(PhoenixConnection.class) .getQueryServices(); extractTablesAndIndexes(conn.unwrap(PhoenixConnection.class)); executeTool(conn, queryServices, conf); } catch (SQLException e) { LOGGER.severe("Something went wrong in executing tool "+ e); System.exit(-1); } }

Target:
public int executeTool() { Configuration conf = HBaseConfiguration.addHbaseResources(getConf()); try (Connection conn = ConnectionUtil.getInputConnection(conf)) { ConnectionQueryServices queryServices = conn.unwrap(PhoenixConnection.class) .getQueryServices(); boolean status = extractTablesAndIndexes(conn.unwrap(PhoenixConnection.class)); if (status) { return executeTool(conn, queryServices, conf); } } catch (SQLException e) { LOGGER.severe("Something went wrong in executing tool "+ e); } return -1; }
Source:
private LinkedHashMap<String, ArrayList<String>> getPathToAliases(MapredWork mrWork) { String mapWorkClassName = "org.apache.hadoop.hive.ql.plan.MapWork"; Class<?> clazz = MapredWork.class; Method m_getMapWork = null; try { clazz = Class.forName(mapWorkClassName); m_getMapWork = MapredWork.class.getDeclaredMethod("getMapWork"); } catch (Exception e) { LOG.info("No Hive 0.12.0 compatible API was found, couldn't load " + mapWorkClassName); LOG.debug(e); } try { Method m_getPathToAlias = clazz.getDeclaredMethod("getPathToAliases"); Object obj = (m_getMapWork == null) ? mrWork : m_getMapWork.invoke(mrWork); return (LinkedHashMap<String, ArrayList<String>>) m_getPathToAlias.invoke(obj); } catch (Exception e) { LOG.fatal("Can't access to getPathToAliases() on " + MapredWork.class.getName(), e); throw new RuntimeException("Incompatible Hive API found. Expected: 0.11.0+", e); } }

Target:
private LinkedHashMap<String, ArrayList<String>> getPathToAliases(MapredWork mrWork) { return closure.apply(mrWork); }
Source:
public void registerConvertersIn(GenericConversionService conversionService) { Assert.notNull(conversionService, "ConversionService must not be null!"); converters.forEach(it -> { boolean added = false; if (it instanceof Converter) { conversionService.addConverter(Converter.class.cast(it)); added = true; } if (it instanceof ConverterFactory) { conversionService.addConverterFactory(ConverterFactory.class.cast(it)); added = true; } if (it instanceof GenericConverter) { conversionService.addConverter(GenericConverter.class.cast(it)); added = true; } if (!added) { throw new IllegalArgumentException( "Given set contains element that is neither Converter nor ConverterFactory!"); } }); }

Target:
public void registerConvertersIn(GenericConversionService conversionService) { Assert.notNull(conversionService, "ConversionService must not be null!"); converters.forEach(it -> { boolean added = false; if (it instanceof Converter) { conversionService.addConverter(Converter.class.cast(it)); added = true; } if (it instanceof ConverterFactory) { conversionService.addConverterFactory(ConverterFactory.class.cast(it)); added = true; } if (it instanceof GenericConverter) { conversionService.addConverter(GenericConverter.class.cast(it)); added = true; } if (!added) { throw new IllegalArgumentException(String.format(NOT_A_CONVERTER, it)); } }); }
Source:
protected boolean isLinked(String channelId) { Channel channel = thing.getChannel(channelId); if (channel != null) { return !linkRegistry.getLinks(channel.getUID()).isEmpty(); } else { throw new IllegalArgumentException("Channel with ID '" + channelId + "' does not exists."); } }

Target:
protected boolean isLinked(String channelId) { Channel channel = thing.getChannel(channelId); if (channel != null) { return linkRegistry != null ? !linkRegistry.getLinks(channel.getUID()).isEmpty() : false; } else { throw new IllegalArgumentException("Channel with ID '" + channelId + "' does not exists."); } }
Source:
public void setDefaultPrivilegesForCoowner() { this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE, Boolean.valueOf(true)); this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR, Boolean.valueOf(true)); this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION, Boolean.valueOf(true)); this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTION, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTION, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTION, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTION, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTION, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTION, Boolean.valueOf(true)); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTION, Boolean.valueOf(true)); }

Target:
public void setDefaultPrivilegesForCoowner() { this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE, true); this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR, true); this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION, true); this.courseLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTION, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTION, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTION, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTION, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTION, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTION, true); this.sectionLevel.put(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTION, true); }
Source:
private void downloadSingleProjectTest() throws IOException { List<String> expectedPackageFileList = asList( ".che/classpath", "README.md", "pom.xml", "src/main/java/org/eclipse/qa/examples/AppController.java", "src/main/webapp/WEB-INF/jsp/guess_num.jsp", "src/main/webapp/WEB-INF/spring-servlet.xml", "src/main/webapp/WEB-INF/web.xml", "src/main/webapp/index.jsp"); projectExplorer.waitAndSelectItem(TEST_PROJECT_1); projectExplorer.openContextMenuByPathSelectedItem(TEST_PROJECT_1); projectExplorer.clickOnItemInContextMenu(ContextMenuFirstLevelItems.DOWNLOAD); assertEquals( getPackageFileList(DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME), expectedPackageFileList.toString()); menu.runCommand( TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.DOWNLOAD_AS_ZIP); assertEquals( getPackageFileList(DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME), expectedPackageFileList.toString()); }

Target:
private void downloadSingleProjectTest() throws IOException { List<String> expectedPackageFileList = asList( ".che/classpath", "README.md", "pom.xml", "src/main/java/org/eclipse/qa/examples/AppController.java", "src/main/webapp/WEB-INF/jsp/guess_num.jsp", "src/main/webapp/WEB-INF/spring-servlet.xml", "src/main/webapp/WEB-INF/web.xml", "src/main/webapp/index.jsp"); projectExplorer.waitAndSelectItem(TEST_PROJECT_1); projectExplorer.openContextMenuByPathSelectedItem(TEST_PROJECT_1); projectExplorer.clickOnItemInContextMenu(ContextMenuFirstLevelItems.DOWNLOAD); assertEquals( getPackageFileList(DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME), expectedPackageFileList.toString()); downloadedFileUtil.removeDownloadedFiles( seleniumWebDriver.getSessionId(), DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME); menu.runCommand( TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.DOWNLOAD_AS_ZIP); assertEquals( getPackageFileList(DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME), expectedPackageFileList.toString()); }
Source:
public EC2OndemandSlave(String instanceId, String description, String remoteFS, int numExecutors, String labelString, Mode mode, String initScript, String tmpDir, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, String publicDNS, String privateDNS, List<EC2Tag> tags, String cloudName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType) throws FormException, IOException { this(description + " (" + instanceId + ")", instanceId, description, remoteFS, numExecutors, labelString, mode, initScript, tmpDir, Collections.emptyList(), remoteAdmin, jvmopts, stopOnTerminate, idleTerminationMinutes, publicDNS, privateDNS, tags, cloudName, useDedicatedTenancy, launchTimeout, amiType); }

Target:
public EC2OndemandSlave(String instanceId, String description, String remoteFS, int numExecutors, String labelString, Mode mode, String initScript, String tmpDir, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, String publicDNS, String privateDNS, List<EC2Tag> tags, String cloudName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType) throws FormException, IOException { this(instanceId, description, remoteFS, numExecutors, labelString, mode, initScript, tmpDir, remoteAdmin, jvmopts, stopOnTerminate, idleTerminationMinutes, publicDNS, privateDNS, tags, cloudName, false, useDedicatedTenancy, launchTimeout, amiType); }
Source:
public void getObs_ShouldPopulateModelAndViewWitDicomViewerUrlForCompletedStudyAndObsForGivenObsAndGivenValidOrder() throws Exception { mockStudy.setPerformedStatus(PerformedProcedureStepStatus.COMPLETED); when(Utils.serversAddress()).thenReturn("localhost"); when(Utils.serversPort()).thenReturn("8081"); when(Utils.dicomViewerUrlBase()).thenReturn("/oviyam2/viewer.html?"); when(Utils.dicomViewerLocalServerName()).thenReturn("oviyamlocal"); ModelAndView modelAndView = radiologyObsFormController.getObs(validorderId, validObsIdForOrder20); assertNotNull(modelAndView); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); assertTrue(modelAndView.getModelMap().containsKey("dicomViewerUrl")); String dicomViewerUrl = (String) modelAndView.getModelMap().get("dicomViewerUrl"); assertNotNull(dicomViewerUrl); String patID = mockOrder.getPatient().getPatientIdentifier().getIdentifier(); assertTrue(dicomViewerUrl.equals("http://localhost:8081/oviyam2/viewer.html?serverName=oviyamlocal&studyUID=" + mockStudy.getStudyInstanceUid() + "&patientID=" + patID)); }

Target:
public void getObs_ShouldPopulateModelAndViewWitDicomViewerUrlForCompletedStudyAndObsForGivenObsAndGivenValidOrder() throws Exception { mockStudy.setPerformedStatus(PerformedProcedureStepStatus.COMPLETED); when(Utils.serversAddress()).thenReturn("localhost"); when(Utils.serversPort()).thenReturn("8081"); when(Utils.dicomViewerUrlBase()).thenReturn("/weasis-pacs-connector/viewer?"); when(Utils.dicomViewerLocalServerName()).thenReturn(""); when(Utils.dicomViewerUrl()).thenReturn("http://localhost:8081/weasis-pacs-connector/viewer?"); ModelAndView modelAndView = radiologyObsFormController.getObs(validorderId, validObsIdForOrder20); assertNotNull(modelAndView); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); assertTrue(modelAndView.getModelMap().containsKey("dicomViewerUrl")); String dicomViewerUrl = (String) modelAndView.getModelMap().get("dicomViewerUrl"); assertNotNull(dicomViewerUrl); String patID = mockOrder.getPatient().getPatientIdentifier().getIdentifier(); System.out.println("dicomViewerUrl: " + dicomViewerUrl); System.out.println("Utils.dicomViewerUrl(): " + Utils.dicomViewerUrl()); assertTrue(dicomViewerUrl.equals("http://localhost:8081/weasis-pacs-connector/viewer?studyUID=" + mockStudy.getStudyInstanceUid() + "&patientID=" + patID)); }
Source:
private void touchFeatures() { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); IFeatureModel[] workspaceFeatures = manager.getWorkspaceModels(); if (workspaceFeatures.length > 0) { IProgressMonitor monitor = new NullProgressMonitor(); SubMonitor subMonitor = SubMonitor.convert(monitor, workspaceFeatures.length); for (int i = 0; i < workspaceFeatures.length; i++) { try { IResource resource = workspaceFeatures[i].getUnderlyingResource(); if (resource != null) { resource.touch(subMonitor.newChild(1)); } else { monitor.worked(1); } } catch (CoreException e) { } } } fTouchFeatures = false; }

Target:
private void touchFeatures() { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); IFeatureModel[] workspaceFeatures = manager.getWorkspaceModels(); if (workspaceFeatures.length > 0) { IProgressMonitor monitor = new NullProgressMonitor(); SubMonitor subMonitor = SubMonitor.convert(monitor, workspaceFeatures.length); for (int i = 0; i < workspaceFeatures.length; i++) { SubMonitor iterationMonitor = subMonitor.newChild(1); try { IResource resource = workspaceFeatures[i].getUnderlyingResource(); if (resource != null) { resource.touch(iterationMonitor); } } catch (CoreException e) { PDECore.log(e); } } } fTouchFeatures = false; }
Source:
public void setChannelName(String channelName) { super.setReceiver(channelName); this.channelName = channelName; channelTabRoot.setId(channelName); channelTabRoot.setText(channelName); userSearchTextField.setPromptText(i18n.get("chat.userCount", chatService.getChatUsersForChannel(channelName).size())); chatService.getChatUsersForChannel(channelName).addListener((MapChangeListener<? super String, ? super ChatUser>) change -> { Platform.runLater(() -> userSearchTextField.setPromptText(i18n.get("chat.userCount", change.getMap().size()))); }); chatService.addChannelUserListListener(channelName, change -> { if (change.wasAdded()) { onUserJoinedChannel(change.getValueAdded()); } else if (change.wasRemoved()) { onUserLeft(change.getValueRemoved().getUsername()); } }); ConcurrentUtil.executeInBackground(new Task<Void>() { @Override protected Void call() throws Exception { ObservableMap<String, ChatUser> chatUsersForChannel = chatService.getChatUsersForChannel(channelName); synchronized (chatUsersForChannel) { chatUsersForChannel.values().forEach(ChannelTabController.this::onUserJoinedChannel); } return null; } }); channelTabRoot.setOnCloseRequest(event -> chatService.leaveChannel(channelName)); }

Target:
public void setChannelName(String channelName) { super.setReceiver(channelName); this.channelName = channelName; channelTabRoot.setId(channelName); channelTabRoot.setText(channelName); userSearchTextField.setPromptText(i18n.get("chat.userCount", chatService.getChatUsersForChannel(channelName).size())); chatService.getChatUsersForChannel(channelName).addListener((InvalidationListener) change -> { Platform.runLater(() -> userSearchTextField.setPromptText(i18n.get("chat.userCount", chatService.getChatUsersForChannel(channelName).size()))); }); chatService.addChannelUserListListener(channelName, change -> { if (change.wasAdded()) { onUserJoinedChannel(change.getValueAdded()); } else if (change.wasRemoved()) { onUserLeft(change.getValueRemoved().getUsername()); } }); ConcurrentUtil.executeInBackground(new Task<Void>() { @Override protected Void call() throws Exception { ObservableMap<String, ChatUser> chatUsersForChannel = chatService.getChatUsersForChannel(channelName); synchronized (chatUsersForChannel) { chatUsersForChannel.values().forEach(ChannelTabController.this::onUserJoinedChannel); } return null; } }); channelTabRoot.setOnCloseRequest(event -> chatService.leaveChannel(channelName)); }
Source:
private void retrieveFiles() { displayLoading(); URL googleDriveURL = null; try { googleDriveURL = new URL("<LINK_0>"); } catch (MalformedURLException e) { e.printStackTrace(); } GsonResponseParser gsonResponseParser = new GsonResponseParser(); gsonResponseParser.getMarshallingConfig().setDataRoot("items"); PipeManager.config("files", RestfulPipeConfiguration.class) .withUrl(googleDriveURL) .module(authzModule) .responseParser(gsonResponseParser) .forClass(Files.class); @SuppressWarnings("unchecked") Pipe<Files> documentsPipe = PipeManager.getPipe("files", this); documentsPipe.read(new Callback<List<Files>>() { @Override public void onSuccess(final List<Files> fileses) { Toast.makeText(getApplicationContext(), getResources().getQuantityString(R.plurals.fetched, fileses.size()), Toast.LENGTH_LONG).show(); displayDriveFiles(fileses); } @Override public void onFailure(Exception e) { Log.e("EXCEPTION", e.getMessage(), e); Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } }); }

Target:
private void retrieveFiles() { displayLoading(); URL googleDriveURL = null; try { googleDriveURL = new URL("<LINK_0>"); } catch (MalformedURLException e) { e.printStackTrace(); } GsonResponseParser gsonResponseParser = new GsonResponseParser(); gsonResponseParser.getMarshallingConfig().setDataRoot("items"); PipeManager.config("files", RestfulPipeConfiguration.class) .withUrl(googleDriveURL) .module(authzModule) .responseParser(gsonResponseParser) .forClass(Files.class); @SuppressWarnings("unchecked") Pipe<Files> documentsPipe = PipeManager.getPipe("files", this); documentsPipe.read(new Callback<List<Files>>() { @Override public void onSuccess(final List<Files> fileses) { Toast.makeText(getApplicationContext(), getResources().getQuantityString(R.plurals.fetched, fileses.size() , fileses.size()), Toast.LENGTH_LONG).show(); displayDriveFiles(fileses); } @Override public void onFailure(Exception e) { Log.e("EXCEPTION", e.getMessage(), e); Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } }); }
Source:
public MenuItem build() { final DropDownMenus.Builder menuBuilder = new DropDownMenus.Builder().addStyleName("pull-right"); for (final MenuDevCommand command : devCommands) { menuBuilder.add(new AnchorListItems.Builder(command.getText()) .setIcon(command.getIcon()) .addClickHandler(event -> command.execute()) .build()); } final IsWidget group = new ButtonGroups.Builder() .add(new Buttons.Builder() .setToggleCaret(false) .setDataToggle(Toggle.DROPDOWN) .setIcon(IconType.COG) .setSize(ButtonSize.SMALL) .setTitle("Development") .build()) .add(menuBuilder.build()) .build(); return MenuUtils.buildItem(group); }

Target:
public MenuItem build() { final DropDownMenu menu = new DropDownMenus.Builder().addStyleName("pull-right").build(); for (final MenuDevCommand command : devCommands) { menu.add(new AnchorListItems.Builder(command.getText()) .setIcon(command.getIcon()) .addClickHandler(event -> command.execute()).build() ); } final IsWidget group = new ButtonGroups.Builder() .add(new Buttons.Builder() .setToggleCaret(false) .setDataToggle(Toggle.DROPDOWN) .setIcon(IconType.COG) .setSize(ButtonSize.SMALL) .setTitle("Development").build()) .add(menu).build(); return MenuUtils.buildItem(group); }
Source:
public void saveOrUpdateDetailsInBatch(List<GlusterGeoRepSessionDetails> geoRepSessionDetailsObjs) { List<GlusterGeoRepSessionDetails> insertList = new ArrayList<>(); List<GlusterGeoRepSessionDetails> updateList = new ArrayList<>(); for (GlusterGeoRepSessionDetails details : geoRepSessionDetailsObjs) if (getGeoRepSessionDetails(details.getSessionId(), details.getMasterBrickId()) == null) insertList.add(details); else updateList.add(details); saveDetailsInBatch(insertList); updateDetailsInBatch(updateList); }

Target:
public void saveOrUpdateDetailsInBatch(List<GlusterGeoRepSessionDetails> geoRepSessionDetailsObjs) { List<GlusterGeoRepSessionDetails> insertList = new ArrayList<>(); List<GlusterGeoRepSessionDetails> updateList = new ArrayList<>(); for (GlusterGeoRepSessionDetails details : geoRepSessionDetailsObjs) { if (getGeoRepSessionDetails(details.getSessionId(), details.getMasterBrickId()) == null) { insertList.add(details); } else { updateList.add(details); } } saveDetailsInBatch(insertList); updateDetailsInBatch(updateList); }
Source:
private List<AffinityGroup> mapAffinityGroups(Map<String, String> affinityGroupMap, List<AffinityGroup> affinityGroupsFromParam, Guid vmId) { List<AffinityGroup> affinityGroups = new ArrayList<>(); if (affinityGroupsFromParam == null) { return Collections.emptyList(); } affinityGroupsFromParam.forEach(affinityGroup -> { log.info("Mapping affinity group '{}/{} for vm '{}'.", affinityGroup.getId(), affinityGroup.getName(), vmId); AffinityGroup affGroup = getRelatedEntity(affinityGroupMap, affinityGroup.getName(), val -> affinityGroupDao.getByName((String) val)); if (affGroup != null) { affinityGroups.add(affGroup); } }); return affinityGroups; }

Target:
private List<AffinityGroup> mapAffinityGroups(Map<String, String> affinityGroupMap, List<AffinityGroup> affinityGroupsFromParam, Guid vmId) { if (affinityGroupsFromParam == null) { return Collections.emptyList(); } List<AffinityGroup> affinityGroups = new ArrayList<>(); affinityGroupsFromParam.forEach(affinityGroup -> { log.info("Mapping affinity group '{}/{} for vm '{}'.", affinityGroup.getId(), affinityGroup.getName(), vmId); AffinityGroup affGroup = getRelatedEntity(affinityGroupMap, affinityGroup.getName(), val -> affinityGroupDao.getByName((String) val)); if (affGroup != null) { affinityGroups.add(affGroup); } }); return affinityGroups; }
Source:
protected ByteBuffer filterChunkToRange(ByteBuffer buf) { if (options.getBlobOptions.getRange() == null) { return buf; } if (resolvedByteRange.getRangeSize() == 0) { buf.position(0); buf.limit(0); } else { long startOffsetInThisChunk = chunkIndex == 0 ? resolvedByteRange.getStartOffset() - offset : 0; long endOffsetInThisChunk = chunkIndex == (numChunksTotal - 1) ? resolvedByteRange.getEndOffset() - offset + 1 : chunkSize; buf.position((int) startOffsetInThisChunk); buf.limit((int) endOffsetInThisChunk); } return buf.slice(); }

Target:
protected ByteBuffer filterChunkToRange(ByteBuffer buf) { if (options.getBlobOptions.getRange() == null) { return buf; } if (resolvedByteRange.getRangeSize() == 0) { buf.position(0); buf.limit(0); } else { long startOffsetInThisChunk = chunkIndex == 0 ? resolvedByteRange.getStartOffset() - offset : 0; long endOffsetInThisChunkExclusive = chunkIndex == (numChunksTotal - 1) ? resolvedByteRange.getEndOffset() - offset + 1 : chunkSize; buf.position((int) startOffsetInThisChunk); buf.limit((int) endOffsetInThisChunkExclusive); } return buf.slice(); }