auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void handleFailedMigrations(MultiStatus status) throws CoreException { if (!status.isOK()) { MultiStatus errorStatus = new MultiStatus(ITasksCoreConstants.ID_PLUGIN, IStatus.ERROR, NLS.bind(Messages.RefactorTaskIdsOperation_FailedTaskCount, status.getChildren().length), null); errorStatus.merge(status); throw new CoreException(errorStatus); } }

Target:
private void handleFailedMigrations(MultiStatus status) throws CoreException { if (!status.isOK()) { MultiStatus errorStatus = new MultiStatus(ITasksCoreConstants.ID_PLUGIN, IStatus.ERROR, NLS.bind(Messages.RefactorTaskIdsOperation_FailedTaskCount, status.getChildren().length), null); errorStatus.merge(status); StatusHandler.log(errorStatus); throw new CoreException(errorStatus); } }
Source:
public void doRunQuickFix() { Display.getDefault().syncExec(new Runnable() { @Override public void run() { for (int i = 0; i < markers.length; i++) { IMarker marker = markers[i]; isApplicableMap.put(marker, quickFix.isApplicable(marker)); quickFix.run(marker); dispatch(0); } PlatformUI.getWorkbench().saveAllEditors(false); } }); }

Target:
public void doRunQuickFix() { Display.getDefault().syncExec(new Runnable() { @Override public void run() { for (int i = 0; i < markers.length; i++) { IMarker marker = markers[i]; isApplicableMap.put(marker, quickFix.isApplicable(marker)); if (quickFix.isApplicable(marker)) { quickFix.run(marker); dispatch(0); } } PlatformUI.getWorkbench().saveAllEditors(false); } }); }
Source:
static <K, V> void setAll(Map<K, V> target, Map<K, V> newValues) { target.clear(); target.putAll(newValues); }

Target:
static <K, V> void setAll(Map<K, V> target, Map<K, V> newValues) { target.keySet().retainAll(newValues.keySet()); target.putAll(newValues); }
Source:
default long getPriority() { return 1; }

Target:
default long getPriority() { return 0; }
Source:
public Response approve(Action action) { if (action.isSetCluster() && (action.getCluster().isSetId() || action.getCluster().isSetName())) { update(setCluster(get(), action.getCluster())); } ApproveVdsParameters params = new ApproveVdsParameters(guid); params.setPassword(action.getRootPassword()); if (action.isSetSsh()) { if (action.getSsh().isSetUser()) { if (action.getSsh().getUser().isSetPassword()) { params.setPassword(action.getSsh().getUser().getPassword()); } } if (action.getSsh().isSetAuthenticationType()) { params.setAuthMethod(mapAuth(action.getSsh().getAuthenticationType().getAuthenticationType())); } } return doAction(VdcActionType.ApproveVds, params, action); }

Target:
public Response approve(Action action) { if (action.isSetCluster() && (action.getCluster().isSetId() || action.getCluster().isSetName())) { update(setCluster(get(), action.getCluster())); } validateEnums(Action.class, action); ApproveVdsParameters params = new ApproveVdsParameters(guid); params = getMapper(Action.class, ApproveVdsParameters.class).map(action, params); return doAction(VdcActionType.ApproveVds, params, action); }
Source:
public void testInterruptsHealthCheckOnClose() throws InterruptedException { final CountDownLatch inHealthCheckLatch = new CountDownLatch(1); final CountDownLatch interruptedLatch = new CountDownLatch(1); when(_serviceFactory.isHealthy(FOO_ENDPOINT)).thenAnswer(new Answer<Boolean>() { @Override public Boolean answer(InvocationOnMock invocation) { inHealthCheckLatch.countDown(); synchronized (this) { try { this.wait(); } catch (InterruptedException e) { interruptedLatch.countDown(); } } return false; } }); when(_hostDiscovery.getHosts()).thenReturn(ImmutableList.of(FOO_ENDPOINT)); ServicePool<Service> pool = new ServicePool<>(_ticker, _hostDiscovery, false, _serviceFactory, ServiceCachingPolicyBuilder.NO_CACHING, _partitionFilter, _loadBalanceAlgorithm, Executors.newScheduledThreadPool(1), true, new FixedHealthCheckRetryPolicy(100, TimeUnit.MILLISECONDS), _registry); try { pool.execute(NEVER_RETRY, new ServiceCallback<Service, Void>() { @Override public Void call(Service service) throws ServiceException { throw new ServiceException(); } }); fail(); } catch (MaxRetriesException e) { } assertTrue(inHealthCheckLatch.await(10, TimeUnit.SECONDS)); pool.close(); assertTrue(interruptedLatch.await(10, TimeUnit.SECONDS)); }

Target:
public void testInterruptsHealthCheckOnClose() throws InterruptedException { final CountDownLatch inHealthCheckLatch = new CountDownLatch(1); final CountDownLatch interruptedLatch = new CountDownLatch(1); when(_serviceFactory.isHealthy(FOO_ENDPOINT)).thenAnswer(new Answer<Boolean>() { @Override public Boolean answer(InvocationOnMock invocation) { inHealthCheckLatch.countDown(); synchronized (this) { try { this.wait(); } catch (InterruptedException e) { interruptedLatch.countDown(); } } return false; } }); when(_hostDiscovery.getHosts()).thenReturn(ImmutableList.of(FOO_ENDPOINT)); ServicePool<Service> pool = new ServicePool<>(_ticker, _hostDiscovery, false, _serviceFactory, ServiceCachingPolicyBuilder.NO_CACHING, _partitionFilter, _loadBalanceAlgorithm, Executors.newScheduledThreadPool(1), true, new FixedHealthCheckRetryDelay(100, TimeUnit.MILLISECONDS), _registry); try { pool.execute(NEVER_RETRY, new ServiceCallback<Service, Void>() { @Override public Void call(Service service) throws ServiceException { throw new ServiceException(); } }); fail(); } catch (MaxRetriesException e) { } assertTrue(inHealthCheckLatch.await(10, TimeUnit.SECONDS)); pool.close(); assertTrue(interruptedLatch.await(10, TimeUnit.SECONDS)); }
Source:
public static byte[] getInitialJson(String dirName, String file) { Preconditions.checkArgument(!dirName.contains("/"), "Invalid dir name %s", dirName); Mutation mutation = RootTable.EXTENT.getPrevRowUpdateMutation(); ServerColumnFamily.DIRECTORY_COLUMN.put(mutation, new Value(dirName.getBytes(UTF_8))); mutation.put(DataFileColumnFamily.STR_NAME, file, new DataFileValue(0, 0).encodeAsValue()); ServerColumnFamily.TIME_COLUMN.put(mutation, new Value(new MetadataTime(0, TimeType.LOGICAL).encode())); RootTabletMetadata rtm = new RootTabletMetadata(); rtm.update(mutation); return rtm.toJson().getBytes(UTF_8); }

Target:
public static byte[] getInitialJson(String dirName, String file) { ServerColumnFamily.validateDirCol(dirName); Mutation mutation = RootTable.EXTENT.getPrevRowUpdateMutation(); ServerColumnFamily.DIRECTORY_COLUMN.put(mutation, new Value(dirName.getBytes(UTF_8))); mutation.put(DataFileColumnFamily.STR_NAME, file, new DataFileValue(0, 0).encodeAsValue()); ServerColumnFamily.TIME_COLUMN.put(mutation, new Value(new MetadataTime(0, TimeType.LOGICAL).encode())); RootTabletMetadata rtm = new RootTabletMetadata(); rtm.update(mutation); return rtm.toJson().getBytes(UTF_8); }
Source:
public void setHttpConnector(HttpConnector httpConnector) { log.debug("HttpConnector '" + httpConnector.getClass().getName() + "' registered."); }

Target:
public void setHttpConnector(HttpConnector httpConnector) { log.debug("HttpConnector '{}' registered.", httpConnector.getClass().getName()); }
Source:
public Object getObject(String category, String url, String username, String password) { this.restTemplate.setInterceptors(Arrays.asList(new BasicAuthInterceptor(username, password), new HeaderClientHttpRequestInterceptor("Accept", "application/json"))); this.restTemplate.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(new FHIRHttpMessageConverter())); return restTemplate.getForObject(url, resolveCategory(category)); }

Target:
public Object getObject(String category, String url, String username, String password) throws HttpClientErrorException { prepareRestTemplate(username, password); String stringObject = ""; try { stringObject = restTemplate.getForObject(url, resolveCategory(category)).toString(); } catch(HttpClientErrorException e) { log.error(String.format("Resource %s not found", category)); } return convertStringToFHIRObject(resolveCategory(category), stringObject); }
Source:
String updateAgentAssociation(Request request, Response response) { String envName = request.params("env_name"); EnvironmentConfig envConfig = environmentConfigService.getEnvironmentConfig(envName); JsonReader jsonReader = GsonTransformer.getInstance().jsonReaderFrom(request.body()); JsonReader agents = jsonReader.readJsonObject("agents"); List<String> uuidsToAssociate = agents.readStringArrayIfPresent("add").orElse(Collections.emptyList()); List<String> uuidsToRemove = agents.readStringArrayIfPresent("remove").orElse(Collections.emptyList()); if (!uuidsToAssociate.isEmpty() || !uuidsToRemove.isEmpty()) { agentService.updateAgentsAssociationOfEnvironment(envConfig, uuidsToAssociate, uuidsToRemove); } return renderMessage(response, 200, "Environment '" + envName + "' updated successfully!"); }

Target:
String updateAgentAssociation(Request request, Response response) { String envName = request.params("env_name"); EnvironmentConfig envConfig = environmentConfigService.getEnvironmentConfig(envName); JsonReader jsonReader = GsonTransformer.getInstance().jsonReaderFrom(request.body()); JsonReader agents = jsonReader.readJsonObject("agents"); List<String> uuidsToAssociate = agents.readStringArrayIfPresent("add").orElse(Collections.emptyList()); List<String> uuidsToRemove = agents.readStringArrayIfPresent("remove").orElse(Collections.emptyList()); if (!uuidsToAssociate.isEmpty() || !uuidsToRemove.isEmpty()) { agentService.updateAgentsAssociationOfEnvironment(envConfig, uuidsToAssociate, uuidsToRemove); } return renderMessage(response, 200, EntityType.Environment.updateSuccessful(envName)); }
Source:
private String getBody() { String jobID = jobState.getId().value(); String status = jobState.getStatus().toString(); String hostname = "UNKNOWN"; List<TaskState> tasks = jobState.getTasks(); StringBuilder taskStatus = new StringBuilder(); for (TaskState task : tasks) { taskStatus.append("Task : " + task.getId().toString() + " Status: " + task.getStatus().toString() + "\n"); } try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { logger.debug("Could not get hostname", e); } return String.format(BODY_TEMPLATE, jobID, status, taskStatus.toString(), hostname); }

Target:
private String getBody() { String jobID = jobState.getId().value(); String status = jobState.getStatus().toString(); String hostname = "UNKNOWN"; try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { logger.debug("Could not get hostname", e); } return String.format(BODY_TEMPLATE, jobID, status, hostname); }
Source:
public void setScanRows(int[] rows, int[] rowIndices, int numRows) { filterIdx = -1; failNext = 0; if (numRows == numFilterRows) { allFilters = true; numFilters = numFilterRows; } else { allFilters = false; numFilters = numRows; if (numFilters == 0) { return; } if (filterOrder == null || filterOrder.length < numRows) { filterOrder = new int[numRows]; } int row = rowIndices != null ? rows[rowIndices[0]] : rows[0]; int first = Arrays.binarySearch(filterRows, 0, numFilterRows, row); if (first < 0) { throw new IllegalArgumentException("Filter row not in defined row set for PositionalFilter"); } filterOrder[0] = first; for (int i = 1; i < numRows; i++) { row = rowIndices != null ? rows[rowIndices[i]] : rows[i]; boolean found = false; for (int j = filterOrder[i - 1] + 1; j < numFilterRows; j++) { if (filterRows[j] == row) { filterOrder[i] = j; found = true; break; } if (filterRows[j] > row) { break; } } if (!found) { throw new IllegalArgumentException("Setting a filtered row that is not in the set of defined rows for PositionalFilter"); } } } }

Target:
public void setScanRows(int[] rows, int[] rowIndices, int numRows) { checkArgument(numRows <= rows.length); checkArgument(numRows <= numPositions); filterIndex = -1; numNextPositionsToFail = 0; if (numRows == numPositions) { scanAllPositions = true; numSelectedPositions = numPositions; } else { scanAllPositions = false; numSelectedPositions = numRows; if (numSelectedPositions == 0) { return; } if (selectedPositionIndexes == null || selectedPositionIndexes.length < numRows) { selectedPositionIndexes = new int[numRows]; } int row = rowIndices != null ? rows[rowIndices[0]] : rows[0]; int first = Arrays.binarySearch(positions, 0, numPositions, row); verify(first >= 0, "Filter row not in defined row set for PositionalFilter"); selectedPositionIndexes[0] = first; for (int i = 1; i < numRows; i++) { row = rowIndices != null ? rows[rowIndices[i]] : rows[i]; boolean found = false; for (int j = selectedPositionIndexes[i - 1] + 1; j < numPositions; j++) { if (positions[j] == row) { selectedPositionIndexes[i] = j; found = true; break; } if (positions[j] > row) { break; } } verify(found, "Row not found in PositionalFilter " + row); } } }
Source:
public Object[] getElements() { Object[] allElements = new Object[keys.length]; for (int i = 0; i < keys.length; ++i) allElements[i] = get(keys[i]); return allElements; }

Target:
public Object[] getElements() { Preconditions.checkState(keys != null, KEYS_ARRAY_SETUP_MISSING_MESSAGE); Object[] allElements = new Object[keys.length]; for (int i = 0; i < keys.length; ++i) allElements[i] = get(keys[i]); return allElements; }
Source:
private void validateProperties(List<Property> properties, Optional<Scope> scope) { Set<String> propertyNames = new HashSet<>(); for (Property property : properties) { if (!propertyNames.add(property.getName().getValue())) { throw new SemanticException(DUPLICATE_PROPERTY, property, "Duplicate property '%s'", property.getName().getValue()); } } for (Property property : properties) { process(property, scope); } }

Target:
private void validateProperties(List<Property> properties, Optional<Scope> scope) { Set<String> propertyNames = new HashSet<>(); for (Property property : properties) { if (!propertyNames.add(property.getName().getValue())) { throw new SemanticException(DUPLICATE_PROPERTY, property, "Duplicate property: %s", property.getName().getValue()); } } for (Property property : properties) { process(property, scope); } }
Source:
default int getIntValue(JsonObject jsonObject) throws DataException { try { return jsonObject.getInt(this.toString()); } catch (RuntimeException e) { throw new DataException("Not possible to retrieve int value for key " + this.toString() + ". Exception: " + e.getMessage()); } }

Target:
default int getIntValue(JsonObject jsonObject) throws DataException { try { return jsonObject.getInt(this.toString()); } catch (ClassCastException | NullPointerException e) { throw new DataException("Not possible to retrieve int value for key " + this.toString() + ". Exception: " + e.getMessage()); } }
Source:
public String toString() { String str = ""; if (production.items.size() > 0) { if (production.items.get(0) instanceof UserList) { String separator = ((UserList) production.items.get(0)).separator; if (contents.size() == 2) str = contents.get(0) + " " + separator + " " + contents.get(1) + " "; else str = ".List{\"" + StringUtil.escape(separator) + "\"}"; } else for (int i = 0, j = 0; i < production.items.size(); i++) { ProductionItem pi = production.items.get(i); if (pi instanceof Terminal) { String terminall = pi.toString(); terminall = terminall.substring(1, terminall.length() - 1); str += terminall + " "; } else if (pi instanceof Sort) str += contents.get(j++) + " "; } } return str; }

Target:
public String toString() { String str = ""; if (production.items.size() > 0) { if (production.isListDecl()) { String separator = ((UserList) production.items.get(0)).separator; if (contents.size() == 0) str += "." + sort; else { str += "'_" + separator + "_("; for (Term t : contents) str += t + ", "; str = str.substring(0, str.length()-2) + ")"; } } else for (int i = 0, j = 0; i < production.items.size(); i++) { ProductionItem pi = production.items.get(i); if (pi instanceof Terminal) { str += ((Terminal) pi).getTerminal() + " "; } else if (pi instanceof Sort) str += contents.get(j++) + " "; } } return str; }
Source:
public static BootSequence getBootSequence(List<VmDevice> devices) { BootSequence ret = BootSequence.C; String seq = ""; for (VmDevice device : devices) { if (device.getBootOrder() > 0) { if (isNetwork(device) && seq.indexOf('N') < 0) { seq.concat("N"); } if (isDisk(device) && seq.indexOf('C') < 0) { seq.concat("C"); } if (isCD(device) && seq.indexOf('D') < 0) { seq.concat("D"); } if (seq.length() == 3) { break; } } } for (BootSequence bs : BootSequence.values()) { if (bs.name().equals(seq)) { ret = bs; } } return ret; }

Target:
public static BootSequence getBootSequence(List<VmDevice> devices) { BootSequence ret = BootSequence.C; String seq = ""; for (VmDevice device : devices) { if (device.getBootOrder() > 0) { if (isNetwork(device) && seq.indexOf('N') < 0) { seq.concat("N"); } if (isDisk(device) && seq.indexOf('C') < 0) { seq.concat("C"); } if (isCD(device) && seq.indexOf('D') < 0) { seq.concat("D"); } if (seq.length() == 3) { break; } } } for (BootSequence bs : BootSequence.values()) { if (bs.name().equals(seq)) { ret = bs; break; } } return ret; }
Source:
public void writeStringNoTag(final String value) throws IOException { writeRawVarint32(encodedLength(value)); if (charsetEncoder == null ) { charsetEncoder = UTF8_CHARSET.newEncoder(); } try { final CharBuffer charBuffer = CharBuffer.wrap(value); CoderResult coderResult = charsetEncoder.encode(charBuffer, buffer, true ); if (coderResult.isError() && !coderResult.isUnderflow()) { coderResult.throwException(); } coderResult = charsetEncoder.flush(buffer); if (coderResult.isError() && !coderResult.isUnderflow()) { coderResult.throwException(); } } finally { charsetEncoder.reset(); } }

Target:
public void writeStringNoTag(final String value) throws IOException { try { final int lengthVarIntSize = computeRawVarint32Size(value.length()); if (lengthVarIntSize == computeRawVarint32Size(value.length() * 3 )) { int oldPosition = buffer.position(); buffer.position(oldPosition + lengthVarIntSize); encode(value, buffer); int newPosition = buffer.position(); buffer.position(oldPosition); writeRawVarint32(newPosition - oldPosition - lengthVarIntSize); buffer.position(newPosition); } else { writeRawVarint32(encodedLength(value)); encode(value, buffer); } } catch (BufferOverflowException e) { throw new OutOfSpaceException(buffer.position(), buffer.limit()); } }
Source:
public BatchProcessor(StreamLog streamLog, long sealEpoch, boolean sync) { this.sealEpoch = sealEpoch; this.sync = sync; this.streamLog = streamLog; operationsQueue = new LinkedBlockingQueue<>(); processorService.submit(this::processor); writeRecordTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.write.timer") .tags("type", "single").register(registry)); writeRecordsTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.write.timer") .tags("type", "multiple").register(registry)); fsyncTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.fsync.timer") .register(registry)); }

Target:
public BatchProcessor(StreamLog streamLog, long sealEpoch, boolean sync) { this.sealEpoch = sealEpoch; this.sync = sync; this.streamLog = streamLog; operationsQueue = new LinkedBlockingQueue<>(); writeRecordTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.write.timer") .tags("type", "single").register(registry)); writeRecordsTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.write.timer") .tags("type", "multiple").register(registry)); queueSizeDist = MeterRegistryProvider.getInstance().map(registry -> DistributionSummary .builder("logunit.queue.size") .publishPercentiles(0.50, 0.95, 0.99) .publishPercentileHistogram() .baseUnit("op") .register(registry)); processorService.submit(this::processor); }
Source:
public void save(ExecutionStatus status) { DefaultTransaction transaction = new DefaultTransaction("create"); try { SimpleFeatureSource source = statuses.getFeatureSource(STATUS); if (source instanceof SimpleFeatureStore) { SimpleFeatureStore store = (SimpleFeatureStore) source; store.setTransaction(transaction); SimpleFeature feature = statusToFeature(status); FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = DataUtilities .collection(feature); Filter filter = ECQL.toFilter( PROCESS_ID + " = '" + status.getExecutionId() + "'"); store.removeFeatures(filter); store.addFeatures(featureCollection); transaction.commit(); } } catch (IOException e) { e.printStackTrace(); try { transaction.rollback(); } catch (IOException e1) { } } catch (CQLException e) { e.printStackTrace(); } finally { transaction.close(); } }

Target:
public void save(ExecutionStatus status) { DefaultTransaction transaction = new DefaultTransaction("create"); try { SimpleFeatureSource source = statuses.getFeatureSource(fixTableName(STATUS)); if (source instanceof SimpleFeatureStore) { SimpleFeatureStore store = (SimpleFeatureStore) source; store.setTransaction(transaction); SimpleFeature feature = statusToFeature(status); FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = DataUtilities .collection(feature); Filter filter = ECQL.toFilter(fixColumnName(PROCESS_ID) + " = '" + status.getExecutionId() + "'"); Filter fixedFilter = fixFilter(filter); store.removeFeatures(fixedFilter); store.addFeatures(featureCollection); transaction.commit(); } } catch (IOException e) { LOGGER.info("failed to save WPS Status " + status.getExecutionId()); LOGGER.log(Level.FINE,"Can not save to table",e); try { transaction.rollback(); } catch (IOException e1) { LOGGER.fine("failed to rollback failed save"); } } catch (CQLException e) { } finally { transaction.close(); } }
Source:
public static <T, U> Collector<T, ?, Optional<Double>> percentRankBy(U value, Function<? super T, ? extends U> function, Comparator<? super U> comparator) { return Collector.of( () -> new ArrayList<U>(), (l, v) -> l.add(function.apply(v)), (l1, l2) -> { l1.addAll(l2); return l1; }, l -> { int size = l.size(); if (size == 0) return Optional.empty(); l.sort(comparator); int index = Collections.binarySearch(l, value, comparator); if (index < 0) index = -index - 1; else while (index > 0 && l.get(index) == l.get(index - 1)) --index; return Optional.of((double) index / (double) size); } ); }

Target:
public static <T, U> Collector<T, ?, Optional<Double>> percentRankBy(U value, Function<? super T, ? extends U> function, Comparator<? super U> comparator) { return Collector.of( () -> new ArrayList<U>(), (l, v) -> l.add(function.apply(v)), (l1, l2) -> { l1.addAll(l2); return l1; }, l -> { int size = l.size(); if (size == 0) return Optional.empty(); l.sort(comparator); int index = binarySearchRank(l, value, comparator); return Optional.of((double) index / (double) size); } ); }
Source:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() == Material.NETHERRACK || block.isEmpty()) && block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) { int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); Bukkit.getScheduler().scheduleSyncDelayedTask(null, new PulseTask((GlowBlock) block), 1); } } }

Target:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() == Material.NETHERRACK || block.isEmpty()) && block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) { int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); new PulseTask((GlowBlock) block, true, 1, true).startPulseTask(); } } }
Source:
public void blockFlooder(final Flooder flooder) throws RuntimeException { try { zooKeeperHolder.get().create().creatingParentsIfNeeded().forPath(createFlooderPath(flooder)); } catch (final KeeperException.NoNodeException nne) { LOG.debug("Flooder does not exist {}", flooder.getName()); } catch (final Exception e) { throw new RuntimeException("Issue occurred while creating node in zk", e); } }

Target:
public void blockFlooder(final Flooder flooder) throws RuntimeException { try { final CuratorFramework curator = zooKeeperHolder.get(); final String path = createFlooderPath(flooder); if (curator.checkExists().forPath(path) == null) { curator.create().creatingParentsIfNeeded().forPath(path); } } catch (final Exception e) { throw new RuntimeException("Issue occurred while creating node in zk", e); } }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } Player player = getPlayer(args[0]); if (player == null) { playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND); return true; } if (sender instanceof Player) { if (player == (Player) sender) { playerMsg(ChatColor.RED + "Please, don't try to warn yourself."); return true; } } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(ChatColor.RED + "You may not report " + player.getName() + ", they are an admin."); return true; } String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); player.sendMessage(ChatColor.RED + "[WARNING] " + warnReason); playerMsg(ChatColor.GREEN + "You have successfully warned " + player.getName()); TFM_PlayerData.getPlayerData(player).incrementWarnings(); return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } Player player = getPlayer(args[0]); if (player == null) { playerMsg(PLAYER_NOT_FOUND); return true; } if (sender instanceof Player) { if (player.equals(sender_p)) { playerMsg(ChatColor.RED + "Please, don't try to warn yourself."); return true; } } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(ChatColor.RED + "You can not warn admins"); return true; } String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); playerMsg(ChatColor.RED + "[WARNING] " + warnReason); playerMsg(ChatColor.GREEN + "You have successfully warned " + player.getName()); TFM_PlayerData.getPlayerData(player).incrementWarnings(); return true; }
Source:
public void onWireComponentDeleted(WireComponent component) { if (!WIRE_ASSET_PID.equals(component.getFactoryPid())) configurations.deleteConfiguration(component.getPid()); configurations.deleteConfiguration(component.getPid()); updateDirtyState(); this.btnGraphDelete.setEnabled(wireComposer.getWireComponentCount() > 0); this.dialogs.setAssetPids(getAssetsNotInComposer()); }

Target:
public void onWireComponentDeleted(WireComponent component) { if (!WIRE_ASSET_PID.equals(component.getFactoryPid())) configurations.deleteConfiguration(component.getPid()); updateDirtyState(); this.btnGraphDelete.setEnabled(wireComposer.getWireComponentCount() > 0); this.dialogs.setAssetPids(getAssetsNotInComposer()); }
Source:
public <T> void executeBlocking(Action<T> action, Handler<Future<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler) { try { orderedInternalPoolExec.execute(() -> { Future<T> res = Future.future(); try { if (blockingCodeHandler != null) { setContext(this); blockingCodeHandler.handle(res); } else { T result = action.perform(); res.complete(result); } } catch (Throwable e) { res.fail(e); } finally { if (blockingCodeHandler != null) { unsetContext(); } } if (resultHandler != null) { runOnContext(v -> res.setHandler(resultHandler)); } }); } catch (RejectedExecutionException ignore) { } }

Target:
public <T> void executeBlocking(Action<T> action, Handler<Future<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler) { try { orderedInternalPoolExec.execute(() -> { Future<T> res = Future.future(); try { if (blockingCodeHandler != null) { setContext(this); blockingCodeHandler.handle(res); } else { T result = action.perform(); res.complete(result); } } catch (Throwable e) { res.fail(e); } if (resultHandler != null) { runOnContext(v -> res.setHandler(resultHandler)); } }); } catch (RejectedExecutionException ignore) { } }
Source:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); vanillaValues.add(this.canJoinRaid().asImmutable()); vanillaValues.add(this.isCelebrating().asImmutable()); if (this.getRaid().isPresent()) { this.raidWave().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.canJoinRaid().asImmutable()); values.add(this.celebrating().asImmutable()); this.raidWave().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
public Object visit(ASTCompilationUnit node, Object data) { methodReportLevel = getProperty(METHOD_REPORT_LEVEL_DESCRIPTOR); classReportLevel = getProperty(CLASS_REPORT_LEVEL_DESCRIPTOR); if (ncssOptions == null) { ncssOptions = MetricOptions.ofOptions(getProperty(NCSS_OPTIONS_DESCRIPTOR)); } super.visit(node, data); return data; }

Target:
public Object visit(ASTCompilationUnit node, Object data) { methodReportLevel = getProperty(METHOD_REPORT_LEVEL_DESCRIPTOR); classReportLevel = getProperty(CLASS_REPORT_LEVEL_DESCRIPTOR); ncssOptions = MetricOptions.ofOptions(getProperty(NCSS_OPTIONS_DESCRIPTOR)); super.visit(node, data); return data; }
Source:
private FixedDoubleBreakdownHistogram(FixedDoubleBreakdownHistogram other) { this.bucketCount = other.bucketCount; this.min = other.min; this.max = other.max; this.indices = new int[other.indices.length]; this.weights = new double[other.weights.length]; this.counts = new long[other.counts.length]; for (int i = 0; i < other.indices.length; i++) { this.indices[i] = other.indices[i]; this.weights[i] = other.weights[i]; this.counts[i] = other.counts[i]; } }

Target:
private FixedDoubleBreakdownHistogram(FixedDoubleBreakdownHistogram other) { this.bucketCount = other.bucketCount; this.min = other.min; this.max = other.max; this.indices = Arrays.copyOf(other.indices, other.indices.length); this.weights = Arrays.copyOf(other.weights, other.weights.length); this.counts = Arrays.copyOf(other.counts, other.counts.length); }
Source:
public TaskStats removeTask(final String taskHostname) { return innerMap.remove(taskHostname); }

Target:
public TaskStats removeTask(final String taskHostname) { innerList.remove(taskHostname); return innerMap.remove(taskHostname); }
Source:
public void actionPerformed(ActionEvent e) { if(e.getSource() == addCertButton){ addCertificate(); } if(e.getSource() == idTable){ showCert.setEnabled(true); } if(e.getSource() == showCert){ idControll.showCertificate(); } if (e.getSource() == createButton) { idControll.setUpData(commonNameField.getText(), organizationUnitField.getText(), organizationField.getText(), countryField.getText(), cityField.getText()); if (certificateSigningRequest.isSelected()) { try { KeyPair keyPair = idControll.createKeyPair(); PKCS10CertificationRequest request = idControll.createCSR(keyPair); PemHelper.saveToPemFile(keyPair, IdentityController.KEY_FILE); PemHelper.saveToPemFile(request, IdentityController.CSR_FILE); JOptionPane.showMessageDialog(null, Res.getString("dialog.certificate.request.has.been.created") + IdentityController.SECURITY_DIRECTORY.toString()); } catch (OperatorCreationException | NoSuchAlgorithmException | IOException | NoSuchProviderException e1) { Log.error("Couldn't create Certificate Signing Request", e1); } } else if (selfSignedCertificate.isSelected()) { try { KeyPair keyPair = idControll.createKeyPair(); PemBuilder pemBuilder = new PemHelper().new PemBuilder(); X509Certificate cert = idControll.createSelfSignedCertificate(idControll.createKeyPair()); pemBuilder.add(keyPair); pemBuilder.add(cert); pemBuilder.saveToPemFile(IdentityController.CERT_FILE); JOptionPane.showMessageDialog(null, Res.getString("dialog.self.signed.certificate.has.been.created") + IdentityController.SECURITY_DIRECTORY.toString()); } catch (NoSuchAlgorithmException | NoSuchProviderException | IOException | OperatorCreationException | CertificateException e1) { Log.error("Couldn't create Self Signed Certificate", e1); } } } }

Target:
public void actionPerformed(ActionEvent e) { if(e.getSource() == addCertButton){ addCertificate(); } if(e.getSource() == idTable){ showCert.setEnabled(true); } if(e.getSource() == showCert){ idControll.showCertificate(); } if (e.getSource() == createButton) { if (certificateSigningRequest.isSelected()) { createCertificateSignRequest(); } else if (selfSignedCertificate.isSelected()) { createSelfSignedCertificate(); } } }
Source:
private DirectoryUser findDirectoryUser(String directoryName, User user) { DirectoryUser result = null; String namespace = user.getNamespace(); if (user.isSetDomainEntryId()) { result = getUserById(directoryName, namespace, user.getDomainEntryId()); } else if (user.isSetId()) { result = getUserById(directoryName, namespace, user.getId()); } else { if (user.isSetUserName()) { result = getEntity( DirectoryUser.class, SearchType.DirectoryUser, getDirectoryUserSearchPattern( user.getUserName().contains("@") ? user.getUserName().substring(0, user.getUserName().indexOf("@")) : user.getUserName(), user.getNamespace(), directoryName) ); } } return result; }

Target:
private DirectoryUser findDirectoryUser(String directoryName, User user) { DirectoryUser result = null; String namespace = user.getNamespace(); if (user.isSetDomainEntryId()) { result = getUserById(directoryName, namespace, user.getDomainEntryId()); } else if (user.isSetId()) { result = getUserById(directoryName, namespace, user.getId()); } else { if (user.isSetUserName()) { result = getEntity( DirectoryUser.class, SearchType.DirectoryUser, getDirectoryUserSearchPattern( isNameContainsDomain(user) ? user.getUserName().substring(0, user.getUserName().lastIndexOf("@")) : user.getUserName(), user.getNamespace(), directoryName) ); } } return result; }
Source:
public void addWidget(UIWidget element, CCHint hint) { final ComponentWrapper cw = getWrapper(element); final String cStr = ConstraintParser.prepare(hint != null ? hint.cc : ""); AccessController.doPrivileged(new PrivilegedAction<Task>() { @Override public Task run() { ccMap.put(cw, ConstraintParser.parseComponentConstraint(cStr)); return null; } }); wrappers.put(element, cw); children.add(cw); dirty = true; }

Target:
public void addWidget(UIWidget element, CCHint hint) { final ComponentWrapper cw = getWrapper(element); final String cStr = ConstraintParser.prepare(hint != null ? hint.cc : ""); CC constraint = AccessController.doPrivileged(new PrivilegedAction<CC>() { @Override public CC run() { return ConstraintParser.parseComponentConstraint(cStr); } }); ccMap.put(cw, constraint); wrappers.put(element, cw); children.add(cw); dirty = true; }
Source:
private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { boolean allowStartSessionCommand = true; if(volumeEntity == null) { return; } getNewSessionCommand().setIsAvailable(volumeEntity == null); if(getSelectedItem() == null) { allowStartSessionCommand = false; } else { if(getSelectedItems().size() == 1) { GlusterGeoRepSession selectedSession = (GlusterGeoRepSession)getSelectedItem(); allowStartSessionCommand = selectedSession .getStatus() == GeoRepSessionStatus.NOTSTARTED || selectedSession.getStatus() == GeoRepSessionStatus.STOPPED; } } getNewSessionCommand().setIsAvailable(true); getRemoveSessionCommand().setIsAvailable(false); getStartSessionCommand().setIsExecutionAllowed(allowStartSessionCommand); getStopSessionCommand().setIsAvailable(false); getSessionOptionsCommand().setIsAvailable(false); getViewSessionDetailsCommand().setIsAvailable(false); }

Target:
private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { boolean allowStartSessionCommand = true; if(volumeEntity == null) { return; } if(getSelectedItem() == null) { allowStartSessionCommand = false; } else { if(getSelectedItems().size() == 1) { GlusterGeoRepSession selectedSession = (GlusterGeoRepSession)getSelectedItem(); allowStartSessionCommand = selectedSession .getStatus() == GeoRepSessionStatus.NOTSTARTED || selectedSession.getStatus() == GeoRepSessionStatus.STOPPED; } } getNewSessionCommand().setIsAvailable(true); getRemoveSessionCommand().setIsAvailable(false); getStartSessionCommand().setIsExecutionAllowed(allowStartSessionCommand); getStopSessionCommand().setIsAvailable(false); getSessionOptionsCommand().setIsAvailable(false); getViewSessionDetailsCommand().setIsAvailable(false); getRefreshSessionsCommand().setIsAvailable(true); }
Source:
private void logError(LifecycleListener listener, Exception e) { logger.error("Error for listener " + listener, e); }

Target:
private void logError(LifecycleListener listener, Exception e) { logger.error("Error for listener " + listener.getClass(), e); }
Source:
public void beforeSend(ServerSession session, Transaction tx, Message message, boolean direct, boolean noAutoCreateQueue) throws ActiveMQException { if (populateValidatedUser != null && !message.containsProperty(Message.HDR_VALIDATED_USER)) { message.messageChanged(); message.putStringProperty(Message.HDR_VALIDATED_USER, populateValidatedUser); } }

Target:
public void beforeSend(ServerSession session, Transaction tx, Message message, boolean direct, boolean noAutoCreateQueue) throws ActiveMQException { if (populateValidatedUser != null && !message.containsProperty(Message.HDR_VALIDATED_USER)) { message.messageChanged(); message.putStringProperty(Message.HDR_VALIDATED_USER, populateValidatedUser); message.reencode(); } }
Source:
private Map<String, ArrayList<CommentInfo>> queryComments(GerritRepository gerritRepository, String change_id, String revision_id, IProgressMonitor monitor) { try { monitor.beginTask("Executing query", IProgressMonitor.UNKNOWN); Gerrit gerrit = gerritRepository.instantiateGerrit(); if (gerrit != null) { ListCommentsCommand command = gerrit.getListComments(change_id, revision_id); Map<String, ArrayList<CommentInfo>> res = null; try { res = command.call(); return res; } catch (EGerritException | ClientProtocolException e) { EGerritCorePlugin.logError(e.getMessage()); } } } catch (UnsupportedClassVersionError e) { return null; } finally { monitor.done(); } return null; }

Target:
private Map<String, ArrayList<CommentInfo>> queryComments(GerritRepository gerritRepository, String change_id, String revision_id, IProgressMonitor monitor) { try { monitor.beginTask("Executing query", IProgressMonitor.UNKNOWN); Gerrit gerrit = gerritRepository.instantiateGerrit(); if (gerrit != null) { ListCommentsCommand command = gerrit.getListComments(change_id, revision_id); Map<String, ArrayList<CommentInfo>> res = null; try { res = command.call(); return res; } catch (EGerritException e) { EGerritCorePlugin.logError(e.getMessage()); } catch (ClientProtocolException e) { UIUtils.displayInformation(null, TITLE, e.getLocalizedMessage() + "\n " + command.formatRequest()); } } } catch (UnsupportedClassVersionError e) { return null; } finally { monitor.done(); } return null; }
Source:
private static MacOsVersion getMacOsVersion() { if (!SWTUtils.isMac()) { return null; } String osVersion = System.getProperty("os.version"); if (osVersion == null) { return null; } Matcher matcher = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)").matcher(osVersion); if (matcher.matches()) { try { return new MacOsVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); } catch (NumberFormatException e) { } } return null; }

Target:
private static MacOsVersion getMacOsVersion() { if (!SWTUtils.isMac()) { return null; } String osVersion = System.getProperty("os.version"); if (osVersion == null) { return null; } Matcher matcher = MAC_OS_VERSION_PATTERN.matcher(osVersion); if (matcher.matches()) { try { return new MacOsVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); } catch (NumberFormatException e) { } } return null; }
Source:
protected final void lockKeyAndCheckOwnership(InvocationContext ctx, Object key) throws InterruptedException { boolean checkForPendingLocks = false; if (!ctx.isInTxScope()) { lockManager.acquireLock(ctx, key); return; } TxInvocationContext txContext = (TxInvocationContext) ctx; final Integer viewId = txContext.getCacheTransaction().getViewId(); if (viewId != null) { checkForPendingLocks = viewId > txTable.getMinViewId(); } log.tracef("Locking key %s, checking for pending locks? %s", key, checkForPendingLocks); if (!checkForPendingLocks) { lockManager.acquireLock(ctx, key); } else { Set<CacheTransaction> tx = txTable.getTransactionsStartedBefore(viewId); long start = System.currentTimeMillis(); long remaining = configuration.getLockAcquisitionTimeout(); for (CacheTransaction ct : tx) { if (!ct.waitForTransactionsToFinishIfHasLock(key, remaining)) { throw new TimeoutException("Could not acquire lock on " + key + " on behalf of transaction " + txContext.getGlobalTransaction() + ". Lock is being held by " + lockManager.getOwner(key)); } final long elapsed = System.currentTimeMillis() - start; remaining = Math.abs(remaining - elapsed); } log.tracef("Finished waiting for other potential lockers, trying to acquire the lock on %s", key); lockManager.acquireLock(ctx, key, remaining); } }

Target:
protected final void lockKeyAndCheckOwnership(InvocationContext ctx, Object key) throws InterruptedException { boolean checkForPendingLocks = false; if (!ctx.isInTxScope()) { lockManager.acquireLock(ctx, key); return; } TxInvocationContext txContext = (TxInvocationContext) ctx; final Integer viewId = txContext.getCacheTransaction().getViewId(); if (viewId != null) { checkForPendingLocks = viewId > txTable.getMinViewId(); } log.tracef("Locking key %s, checking for pending locks? %s", key, checkForPendingLocks); if (!checkForPendingLocks) { lockManager.acquireLock(ctx, key); } else { Set<CacheTransaction> tx = txTable.getTransactionsStartedBefore(viewId); long expectedEndTime = nowMillis() + configuration.getLockAcquisitionTimeout(); for (CacheTransaction ct : tx) { long remaining = expectedEndTime - nowMillis(); if (remaining < 0 || !ct.waitForLockRelease(key, remaining)) throw newTimeoutException(key, txContext); } final long remaining = expectedEndTime - nowMillis(); if (remaining < 0) { throw newTimeoutException(key, txContext); } else { log.tracef("Finished waiting for other potential lockers, trying to acquire the lock on %s", key); lockManager.acquireLock(ctx, key, remaining); } } }
Source:
public CompletableFuture<Void> transactionDataFuture(int expectedTopologyId) { if (transactionDataTopologyId >= expectedTopologyId) return null; if (trace) { log.tracef("Waiting for transaction data for topology %d, current topology is %d", expectedTopologyId, transactionDataTopologyId); } transactionDataLock.lock(); try { if (transactionDataTopologyId >= expectedTopologyId) { return null; } else if (transactionDataTopologyId == expectedTopologyId - 1){ return transactionDataFuture; } else { return transactionDataFuture.thenCompose(nil -> transactionDataFuture(expectedTopologyId)); } } finally { transactionDataLock.unlock(); } }

Target:
public CompletableFuture<Void> transactionDataFuture(int expectedTopologyId) { if (transactionDataTopologyId >= expectedTopologyId) return CompletableFutures.completedNull(); if (trace) { log.tracef("Waiting for transaction data for topology %d, current topology is %d", expectedTopologyId, transactionDataTopologyId); } synchronized (this){ if (transactionDataTopologyId >= expectedTopologyId) { return CompletableFutures.completedNull(); } else { return transactionDataFuture.thenCompose(nil -> transactionDataFuture(expectedTopologyId)); } } }
Source:
public void init(@Value("${strongbox.security.jwtSecret:secret}") String secret) throws Exception { key = new HmacKey(secret.getBytes("UTF-8")); }

Target:
public void init(@Value("${strongbox.security.jwtSecret:secret}") String secret) throws UnsupportedEncodingException { key = new HmacKey(secret.getBytes("UTF-8")); }
Source:
public synchronized void registerPropertyDeprecation(PropertyDeprecationDescriptor descriptor) { Map<String, Map<String, String>> properties = removedProperties; if (descriptor.isDeprecated()) { properties = deprecatedProperties; } properties.computeIfAbsent(descriptor.getSchema(), key -> new HashMap<>()).put(descriptor.getName(), descriptor.getFallback()); log.info("Registered property deprecation: " + descriptor); }

Target:
public synchronized void registerPropertyDeprecation(PropertyDeprecationDescriptor descriptor) { Map<String, Map<String, String>> properties = descriptor.isDeprecated() ? deprecatedProperties : removedProperties; properties.computeIfAbsent(descriptor.getSchema(), key -> new HashMap<>()).put(descriptor.getName(), descriptor.getFallback()); log.info("Registered property deprecation: " + descriptor); }
Source:
public void onInfoWindowClick(Marker marker) { mCustomInfoWindowAdapter.cancelUpdates(); ObaTripStatus status = mMarkerData.getStatusFromMarker(marker); if (mController != null && mController.getFocusedStopId() != null) { TripDetailsActivity.start(mActivity, status.getActiveTripId(), mController.getFocusedStopId(), "vehicle"); } else { TripDetailsActivity.start(mActivity, status.getActiveTripId(), null, "vehicle"); } }

Target:
public void onInfoWindowClick(Marker marker) { mCustomInfoWindowAdapter.cancelUpdates(); ObaTripStatus status = mMarkerData.getStatusFromMarker(marker); if (mController != null && mController.getFocusedStopId() != null) { TripDetailsActivity.start(mActivity, status.getActiveTripId(), mController.getFocusedStopId(), TripDetailsListFragment.SCROLL_MODE_VEHICLE); } else { TripDetailsActivity.start(mActivity, status.getActiveTripId(), TripDetailsListFragment.SCROLL_MODE_VEHICLE); } }
Source:
private ScrollPane createAllMilestonesScrollPane() { VBox milestonesBox = new VBox(); milestonesBox.setPrefWidth(398); milestonesBox.setStyle("-fx-background-color: white;"); originalMilestones.forEach(milestone -> milestonesBox.getChildren().add( setMouseClickForNode(milestone.getDetailedMilestoneNode(), milestone.getTitle())) ); ScrollPane milestonesScrollPane = new ScrollPane(); milestonesScrollPane.setMaxHeight(160); milestonesScrollPane.setContent(milestonesBox); return milestonesScrollPane; }

Target:
private ScrollPane createAllMilestonesScrollPane() { VBox milestonesBox = new VBox(); milestonesBox.setStyle("-fx-background-color: white;"); originalMilestones.forEach(milestone -> milestonesBox.getChildren().add( setMouseClickForNode(milestone.getDetailedMilestoneNode(), milestone.getTitle())) ); ScrollPane milestonesScrollPane = new ScrollPane(); milestonesScrollPane.setMaxHeight(MILESTONES_SCROLLPANE_MAX_HEIGHT); milestonesScrollPane.setContent(milestonesBox); return milestonesScrollPane; }