auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> list = new ArrayList<PermissionSubject>(); Guid storagePoolId = getVdsGroup() == null || getVdsGroup().getstorage_pool_id() == null ? null : getVdsGroup().getstorage_pool_id().getValue(); list.add(new PermissionSubject(storagePoolId, VdcObjectType.StoragePool, getActionType().getActionGroup())); QuotaHelper.addQuotaPermissionSubject(list, getStoragePool(), getQuotaId()); return list; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> list = new ArrayList<PermissionSubject>(); Guid storagePoolId = getVdsGroup() == null || getVdsGroup().getstorage_pool_id() == null ? null : getVdsGroup().getstorage_pool_id().getValue(); list.add(new PermissionSubject(storagePoolId, VdcObjectType.StoragePool, getActionType().getActionGroup())); list = QuotaHelper.addQuotaPermissionSubject(list, getStoragePool(), getQuotaId()); return list; }
Source:
private void reverseGeocode(final Point point) { try { MapboxGeocoding client = MapboxGeocoding.builder() .accessToken(getString(R.string.access_token)) .query(Point.fromLngLat(point.longitude(), point.latitude())) .geocodingTypes(GeocodingCriteria.TYPE_ADDRESS) .build(); client.enqueueCall(new Callback<GeocodingResponse>() { @Override public void onResponse(Call<GeocodingResponse> call, Response<GeocodingResponse> response) { List<CarmenFeature> results = response.body().features(); if (results.size() > 0) { CarmenFeature feature = results.get(0); mapboxMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { Toast.makeText(LocationPickerActivity.this, String.format(getString(R.string.location_picker_place_name_result), feature.placeName()), Toast.LENGTH_SHORT).show(); } }); } else { Toast.makeText(LocationPickerActivity.this, getString(R.string.location_picker_dropped_marker_snippet_no_results), Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<GeocodingResponse> call, Throwable throwable) { Timber.e("Geocoding Failure: %s", throwable.getMessage()); } }); } catch (ServicesException servicesException) { Timber.e("Error geocoding: %s", servicesException.toString()); servicesException.printStackTrace(); } }

Target:
private void reverseGeocode(final Point point) { try { MapboxGeocoding client = MapboxGeocoding.builder() .accessToken(getString(R.string.access_token)) .query(Point.fromLngLat(point.longitude(), point.latitude())) .geocodingTypes(GeocodingCriteria.TYPE_ADDRESS) .build(); client.enqueueCall(new Callback<GeocodingResponse>() { @Override public void onResponse(Call<GeocodingResponse> call, Response<GeocodingResponse> response) { List<CarmenFeature> results = response.body().features(); if (results.size() > 0) { CarmenFeature feature = results.get(0); mapboxMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { if (style.getLayer(DROPPED_MARKER_LAYER_ID) != null) { Toast.makeText(LocationPickerActivity.this, String.format(getString(R.string.location_picker_place_name_result), feature.placeName()), Toast.LENGTH_SHORT).show(); } } }); } else { Toast.makeText(LocationPickerActivity.this, getString(R.string.location_picker_dropped_marker_snippet_no_results), Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<GeocodingResponse> call, Throwable throwable) { Timber.e("Geocoding Failure: %s", throwable.getMessage()); } }); } catch (ServicesException servicesException) { Timber.e("Error geocoding: %s", servicesException.toString()); servicesException.printStackTrace(); } }
Source:
public void setUp() throws InterruptedException, ExecutionException { function = new RestoreRedundancyFunction(); when(mockContext.getCache()).thenReturn(mockCache); request = new RestoreRedundancyRequest(); request.setReassignPrimaries(true); when(mockContext.getArguments()).thenReturn(new Object[] {request, false}); when(mockCache.getResourceManager().createRestoreRedundancyOperation()) .thenReturn(mockOperation); CompletableFuture<RestoreRedundancyResults> future = CompletableFuture.completedFuture(mockResults); when(mockOperation.start()).thenReturn(future); when(mockResults.getRegionOperationMessage()).thenReturn(message); resultSender = mock(ResultSender.class); when(mockContext.getResultSender()).thenReturn(resultSender); argumentCaptor = ArgumentCaptor.forClass(SerializableRestoreRedundancyResultsImpl.class); }

Target:
public void setUp() throws InterruptedException, ExecutionException { function = new RestoreRedundancyFunction(); when(mockContext.getCache()).thenReturn(mockCache); request = new RestoreRedundancyRequest(); when(mockContext.getArguments()).thenReturn(new Object[] {request, false}); when(mockCache.getResourceManager().createRestoreRedundancyOperation()) .thenReturn(mockOperation); CompletableFuture<RestoreRedundancyResults> future = CompletableFuture.completedFuture(mockResults); when(mockOperation.start()).thenReturn(future); when(mockResults.getRegionOperationMessage()).thenReturn(message); resultSender = mock(ResultSender.class); when(mockContext.getResultSender()).thenReturn((ResultSender) resultSender); argumentCaptor = ArgumentCaptor.forClass(SerializableRestoreRedundancyResultsImpl.class); }
Source:
public Item[] getDrops() { List<Item> drops = new ArrayList<>(); if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { int leather = Drops.rand(1, 4); int rawbeef = Drops.rand(1, 3); for (int i=0; i < leather; i++) { drops.add(Item.get(Item.LEATHER, 0, 1)); } for (int i=0; i < rawbeef; i++) { drops.add(Item.get(Item.RAW_BEEF, 0, 1)); } } return drops.toArray(new Item[drops.size()]); }

Target:
public Item[] getDrops() { List<Item> drops = new ArrayList<>(); if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { int leather = Drops.rand(0, 3); int rawbeef = Drops.rand(1, 4); for (int i=0; i < leather; i++) { drops.add(Item.get(Item.LEATHER, 0, 1)); } for (int i=0; i < rawbeef; i++) { drops.add(Item.get(Item.RAW_BEEF, 0, 1)); } } return drops.toArray(new Item[drops.size()]); }
Source:
public WorkspaceConfigImpl devFileToWorkspaceConfig(Devfile devFile) throws DevfileFormatException { validateCurrentVersion(devFile); WorkspaceConfigImpl config = new WorkspaceConfigImpl(); config.setName(devFile.getName()); List<ProjectConfigImpl> projects = new ArrayList<>(); devFile.getProjects().forEach(project -> projects.add(devProjectToProjectConfig(project))); config.setProjects(projects); Map<String, String> attributes = new HashMap<>(); StringJoiner pluginsStringJoiner = new StringJoiner(","); StringJoiner toolIdToNameMappingStringJoiner = new StringJoiner(","); for (Tool tool : devFile.getTools()) { if (tool.getType().equals("cheEditor")) { attributes.put(EDITOR_WORKSPACE_ATTRIBUTE_NAME, tool.getId()); } else if (tool.getType().equals("chePlugin")) { pluginsStringJoiner.add(tool.getId()); } toolIdToNameMappingStringJoiner.add(tool.getId() + "=" + tool.getName()); } if (pluginsStringJoiner.length() > 0) { attributes.put(PLUGINS_WORKSPACE_ATTRIBUTE_NAME, pluginsStringJoiner.toString()); } if (toolIdToNameMappingStringJoiner.length() > 0) { attributes.put(ALIASES_WORKSPACE_ATTRIBUTE_NAME, toolIdToNameMappingStringJoiner.toString()); } config.setAttributes(attributes); List<CommandImpl> commands = new ArrayList<>(); devFile .getCommands() .forEach(command -> commands.addAll(devCommandToCommandImpls(devFile, command))); config.setCommands(commands); return config; }

Target:
public WorkspaceConfigImpl devFileToWorkspaceConfig(Devfile devFile) throws DevfileFormatException { validateCurrentVersion(devFile); WorkspaceConfigImpl config = new WorkspaceConfigImpl(); config.setName(devFile.getName()); List<ProjectConfigImpl> projects = new ArrayList<>(); devFile.getProjects().forEach(project -> projects.add(devProjectToProjectConfig(project))); config.setProjects(projects); Map<String, String> attributes = new HashMap<>(); StringJoiner pluginsStringJoiner = new StringJoiner(","); StringJoiner toolIdToNameMappingStringJoiner = new StringJoiner(","); for (Tool tool : devFile.getTools()) { switch (tool.getType()) { case "cheEditor": attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, tool.getId()); break; case "chePlugin": pluginsStringJoiner.add(tool.getId()); break; default: throw new DevfileFormatException( format("Unsupported tool %s type provided: %s", tool.getName(), tool.getType())); } toolIdToNameMappingStringJoiner.add(tool.getId() + "=" + tool.getName()); } if (pluginsStringJoiner.length() > 0) { attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, pluginsStringJoiner.toString()); } if (toolIdToNameMappingStringJoiner.length() > 0) { attributes.put(ALIASES_WORKSPACE_ATTRIBUTE_NAME, toolIdToNameMappingStringJoiner.toString()); } config.setAttributes(attributes); List<CommandImpl> commands = new ArrayList<>(); devFile .getCommands() .forEach(command -> commands.addAll(devCommandToCommandImpls(devFile, command))); config.setCommands(commands); return config; }
Source:
protected SimpleCollector(Builder b) { if (b.name.isEmpty()) throw new IllegalStateException("Name hasn't been set."); String name = b.name; if (!b.subsystem.isEmpty()) { name = b.subsystem + '_' + name; } if (!b.namespace.isEmpty()) { name = b.namespace + '_' + name; } fullname = name; checkMetricName(fullname); if (b.help.isEmpty()) throw new IllegalStateException("Help hasn't been set."); help = b.help; labelNames = b.labelNames.length == 0 ? Collections.<String>emptyList() : (b.labelNames.length == 1 ? Collections.singletonList(b.labelNames[0]) : Arrays.asList(b.labelNames)); for (String n: b.labelNames) { checkMetricLabelName(n); } if (!b.dontInitializeNoLabelsChild) { initializeNoLabelsChild(); } }

Target:
protected SimpleCollector(Builder b) { if (b.name.isEmpty()) throw new IllegalStateException("Name hasn't been set."); String name = b.name; if (!b.subsystem.isEmpty()) { name = b.subsystem + '_' + name; } if (!b.namespace.isEmpty()) { name = b.namespace + '_' + name; } fullname = name; checkMetricName(fullname); if (b.help.isEmpty()) throw new IllegalStateException("Help hasn't been set."); help = b.help; labelNames = new LabelNames(b.labelNames.length); for (String label : b.labelNames) { labelNames.add(label); } for (String n: b.labelNames) { checkMetricLabelName(n); } if (!b.dontInitializeNoLabelsChild) { initializeNoLabelsChild(); } }
Source:
private void updateWatchdogModels() { updateWatchdogModels(getOSType().getSelectedItem()); }

Target:
private void updateWatchdogModels() { updateWatchdogModels((Integer) getOSType().getSelectedItem()); }
Source:
public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); assertNotNull(bpmnModel); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); validateModel(parsedModel); deployProcess(parsedModel); }

Target:
public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); assertNotNull(bpmnModel); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); assertNotNull(parsedModel); validateModel(parsedModel); }
Source:
private static void populateAnalysisModules() { fModules = new ArrayList<>(); IPath pathToFiles = XmlUtils.getXmlFilesPath(); File fFolder = pathToFiles.toFile(); if (!(fFolder.isDirectory() && fFolder.exists())) { return; } for (File xmlFile : fFolder.listFiles()) { if (!XmlUtils.xmlValidate(xmlFile)) { continue; } try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(xmlFile); doc.getDocumentElement().normalize(); NodeList stateproviderNodes = doc .getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); for (int i = 0; i < stateproviderNodes.getLength(); i++) { Element node = (Element) stateproviderNodes.item(i); IAnalysisModuleHelper helper = new TmfAnalysisModuleHelperXml(xmlFile, node, XmlAnalysisModuleType.STATE_SYSTEM); fModules.add(helper); } } catch (ParserConfigurationException e) { Activator.logError("Error opening XML file", e); } catch (SAXException e) { Activator.logError("Error opening XML file", e); } catch (IOException e) { Activator.logError("Error opening XML file", e); } } }

Target:
private static void populateAnalysisModules() { fModules = new ArrayList<>(); IPath pathToFiles = XmlUtils.getXmlFilesPath(); File fFolder = pathToFiles.toFile(); if (!(fFolder.isDirectory() && fFolder.exists())) { return; } for (File xmlFile : fFolder.listFiles()) { if (!XmlUtils.xmlValidate(xmlFile).isOK()) { continue; } try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(xmlFile); doc.getDocumentElement().normalize(); NodeList stateproviderNodes = doc.getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); for (int i = 0; i < stateproviderNodes.getLength(); i++) { Element node = (Element) stateproviderNodes.item(i); IAnalysisModuleHelper helper = new TmfAnalysisModuleHelperXml(xmlFile, node, XmlAnalysisModuleType.STATE_SYSTEM); fModules.add(helper); } } catch (ParserConfigurationException | SAXException | IOException e) { Activator.logError("Error opening XML file", e); } } }
Source:
private Artifact getSawTeam() { return ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition, "SAW Requirements", AtsUtilCore.getAtsBranch()); }

Target:
private Long getSawTeam() { return org.eclipse.osee.ats.client.demo.DemoArtifactToken.SAW_Requirements.getUuid(); }
Source:
private CreateCloneOfTemplateParameters buildCreateCloneOfTemplateParameters(DiskImage disk) { DiskImageBase diskInfo = getParameters().getDiskInfoDestinationMap().get(disk.getId()); CreateCloneOfTemplateParameters params = new CreateCloneOfTemplateParameters(disk.getImageId(), getParameters().getVmStaticData().getId(), diskInfo); params.setStorageDomainId(diskInfoSourceMap.get(disk.getId())); params.setDestStorageDomainId(retrieveDestinationDomainForDisk(disk.getId())); params.setDiskAlias(diskInfoDestinationMap.get(disk.getId()).getDiskAlias()); params.setVmSnapshotId(getVmSnapshotId()); params.setParentCommand(VdcActionType.AddVmFromTemplate); params.setParentParameters(getParameters()); params.setEntityInfo(getParameters().getEntityInfo()); params.setQuotaId(diskInfoDestinationMap.get(disk.getId()).getQuotaId() != null ? diskInfoDestinationMap.get(disk.getId()).getQuotaId() : null); params.setDiskProfileId(diskInfoDestinationMap.get(disk.getId()).getDiskProfileId() != null ? diskInfoDestinationMap.get(disk.getId()).getDiskProfileId() : null); return params; }

Target:
private CreateCloneOfTemplateParameters buildCreateCloneOfTemplateParameters(DiskImage disk) { DiskImageBase diskInfo = getParameters().getDiskInfoDestinationMap().get(disk.getId()); CreateCloneOfTemplateParameters params = new CreateCloneOfTemplateParameters(disk.getImageId(), getParameters().getVmStaticData().getId(), diskInfo); params.setStorageDomainId(diskInfoSourceMap.get(disk.getId())); params.setDestStorageDomainId(retrieveDestinationDomainForDisk(disk.getId())); params.setDiskAlias(diskInfoDestinationMap.get(disk.getId()).getDiskAlias()); params.setVmSnapshotId(getVmSnapshotId()); params.setParentCommand(VdcActionType.AddVmFromTemplate); params.setParentParameters(getParameters()); params.setEntityInfo(getParameters().getEntityInfo()); params.setQuotaId(diskInfoDestinationMap.get(disk.getId()).getQuotaId() != null ? diskInfoDestinationMap.get(disk.getId()).getQuotaId() : null); params.setDiskProfileId(diskInfoDestinationMap.get(disk.getId()).getDiskProfileId()); return params; }
Source:
void shouldUpdateChargeToCaptured_IfEpdqStatusIs9AndChargeIsHistoric() { final String payload = notificationPayloadForTransaction(payId, EPDQ_PAYMENT_REQUESTED); charge = getCharge(true); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); verify(mockChargeNotificationProcessor).processCaptureNotificationForExpungedCharge(gatewayAccountEntity, payId, charge, CAPTURED); }

Target:
void shouldUpdateChargeToCaptured_IfEpdqStatusIs9AndChargeIsHistoric() { final String payload = notificationPayloadForTransaction(payId, EPDQ_PAYMENT_REQUESTED); charge = getCharge(true); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verify(mockChargeNotificationProcessor).processCaptureNotificationForExpungedCharge(gatewayAccountEntity, payId, charge, CAPTURED); }
Source:
public void inject(GlobalConfiguration globalConfiguration, EmbeddedCacheManager cacheManager) { this.globalConfiguration = globalConfiguration; this.cacheManager = cacheManager; this.localConfigurationManager = globalConfiguration.globalState().localConfigurationManager(); }

Target:
public void inject(GlobalConfiguration globalConfiguration, EmbeddedCacheManager cacheManager) { this.cacheManager = cacheManager; this.localConfigurationManager = globalConfiguration.globalState().localConfigurationManager(); }
Source:
public void clear() { if (loader instanceof CacheStore) try { ((CacheStore) loader).clear(); } catch (CacheLoaderException e) { throw newCacheLoaderException(e); } }

Target:
public void clear() { if (loader instanceof CacheStore) { try { ((CacheStore) loader).clear(); } catch (CacheLoaderException e) { throw newCacheLoaderException(e); } } }
Source:
public ProcessingResult processAnnotations(Iterable<String> fileArgs, List<ProcessingContext> inputs) { final List<ProcessingContext> generatedInputs = Lists.newArrayList(); PathClassLoader loader = new PathClassLoader(options.fileUtil().getClassPathEntries()); loader.addPaths(options.getProcessorPathEntries()); Iterator<Processor> serviceIterator = ServiceLoader.load(Processor.class, loader).iterator(); String explicitProcessorList = options.getProcessors(); if (serviceIterator.hasNext() || explicitProcessorList != null) { List<File> inputFiles = new ArrayList<>(); for (ProcessingContext input : inputs) { inputFiles.add(new File(input.getFile().getAbsolutePath())); } try { JavacEnvironment env = createEnvironment(inputFiles, null, true, explicitProcessorList); env.task().parse(); env.task().enter(); processDiagnostics(env.diagnostics()); File sourceOutputDirectory = env.fileManager().getLocation(StandardLocation.SOURCE_OUTPUT).iterator().next(); collectGeneratedInputs(sourceOutputDirectory, "", generatedInputs); return new JavacProcessingResult(generatedInputs, sourceOutputDirectory); } catch (IOException e) { ErrorUtil.fatalError(e, "javac file manager error"); } } return new JavacProcessingResult(generatedInputs, null); }

Target:
public ProcessingResult processAnnotations(Iterable<String> fileArgs, List<ProcessingContext> inputs) { final List<ProcessingContext> generatedInputs = Lists.newArrayList(); PathClassLoader loader = new PathClassLoader(options.fileUtil().getClassPathEntries()); loader.addPaths(options.getProcessorPathEntries()); Iterator<Processor> serviceIterator = ServiceLoader.load(Processor.class, loader).iterator(); if (serviceIterator.hasNext() || options.getProcessors() != null) { List<File> inputFiles = new ArrayList<>(); for (ProcessingContext input : inputs) { inputFiles.add(new File(input.getFile().getAbsolutePath())); } try { JavacEnvironment env = createEnvironment(inputFiles, null, true); env.task().parse(); env.task().enter(); processDiagnostics(env.diagnostics()); File sourceOutputDirectory = env.fileManager().getLocation(StandardLocation.SOURCE_OUTPUT).iterator().next(); collectGeneratedInputs(sourceOutputDirectory, "", generatedInputs); return new JavacProcessingResult(generatedInputs, sourceOutputDirectory); } catch (IOException e) { ErrorUtil.fatalError(e, "javac file manager error"); } } return new JavacProcessingResult(generatedInputs, null); }
Source:
public void addItem(File item) { try { copyFile(item, new File(mDataDir, item.getName())); notifyListeners(); } catch (IOException e) { } }

Target:
public boolean addItem(File item) { try { copyFile(item, new File(mDataDir, item.getName())); notifyListeners(); return true; } catch (IOException e) { return false; } }
Source:
private Object callMethod(Map message, Object id) throws JsonRpcException { if (!message.containsKey(METHOD)) { throw new JsonRpcException(id, invalid("required key `method` missing")); } if (!(message.get(METHOD) instanceof String)) { throw new JsonRpcException(id, invalid("key `method` not string", message.get(METHOD))); } String method = (String) message.get(METHOD); if (!methods.containsKey(method)) { throw new JsonRpcException( id, error(METHOD_NOT_FOUND, String.format("method `%s` not found", method))); } Object params = message.get("params"); if (params != null && !(params instanceof List || params instanceof Map)) { throw new JsonRpcException( id, invalidParams("parameters must be a structured value", params)); } try { return methods.get(method).apply(params); } catch (RuntimeException e) { throw new JsonRpcException(id, error(INTERNAL_ERROR, "Internal Error")); } }

Target:
private Object callMethod(Map message, Object id) throws JsonRpcException { if (!message.containsKey(METHOD)) { throw new JsonRpcException(id, invalid(String.format("required key `%s` missing", METHOD))); } if (!(message.get(METHOD) instanceof String)) { throw new JsonRpcException( id, invalid(String.format("key `%s` not string", METHOD), message.get(METHOD))); } String method = (String) message.get(METHOD); if (!methods.containsKey(method)) { throw new JsonRpcException( id, error(METHOD_NOT_FOUND, String.format("method `%s` not found", method))); } Object params = message.get("params"); if (params != null && !(params instanceof List || params instanceof Map)) { throw new JsonRpcException( id, invalidParams("parameters must be a structured value", params)); } try { return methods.get(method).apply(params); } catch (RuntimeException e) { throw new JsonRpcException(id, error(INTERNAL_ERROR, "Internal Error")); } }
Source:
Option<T> peekOption() { return isEmpty() ? Option.none() : Option.some(peek()); }

Target:
public Option<T> peekOption() { return isEmpty() ? Option.none() : Option.some(peek()); }
Source:
public void testDeprecatedKeys_throwsExceptionWhenDeprecatedKeyIsUsed() throws IllegalArgumentException { GoogleHadoopFileSystemConfigurationProperty<String> GCS_PROXY_ADDRESS = new GoogleHadoopFileSystemConfigurationProperty<>( EntriesCredentialConfiguration.PROXY_ADDRESS_KEY, "proxy-address", "fs.gs.proxy.deprecated.address"); GoogleHadoopFileSystemConfigurationProperty<Integer> GCS_PROXY_USERNAME = new GoogleHadoopFileSystemConfigurationProperty<>( EntriesCredentialConfiguration.PROXY_USERNAME_KEY, 1234, "fs.gs.proxy.deprecated.user"); GoogleHadoopFileSystemConfigurationProperty<String> GCS_PROXY_PASSWORD = new GoogleHadoopFileSystemConfigurationProperty<>( EntriesCredentialConfiguration.PROXY_PASSWORD_KEY, "proxy-pass", "fs.gs.proxy.deprecated.pass"); Configuration config = new Configuration(); config.set(GCS_PROXY_ADDRESS.getKey(), GCS_PROXY_ADDRESS.getDefault()); config.setInt(GCS_PROXY_USERNAME.getKey(), GCS_PROXY_USERNAME.getDefault()); config.set("fs.gs.proxy.deprecated.pass", GCS_PROXY_PASSWORD.getDefault()); String userpass = GCS_PROXY_PASSWORD.getPassword(config); assertThat(userpass).isEqualTo("proxy-pass"); GoogleCloudStorageFileSystemOptions.Builder optionsBuilder = GoogleHadoopFileSystemConfiguration.getGcsFsOptionsBuilder(config); assertThrows(IllegalArgumentException.class, () -> optionsBuilder.build()); }

Target:
public void testDeprecatedKeys_throwsExceptionWhenDeprecatedKeyIsUsed() throws IllegalArgumentException { GoogleHadoopFileSystemConfigurationProperty<String> gcsProxyAddress = new GoogleHadoopFileSystemConfigurationProperty<>( EntriesCredentialConfiguration.PROXY_ADDRESS_KEY, "proxy-address", "fs.gs.proxy.deprecated.address"); GoogleHadoopFileSystemConfigurationProperty<Integer> gcsProxyUsername = new GoogleHadoopFileSystemConfigurationProperty<>( EntriesCredentialConfiguration.PROXY_USERNAME_KEY, 1234, "fs.gs.proxy.deprecated.user"); GoogleHadoopFileSystemConfigurationProperty<String> gcsProxyPassword = new GoogleHadoopFileSystemConfigurationProperty<>( EntriesCredentialConfiguration.PROXY_PASSWORD_KEY, "proxy-pass", "fs.gs.proxy.deprecated.pass"); Configuration config = new Configuration(); config.set(gcsProxyAddress.getKey(), gcsProxyAddress.getDefault()); config.setInt(gcsProxyUsername.getKey(), gcsProxyUsername.getDefault()); config.set("fs.gs.proxy.deprecated.pass", gcsProxyPassword.getDefault()); String userPass = gcsProxyPassword.getPassword(config); assertThat(userPass).isEqualTo("proxy-pass"); GoogleCloudStorageFileSystemOptions.Builder optionsBuilder = GoogleHadoopFileSystemConfiguration.getGcsFsOptionsBuilder(config); assertThrows(IllegalArgumentException.class, optionsBuilder::build); }
Source:
private <I extends Identified> I visitIdentified(I identified) { if (msg.hasId()) { identified.setId(Id.valueOf(msg.getId())); } if (msg.hasUri()) { identified.setCanonicalUri(msg.getUri()); } if (msg.hasLastUpdated()) { identified.setLastUpdated(new DateTimeSerializer().deserialize(msg.getLastUpdated())); } Builder<Alias> aliases = ImmutableSet.builder(); for (CommonProtos.Alias alias : msg.getAliasesList()) { aliases.add(new Alias(alias.getNamespace(), alias.getValue())); } identified.setAliases(aliases.build()); ImmutableSet.Builder<EquivalenceRef> equivRefs = ImmutableSet.builder(); for (Reference equivRef : msg.getEquivsList()) { equivRefs.add(new EquivalenceRef(Id.valueOf(equivRef.getId()), Sources.fromPossibleKey(equivRef.getSource()).get() )); } identified.setEquivalentTo(equivRefs.build()); return identified; }

Target:
private <I extends Identified> I visitIdentified(I identified) { if (msg.hasId()) { identified.setId(Id.valueOf(msg.getId())); } if (msg.hasUri()) { identified.setCanonicalUri(msg.getUri()); } if (msg.hasLastUpdated()) { identified.setLastUpdated(dateTimeSerializer.deserialize(msg.getLastUpdated())); } Builder<Alias> aliases = ImmutableSet.builder(); for (CommonProtos.Alias alias : msg.getAliasesList()) { aliases.add(new Alias(alias.getNamespace(), alias.getValue())); } identified.setAliases(aliases.build()); ImmutableSet.Builder<EquivalenceRef> equivRefs = ImmutableSet.builder(); for (Reference equivRef : msg.getEquivsList()) { equivRefs.add(new EquivalenceRef(Id.valueOf(equivRef.getId()), Sources.fromPossibleKey(equivRef.getSource()).get() )); } identified.setEquivalentTo(equivRefs.build()); return identified; }
Source:
protected boolean isInterfaceSupportedForPlugUnPlug(Disk disk) { List<String> diskHotpluggableInterfaces = osRepository.getDiskHotpluggableInterfaces(getVm().getOs(), getVm().getVdsGroupCompatibilityVersion()); if (CollectionUtils.isEmpty(diskHotpluggableInterfaces)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } Collection<DiskInterface> diskInterfaces = new HashSet<DiskInterface>(); for (String diskHotpluggableInterface : diskHotpluggableInterfaces) { diskInterfaces.add(DiskInterface.valueOf(diskHotpluggableInterface)); } if (!diskInterfaces.contains(disk.getDiskInterface())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return true; }

Target:
protected boolean isInterfaceSupportedForPlugUnPlug(Disk disk) { Set<String> diskHotpluggableInterfaces = osRepository.getDiskHotpluggableInterfaces(getVm().getOs(), getVm().getVdsGroupCompatibilityVersion()); if (CollectionUtils.isEmpty(diskHotpluggableInterfaces) || !diskHotpluggableInterfaces.contains(disk.getDiskInterface().toString())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return true; }
Source:
private void updateVolumeDescription() { Guid storagePoolId = getParameters().getStoragePoolId(); Guid storageDomainId = getParameters().getStorageDomainId(); Guid imageGroupId = getParameters().getImageGroupId(); DiskImage baseDiskImage = imagesHandler.getVolumeInfoFromVdsm( storagePoolId, storageDomainId, imageGroupId, getParameters().getBaseImage().getImageId()); DiskImage topDiskImage = imagesHandler.getVolumeInfoFromVdsm( storagePoolId, storageDomainId, imageGroupId, getParameters().getTopImage().getImageId()); if (!Objects.equals(topDiskImage.getDescription(), baseDiskImage.getDescription())) { try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters( storagePoolId, storageDomainId, imageGroupId, baseDiskImage.getImageId(), topDiskImage.getDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); StorageDomain storageDomain = storageDomainDao.getForStoragePool(storageDomainId, storagePoolId); StoragePool storagePool = storagePoolDao.get(storagePoolId); addCustomValue("DataCenterName", storagePool.getName()); addCustomValue("StorageDomainName", storageDomain.getName()); addCustomValue("DiskName", getParameters().getBaseImage().getDiskAlias()); auditLogDirector.log(this, AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED); } } }

Target:
private void updateVolumeDescription() { Guid storagePoolId = getParameters().getStoragePoolId(); Guid storageDomainId = getParameters().getStorageDomainId(); Guid imageGroupId = getParameters().getImageGroupId(); try { imagesHandler.updateMergeVolumeDescription(storagePoolId, storageDomainId, imageGroupId, getParameters().getBaseImage().getImageId(), getParameters().getTopImage().getImageId()); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); StorageDomain storageDomain = storageDomainDao.getForStoragePool(storageDomainId, storagePoolId); StoragePool storagePool = storagePoolDao.get(storagePoolId); addCustomValue("DataCenterName", storagePool.getName()); addCustomValue("StorageDomainName", storageDomain.getName()); addCustomValue("DiskName", getParameters().getBaseImage().getDiskAlias()); auditLogDirector.log(this, AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED); } }
Source:
default void sendWrongEpochMessage(CorfuMsg msg, ChannelHandlerContext ctx) { sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, getServerEpoch())); log.warn("Incoming message with wrong epoch, got {}, expected {}, message was: {}", msg.getEpoch(), getServerEpoch(), msg); }

Target:
default void sendWrongEpochMessage(CorfuMsg msg, ChannelHandlerContext ctx) { sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, getServerEpoch())); log.trace("Incoming message with wrong epoch, got {}, expected {}, message was: {}", msg.getEpoch(), getServerEpoch(), msg); }
Source:
private RecipeManager loadRecipesAndTags() { ResourcePackList<ResourcePackInfo> resourcePacks = new ResourcePackList<>(ResourcePackInfo::new); ResourcePackLoader.loadResourcePacks(resourcePacks, RecipeAdvancementProvider::buildPackFinder); SimpleReloadableResourceManager resourceManager = new SimpleReloadableResourceManager( ResourcePackType.SERVER_DATA, Thread.currentThread()); resourceManager.addReloadListener(new NetworkTagManager()); RecipeManager recipeManager = new RecipeManager(); resourceManager.addReloadListener(recipeManager); resourcePacks.addPackFinder(new ServerPackFinder()); resourcePacks.reloadPacksFromFinders(); List<ResourcePackInfo> list = Lists.newArrayList(resourcePacks.getEnabledPacks()); for (ResourcePackInfo resourcepackinfo : resourcePacks.getAllPacks()) { resourcepackinfo.getPriority().func_198993_a(list, resourcepackinfo, (p_200247_0_) -> { return p_200247_0_; }, false); } resourcePacks.setEnabledPacks(list); List<IResourcePack> list1 = Lists.newArrayList(); resourcePacks.getEnabledPacks().forEach((p_200244_1_) -> { list1.add(p_200244_1_.getResourcePack()); }); CompletableFuture<Unit> completablefuture = resourceManager.reloadResourcesAndThen(Util.getServerExecutor(), Util.getServerExecutor(), list1, CompletableFuture.completedFuture(Unit.INSTANCE)); BooleanSupplier isDone = completablefuture::isDone; while (!isDone.getAsBoolean()) { Thread.yield(); LockSupport.parkNanos("waiting for tasks", 100000L); } return recipeManager; }

Target:
private RecipeManager loadRecipesAndTags() { ResourcePackList<ResourcePackInfo> resourcePacks = new ResourcePackList<>(ResourcePackInfo::new); ResourcePackLoader.loadResourcePacks(resourcePacks, RecipeAdvancementProvider::buildPackFinder); SimpleReloadableResourceManager resourceManager = new SimpleReloadableResourceManager( ResourcePackType.SERVER_DATA, Thread.currentThread()); resourceManager.addReloadListener(new NetworkTagManager()); RecipeManager recipeManager = new RecipeManager(); resourceManager.addReloadListener(recipeManager); resourcePacks.addPackFinder(new ServerPackFinder()); resourcePacks.reloadPacksFromFinders(); List<ResourcePackInfo> list = Lists.newArrayList(resourcePacks.getEnabledPacks()); for (ResourcePackInfo resourcepackinfo : resourcePacks.getAllPacks()) { resourcepackinfo.getPriority().func_198993_a(list, resourcepackinfo, (p_200247_0_) -> { return p_200247_0_; }, false); } resourcePacks.setEnabledPacks(list); List<IResourcePack> list1 = Lists.newArrayList(); resourcePacks.getEnabledPacks().forEach((p_200244_1_) -> { list1.add(p_200244_1_.getResourcePack()); }); CompletableFuture<Unit> completablefuture = resourceManager.reloadResourcesAndThen(Util.getServerExecutor(), Util.getServerExecutor(), list1, CompletableFuture.completedFuture(Unit.INSTANCE)); completablefuture.join(); return recipeManager; }
Source:
public void addServerAndUpdateSegment( QueryableDruidServer server, DataSegment segment ) { synchronized (this) { this.segment.set(segment); Set<QueryableDruidServer> priorityServers; if (server.getServer().getType() == ServerType.REALTIME) { priorityServers = realtimeServers.computeIfAbsent( server.getServer().getPriority(), p -> new HashSet<>()); } else { priorityServers = historicalServers.computeIfAbsent( server.getServer().getPriority(), p -> new HashSet<>()); } priorityServers.add(server); } }

Target:
public void addServerAndUpdateSegment( QueryableDruidServer server, DataSegment segment ) { synchronized (this) { this.segment.set(segment); Set<QueryableDruidServer> priorityServers; if (server.getServer().getType() == ServerType.HISTORICAL) { priorityServers = historicalServers.computeIfAbsent( server.getServer().getPriority(), p -> new HashSet<>() ); } else { priorityServers = realtimeServers.computeIfAbsent( server.getServer().getPriority(), p -> new HashSet<>() ); } priorityServers.add(server); } }
Source:
public String getCatalog() throws SQLException { HPCCJDBCUtils.traceoutln(TraceLevel.VERBOSE, "HPCCConnection: getCatalog()"); return "HPCC Catalog"; }

Target:
public String getCatalog() throws SQLException { HPCCJDBCUtils.traceoutln(Level.FINEST, "HPCCConnection: getCatalog()"); return "HPCC Catalog"; }
Source:
protected File dir() { if (this.project instanceof Job) { Job jib = (Job) this.project; Run run = jib.getLastSuccessfulBuild(); if (run != null) { File javadocDir = getBuildArchiveDir(run); if (javadocDir.exists()) { return javadocDir; } } } return getProjectArchiveDir(this.project); }

Target:
protected File dir() { if (this.project instanceof Job) { final Job job = (Job) this.project; Run run = getArchiveBuild(job); if (run != null) { File javadocDir = getBuildArchiveDir(run); if (javadocDir.exists()) { return javadocDir; } } } return getProjectArchiveDir(this.project); }
Source:
private void doRecoverTransaction(Uid recoverUid) { int theStatus = _transactionStatusConnectionMgr.getTransactionStatus(_transactionType, recoverUid); try { RecoveringLRA lra = new RecoveringLRA(lraService, recoverUid, theStatus); String Status = ActionStatus.stringForm(theStatus); boolean inFlight = lraService.hasTransaction(lra.getId()); if (!inFlight && lra.getLRAStatus() == null) { lraService.addTransaction(lra); inFlight = true; } if (inFlight && !lraService.getTransaction(lra.getId()).isInFlight()) { inFlight = false; } if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debug("transaction type is " + _transactionType + " uid is " + recoverUid.toString() + "\n ActionStatus is " + Status + " in flight is " + inFlight); } if (!inFlight && lra.isRecovering()) { lra.replayPhase2(); if (!lra.isRecovering()) { if (lraService != null) { lraService.finished(lra, false); } } } } catch (Exception ex) { if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("failed to recover Transaction %s: %s", recoverUid, ex.getMessage()); } } }

Target:
private void doRecoverTransaction(Uid recoverUid) { int theStatus = _transactionStatusConnectionMgr.getTransactionStatus(_transactionType, recoverUid); try { RecoveringLRA lra = new RecoveringLRA(lraService, recoverUid, theStatus); String Status = ActionStatus.stringForm(theStatus); boolean inFlight = lraService.hasTransaction(lra.getId()); if (!inFlight && lra.getLRAStatus() == null) { lraService.addTransaction(lra); inFlight = true; } if (inFlight && !lraService.getTransaction(lra.getId()).isInFlight()) { inFlight = false; } if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debug("transaction type is " + _transactionType + " uid is " + recoverUid.toString() + "\n ActionStatus is " + Status + " in flight is " + inFlight); } if (!inFlight && lra.isRecovering()) { lra.replayPhase2(); if (!lra.isRecovering() && lraService != null) { lraService.finished(lra, false); } } } catch (Exception ex) { if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("failed to recover Transaction %s: %s", recoverUid, ex.getMessage()); } } }
Source:
protected CurrentTraceContext(Builder<?> builder) { this.scopeDecorators = (List<ScopeDecorator>) builder.scopeDecorators.clone(); }

Target:
protected CurrentTraceContext(Builder<?> builder) { this.scopeDecorators = new ArrayList<>(builder.scopeDecorators); }
Source:
private XmlRpcStruct generateNetworks() { XmlRpcStruct networks = new XmlRpcStruct(); String ifaceNameWithoutVlan; Boolean bonded; Map<String, String> opts; VdsNetworkInterface iface; for (Network network : getParameters().getNetworks()) { opts = new HashMap<String, String>(); iface = findNetworkInterface(network.getName(), getParameters().getInterfaces(), getParameters().getBonds()); ifaceNameWithoutVlan = NetworkUtils.StripVlan(iface.getName()); bonded = isVlan(network) ? findInterfaceByName(ifaceNameWithoutVlan).getBonded() : iface.getBonded(); String type = (bonded != null && bonded) ? "bonding" : "nic"; opts.put(type, ifaceNameWithoutVlan); if (isVlan(network)) { opts.put("vlan", network.getVlanId().toString()); } addBootProtocol(opts, iface); if (network.getMtu() != 0) { opts.put("mtu", String.valueOf(network.getMtu())); } opts.put("bridged", Boolean.toString(network.isVmNetwork())); if (network.isVmNetwork()) { opts.put(VdsProperties.STP, network.getStp() ? "yes" : "no"); } networks.add(network.getName(), opts); } for (String net : getParameters().getRemovedNetworks()) { networks.add(net, REMOVE_OBJ); } return networks; }

Target:
private XmlRpcStruct generateNetworks() { XmlRpcStruct networks = new XmlRpcStruct(); for (Network network : getParameters().getNetworks()) { Map<String, String> opts = new HashMap<String, String>(); VdsNetworkInterface iface = findNetworkInterface(network.getName(), getParameters().getInterfaces(), getParameters().getBonds()); String ifaceNameWithoutVlan = NetworkUtils.StripVlan(iface.getName()); Boolean bonded = isVlan(network) ? findInterfaceByName(ifaceNameWithoutVlan).getBonded() : iface.getBonded(); String type = (bonded != null && bonded) ? "bonding" : "nic"; opts.put(type, ifaceNameWithoutVlan); if (isVlan(network)) { opts.put("vlan", network.getVlanId().toString()); } addBootProtocol(opts, iface); if (network.getMtu() != 0) { opts.put("mtu", String.valueOf(network.getMtu())); } opts.put("bridged", Boolean.toString(network.isVmNetwork())); if (network.isVmNetwork()) { opts.put(VdsProperties.STP, network.getStp() ? "yes" : "no"); } networks.add(network.getName(), opts); } for (String net : getParameters().getRemovedNetworks()) { networks.add(net, REMOVE_OBJ); } return networks; }
Source:
public List<ConnectorPartitionHandle> listPartitionHandles(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle; int bucketCount = handle.getBucketCount(); ImmutableList.Builder<ConnectorPartitionHandle> resultBuilder = ImmutableList.builder(); for (int i = 0; i < bucketCount; i++) { resultBuilder.add(new HivePartitionHandle(i)); } return resultBuilder.build(); }

Target:
public List<ConnectorPartitionHandle> listPartitionHandles(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle; int bucketCount = handle.getBucketCount(); return IntStream.range(0, bucketCount).mapToObj(HivePartitionHandle::new).collect(toImmutableList()); }
Source:
public PublishPlanetJob(String thingUID) { checkNotNull(thingUID, "Thing UID cannot be null"); this.thingUID = thingUID; }

Target:
public PublishPlanetJob(String thingUID) { checkArgument(thingUID != null, "Thing UID cannot be null"); this.thingUID = thingUID; }
Source:
public OpenShiftLocalSubjectAccessReviewOperationsImpl(OkHttpClient client, Config config, String apiGroupName, String apiGroupVersion, String plural) { this(new OperationContext().withOkhttpClient(client).withConfig(config), apiGroupName, apiGroupVersion, plural); this.subjectAccessApiGroupName = apiGroupName; this.subjectAccessApiGroupVersion = apiGroupVersion; this.plural = plural; }

Target:
public OpenShiftLocalSubjectAccessReviewOperationsImpl(OkHttpClient client, Config config, String apiGroupName, String apiGroupVersion, String plural) { this(new OperationContext().withOkhttpClient(client).withConfig(config), apiGroupName, apiGroupVersion, plural); }
Source:
ViewDistance(String displayName, int index, Vector3i chunkDistance) { this.displayName = String.format(displayName + " (%1$dx%2$dx%3$d)", chunkDistance.getX(), chunkDistance.getY(), chunkDistance.getZ()); this.index = index; this.chunkDistance = chunkDistance; }

Target:
ViewDistance(String displayName, int index, Vector3i chunkDistance) { this.displayName = displayName; this.index = index; this.chunkDistance = chunkDistance; }
Source:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { {"255.255.255.255", 4294967295L }, {"1.255.4.255", 33490175 }, {"0.128.0.7", 8388615 }, {"1.2.3.4", 16909060 }, {"127.63.31.7", 2134843143 }, {"0.0.0.1", 1 }, }); }

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { "255.255.255.255", 4294967295L }, { "1.1.1.1", 16843009 }, { "1.255.4.255", 33490175 }, { "0.128.0.7", 8388615 }, { "1.2.3.4", 16909060 }, { "127.63.31.7", 2134843143 }, { "0.0.0.1", 1 }, }); }
Source:
public Reply<?> create(Request request) { NewAccessPointDTO dto = request.read(NewAccessPointDTO.class).as(Json.class); NewAccessPoint ap = adapt(dto); Optional<Object> id = repository.create(ap); if (!id.isPresent()) { return Reply.with("AP creation failed due to non-existing operator").notFound(); } return Reply.saying().ok(); }

Target:
public Reply<?> create(Request request) { NewAccessPointDTO dto = request.read(NewAccessPointDTO.class).as(Json.class); NewAccessPoint ap = adapt(dto); repository.create(ap); return Reply.with("Successfully created AP").ok(); }
Source:
protected CourseComponent doInBackground(Object... params) { try { String courseId = (String) (params[0]); if(courseId!=null){ PrefManager.UserPrefManager prefManager = new PrefManager.UserPrefManager(MainApplication.instance()); long lastFetchTime = prefManager.getLastCourseStructureFetch(courseId); long curTime = new Date().getTime(); HttpRequestDelegate.REQUEST_CACHE_TYPE useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.PREFER_CACHE; if ( lastFetchTime + 3600 * 1000 < curTime ){ useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.IGNORE_CACHE;; prefManager.setLastCourseStructureFetch(courseId, curTime); } final CourseComponent model = ServiceManager.getInstance().getCourseStructure(courseId, useCacheType); if (model != null) { handler.post(new Runnable() { public void run() { onFinish(model); stopProgress(); } }); } CookieSyncManager m ; } } catch (Exception ex) { handle(ex); logger.error(ex, true); } return null; }

Target:
protected CourseComponent doInBackground(Object... params) { try { String courseId = (String) (params[0]); if(courseId!=null){ PrefManager.UserPrefManager prefManager = new PrefManager.UserPrefManager(MainApplication.instance()); long lastFetchTime = prefManager.getLastCourseStructureFetch(courseId); long curTime = new Date().getTime(); HttpRequestDelegate.REQUEST_CACHE_TYPE useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.PREFER_CACHE; if ( lastFetchTime + 3600 * 1000 < curTime ){ useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.IGNORE_CACHE;; prefManager.setLastCourseStructureFetch(courseId, curTime); } final CourseComponent model = ServiceManager.getInstance().getCourseStructure(courseId, useCacheType); if (model != null) { handler.post(new Runnable() { public void run() { onFinish(model); stopProgress(); } }); } } } catch (Exception ex) { handle(ex); logger.error(ex, true); } return null; }
Source:
private void pollFromKafka() throws NakadiException { try { final ConsumerRecords<String, String> records = kafkaConsumer.poll(pollTimeout); eventQueue = StreamSupport .stream(records.spliterator(), false) .map(record -> new ConsumedEvent(record.value(), record.topic(), Integer.toString(record.partition()), Long.toString(record.offset() + 1))) .collect(Collectors.toCollection(Lists::newLinkedList)); } catch (InvalidOffsetException e) { throw new NakadiException("Wrong offset provided", e); } catch (KafkaException e) { throw new NakadiException("Error occurred when polling from kafka", e); } }

Target:
private void pollFromKafka() throws NakadiException { try { final ConsumerRecords<String, String> records = kafkaConsumer.poll(pollTimeout); eventQueue = StreamSupport .stream(records.spliterator(), false) .map(record -> { final Cursor cursor = kafkaCursor(record.partition(), record.offset() + 1).asNakadiCursor(); return new ConsumedEvent(record.value(), record.topic(), cursor.getPartition(), cursor.getOffset()); }) .collect(Collectors.toCollection(Lists::newLinkedList)); } catch (KafkaException e) { throw new NakadiException("Error occurred when polling from kafka", e); } }