auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void writeClusterJob(@NotNull final CassandraCluster cluster, @NotNull final JsonGenerator json, @NotNull final String name, @Nullable final ClusterJobStatus jobStatus) throws IOException { if (jobStatus != null && jobStatus.hasJobType()) { json.writeObjectFieldStart(name); json.writeStringField("type", jobStatus.getJobType().name()); json.writeNumberField("started", jobStatus.getStartedTimestamp()); if (jobStatus.hasFinishedTimestamp()) { json.writeNumberField("finished", jobStatus.getFinishedTimestamp()); } else { json.writeNullField("finished"); } json.writeBooleanField("aborted", jobStatus.getAborted()); json.writeArrayFieldStart("remainingNodes"); for (final String node : jobStatus.getRemainingNodesList()) { json.writeString(node); } json.writeEndArray(); if (jobStatus.hasCurrentNode()) { json.writeObjectFieldStart("currentNode"); writeNodeJobStatus(cluster, json, jobStatus.getCurrentNode()); } else { json.writeNullField("currentNode"); } json.writeArrayFieldStart("completedNodes"); for (final NodeJobStatus nodeJobStatus : jobStatus.getCompletedNodesList()) { json.writeStartObject(); writeNodeJobStatus(cluster, json, nodeJobStatus); } json.writeEndArray(); if (jobStatus.hasData()) json.writeStringField("data", jobStatus.getData()); json.writeEndObject(); } else { json.writeNullField(name); } }

Target:
public static void writeClusterJob(@NotNull final CassandraCluster cluster, @NotNull final JsonGenerator json, @NotNull final String name, @Nullable final ClusterJobStatus jobStatus) throws IOException { if (jobStatus != null && jobStatus.hasJobType()) { json.writeObjectFieldStart(name); json.writeStringField("type", jobStatus.getJobType().name()); json.writeNumberField("started", jobStatus.getStartedTimestamp()); if (jobStatus.hasFinishedTimestamp()) { json.writeNumberField("finished", jobStatus.getFinishedTimestamp()); } else { json.writeNullField("finished"); } json.writeBooleanField("aborted", jobStatus.getAborted()); json.writeArrayFieldStart("remainingNodes"); for (final String node : jobStatus.getRemainingNodesList()) { json.writeString(node); } json.writeEndArray(); if (jobStatus.hasCurrentNode()) { json.writeObjectFieldStart("currentNode"); writeNodeJobStatus(cluster, json, jobStatus.getCurrentNode()); } else { json.writeNullField("currentNode"); } json.writeArrayFieldStart("completedNodes"); for (final NodeJobStatus nodeJobStatus : jobStatus.getCompletedNodesList()) { json.writeStartObject(); writeNodeJobStatus(cluster, json, nodeJobStatus); } json.writeEndArray(); if (jobStatus.hasBackupName()) json.writeStringField("backupName", jobStatus.getBackupName()); json.writeEndObject(); } else { json.writeNullField(name); } }
Source:
public static Size autoConvert(long size, SizeUnit inUnit) { for (long i = weightToUnit.size(); i >= inUnit.getUnitWeight(); i--) { if (size / Math.pow(CONVERT_FACTOR, i - 1) >= 1) { return new SizeConverter.Size(SizeConverter.SizeUnit.getUnit(i), SizeConverter.convert(size, inUnit, SizeUnit.getUnit(i)).doubleValue()); } } return new Size(SizeUnit.BYTES, new Double(new Long(size))); }

Target:
public static Size autoConvert(long size, SizeUnit inUnit) { for (long i = weightToUnit.size(); i >= inUnit.getUnitWeight(); i--) { if (size / Math.pow(CONVERT_FACTOR, i - 1) >= 1) { return new Size(SizeConverter.SizeUnit.getUnit(i), Double.valueOf(SizeConverter.convert(size, inUnit, SizeUnit.getUnit(i)).doubleValue())); } } return new Size(SizeUnit.BYTES, new Double(new Long(size))); }
Source:
public Intent generate(EvaluationContext ec) { Intent i = new Intent(); if(className != null){ i.setAction(className); } if(type != null){ i.setType(type); } if(data != null){ i.setData(Uri.parse(data)); } if(component != null){ i.setComponent(new ComponentName(component, className)); } for(Enumeration<String> en = refs.keys() ; en.hasMoreElements() ;) { String key = en.nextElement(); AbstractTreeElement e = ec.resolveReference(refs.get(key)); if(e != null && e.getValue() != null) { i.putExtra(key, e.getValue().uncast().getString()); } } return i; }

Target:
public Intent generate(EvaluationContext ec) { Intent i = new Intent(); if(className != null){ i.setAction(className); if(component != null){ i.setComponent(new ComponentName(component, className)); } } if(type != null){ i.setType(type); } if(data != null){ i.setData(Uri.parse(data)); } for(Enumeration<String> en = refs.keys() ; en.hasMoreElements() ;) { String key = en.nextElement(); AbstractTreeElement e = ec.resolveReference(refs.get(key)); if(e != null && e.getValue() != null) { i.putExtra(key, e.getValue().uncast().getString()); } } return i; }
Source:
protected void trackEventsProcessedProgress(int recordCount) { _eventsProcessedCount += recordCount; Duration timeSinceLastLog = Duration.between(_eventsProcessedCountLoggedTime, Instant.now()); if (timeSinceLastLog.compareTo(LOG_EVENTS_PROCESSED_PROGRESS_DURATION) > 0) { _logger.info("Processed records in milliseconds for datastream {}", _eventsProcessedCount, timeSinceLastLog.toMillis(), _datastreamName); _eventsProcessedCount = 0; _eventsProcessedCountLoggedTime = Instant.now(); } }

Target:
protected void trackEventsProcessedProgress(int recordCount) { _eventsProcessedCount += recordCount; Duration timeSinceLastLog = Duration.between(_eventsProcessedCountLoggedTime, Instant.now()); if (timeSinceLastLog.compareTo(LOG_EVENTS_PROCESSED_PROGRESS_DURATION) > 0) { _logger.info("Processed records in seconds for datastream {}", _eventsProcessedCount, timeSinceLastLog.getSeconds(), _datastreamName); _eventsProcessedCount = 0; _eventsProcessedCountLoggedTime = Instant.now(); } }
Source:
protected void addWrite(int size) { if(size < 0) { throw new IllegalArgumentException("Size must be positive number"); } super.addWrite(size); }

Target:
protected void addWrite(int size) { ArgumentVerifier.assertNotNegative(size, "size"); super.addWrite(size); }
Source:
public static boolean workspaceLayerGroupInherit() { String value = GeoServerExtensions.getProperty("GEOSERVER_GLOBAL_LAYER_GROUP_INHERIT"); if(value != null){ return Boolean.parseBoolean(value); } else { return true; } }

Target:
public static boolean workspaceLayerGroupInherit() { if(groupInherit==null){ String value = GeoServerExtensions.getProperty("GEOSERVER_GLOBAL_LAYER_GROUP_INHERIT"); if(value != null){ groupInherit = Boolean.parseBoolean(value); } else { groupInherit = true; } } return groupInherit; }
Source:
public GlusterGeoRepSessionDetails mapRow(ResultSet rs, int rowNum) throws SQLException { GlusterGeoRepSessionDetails entity = new GlusterGeoRepSessionDetails(); entity.setSessionId(getGuidDefaultEmpty(rs, "session_id")); entity.setMasterBrickId(getGuidDefaultEmpty(rs, "master_brick_id")); entity.setSlaveHostName(rs.getString("slave_host_name")); entity.setSlaveNodeUuid(getGuid(rs, "slave_host_uuid")); entity.setStatus(GeoRepSessionStatus.valueOf(rs.getString("status"))); entity.setCheckPointStatus(rs.getString("checkpoint_status")); entity.setCrawlStatus(GeoRepCrawlStatus.valueOf(rs.getString("crawl_status"))); entity.setFilesSynced(rs.getLong("files_synced")); entity.setFilesPending(rs.getLong("files_pending")); entity.setBytesPending(rs.getLong("bytes_pending")); entity.setDeletesPending(rs.getLong("deletes_pending")); entity.setFilesSkipped(rs.getLong("files_skipped")); return entity; }

Target:
public GlusterGeoRepSessionDetails mapRow(ResultSet rs, int rowNum) throws SQLException { GlusterGeoRepSessionDetails entity = new GlusterGeoRepSessionDetails(); entity.setId(getGuidDefaultEmpty(rs, "session_id")); entity.setMasterBrickId(getGuidDefaultEmpty(rs, "master_brick_id")); entity.setSlaveHostName(rs.getString("slave_host_name")); entity.setSlaveNodeUuid(getGuid(rs, "slave_host_uuid")); entity.setStatus(GeoRepSessionStatus.valueOf(rs.getString("status"))); entity.setCheckPointStatus(rs.getString("checkpoint_status")); entity.setCrawlStatus(GeoRepCrawlStatus.valueOf(rs.getString("crawl_status"))); entity.setFilesSynced(rs.getLong("files_synced")); entity.setFilesPending(rs.getLong("files_pending")); entity.setBytesPending(rs.getLong("bytes_pending")); entity.setDeletesPending(rs.getLong("deletes_pending")); entity.setFilesSkipped(rs.getLong("files_skipped")); return entity; }
Source:
public void start() { if (!isRunning()) { try { if (log.isDebugEnabled()) { log.debug("starting process"); } process = processBuilder.start(); stdout = process.getInputStream(); stdin = process.getOutputStream(); running.set(true); if (log.isDebugEnabled()) { log.debug("process started"); } } catch (IOException e) { log.error(e.getMessage(),e); throw new RuntimeException(e.getMessage(),e); } } }

Target:
public void start() { if (!isRunning()) { if (log.isDebugEnabled()) { log.debug("starting process. Command = [" + command + "]"); } try { process = processBuilder.start(); } catch (IOException e) { log.error(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } if (!processBuilder.redirectErrorStream()) { monitorErrorStream(); } monitorProcess(); stdout = process.getInputStream(); stdin = process.getOutputStream(); running.set(true); if (log.isDebugEnabled()) { log.debug("process started. Command = [" + command + "]"); } } }
Source:
protected Map getImgMetadata(File file) { logger.debug("Get image Metadata in Resource Action"); Map<String, String> map = new HashMap<>(); try { Metadata meta = ImageMetadataReader.readMetadata(file); map = processMetaData(meta); } catch (ImageProcessingException ex) { logger.error("Error reading metadata from file " + this.getFileName() + " - message " + ex.getMessage()); } catch (IOException ioex) { logger.error("Error reading file", ioex); } return map; }

Target:
protected Map getImgMetadata(File file) { logger.debug("Get image Metadata in Resource Action"); Map<String, String> imgMetdata = new HashMap<>(); try { Metadata meta = ImageMetadataReader.readMetadata(file); imgMetdata = processMetaData(meta); } catch (ImageProcessingException ex) { logger.error("Error reading metadata from file " + this.getFileName() + " - message " + ex.getMessage(), ex); } catch (IOException ioex) { logger.error("Error reading file", ioex); } return imgMetdata; }
Source:
public void checkAttributeValue(PerunSessionImpl sess, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException{ if(attribute.getValue() == null) return; String attrValue = (String) attribute.getValue(); if(!attrValue.equals("true") && !attrValue.equals("false")) { throw new WrongAttributeValueException(attribute, group, "If attribute is not null, only string 'true' or 'false' is correct format."); } try { if (attrValue.equals("true") && (sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROINTERVAL_ATTRNAME).getValue() == null || sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPMEMBERSQUERY_ATTRNAME).getValue() == null || sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPEXTSOURCE_ATTRNAME).getValue() == null)) { throw new WrongReferenceAttributeValueException("At least one of required attributes " + GROUPSYNCHROINTERVAL_ATTRNAME + ", " + GROUPMEMBERSQUERY_ATTRNAME + " or " + GROUPEXTSOURCE_ATTRNAME + " is not set."); } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }

Target:
public void checkAttributeValue(PerunSessionImpl sess, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException{ if(attribute.getValue() == null) return; String attrValue = (String) attribute.getValue(); if(!attrValue.equals("true") && !attrValue.equals("false")) { throw new WrongAttributeValueException(attribute, group, "If attribute is not null, only string 'true' or 'false' is correct format."); } try { if (attrValue.equals("true")) { Attribute requiredAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROINTERVAL_ATTRNAME); if (requiredAttribute.getValue() == null) { throw new WrongReferenceAttributeValueException(attribute, requiredAttribute, requiredAttribute.toString() + " must be set in order to enable synchronization."); } requiredAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPMEMBERSQUERY_ATTRNAME); if (requiredAttribute.getValue() == null) { throw new WrongReferenceAttributeValueException(attribute, requiredAttribute, requiredAttribute.toString() + " must be set in order to enable synchronization."); } requiredAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPEXTSOURCE_ATTRNAME); if (requiredAttribute.getValue() == null) { throw new WrongReferenceAttributeValueException(attribute, requiredAttribute, requiredAttribute.toString() + " must be set in order to enable synchronization."); } } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }
Source:
UnsynchronizedStaticFormatterRule(Class<?> formatterClassToCheck) { this.formatterClassToCheck = formatterClassToCheck; }

Target:
UnsynchronizedStaticFormatterRule(Class<?> formatterClassToCheck) { this(); this.formatterClassToCheck = formatterClassToCheck; }
Source:
public LocalSearchMatcher newLocalSearchMatcher(Object[] parameters) throws ViatraQueryException, QueryProcessingException { ViatraQueryEngine engine = (ViatraQueryEngine) hintProvider; final ISearchContext searchContext = new ISearchContext.SearchContext(engine.getBaseIndex()); Set<EClass> classesToIndex = Sets.newHashSet(); Set<EStructuralFeature> featuresToIndex = Sets.newHashSet(); Set<EDataType> dataTypesToIndex = Sets.newHashSet(); final Set<PParameter> adornment = Sets.newHashSet(); for (int i = 0; i < parameters.length; i++) { if (parameters[i] != null) { adornment.add(query.getParameters().get(i)); } } final MatcherReference reference = new MatcherReference(query, adornment); Set<MatcherReference> dependencies = Sets.newHashSet(reference); Set<MatcherReference> processedDependencies = Sets.newHashSet(); Set<MatcherReference> todo = Sets.difference(dependencies, processedDependencies); while (!todo.isEmpty()) { final MatcherReference dependency = todo.iterator().next(); Planner planner = new Planner(backend, plannerConfiguration); planner.createPlan(dependency, planProvider, searchContext); planner.collectElementsToIndex(classesToIndex, featuresToIndex, dataTypesToIndex); planner.collectDependencies(dependencies); processedDependencies.add(dependency); } searchContext.registerObservedTypes(classesToIndex, dataTypesToIndex, featuresToIndex); return searchContext.getMatcher(reference); }

Target:
public LocalSearchMatcher newLocalSearchMatcher(Object[] parameters) throws ViatraQueryException, QueryProcessingException { ViatraQueryEngine engine = (ViatraQueryEngine) hintProvider; final ISearchContext searchContext = new ISearchContext.SearchContext(engine.getBaseIndex()); Set<EClass> classesToIndex = Sets.newHashSet(); Set<EStructuralFeature> featuresToIndex = Sets.newHashSet(); Set<EDataType> dataTypesToIndex = Sets.newHashSet(); final Set<PParameter> adornment = Sets.newHashSet(); for (int i = 0; i < parameters.length; i++) { if (parameters[i] != null) { adornment.add(query.getParameters().get(i)); } } final MatcherReference reference = new MatcherReference(query, adornment); Set<MatcherReference> dependencies = Sets.newHashSet(reference); Set<MatcherReference> processedDependencies = Sets.newHashSet(); Set<MatcherReference> todo = Sets.difference(dependencies, processedDependencies); while (!todo.isEmpty()) { final MatcherReference dependency = todo.iterator().next(); Collection<SearchPlanForBody> compiledPlans = createPlan(dependency, planProvider, searchContext); collectElementsToIndex(compiledPlans, classesToIndex, featuresToIndex, dataTypesToIndex); collectDependencies(compiledPlans, dependencies); processedDependencies.add(dependency); } searchContext.registerObservedTypes(classesToIndex, dataTypesToIndex, featuresToIndex); return searchContext.getMatcher(reference); }
Source:
public static void disableHealthMetrics() { System.clearProperty(AbstractFolderConfiguration.class.getName() + ".ADD_HEALTH_METRICS"); }

Target:
public static void disableHealthMetrics() { if (HEALTH_METRIC_PROPERTY != null) { System.setProperty(AbstractFolderConfiguration.class.getName() + ".ADD_HEALTH_METRICS", HEALTH_METRIC_PROPERTY); } else { System.clearProperty(AbstractFolderConfiguration.class.getName() + ".ADD_HEALTH_METRICS"); } }
Source:
private boolean isCcpEmpty() { if(ccp.getSelectedCountryName()==null) return true; return false; }

Target:
private boolean isCcpEmpty() { return mCountryCodePicker.getSelectedCountryName() == null; }
Source:
public void setPassword(Principal principal, PasswordCallback passwordCallback) throws IOException, AccountNotFoundException { if (principal == null) { throw new IllegalArgumentException("Principal should never be null"); } String userName = principal.getName(); String password = ""; if (passwordCallback instanceof PlainPasswordCallback) { password = ((PlainPasswordCallback) passwordCallback).getPlainPassword(); } boolean isAuthenticated = false; try { if (authenticationService != null) { isAuthenticated = authenticationService.isValidUser(userName, password); } else { logger.error("No AuthenticationService implementation is available"); } } catch (AuthenticationException e) { logger.error("Error while validating user" + userName, e); } if (passwordCallback instanceof PlainPasswordCallback) { ((PlainPasswordCallback) passwordCallback).setAuthenticated(isAuthenticated); } }

Target:
public void setPassword(Principal principal, PasswordCallback passwordCallback) throws IOException, AccountNotFoundException { if (principal == null) { throw new IllegalArgumentException("Principal should never be null"); } String userName = principal.getName(); char[] password = new char[10]; if (passwordCallback instanceof PlainPasswordCallback) { password = ((PlainPasswordCallback) passwordCallback).getPlainPassword().toCharArray(); } boolean isAuthenticated = false; try { if (authenticationService != null) { isAuthenticated = authenticationService.isValidUser(userName, password); } else { logger.error("No AuthenticationService implementation is available"); } } catch (AuthenticationException e) { logger.error("Error while validating user: " + userName, e); } if (passwordCallback instanceof PlainPasswordCallback) { ((PlainPasswordCallback) passwordCallback).setAuthenticated(isAuthenticated); } }
Source:
public @Nullable ConfigDescription getConfigDescription(URI uri, Locale locale) { List<ConfigDescriptionParameter> parameters = new ArrayList<ConfigDescriptionParameter>(); List<ConfigDescriptionParameterGroup> parameterGroups = new ArrayList<ConfigDescriptionParameterGroup>(); URI aliasedURI = uri; for (ConfigDescriptionAliasHandler aliasHandler : configDescriptionAliasHandlers) { URI alias = aliasHandler.getAlias(uri); if (alias != null) { aliasedURI = alias; break; } } boolean found = false; for (ConfigDescriptionProvider configDescriptionProvider : this.configDescriptionProviders) { ConfigDescription config = configDescriptionProvider.getConfigDescription(aliasedURI, locale); if (config != null) { found = true; parameters.addAll(config.getParameters()); parameterGroups.addAll(config.getParameterGroups()); } } if (found) { List<ConfigDescriptionParameter> parametersWithOptions = new ArrayList<ConfigDescriptionParameter>( parameters.size()); for (ConfigDescriptionParameter parameter : parameters) { parametersWithOptions.add(getConfigOptions(aliasedURI, parameter, locale)); } return new ConfigDescription(aliasedURI, parametersWithOptions, parameterGroups); } else { return null; } }

Target:
public @Nullable ConfigDescription getConfigDescription(URI uri, Locale locale) { List<ConfigDescriptionParameter> parameters = new ArrayList<ConfigDescriptionParameter>(); List<ConfigDescriptionParameterGroup> parameterGroups = new ArrayList<ConfigDescriptionParameterGroup>(); boolean found = fillFromProviders(uri, locale, parameters, parameterGroups); URI alias = null; if (!found) { for (ConfigDescriptionAliasProvider aliasProvider : configDescriptionAliasProviders) { alias = aliasProvider.getAlias(uri); if (alias != null) { logger.debug("No config description found for '{}', using alias '{}' instead", uri, alias); found = fillFromProviders(alias, locale, parameters, parameterGroups); break; } } } if (found) { List<ConfigDescriptionParameter> parametersWithOptions = new ArrayList<ConfigDescriptionParameter>( parameters.size()); for (ConfigDescriptionParameter parameter : parameters) { parametersWithOptions.add(getConfigOptions(uri, alias, parameter, locale)); } return new ConfigDescription(uri, parametersWithOptions, parameterGroups); } else { return null; } }
Source:
public void testNoHangIfPartitionIsOffline() throws Exception { BackgroundHiveSplitLoader backgroundHiveSplitLoader = backgroundHiveSplitLoaderNoMetadata(); HiveSplitSource hiveSplitSource = hiveSplitSource(backgroundHiveSplitLoader, TupleDomain.none()); backgroundHiveSplitLoader.start(hiveSplitSource); try { drain(hiveSplitSource); } catch (Exception e) { assertEquals(e.getMessage(), "java.lang.Exception: OFFLINE"); } boolean failed = false; try { hiveSplitSource.isFinished(); } catch (Exception e) { failed = true; } assertEquals(failed, true); }

Target:
public void testNoHangIfPartitionIsOffline() throws Exception { BackgroundHiveSplitLoader backgroundHiveSplitLoader = backgroundHiveSplitLoaderOfflinePartitions(); HiveSplitSource hiveSplitSource = hiveSplitSource(backgroundHiveSplitLoader, TupleDomain.all()); backgroundHiveSplitLoader.start(hiveSplitSource); assertThrows(RuntimeException.class, () -> drain(hiveSplitSource)); assertThrows(RuntimeException.class, () -> hiveSplitSource.isFinished()); }
Source:
protected Menu getMenu(final MMenu mmenu, ToolItem toolItem) { Object obj = mmenu.getWidget(); if (obj instanceof Menu && !((Menu) obj).isDisposed()) { return (Menu) obj; } if (mmenu instanceof MRenderedMenu) { obj = ((MRenderedMenu) mmenu).getContributionManager(); if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj); } if (obj instanceof IMenuCreator) { final IMenuCreator creator = (IMenuCreator) obj; final Menu menu = creator.getMenu(toolItem.getParent() .getShell()); if (menu != null) { toolItem.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (menu != null && !menu.isDisposed()) { creator.dispose(); ((MRenderedMenu) mmenu).setWidget(null); } } }); menu.setData(AbstractPartRenderer.OWNING_ME, menu); return menu; } } } else { final IEclipseContext lclContext = getContext(mmenu); IPresentationEngine engine = lclContext .get(IPresentationEngine.class); obj = engine.createGui(mmenu, toolItem.getParent(), lclContext); if (obj instanceof Menu) { return (Menu) obj; } System.err.println("Rendering returned " + obj); } return null; }

Target:
protected Menu getMenu(final MMenu mmenu, ToolItem toolItem) { Object obj = mmenu.getWidget(); if (obj instanceof Menu && !((Menu) obj).isDisposed()) { return (Menu) obj; } if (mmenu instanceof MRenderedMenu) { obj = ((MRenderedMenu) mmenu).getContributionManager(); if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj); } if (obj instanceof IMenuCreator) { final IMenuCreator creator = (IMenuCreator) obj; final Menu menu = creator.getMenu(toolItem.getParent() .getShell()); if (menu != null) { toolItem.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (menu != null && !menu.isDisposed()) { creator.dispose(); ((MRenderedMenu) mmenu).setWidget(null); } } }); menu.setData(AbstractPartRenderer.OWNING_ME, menu); return menu; } } } else { final IEclipseContext lclContext = getContext(model); IPresentationEngine engine = lclContext .get(IPresentationEngine.class); obj = engine.createGui(mmenu, toolItem.getParent(), lclContext); if (obj instanceof Menu) { return (Menu) obj; } if (logger != null) { logger.debug("Rendering returned " + obj); } } return null; }
Source:
public String login(String username, String password) { resetClientSettings(); updateClientBeforeCall(); restClient.setHttpBasicAuth(username, password); Api api = restClient.loginV3(); authenticator.setApiMajorVersion(api); setupVersionHeader(); String token = ""; if (!authenticator.enforceBasicAuth()) { if (isApiV3()) { setPersistentV3AuthHeaders(); restClient.setCookie(JSESSIONID, ""); restClient.loginV3(); token = restClient.getCookie(JSESSIONID); } else { resetClientSettings(); restClient.setRootUrl(authenticator.getBaseUrl()); token = restClient.loginV4(username, password).getAccessToken(); restClient.setRootUrl(authenticator.getApiUrl()); } } resetClientSettings(); return token; }

Target:
public String login(String username, String password) { String token = ""; resetClientSettings(); setupVersionHeader(""); updateClientBeforeCall(); restClient.setRootUrl(authenticator.getBaseUrl()); try { token = restClient.loginV4(username, password).getAccessToken(); } catch (Exception x) { } restClient.setRootUrl(authenticator.getApiUrl()); boolean oldApi = StringUtils.isEmpty(token); restClient.setCookie(JSESSIONID, ""); if (oldApi) { restClient.setHttpBasicAuth(username, password); setPersistentV3AuthHeaders(); } else { restClient.setBearerAuth(token); } Api api = restClient.loginV3(); authenticator.setApiMajorVersion(api); setupVersionHeader(authenticator.getApiMajorVersion()); if (oldApi && api != null) { token = restClient.getCookie(JSESSIONID); } resetClientSettings(); return token; }
Source:
protected String generateVmConfiguration(VM vm, List<DiskImage> disks, Map<Guid, VmDevice> vmDevices) { if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) { vm.setInterfaces(vmNetworkInterfaceDao.getAllForVm(vm.getId())); } if (StringUtils.isEmpty(vm.getVmtName())) { VmTemplate t = vmTemplateDao.get(vm.getVmtGuid()); vm.setVmtName(t.getName()); } if (vmDevices == null) { vmDeviceUtils.setVmDevices(vm.getStaticData()); } else { vm.getStaticData().setManagedDeviceMap(vmDevices); } if (disks == null) { disks = DisksFilter.filterImageDisks(diskDao.getAllForVm(vm.getId()), ONLY_SNAPABLE, ONLY_ACTIVE); disks.addAll(imagesHandler.getCinderLeafImages(diskDao.getAllForVm(vm.getId()))); disks.addAll(imagesHandler.getManagedBlockStorageSnapshots(diskDao.getAllForVm(vm.getId()))); } populateDisksWithVmData(disks, vm.getId()); disks.forEach(image -> image.setStorageIds(null)); FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm); fullEntityOvfData.setDiskImages(disks); vmHandler.updateVmInitFromDB(vm.getStaticData(), true); return ovfManager.exportVm(vm, fullEntityOvfData, clusterUtils.getCompatibilityVersion(vm)); }

Target:
protected String generateVmConfiguration(VM vm, List<DiskImage> disks, Map<Guid, VmDevice> vmDevices) { if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) { vm.setInterfaces(vmNetworkInterfaceDao.getAllForVm(vm.getId())); } if (StringUtils.isEmpty(vm.getVmtName())) { VmTemplate t = vmTemplateDao.get(vm.getVmtGuid()); vm.setVmtName(t.getName()); } if (vmDevices == null) { vmDeviceUtils.setVmDevices(vm.getStaticData()); } else { vm.getStaticData().setManagedDeviceMap(vmDevices); } if (disks == null) { disks = DisksFilter.filterImageDisks(diskDao.getAllForVm(vm.getId()), ONLY_SNAPABLE, ONLY_ACTIVE); disks.addAll(imagesHandler.getCinderLeafImages(diskDao.getAllForVm(vm.getId()))); disks.addAll(imagesHandler.getManagedBlockStorageSnapshots(diskDao.getAllForVm(vm.getId()))); } populateDisksWithVmData(disks, vm.getId()); disks.forEach(image -> image.setStorageIds(null)); FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm); fullEntityOvfData.setDiskImages(disks); if (vm.getStaticData().getVmInit() == null) { vmHandler.updateVmInitFromDB(vm.getStaticData(), true); } return ovfManager.exportVm(vm, fullEntityOvfData, clusterUtils.getCompatibilityVersion(vm)); }
Source:
private String getValidConfirmPatternOrThrow(String confirmPattern) { if (confirmPattern == null) { throw new IllegalArgumentException("Confirm pattern is null"); } try { Pattern.compile(confirmPattern); } catch (PatternSyntaxException ex) { throw new IllegalArgumentException("invalid " + "regex provided for confirmPattern"); } if (DEFAULT.equalsIgnoreCase(confirmPattern)) { set(CONFIRM_PATTERN, DEFAULT); return DEFAULT; } return confirmPattern; }

Target:
private String getValidConfirmPatternOrThrow(String confirmPattern) { if (confirmPattern == null) { throw new IllegalArgumentException("Confirm pattern is null"); } if (DEFAULT.equalsIgnoreCase(confirmPattern)) { confirmPattern = sqlLine.loc("default-confirm-pattern"); } set(CONFIRM_PATTERN, confirmPattern); try { compiledConfirmPattern = Pattern.compile(confirmPattern); } catch (PatternSyntaxException ex) { throw new IllegalArgumentException("invalid " + "regex provided for confirmPattern"); } return confirmPattern; }
Source:
public Statement apply(final Statement base, final Description d) { return new Statement() { @Override public void evaluate() throws Throwable { Class<?> testCase = d.getTestClass(); check(d.getAnnotation(WithOS.class), testCase); check(testCase.getAnnotation(WithOS.class), testCase); base.evaluate(); } private void check(WithOS withos, Class<?> testCase) { if (withos == null) return; String errorMsg = "Test must be run on a machine running any of the following operating systems: " + Arrays.toString(withos.os()); for (OS _os : withos.os()) { switch (_os) { case LINUX: if (!SystemUtils.IS_OS_LINUX) { throw new AssumptionViolatedException(errorMsg); } break; case WINDOWS: if (!SystemUtils.IS_OS_WINDOWS) { throw new AssumptionViolatedException(errorMsg); } break; case MAC: if (!SystemUtils.IS_OS_MAC) { throw new AssumptionViolatedException(errorMsg); } break; default: break; } } } }; }

Target:
public Statement apply(final Statement base, final Description d) { return new Statement() { @Override public void evaluate() throws Throwable { Class<?> testSuite = d.getTestClass(); check(d.getAnnotation(WithOS.class), testSuite); check(testSuite.getAnnotation(WithOS.class), testSuite); base.evaluate(); } private void check(WithOS withos, Class<?> testCase) { if (withos == null) return; if (!(controller instanceof LocalController)) { throw new AssumptionViolatedException("Test skipped. WithOS should be used with a local controller, otherwise it cannot be fully trusted to work as expected."); } String errorMsg = "Test and Jenkins instance must be running on any of the following operating systems: " + Arrays.toString(withos.os()); for (OS _os : withos.os()) { switch (_os) { case LINUX: if (!SystemUtils.IS_OS_LINUX) { throw new AssumptionViolatedException(errorMsg); } break; case WINDOWS: if (!SystemUtils.IS_OS_WINDOWS) { throw new AssumptionViolatedException(errorMsg); } break; case MAC: if (!SystemUtils.IS_OS_MAC) { throw new AssumptionViolatedException(errorMsg); } break; default: break; } } } }; }
Source:
private CompletableFuture<Void> handleDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) throws Throwable { if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { if (trace) { log.tracef("local mode forced, suppressing L1 calls."); } return ctx.continueInvocation(); } Future<?> l1InvalidationFuture = invalidateL1InCluster(ctx, command, assumeOriginKeptEntryInL1); return ctx.forkInvocation(command, (ctx1, command1, rv, throwable) -> { if (throwable != null) throw throwable; processInvalidationResult(command, l1InvalidationFuture); return removeFromLocalL1(ctx, command, rv); }); }

Target:
private CompletableFuture<Void> handleDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) throws Throwable { if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { if (trace) { log.tracef("local mode forced, suppressing L1 calls."); } return ctx.continueInvocation(); } Future<?> l1InvalidationFuture = invalidateL1InCluster(ctx, command, assumeOriginKeptEntryInL1); return ctx.forkInvocation(command, (rCtx, rCommand, rv, throwable) -> { if (throwable != null) throw throwable; DataWriteCommand dataWriteCommand = (DataWriteCommand) rCommand; processInvalidationResult(dataWriteCommand, l1InvalidationFuture); return removeFromLocalL1(rCtx, dataWriteCommand, rv); }); }
Source:
public BinaryResult apply(ChangeEditResource rsrc) throws ResourceNotFoundException, IOException, InvalidChangeOperationException { try { return fileContentUtil.getContent( rsrc.getChangeEdit().getChange().getProject(), rsrc.getChangeEdit().getRevision().get(), rsrc.getPath()); } catch (ResourceNotFoundException rnfe) { return fileContentUtil.getContent( rsrc.getChangeEdit().getChange().getProject(), rsrc.getChangeEdit().getBasePatchSet().getRevision().get(), rsrc.getPath()); } }

Target:
public Response<?> apply(ChangeEditResource rsrc) throws ResourceNotFoundException, IOException, InvalidChangeOperationException { try { return Response.ok(fileContentUtil.getContent( rsrc.getChangeEdit().getChange().getProject(), rsrc.getChangeEdit().getRevision().get(), rsrc.getPath())); } catch (ResourceNotFoundException rnfe) { return Response.none(); } }
Source:
public GlowSound getPlaceSound() { return new GlowSound(Sound.DIG_WOOD); }

Target:
public SoundInfo getPlaceSound() { return placeSound; }
Source:
public synchronized boolean retry(ITestResult result) { if (currentTry < maxreruntimes) { ++currentTry; return true; } return false; }

Target:
public boolean retry(ITestResult result) { if (currentTry < maxreruntimes) { ++currentTry; return true; } return false; }
Source:
public String getToken() throws NoSuchAlgorithmException { createToken(); return token; }

Target:
public String getToken() { createToken(); return token; }
Source:
public void testCreateAnAPIThroughThePublisherRest() throws Exception { String apiContext = "apim574PublisherTestAPI"; String apiDescription = "This is Test API Created by API Manager Integration Test"; String apiTags = "tag574-1, tag574-2, tag587-3"; APICreationRequestBean apiCreationRequestBean = new APICreationRequestBean(apiNameTest, apiContext, apiVersion, apiProvider, new URL(apiEndPointUrl)); apiCreationRequestBean.setTags(apiTags); apiCreationRequestBean.setDescription(apiDescription); apiCreationRequestBean.setTiersCollection("Gold,Bronze"); apiCreationRequestBean.setDefaultVersion("default_version"); apiCreationRequestBean.setDefaultVersionChecked("default_version"); apiCreationRequestBean.setBizOwner("api574b"); apiCreationRequestBean.setBizOwnerMail("api574b@ee.com"); apiCreationRequestBean.setTechOwner("api574t"); apiCreationRequestBean.setTechOwnerMail("api574t@ww.com"); APIDTO apiCreationResponse = restAPIPublisher.addAPI(apiCreationRequestBean); String status = apiCreationResponse.getLifeCycleStatus(); apiId = apiCreationResponse.getId(); HttpResponse apiResponsePublisher = restAPIPublisher.getAPI(apiId); assertEquals(apiResponsePublisher.getResponseCode(), Response.Status.OK.getStatusCode(), apiNameTest + " is not visible in publisher"); assertTrue(apiCreationResponse.getName().equals(apiNameTest), apiNameTest + " is not visible in " + "publisher"); assertTrue(status.equals("CREATED"), "Status of the " + apiNameTest + "is not a valid status"); }

Target:
public void testCreateAnAPIThroughThePublisherRest() throws Exception { String apiContext = "apim574PublisherTestAPI"; String apiDescription = "This is Test API Created by API Manager Integration Test"; String apiTags = "tag574-1, tag574-2, tag587-3"; APICreationRequestBean apiCreationRequestBean = new APICreationRequestBean(apiNameTest, apiContext, apiVersion, apiProvider, new URL(apiEndPointUrl)); apiCreationRequestBean.setTags(apiTags); apiCreationRequestBean.setDescription(apiDescription); apiCreationRequestBean.setTiersCollection("Gold,Bronze"); apiCreationRequestBean.setDefaultVersion("default_version"); apiCreationRequestBean.setDefaultVersionChecked("default_version"); apiCreationRequestBean.setBizOwner("api574b"); apiCreationRequestBean.setBizOwnerMail("api574b@ee.com"); apiCreationRequestBean.setTechOwner("api574t"); apiCreationRequestBean.setTechOwnerMail("api574t@ww.com"); APIDTO apiCreationResponse = restAPIPublisher.addAPI(apiCreationRequestBean); String status = apiCreationResponse.getLifeCycleStatus(); apiId = apiCreationResponse.getId(); HttpResponse apiResponsePublisher = restAPIPublisher.getAPI(apiId); assertEquals(apiResponsePublisher.getResponseCode(), Response.Status.OK.getStatusCode(), apiNameTest + " is not visible in publisher"); assertTrue(apiNameTest.equals(apiCreationResponse.getName()), apiNameTest + " is not visible in publisher"); assertTrue(APILifeCycleState.CREATED.getState().equalsIgnoreCase(status), "Status of the " + apiNameTest + "is not a valid status"); }
Source:
public CacheStatistics getStatistics(String scope) { return CacheStatistics.EMPTY; }

Target:
public CacheStatistics getStatistics(String scope) { return new CacheStatistics(getScopeCache(scope).size()); }
Source:
public E get(long timeout, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { if (timeout < 0 || timeUnit == null) { throw new IllegalArgumentException("Invalid timeout or timeUnit for MessageFuture.get()"); } long remainingTimeoutNanos = timeUnit.toNanos(timeout); synchronized (this) { while (NO_RESULT.equals(result) && remainingTimeoutNanos > 0) { long started = System.nanoTime(); wait(TimeUnit.NANOSECONDS.toMillis(remainingTimeoutNanos)); remainingTimeoutNanos -= System.nanoTime() - started; } if (NO_RESULT.equals(result)) { throw new TimeoutException(format("Timeout while executing message, total timeout: %d ms", timeUnit.toMillis(timeout))); } if (result instanceof Throwable) { throw new ExecutionException((Throwable) result); } return result; } }

Target:
public E get(long timeout, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { if (timeout < 0 || timeUnit == null) { throw new IllegalArgumentException("Invalid timeout or timeUnit for MessageFuture.get()"); } long remainingTimeoutNanos = timeUnit.toNanos(timeout); synchronized (this) { while (NO_RESULT.equals(result) && remainingTimeoutNanos > ONE_MILLISECOND) { long started = System.nanoTime(); wait(TimeUnit.NANOSECONDS.toMillis(remainingTimeoutNanos)); remainingTimeoutNanos -= System.nanoTime() - started; } E tmpResult = result; if (NO_RESULT.equals(tmpResult)) { throw new TimeoutException(format("Timeout while waiting for message (%d ms)", timeUnit.toMillis(timeout))); } if (tmpResult instanceof Throwable) { throw new ExecutionException((Throwable) tmpResult); } futureMap.remove(key); return tmpResult; } }
Source:
public boolean handles(String source) { return source.equals("github"); }

Target:
public boolean handles(String source) { return "github".equals(source); }
Source:
public void addChangeListener_shouldAddTheObjectToHandlerRealmObjects() { looperThread.realm.beginTransaction(); AllTypesPrimaryKey allTypesPrimaryKey = looperThread.realm.createObject(AllTypesPrimaryKey.class, 1); looperThread.realm.commitTransaction(); assertTrue(looperThread.realm.handlerController.realmObjects.isEmpty()); allTypesPrimaryKey.addChangeListener(new RealmChangeListener<RealmModel>() { @Override public void onChange(RealmModel element) { } }); assertEquals(1, looperThread.realm.handlerController.realmObjects.size()); for (WeakReference<RealmObjectProxy> ref : looperThread.realm.handlerController.realmObjects.keySet()) { assertTrue(ref.get() == allTypesPrimaryKey); } looperThread.testComplete(); }

Target:
public void addChangeListener_shouldAddTheObjectToHandlerRealmObjects() { realm.beginTransaction(); AllTypesPrimaryKey allTypesPrimaryKey = realm.createObject(AllTypesPrimaryKey.class, 1); realm.commitTransaction(); final Map<WeakReference<RealmObjectProxy>, RealmQuery<? extends RealmModel>> realmObjects = realm.handlerController.realmObjects; assertTrue(realmObjects.isEmpty()); allTypesPrimaryKey.addChangeListener(new RealmChangeListener<AllTypesPrimaryKey>() { @Override public void onChange(AllTypesPrimaryKey element) { } }); assertEquals(1, realmObjects.size()); for (WeakReference<RealmObjectProxy> ref : realmObjects.keySet()) { assertTrue(ref.get() == allTypesPrimaryKey); } }
Source:
private Set<String> validateJobHostName(final String hostname) { final Set<String> errors = Sets.newHashSet(); if (hostname == null || hostname.isEmpty()) { return errors; } if (!HOSTNAME_PATTERN.matcher(hostname).matches()) { errors.add( format("Invalid hostname (%s), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63", hostname)); } return errors; }

Target:
private Set<String> validateJobHostName(final String hostname) { final Set<String> errors = Sets.newHashSet(); if (isNullOrEmpty(hostname)) { return errors; } if (!HOSTNAME_PATTERN.matcher(hostname).matches()) { errors.add( format("Invalid hostname (%s), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63", hostname)); } return errors; }
Source:
boolean isValidVersion(WorkflowVersion version) { SortedSet<VersionValidation> versionValidations = version.getValidations(); boolean isValid = true; for (VersionValidation versionValidation : versionValidations) { if (!versionValidation.isValid()) { isValid = false; break; } } return isValid; }

Target:
public boolean isValidVersion(WorkflowVersion version) { return !version.getValidations().stream().filter(versionValidation -> !versionValidation.isValid()).findFirst().isPresent(); }
Source:
private void initCe() { processingScheduler.startScheduling(); cleaningScheduler.startScheduling(); ceDistributedInformation.broadcastWorkerUUIDs(); }

Target:
private void initCe() { ceDistributedInformation.broadcastWorkerUUIDs(); processingScheduler.startScheduling(); cleaningScheduler.startScheduling(); }
Source:
public void updateMapping(FriendlyCodeVO vo) { Connection conn = null; try { conn = this.getConnection(); conn.setAutoCommit(false); this.deleteRecord(vo.getFriendlyCode(), null, null, conn); this.addRecord(vo, conn); conn.commit(); } catch (Throwable t) { this.executeRollback(conn); _logger.error("Error update the mapping", t); throw new RuntimeException("Error update the mapping", t); } finally { this.closeConnection(conn); } }

Target:
public void updateMapping(FriendlyCodeVO vo) { Connection conn = null; try { conn = this.getConnection(); conn.setAutoCommit(false); super.executeQueryWithoutResultset(conn, DELETE_FROM_FRIENDLYCODE, vo.getFriendlyCode()); this.addRecord(vo, conn); conn.commit(); } catch (Throwable t) { this.executeRollback(conn); _logger.error("Error update the mapping", t); throw new RuntimeException("Error update the mapping", t); } finally { this.closeConnection(conn); } }
Source:
public void sortElements(String envVar, String criteria, String order) { String value = ThreadProperty.get(envVar); JsonArray jsonArr = JsonValue.readHjson(value).asArray(); List<JsonValue> jsonValues = new ArrayList<JsonValue>(); for (int i = 0; i < jsonArr.size(); i++) { jsonValues.add(jsonArr.get(i)); } Comparator<JsonValue> comparator; switch (criteria) { case "alphabtical": commonspec.getLogger().debug("Alphabetic criteria selected."); comparator = new Comparator<JsonValue>() { public int compare(JsonValue json1, JsonValue json2) { int res = String.CASE_INSENSITIVE_ORDER.compare(json1.toString(), json2.toString()); if (res == 0) { res = json1.toString().compareTo(json2.toString()); } return res; } }; break; default: commonspec.getLogger().debug("No criteria selected."); comparator = null; } if ("ascending".equals(order)) { Collections.sort(jsonValues,comparator); } else { Collections.sort(jsonValues,comparator.reversed()); } ThreadProperty.set(envVar,jsonValues.toString()); }

Target:
public void sortElements(String envVar, String criteria, String order) { String value = ThreadProperty.get(envVar); JsonArray jsonArr = JsonValue.readHjson(value).asArray(); List<JsonValue> jsonValues = new ArrayList<JsonValue>(); for (int i = 0; i < jsonArr.size(); i++) { jsonValues.add(jsonArr.get(i)); } Comparator<JsonValue> comparator; switch (criteria) { case "alphabetical": commonspec.getLogger().debug("Alphabetical criteria selected."); comparator = new Comparator<JsonValue>() { public int compare(JsonValue json1, JsonValue json2) { int res = String.CASE_INSENSITIVE_ORDER.compare(json1.toString(), json2.toString()); if (res == 0) { res = json1.toString().compareTo(json2.toString()); } return res; } }; break; default: commonspec.getLogger().debug("No criteria selected."); comparator = null; } if ("ascending".equals(order)) { Collections.sort(jsonValues,comparator); } else { Collections.sort(jsonValues,comparator.reversed()); } ThreadProperty.set(envVar,jsonValues.toString()); }
Source:
private static String buildErrorMessage(KafkaTopic topic, int partition, long offset, String message) { return message + format("[offset %d, kafka_topic %s, partition %d]", offset, topic.name().asString(), partition); }

Target:
private static String buildErrorMessage(KafkaTopic topic, int partition, long offset, String message) { return format("%s [offset %d, kafka_topic %s, partition %d]", message, offset, topic.name().asString(), partition); }
Source:
public FileReceiver( TransmissionMeta meta, int chunkSize, BooleanSupplier stopChecker, FileIOFactory factory, Consumer<File> hnd, String path, IgniteLogger log ) { super(meta, stopChecker, log, chunkSize); A.notNull(hnd, "FileHandler must be provided by transmission handler"); A.notNull(path, "File absolute path cannot be null"); A.ensure(!path.trim().isEmpty(), "File absolute path cannot be empty "); this.hnd = hnd; file = new File(path); try { fileIo = factory.create(file); fileIo.position(meta.offset()); } catch (IOException e) { throw new IgniteException("Unable to open destination file. Receiver will will be stopped: " + file.getAbsolutePath(), e); } }

Target:
public FileReceiver( TransmissionMeta meta, int chunkSize, BooleanSupplier stopChecker, FileIOFactory factory, Consumer<File> hnd, String path, IgniteLogger log ) { super(meta, stopChecker, log, chunkSize); A.notNull(hnd, "FileHandler must be provided by transmission handler"); A.notNull(path, "File absolute path cannot be null"); A.ensure(!path.trim().isEmpty(), "File absolute path cannot be empty "); this.hnd = hnd; file = new File(path); try { fileIo = factory.create(file); fileIo.position(meta.offset()); } catch (IOException e) { throw new IgniteException("Unable to open destination file. Receiver will be stopped: " + file.getAbsolutePath(), e); } }
Source:
public long getLatencyAtPercentile(Host host, Statement statement, Exception exception, double percentile) { checkArgument(percentile >= 0.0 && percentile < 100, "percentile must be between 0.0 and 100 (was %f)"); Histogram histogram = getLastIntervalHistogram(host, statement, exception); if (histogram == null || histogram.getTotalCount() < minRecordedValues) return -1; return histogram.getValueAtPercentile(percentile); }

Target:
public long getLatencyAtPercentile(Host host, Statement statement, Exception exception, double percentile) { checkArgument(percentile >= 0.0 && percentile < 100, "percentile must be between 0.0 and 100 (was %s)", percentile); Histogram histogram = getLastIntervalHistogram(host, statement, exception); if (histogram == null || histogram.getTotalCount() < minRecordedValues) return -1; return histogram.getValueAtPercentile(percentile); }
Source:
private void initModList() { modListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); modListView.setCellFactory(modListCellFactory()); modListView.getItems().setAll(modService.getInstalledMods()); try { modService.getActivatedSimAndUIMods().forEach(mod -> modListView.getSelectionModel().select(mod)); } catch (IOException e) { logger.error("Activated Mods could not be loaded", e); } modListView.scrollTo(modListView.getSelectionModel().getSelectedItem()); }

Target:
private void initModList() { modListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); modListView.setCellFactory(modListCellFactory()); modListView.getItems().setAll(modService.getInstalledMods()); try { modService.getActivatedSimAndUIMods().forEach(mod -> modListView.getSelectionModel().select(mod)); } catch (IOException e) { logger.error("Activated mods could not be loaded", e); } modListView.scrollTo(modListView.getSelectionModel().getSelectedItem()); }