auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testColumnHighlight() { final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class); final Bounds bounds = new BaseBounds(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT); when(state.getEventColumnHighlight()).thenReturn(highlight); when(state.getActiveGridWidget()).thenReturn(gridWidget); when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING); when(state.getActiveGridColumns()).thenReturn(new ArrayList<GridColumn<?>>() {{ add(uiColumn); }}); when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation); when(rendererHelper.getRowOffset(anyInt(), any(List.class))).thenCallRealMethod(); when(renderingInformation.getBounds()).thenReturn(bounds); when(gridWidget.getHeader()).thenReturn(gridWidgetHeader); when(gridWidget.getHeight()).thenReturn(GRID_HEIGHT); when(uiColumn.getWidth()).thenReturn(COLUMN_WIDTH); handler.onNodeMouseDown(event); verify(highlight).setWidth(COLUMN_WIDTH); verify(highlight).setHeight(GRID_HEIGHT); verify(highlight).setX(GRID_X); verify(highlight).setY(GRID_Y); verify(layer).batch(); }

Target:
public void testColumnHighlight() { final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class); final Bounds bounds = new BaseBounds(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT); when(state.getEventColumnHighlight()).thenReturn(highlight); when(state.getActiveGridWidget()).thenReturn(gridWidget); when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING); when(state.getActiveGridColumns()).thenReturn(Collections.singletonList(uiColumn)); when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation); when(rendererHelper.getRowOffset(anyInt(), any(List.class))).thenCallRealMethod(); when(renderingInformation.getBounds()).thenReturn(bounds); when(gridWidget.getHeader()).thenReturn(gridWidgetHeader); when(gridWidget.getHeight()).thenReturn(GRID_HEIGHT); when(uiColumn.getWidth()).thenReturn(COLUMN_WIDTH); handler.onNodeMouseDown(event); verify(highlight).setWidth(COLUMN_WIDTH); verify(highlight).setHeight(GRID_HEIGHT); verify(highlight).setX(GRID_X); verify(highlight).setY(GRID_Y); verify(layer).batch(); }
Source:
public void execute(JobExecutionContext arg0) throws JobExecutionException { try { systemUser = userAPI.getSystemUser(); generateSitemapPerHost(); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); } } }

Target:
public void execute(JobExecutionContext arg0) throws JobExecutionException { try { systemUser = userAPI.getSystemUser(); generateSitemapPerHost(); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } }
Source:
public static ActorRequestFactory fromContext(ActorContext actorContext) { Builder builder = newBuilder() .setActor(actorContext.getActor()) .setTenantId(actorContext.getTenantId()) .setZoneOffset(actorContext.getZoneOffset()) .setZoneId(actorContext.getZoneId()); return builder.build(); }

Target:
public static ActorRequestFactory fromContext(ActorContext actorContext) { checkNotNull(actorContext); Builder builder = newBuilder() .setActor(actorContext.getActor()) .setTenantId(actorContext.getTenantId()) .setZoneOffset(actorContext.getZoneOffset()) .setZoneId(actorContext.getZoneId()); return builder.build(); }
Source:
private BuildCommand freshCheckout(String workingDir, Revision revision) { return compose( cleandir(workingDir).setTest(test("-d", workingDir)), mkdirs(workingDir).setTest(test("-nd", workingDir)), checkout(workingDir, revision) ); }

Target:
private BuildCommand freshCheckout(String workingDir, Revision revision) { return compose( echoWithPrefix("Checking out a fresh copy"), cleandir(workingDir).setTest(test("-d", workingDir)), mkdirs(workingDir).setTest(test("-nd", workingDir)), checkout(workingDir, revision) ); }
Source:
public SizeHandler<Lane, SVGShapeView> newSizeHandler() { return newSizeHandlerBuilder() .width(e -> e.getDimensionsSet().getWidth().getValue()) .height(e -> e.getDimensionsSet().getHeight().getValue()) .minWidth(task -> 50d) .maxWidth(task -> 1200d) .minHeight(task -> 50d) .maxHeight(task -> 1200d) .build(); }

Target:
public SizeHandler<Lane, SVGShapeView> newSizeHandler() { return newSizeHandlerBuilder() .width(e -> e.getDimensionsSet().getWidth().getValue()) .height(e -> e.getDimensionsSet().getHeight().getValue()) .minWidth(task -> 200d) .maxWidth(task -> 1200d) .minHeight(task -> 200d) .maxHeight(task -> 1200d) .build(); }
Source:
public boolean replace(String key, String oldValue, String newValue) { Assert.notNull(key, "'key' cannot be null"); Assert.notNull(oldValue, "'oldValue' cannot be null"); Assert.notNull(newValue, "'newValue' cannot be null"); int affectedRows = this.jdbcTemplate.update(getQuery(Query.REPLACE_VALUE), ps -> { ps.setString(1, newValue); ps.setString(2, key); ps.setString(3, oldValue); }); return affectedRows > 0; }

Target:
public boolean replace(String key, String oldValue, String newValue) { Assert.notNull(key, "'key' cannot be null"); Assert.notNull(oldValue, "'oldValue' cannot be null"); Assert.notNull(newValue, "'newValue' cannot be null"); int affectedRows = this.jdbcTemplate.update(this.replaceValueQuery, ps -> { ps.setString(1, newValue); ps.setString(2, key); ps.setString(3, oldValue); ps.setString(4, this.region); }); return affectedRows > 0; }
Source:
private static boolean createSymlinkAtomic(@Nonnull Path pathForSymlink, @Nonnull File fileForSymlink, @Nonnull Path target, @Nonnull String symlinkPath) { try { File symlink = File.createTempFile("symtmp", null, fileForSymlink); symlink.delete(); Path tempSymlinkPath = symlink.toPath(); Files.createSymbolicLink(tempSymlinkPath, target); try { Files.move(tempSymlinkPath, pathForSymlink, java.nio.file.StandardCopyOption.ATOMIC_MOVE); return true; } catch ( UnsupportedOperationException | SecurityException | IOException e) { } symlink.delete(); } catch ( SecurityException | InvalidPathException | UnsupportedOperationException | IOException e) { } return false; }

Target:
private static boolean createSymlinkAtomic(@Nonnull Path pathForSymlink, @Nonnull File fileForSymlink, @Nonnull Path target, @Nonnull String symlinkPath) { try { File symlink = File.createTempFile("symtmp", null, fileForSymlink); tryToDeleteSymlink(symlink); Path tempSymlinkPath = symlink.toPath(); Files.createSymbolicLink(tempSymlinkPath, target); try { Files.move(tempSymlinkPath, pathForSymlink, java.nio.file.StandardCopyOption.ATOMIC_MOVE); return true; } catch ( UnsupportedOperationException | SecurityException | IOException ex) { reportAtomicFailure(pathForSymlink, ex); } tryToDeleteSymlink(symlink); } catch ( SecurityException | InvalidPathException | UnsupportedOperationException | IOException ex) { reportAtomicFailure(pathForSymlink, ex); } return false; }
Source:
@Override public boolean test(Map<Object, Object> map) throws Exception { final int n = nextRandom(args.range()); final String key = "key"+n; final String otherKey = "other_"+key; final IgniteCache<String, Integer> cache = cacheForOperation(); final IgniteLock lock = ignite().reentrantLock(key, false, false, true); lock.lock(); try { cache.put(otherKey, cache.get(otherKey)+1); } finally { lock.unlock(); } return true; }

Target:
@Override public boolean test(Map<Object, Object> map) throws Exception { lock.lock(); lock.unlock(); return true; }
Source:
public void openUrl(String url) { if (url.contains(replayBaseUrl)) { replayService.findById(Integer.parseInt(url.replace(replayBaseUrl, ""))).thenAccept(replay -> { Platform.runLater(() -> { replayDetailController = uiService.loadFxml("theme/vault/replay/replay_detail.fxml"); replayDetailController.setReplay(replay); Node replayDetailRoot = replayDetailController.getRoot(); replayDetailRoot.setVisible(true); replayDetailRoot.requestFocus(); Stage stage = new Stage(StageStyle.UNDECORATED); WindowController windowController = uiService.loadFxml("theme/window.fxml"); windowController.configure(stage, (Region) ((AnchorPane) replayDetailRoot).getChildren().get(0), true); replayDetailController.setOnClosure(stage::close); stage.setWidth(((Region) replayDetailRoot).getWidth()); stage.setHeight(((Region) replayDetailRoot).getHeight()); Stage mainStage = StageHolder.getStage(); stage.setX(mainStage.getX()); stage.setY(mainStage.getY()); stage.show(); }); }); return; } platformService.showDocument(url); }

Target:
public void openUrl(String url) { Matcher replayUrlMatcher = replayUrlPattern.matcher(url); if (!replayUrlMatcher.matches()) { platformService.showDocument(url); return; } String replayId = replayUrlMatcher.group(1); replayService.findById(Integer.parseInt(replayId)) .thenAccept(replay -> Platform.runLater(() -> displayReplyDetail(replay, url))); }
Source:
public void coercingOfDmxValues() { int value = Util.toDmxValue(300); assertThat(value, is(equalTo(Channel.MAX_VALUE))); value = Util.toDmxValue(-1); assertThat(value, is(equalTo(Channel.MIN_VALUE))); value = Util.toDmxValue(100); assertThat(value, is(equalTo(100))); }

Target:
public void coercingOfDmxValues() { int value = Util.toDmxValue(300); assertThat(value, is(Channel.MAX_VALUE)); value = Util.toDmxValue(-1); assertThat(value, is(Channel.MIN_VALUE)); value = Util.toDmxValue(100); assertThat(value, is(100)); }
Source:
public synchronized TreeSet<LongRange> remove(final String evalId, final String dataType, final LongRange idRange) { final Map<String, TreeSet<LongRange>> evalDataTypeRanges = evalPartitions.get(evalId); if (evalDataTypeRanges == null) { return new TreeSet<>(); } final TreeSet<LongRange> evalRanges = evalDataTypeRanges.get(dataType); if (evalRanges == null) { return new TreeSet<>(); } final TreeSet<LongRange> globalRanges = globalPartitions.get(dataType); final TreeSet<LongRange> removedRanges = new TreeSet<>(LONG_RANGE_COMPARATOR); final Set<LongRange> insideRanges = removeInsideRanges(globalRanges, evalRanges, idRange); removedRanges.addAll(insideRanges); final LongRange ceilingRange = evalRanges.ceiling(idRange); if (ceilingRange != null && ceilingRange.overlapsRange(idRange)) { final LongRange ceilingRemoved = removeIntersectingRange(globalRanges, evalRanges, ceilingRange, idRange); if (ceilingRemoved != null) { removedRanges.add(ceilingRemoved); } } final LongRange floorRange = evalRanges.floor(idRange); if (floorRange != null && floorRange.overlapsRange(idRange)) { final LongRange floorRemoved = removeIntersectingRange(globalRanges, evalRanges, floorRange, idRange); if (floorRemoved != null) { removedRanges.add(floorRemoved); } } return removedRanges; }

Target:
public synchronized TreeSet<LongRange> remove(final String evalId, final String dataType, final LongRange idRange) { final Map<String, TreeSet<LongRange>> evalDataTypeRanges = evalPartitions.get(evalId); if (evalDataTypeRanges == null) { LOG.log(Level.WARNING, "The evaluator {0} does not exist.", evalId); return new TreeSet<>(); } final TreeSet<LongRange> evalRanges = evalDataTypeRanges.get(dataType); if (evalRanges == null) { LOG.log(Level.WARNING, "The evaluator {0} does not contain any data whose type is {1}.", new Object[]{evalId, dataType}); return new TreeSet<>(); } final TreeSet<LongRange> globalRanges = globalPartitions.get(dataType); final TreeSet<LongRange> removedRanges = new TreeSet<>(LONG_RANGE_COMPARATOR); final Set<LongRange> insideRanges = removeInsideRanges(globalRanges, evalRanges, idRange); removedRanges.addAll(insideRanges); final LongRange ceilingRange = evalRanges.ceiling(idRange); if (ceilingRange != null && ceilingRange.overlapsRange(idRange)) { final LongRange ceilingRemoved = removeIntersectingRange(globalRanges, evalRanges, ceilingRange, idRange); if (ceilingRemoved != null) { removedRanges.add(ceilingRemoved); } } final LongRange floorRange = evalRanges.floor(idRange); if (floorRange != null && floorRange.overlapsRange(idRange)) { final LongRange floorRemoved = removeIntersectingRange(globalRanges, evalRanges, floorRange, idRange); if (floorRemoved != null) { removedRanges.add(floorRemoved); } } return removedRanges; }
Source:
protected String buildLockRepForNewSubAccount(SubAccountGlobal subAccountGlobal, SubAccountGlobalNewAccountDetail newAccountDetail) { String subAccountNumber = subAccountGlobal.isApplyToAllNewSubAccounts() ? subAccountGlobal.getNewSubAccountNumber() : newAccountDetail.getSubAccountNumber(); StringBuilder lockrep = new StringBuilder(); lockrep.append(Account.class.getName() + KFSConstants.Maintenance.AFTER_CLASS_DELIM); lockrep.append(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM); lockrep.append(newAccountDetail.getChartOfAccountsCode() + KFSConstants.Maintenance.AFTER_VALUE_DELIM); lockrep.append(KFSPropertyConstants.ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM); lockrep.append(newAccountDetail.getAccountNumber() + KFSConstants.Maintenance.AFTER_VALUE_DELIM); lockrep.append(KFSPropertyConstants.SUB_ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM); lockrep.append(subAccountNumber + KFSConstants.Maintenance.AFTER_VALUE_DELIM); return lockrep.toString(); }

Target:
protected String buildLockRepForNewSubAccount(SubAccountGlobal subAccountGlobal, SubAccountGlobalNewAccountDetail newAccountDetail) { String subAccountNumber = subAccountGlobal.isApplyToAllNewSubAccounts() ? subAccountGlobal.getNewSubAccountNumber() : newAccountDetail.getSubAccountNumber(); StringBuilder lockrep = new StringBuilder(); lockrep.append(Account.class.getName()).append(KFSConstants.Maintenance.AFTER_CLASS_DELIM); lockrep.append(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE).append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM); lockrep.append(newAccountDetail.getChartOfAccountsCode()).append(KFSConstants.Maintenance.AFTER_VALUE_DELIM); lockrep.append(KFSPropertyConstants.ACCOUNT_NUMBER).append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM); lockrep.append(newAccountDetail.getAccountNumber()).append(KFSConstants.Maintenance.AFTER_VALUE_DELIM); lockrep.append(KFSPropertyConstants.SUB_ACCOUNT_NUMBER).append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM); lockrep.append(subAccountNumber).append(KFSConstants.Maintenance.AFTER_VALUE_DELIM); return lockrep.toString(); }
Source:
public void testShowCreateTable() { queryRunner.execute("CREATE TABLE IF NOT EXISTS test_show_create_table (\n" + "id INT WITH (primary_key=true),\n" + "user_name VARCHAR\n" + ") WITH (\n" + " partition_by_hash_columns = ARRAY['id'],\n" + " partition_by_hash_buckets = 2\n" + ")"); MaterializedResult result = queryRunner.execute("SHOW CREATE TABLE test_show_create_table"); String sqlStatement = (String) result.getOnlyValue(); String tableProperties = sqlStatement.split("\\)\\s*WITH\\s*\\(")[1]; checkTableProperty(tableProperties, "num_replicas", "\\d+"); checkTableProperty(tableProperties, "table_id", "'\\w+'"); checkTableProperty(tableProperties, "partition_by_hash_columns", Pattern.quote("ARRAY['id']")); checkTableProperty(tableProperties, "partition_by_hash_buckets", "2"); }

Target:
public void testShowCreateTable() { queryRunner.execute("CREATE TABLE IF NOT EXISTS test_show_create_table (\n" + "id INT WITH (primary_key=true),\n" + "user_name VARCHAR\n" + ") WITH (\n" + " partition_by_hash_columns = ARRAY['id'],\n" + " partition_by_hash_buckets = 2," + " number_of_replicas = 1\n" + ")"); MaterializedResult result = queryRunner.execute("SHOW CREATE TABLE test_show_create_table"); String sqlStatement = (String) result.getOnlyValue(); String tableProperties = sqlStatement.split("\\)\\s*WITH\\s*\\(")[1]; assertTableProperty(tableProperties, "number_of_replicas", "1"); assertTableProperty(tableProperties, "partition_by_hash_columns", Pattern.quote("ARRAY['id']")); assertTableProperty(tableProperties, "partition_by_hash_buckets", "2"); }
Source:
public static Map<String, Set<String>> determineProblematicNics(List<VdsNetworkInterface> interfaces, List<Network> clusterNetworks) { Map<String, Set<String>> brokenNicsToNetworks = new HashMap<String, Set<String>>(); Map<String, Network> networksByName = NetworkUtils.networksByName(clusterNetworks); for (VdsNetworkInterface iface : interfaces) { if (isRequiredInterfaceDown(networksByName, interfaces, iface)) { String baseNicName = NetworkUtils.stripVlan(iface); Set<String> networks = brokenNicsToNetworks.get(baseNicName); if (networks == null) { networks = new HashSet<String>(); brokenNicsToNetworks.put(baseNicName, networks); } networks.add(iface.getNetworkName()); } } return brokenNicsToNetworks; }

Target:
public static Map<String, Set<String>> determineProblematicNics(List<VdsNetworkInterface> interfaces, List<Network> clusterNetworks) { Map<String, Set<String>> brokenNicsToNetworks = new HashMap<>(); Map<String, Network> networksByName = NetworkUtils.networksByName(clusterNetworks); for (VdsNetworkInterface iface : interfaces) { if (isRequiredInterfaceDown(networksByName, interfaces, iface)) { String baseNicName = NetworkUtils.stripVlan(iface); Set<String> networks = brokenNicsToNetworks.get(baseNicName); if (networks == null) { networks = new HashSet<String>(); brokenNicsToNetworks.put(baseNicName, networks); } networks.add(iface.getNetworkName()); } } return brokenNicsToNetworks; }
Source:
public static List<String> varargsToList(@Nullable Object[] args) { if (args == null || args.length == 0) { return null; } else { final List<String> list = new ArrayList<>(args.length); for (Object arg : args) { list.add(arg.toString()); } return list; } }

Target:
public static List<String> varargsToList(@Nullable Object[] args) { if (args == null || args.length == 0) { return null; } else { final List<String> list = new ArrayList<>(args.length); for (int i = 0; i < args.length; i++) { list.add(args[i].toString()); } return list; } }
Source:
public Object getObject(String type, String value, byte[] byteValue) throws SQLException { if (typemap != null) { Class<?> c = typemap.get(type); System.out.println("check type c in getOject in PgConnection : " + c); if (c != null) { throw new PSQLException(GT.tr("Custom type maps are not supported."), PSQLState.NOT_IMPLEMENTED); } } if(type.equals("inet")) { try { System.out.println(InetAddress.getByName(value)); return InetAddress.getByName(value); } catch (UnknownHostException e) { e.printStackTrace(); } } PGobject obj = null; if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "Constructing object from type={0} value=<{1}>", new Object[]{type, value}); } try { Class<? extends PGobject> klass = typeCache.getPGobject(type); if (klass != null) { obj = klass.newInstance(); obj.setType(type); System.out.println("Object type -->" + obj.getType()); if (byteValue != null && obj instanceof PGBinaryObject) { PGBinaryObject binObj = (PGBinaryObject) obj; binObj.setByteValue(byteValue, 0); } else { obj.setValue(value); } } else { obj = new PGobject(); obj.setType(type); obj.setValue(value); } System.out.println("Object -->" + obj.getValue()); return obj; } catch (SQLException sx) { throw sx; } catch (Exception ex) { throw new PSQLException(GT.tr("Failed to create object for: {0}.", type), PSQLState.CONNECTION_FAILURE, ex); } }

Target:
public Object getObject(String type, String value, byte[] byteValue) throws SQLException { if (typemap != null) { Class<?> c = typemap.get(type); if (c != null) { throw new PSQLException(GT.tr("Custom type maps are not supported."), PSQLState.NOT_IMPLEMENTED); } } if (type.equals("inet")) { try { return InetAddress.getByName(value); } catch (UnknownHostException e) { throw new PSQLException(GT.tr("IP address {0} of a host could not be determined", value), PSQLState.CONNECTION_FAILURE, e); } } PGobject obj = null; if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "Constructing object from type={0} value=<{1}>", new Object[]{type, value}); } try { Class<? extends PGobject> klass = typeCache.getPGobject(type); if (klass != null) { obj = klass.newInstance(); obj.setType(type); if (byteValue != null && obj instanceof PGBinaryObject) { PGBinaryObject binObj = (PGBinaryObject) obj; binObj.setByteValue(byteValue, 0); } else { obj.setValue(value); } } else { obj = new PGobject(); obj.setType(type); obj.setValue(value); } return obj; } catch (SQLException sx) { throw sx; } catch (Exception ex) { throw new PSQLException(GT.tr("Failed to create object for: {0}.", type), PSQLState.CONNECTION_FAILURE, ex); } }
Source:
public Collection<MergeStrategySection> getAllMergeStrategySections() { List<MergeStrategySection> all = new ArrayList<MergeStrategySection>(); all.addAll(getLocalMergeStrategySections()); all.addAll(getInheritedMergeStrategySections()); return all; }

Target:
public List<MergeStrategySection> getAllMergeStrategySections() { List<MergeStrategySection> all = new ArrayList<MergeStrategySection>(); all.addAll(getLocalMergeStrategySections()); all.addAll(getInheritedMergeStrategySections()); return all; }
Source:
public Object getFractionUnique() { if (nProcessed == 0 || uniqueCount == 1) { return 0d; } else { double fractionUnique = uniqueCount / (double) nProcessed; if (tooManyValues) { return String.format("<= %.3f", fractionUnique); } else { return fractionUnique; } } }

Target:
public Double getFractionUnique() { if (nProcessed == 0 || uniqueCount == 1) { return 0d; } else { return uniqueCount / (double) nProcessed; } }
Source:
public Iterable<IAnalysisModuleHelper> getAnalysisModules() { if (fModules == null) { populateAnalysisModules(); } return fModules; }

Target:
public synchronized Iterable<IAnalysisModuleHelper> getAnalysisModules() { if (fModules == null) { populateAnalysisModules(); } return fModules; }
Source:
public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException { if (!super.setTrace(trace)) { return false; } if (!fSegmentStoreModule.setTrace(trace)) { return false; } if (!fStateSystemModule.setTrace(trace)) { return false; } return true; }

Target:
public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException { if (!super.setTrace(trace)) { return false; } return fSegmentStoreModule.setTrace(trace) && fStateSystemModule.setTrace(trace); }
Source:
public List<SubscriptionName> listActiveSubscriptionNames() { return getCurrentData().stream() .map(this::tryToReadSubscriptionSilently) .filter(o -> o != null) .filter(Subscription::isActive) .map(Subscription::toSubscriptionName) .collect(Collectors.toList()); }

Target:
public List<SubscriptionName> listActiveSubscriptionNames() { return getCurrentData().stream() .map(this::tryToReadSubscriptionSilently) .filter(Objects::nonNull) .filter(Subscription::isActive) .map(Subscription::toSubscriptionName) .collect(Collectors.toList()); }
Source:
public void testWriteHandle() throws Exception { Map<String, byte[]> customMetadata = new HashMap<>(); customMetadata.put("test", "test".getBytes(StandardCharsets.UTF_8)); try (WriteHandle writer = result( newCreateLedgerOp() .withAckQuorumSize(1) .withWriteQuorumSize(2) .withEnsembleSize(3) .withDigestType(DigestType.MAC) .withCustomMetadata(customMetadata) .withPassword("password".getBytes(StandardCharsets.UTF_8)) .execute());) { byte[] data = "foo".getBytes(StandardCharsets.UTF_8); writer.append(ByteBuffer.wrap(data)).get(); writer.append(ByteBuffer.wrap(data)).get(); writer.append(Unpooled.wrappedBuffer(data)).get(); writer.append(ByteBuffer.wrap(data)).get(); long expectedEntryId = writer.append(ByteBuffer.wrap(data)).get(); assertEquals(expectedEntryId, writer.getLastAddConfirmed()); } }

Target:
public void testWriteHandle() throws Exception { try (WriteHandle writer = result(newCreateLedgerOp() .withAckQuorumSize(1) .withWriteQuorumSize(2) .withEnsembleSize(3) .withPassword(password) .execute());) { result(writer.append(ByteBuffer.wrap(data))); result(writer.append(Unpooled.wrappedBuffer(data))); long expectedEntryId = result(writer.append(ByteBuffer.wrap(data))); assertEquals(expectedEntryId, writer.getLastAddConfirmed()); } }
Source:
private HealthCheckResult doHealthCheck(ZookeeperClient zookeeperClient) { try { final String timestamp = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); zookeeperClient.getCuratorFramework() .setData() .forPath(healthCheckPath, objectMapper.writeValueAsBytes(timestamp)); LOGGER.info("ZooKeeper healthy.", zookeeperClient.getDcName()); return HealthCheckResult.HEALTHY; } catch (Exception e) { LOGGER.error("Cannot connect to ZooKeeper {}.", zookeeperClient.getDcName(), e); return HealthCheckResult.UNHEALTHY; } }

Target:
private HealthCheckResult doHealthCheck(ZookeeperClient zookeeperClient) { final String timestamp = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); try { zookeeperClient.ensurePathExists(healthCheckPath); zookeeperClient.getCuratorFramework() .setData() .forPath(healthCheckPath, objectMapper.writeValueAsBytes(timestamp)); logger.info("Storage healthy for datacenter {}", zookeeperClient.getDatacenterName()); return HealthCheckResult.HEALTHY; } catch (Exception e) { logger.error("Storage health check failed for datacenter {}", zookeeperClient.getDatacenterName(), e); return HealthCheckResult.UNHEALTHY; } }
Source:
public void testIntegrationNoFailureTag() throws Exception { jenkinsRule.createOnlineSlave(new LabelAtom("windows")); WorkflowJob job = jenkinsRule.jenkins.createProject(WorkflowJob.class, "pipelineIntegrationSuccess"); String definition = IOUtils.toString( this.getClass().getResourceAsStream("testPipelineSuccess.txt"), "UTF-8" ); job.setDefinition(new CpsFlowDefinition(definition, true)); WorkflowRun run = job.scheduleBuild2(0).get(); BufferedReader br = new BufferedReader(run.getLogReader()); String s; while ((s = br.readLine()) != null) { System.out.println(s); } br.close(); String hostname = DatadogUtilities.getHostname(null); String[] tags = new String[]{ "jenkins_url:" + DatadogUtilities.getJenkinsUrl(), "user_id:anonymous", "job:pipelineIntegrationSuccess", "result:UNKNOWN", "stage_depth:0", "stage_name:test", "parent_stage_name:root" }; clientStub.assertMetric("jenkins.job.stage_duration", hostname, tags); }

Target:
public void testIntegrationNoFailureTag() throws Exception { jenkinsRule.createOnlineSlave(new LabelAtom("windows")); WorkflowJob job = jenkinsRule.jenkins.createProject(WorkflowJob.class, "pipelineIntegrationSuccess"); String definition = IOUtils.toString( this.getClass().getResourceAsStream("testPipelineSuccess.txt"), "UTF-8" ); job.setDefinition(new CpsFlowDefinition(definition, true)); job.scheduleBuild2(0).get(); String hostname = DatadogUtilities.getHostname(null); String[] tags = new String[]{ "jenkins_url:" + DatadogUtilities.getJenkinsUrl(), "user_id:anonymous", "job:pipelineIntegrationSuccess", "result:SUCCESS", "stage_depth:0", "stage_name:test", "parent_stage_name:root" }; clientStub.assertMetric("jenkins.job.stage_duration", hostname, tags); }
Source:
public static Collection<Integer> getLostPacketsFci(ByteArrayBuffer fciBuffer) { Collection<Integer> lostPackets = new LinkedList<>(); if (fciBuffer == null) { return lostPackets; } byte[] fci = fciBuffer.getBuffer(); int off = fciBuffer.getOffset(), len = fciBuffer.getLength(); for (int i = 0; i < (len / 4); i++) { int pid = (0xFF & fci[off + i * 4 + 0]) << 8 | (0xFF & fci[off + i * 4 + 1]); lostPackets.add(pid); for (int j = 0; j < 8; j++) if (0 != (fci[off + i * 4 + 2] & (1 << j))) lostPackets.add((pid + 1 + 8 + j) % (1 << 16)); for (int j = 0; j < 8; j++) if (0 != (fci[off + i * 4 + 3] & (1 << j))) lostPackets.add((pid + 1 + j) % (1 << 16)); } return lostPackets; }

Target:
public static Collection<Integer> getLostPacketsFci(ByteArrayBuffer fciBuffer) { Collection<Integer> lostPackets = new LinkedList<>(); if (fciBuffer == null) { return lostPackets; } byte[] fci = fciBuffer.getBuffer(); int off = fciBuffer.getOffset(), len = fciBuffer.getLength(); for (int i = 0; i < (len / 4); i++) { int pid = (0xFF & fci[off + i * 4 + 0]) << 8 | (0xFF & fci[off + i * 4 + 1]); lostPackets.add(pid); for (int j = 0; j < 8; j++) { if (0 != (fci[off + i * 4 + 2] & (1 << j))) { lostPackets.add((pid + 1 + 8 + j) % (1 << 16)); } } for (int j = 0; j < 8; j++) { if (0 != (fci[off + i * 4 + 3] & (1 << j))) { lostPackets.add((pid + 1 + j) % (1 << 16)); } } } return lostPackets; }
Source:
public static boolean isNumber(Class<?> clazz) { if ( clazz == null ) { return false; } else if ( clazz.isPrimitive() ) { return NUMBER_TYPES.contains( clazz ); } else { return Number.class.isAssignableFrom( clazz ); } }

Target:
public static boolean isNumber(Class<?> clazz) { if ( clazz == null ) { return false; } else { return NUMBER_TYPES.contains( clazz ); } }
Source:
protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.of(22); for (ConfigKey k: getEntityType().getConfigKeys()) { if (PortRange.class.isAssignableFrom(k.getType())) { PortRange p = (PortRange)getConfig(k); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } } Map<String, Object> provisioningProperties = getConfig(PROVISIONING_PROPERTIES); if(provisioningProperties.containsKey("required.ports")){ Object requiredPorts = provisioningProperties.get("required.ports"); if (requiredPorts instanceof Integer){ ports.add((Integer)requiredPorts); }else if (requiredPorts instanceof List) { for(Object o : (List<?>)requiredPorts){ if(o instanceof Integer) ports.add((Integer)o); } } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }

Target:
protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.of(22); Map<ConfigKey<?>, ?> allConfig = config().getBag().getAllConfigAsConfigKeyMap(); Set<ConfigKey<?>> configKeys = Sets.newHashSet(allConfig.keySet()); configKeys.addAll(getEntityType().getConfigKeys()); for (ConfigKey<?> k: configKeys) { if (PortRange.class.isAssignableFrom(k.getType())) { PortRange p = (PortRange)getConfig(k); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } else if(k.getName().matches(".*\\.port")){ Object value = getConfig(k); if (value instanceof Integer){ ports.add((Integer)value); } } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }
Source:
public void testFunctionIsAppliedToExistingMessageSource() { ApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)) .web(WebApplicationType.NONE) .run("--spring.cloud.stream.function.name=toUpperCase", "--spring.jmx.enabled=false"); OutputDestination target = context.getBean(OutputDestination.class); assertThat(target.receive(1000).getPayload()).isEqualTo("HELLO FUNCTION".getBytes(StandardCharsets.UTF_8)); }

Target:
public void testFunctionIsAppliedToExistingMessageSource() { try(ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)) .web(WebApplicationType.NONE) .run("--spring.cloud.stream.function.name=toUpperCase", "--spring.jmx.enabled=false")){ OutputDestination target = context.getBean(OutputDestination.class); assertThat(target.receive(1000).getPayload()).isEqualTo("HELLO FUNCTION".getBytes(StandardCharsets.UTF_8)); } }
Source:
public ViewResultsFullVisualizer() { super(); final int maxResults = JMeterUtils.getPropDefault("view.results.tree.max_results", 500); if (maxResults > 0) { buffer = new CircularFifoQueue<>(maxResults); } else { buffer = new LinkedList<>(); } init(); new Timer(REFRESH_PERIOD, e -> updateGui()).start(); }

Target:
public ViewResultsFullVisualizer() { super(); final int maxResults = JMeterUtils.getPropDefault("view.results.tree.max_results", 500); if (maxResults > 0) { buffer = new CircularFifoQueue<>(maxResults); } else { buffer = new ArrayDeque<>(); } init(); new Timer(REFRESH_PERIOD, e -> updateGui()).start(); }
Source:
private void ensureNotCallingFromPartitionOperationThread() { if (Thread.currentThread() instanceof PartitionOperationThread) { throw new IllegalThreadStateException(Thread.currentThread() + " cannot block on InvocationFuture!"); } }

Target:
private void ensureNotCallingFromPartitionOperationThread() { if (Thread.currentThread() instanceof PartitionOperationThread) { throw new IllegalThreadStateException(Thread.currentThread() + " cannot block on " + this); } }
Source:
private void writeMemoryBacking() { if (!HugePageUtils.isBackedByHugepages(vm.getStaticData())) { return; } writer.writeStartElement("memoryBacking"); writer.writeStartElement("hugepages"); writer.writeStartElement("page"); int hugepageSize = Integer.parseInt(HugePageUtils.getHugePageSize(vm.getStaticData())); List<Integer> hugepageSizes = hostStatisticsSupplier.get().getHugePages().stream() .map(HugePage::getSizeKB) .collect(Collectors.toList()); if (!hugepageSizes.contains(hugepageSizes)) { switch(vm.getClusterArch().getFamily()) { case x86: hugepageSize = 2048; break; case ppc: hugepageSize = 16384; break; } } writer.writeAttributeString("size", String.valueOf(hugepageSize)); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); }

Target:
private void writeMemoryBacking() { if (!HugePageUtils.isBackedByHugepages(vm.getStaticData())) { return; } writer.writeStartElement("memoryBacking"); writer.writeStartElement("hugepages"); writer.writeStartElement("page"); int hugepageSize = Integer.parseInt(HugePageUtils.getHugePageSize(vm.getStaticData())); List<Integer> hugepageSizes = hostStatisticsSupplier.get().getHugePages().stream() .map(HugePage::getSizeKB) .collect(Collectors.toList()); if (!hugepageSizes.contains(hugepageSizes)) { switch(vm.getClusterArch().getFamily()) { case x86: hugepageSize = DEFAULT_HUGEPAGESIZE_X86_64; break; case ppc: hugepageSize = DEFAULT_HUGEPAGESIZE_PPC64LE; break; } } writer.writeAttributeString("size", String.valueOf(hugepageSize)); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); }
Source:
protected String browseWorkspace(String description) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setAllowMultiple(false); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IProject || element instanceof IFolder) { return true; } if(element instanceof IFile) { return true; } return false; } }); dialog.setTitle(Messages.LAUNCH_CONFIGURATION_MAIN_TAB_SELECT_MAIN_FILE_TITLE); dialog.setMessage(description); dialog.setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection != null && selection.length > 0 && selection[0] instanceof IFile){ return new Status(IStatus.OK, NodePlugin.PLUGIN_ID, IStatus.OK, NodeConstants.EMPTY, null); } return new Status(IStatus.ERROR, NodePlugin.PLUGIN_ID, IStatus.ERROR, NodeConstants.EMPTY, null); } }); if (dialog.open() == Window.OK) { IFile file = (IFile) dialog.getFirstResult(); if (file != null) { IPath path = file.getLocation(); String wsRelativePath = path.makeRelativeTo(ResourcesPlugin.getWorkspace().getRoot().getLocation()) .toString(); return "${workspace_loc}/" + wsRelativePath; } } return null; }

Target:
protected String browseWorkspace(String description) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setAllowMultiple(false); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IProject || element instanceof IFolder) { return true; } if(element instanceof IFile) { return true; } return false; } }); dialog.setTitle(Messages.LAUNCH_CONFIGURATION_MAIN_TAB_SELECT_MAIN_FILE_TITLE); dialog.setMessage(description); dialog.setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection != null && selection.length > 0 && selection[0] instanceof IFile){ return new Status(IStatus.OK, NodePlugin.PLUGIN_ID, IStatus.OK, NodeConstants.EMPTY, null); } return new Status(IStatus.ERROR, NodePlugin.PLUGIN_ID, IStatus.ERROR, NodeConstants.EMPTY, null); } }); if (dialog.open() == Window.OK) { IFile file = (IFile) dialog.getFirstResult(); if (file != null) { IPath path = file.getLocation(); String wsRelativePath = path.makeRelativeTo(ResourcesPlugin.getWorkspace().getRoot().getLocation()) .toString(); return VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression( "workspace_loc", wsRelativePath); } } return null; }
Source:
public void testDataProvider() { VirtualTableQueryFilter queryFilter = new EventTableQueryFilter(Collections.emptyList(), 0, 5, null); List<Long> expectedColumnsId = Arrays.asList(TIMESTAMP_COLUMN_ID, EVENT_TYPE_COLUMN_ID, CONTENTS_COLUMN_ID); List<EventTableLine> expectedData = Arrays.asList( new EventTableLine(Arrays.asList("19:00:00.001 000 000", "Type-0", ""), 0, TmfTimestamp.fromMillis(1), 0, 0), new EventTableLine(Arrays.asList("19:00:00.002 000 000", "Type-1", ""), 1, TmfTimestamp.fromMillis(2), 1, 0), new EventTableLine(Arrays.asList("19:00:00.003 000 000", "Type-2", ""), 2, TmfTimestamp.fromMillis(3), 2, 0), new EventTableLine(Arrays.asList("19:00:00.004 000 000", "Type-3", ""), 3, TmfTimestamp.fromMillis(4), 3, 0), new EventTableLine(Arrays.asList("19:00:00.005 000 000", "Type-4", ""), 4, TmfTimestamp.fromMillis(5), 4, 0)); TmfModelResponse<ITmfVirtualTableModel<EventTableLine>> response = fProvider.fetch(queryFilter, null); ITmfVirtualTableModel<EventTableLine> currentModel = response.getModel(); ITmfVirtualTableModel<EventTableLine> expectedModel = new TmfVirtualTableModel<>(expectedColumnsId, expectedData, 0, fTrace.getNbEvents()); assertEquals(expectedModel, currentModel); }

Target:
public void testDataProvider() { VirtualTableQueryFilter queryFilter = new EventTableQueryFilter(Collections.emptyList(), 0, 5, null); List<EventTableLine> expectedData = Arrays.asList( new EventTableLine(Arrays.asList("19:00:00.001 000 000", "Type-0", ""), 0, TmfTimestamp.fromMillis(1), 0, 0), new EventTableLine(Arrays.asList("19:00:00.002 000 000", "Type-1", ""), 1, TmfTimestamp.fromMillis(2), 1, 0), new EventTableLine(Arrays.asList("19:00:00.003 000 000", "Type-2", ""), 2, TmfTimestamp.fromMillis(3), 2, 0), new EventTableLine(Arrays.asList("19:00:00.004 000 000", "Type-3", ""), 3, TmfTimestamp.fromMillis(4), 3, 0), new EventTableLine(Arrays.asList("19:00:00.005 000 000", "Type-4", ""), 4, TmfTimestamp.fromMillis(5), 4, 0)); TmfModelResponse<ITmfVirtualTableModel<EventTableLine>> response = fProvider.fetchLines(queryFilter, null); ITmfVirtualTableModel<EventTableLine> currentModel = response.getModel(); ITmfVirtualTableModel<EventTableLine> expectedModel = new TmfVirtualTableModel<>(fColumnId, expectedData, 0, fTrace.getNbEvents()); assertEquals(expectedModel, currentModel); }
Source:
protected void checkConstructorResult( AnnotatedExecutableType constructorType, ExecutableElement constructorElement) { QualifierHierarchy qualifierHierarchy = atypeFactory.getQualifierHierarchy(); Set<AnnotationMirror> constructorAnnotations = constructorType.getReturnType().getAnnotations(); Set<? extends AnnotationMirror> tops = qualifierHierarchy.getTopAnnotations(); for (AnnotationMirror top : tops) { AnnotationMirror constructorAnno = qualifierHierarchy.findAnnotationInHierarchy(constructorAnnotations, top); if (!qualifierHierarchy.isSubtype(top, constructorAnno)) { checker.report( Result.warning( "inconsistent.constructor.type", constructorAnno, qualifierHierarchy.getTopAnnotation(constructorAnno)), constructorElement); } } }

Target:
protected void checkConstructorResult( AnnotatedExecutableType constructorType, ExecutableElement constructorElement) { QualifierHierarchy qualifierHierarchy = atypeFactory.getQualifierHierarchy(); Set<AnnotationMirror> constructorAnnotations = constructorType.getReturnType().getAnnotations(); Set<? extends AnnotationMirror> tops = qualifierHierarchy.getTopAnnotations(); for (AnnotationMirror top : tops) { AnnotationMirror constructorAnno = qualifierHierarchy.findAnnotationInHierarchy(constructorAnnotations, top); if (!qualifierHierarchy.isSubtype(top, constructorAnno)) { checker.report( Result.warning("inconsistent.constructor.type", constructorAnno, top), constructorElement); } } }
Source:
public void onCreate(Connection connection) { TopicExchange exchange = new TopicExchange("amq.rabbitmq.event"); try { this.admin.declareQueue(this.eventQueue); Arrays.stream(this.eventKeys).forEach(k -> { Binding binding = BindingBuilder.bind(this.eventQueue).to(exchange).with(k); this.admin.declareBinding(binding); }); } catch (Exception e) { logger.error("failed to declare event queue/bindings - is the plugin enabled?"); this.bindingsFailed = true; } }

Target:
public void onCreate(Connection connection) { this.bindingsFailedException = null; TopicExchange exchange = new TopicExchange("amq.rabbitmq.event"); try { this.admin.declareQueue(this.eventQueue); Arrays.stream(this.eventKeys).forEach(k -> { Binding binding = BindingBuilder.bind(this.eventQueue).to(exchange).with(k); this.admin.declareBinding(binding); }); } catch (Exception e) { logger.error("failed to declare event queue/bindings - is the plugin enabled?", e); this.bindingsFailedException = e; } }
Source:
public void closeDirty() { try { close(false); } catch (final RuntimeException e) { log.warn(String.format("Ignoring uncaught error in unclean close of standby task %s", id), e); } log.info("Closed dirty"); }

Target:
public void closeDirty() { close(false); log.info("Closed dirty"); }
Source:
public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> create(ITmfTrace trace) { Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>(); List<ITmfStateSystem> sss = new ArrayList<>(); if (fAnalysisIds.isEmpty()) { Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class)); } else { for (String moduleId : fAnalysisIds) { IAnalysisModule module = trace.getAnalysisModule(moduleId); if (module instanceof ITmfAnalysisModuleWithStateSystems) { stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module); } } } for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) { if (module.schedule().isOK() && module.waitForInitialization()) { module.getStateSystems().forEach(sss::add); } } return (sss.isEmpty() ? null : new DataDrivenXYDataProvider(trace, sss, fEntries, null)); }

Target:
public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> create(ITmfTrace trace) { Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>(); List<ITmfStateSystem> sss = new ArrayList<>(); if (fAnalysisIds.isEmpty()) { Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class)); } else { for (String moduleId : fAnalysisIds) { IAnalysisModule module = trace.getAnalysisModule(moduleId); if (module instanceof ITmfAnalysisModuleWithStateSystems) { stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module); } } } for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) { if (module.schedule().isOK() && module.waitForInitialization()) { module.getStateSystems().forEach(sss::add); } } return (sss.isEmpty() ? null : create(trace, sss, fEntries, null)); }
Source:
@Override public void onReadyForWrite(DistributedMetaStorage metastorage) { this.metastorage = metastorage; metastorage.listen( (k) -> k.equals(CLUSTER_ID_TAG_KEY), (String k, ClusterIdAndTag oldVal, ClusterIdAndTag newVal) -> { if (log.isInfoEnabled()) log.info( "Cluster tag will be set to new value: " + newVal != null ? newVal.tag() : "null" + ", previous value was: " + oldVal != null ? oldVal.tag() : "null"); cluster.setTag(newVal != null ? newVal.tag() : null); if (compatibilityMode) { assert oldVal == null; if (log.isInfoEnabled()) log.info("Cluster ID will be initialized to the value: " + newVal.id()); cluster.setId(newVal.id()); compatibilityMode = false; } } ); if (!compatibilityMode) { ctx.closure().runLocalSafe( () -> { try { ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag()); if (log.isInfoEnabled()) log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag); metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag); } catch (IgniteCheckedException e) { ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); } } ); } }

Target:
@Override public void onReadyForWrite(DistributedMetaStorage metastorage) { this.metastorage = metastorage; metastorage.listen( (k) -> k.equals(CLUSTER_ID_TAG_KEY), (String k, ClusterIdAndTag oldVal, ClusterIdAndTag newVal) -> { if (log.isInfoEnabled()) { log.info( "Cluster tag will be set to new value: " + (newVal != null ? newVal.tag() : "null") + ", previous value was: " + (oldVal != null ? oldVal.tag() : "null")); } cluster.setTag(newVal != null ? newVal.tag() : null); } ); ctx.closure().runLocalSafe( () -> { try { ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag()); if (log.isInfoEnabled()) log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag); metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag); } catch (IgniteCheckedException e) { ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); } } ); }
Source:
private Optional<TableReference> logDecision( Optional<TableReference> chosenTable, Map<TableReference, Double> scores, SweepPriorityOverrideConfig sweepPriorityOverrideConfig) { if (!log.isDebugEnabled()) { return chosenTable; } String safeTableNamesToScore = scores.entrySet().stream() .sorted(Comparator.comparingDouble(Map.Entry::getValue)) .map(entry -> LoggingArgs.safeTableOrPlaceholder(entry.getKey()) + "->" + entry.getValue()) .collect(Collectors.joining(", ", "[", "]")); String chosenTableString = chosenTable.isPresent() ? LoggingArgs.safeTableOrPlaceholder(chosenTable.get()).toString() : "no table"; log.debug("Chose from scores: {}, unsafeScores: {}, overrides: {}", SafeArg.of("chosenTable", chosenTableString), SafeArg.of("scores", safeTableNamesToScore), UnsafeArg.of("unsafeScores", scores), SafeArg.of("overrides", sweepPriorityOverrideConfig)); return chosenTable; }

Target:
private Optional<TableReference> logDecision( Optional<TableReference> chosenTable, Map<TableReference, Double> scores, SweepPriorityOverrideConfig sweepPriorityOverrideConfig) { if (!log.isDebugEnabled()) { return chosenTable; } String safeTableNamesToScore = scores.entrySet().stream() .sorted(Comparator.comparingDouble(Map.Entry::getValue)) .map(entry -> LoggingArgs.safeTableOrPlaceholder(entry.getKey()) + "->" + entry.getValue()) .collect(Collectors.joining(", ", "[", "]")); String chosenTableString = chosenTable.isPresent() ? LoggingArgs.safeTableOrPlaceholder(chosenTable.get()).toString() : "no table"; log.debug("Chose from scores: {}, unsafeScores: {}, overrides: {}", SafeArg.of("chosenTable", chosenTableString), SafeArg.of("scores", safeTableNamesToScore), UnsafeArg.of("unsafeScores", scores), UnsafeArg.of("overrides", sweepPriorityOverrideConfig)); return chosenTable; }
Source:
public void onPistonRetract(BlockPistonRetractEvent e) { if(BlockStorage.check(e.getBlock()) != null) { e.setCancelled(true); } else if (e.isSticky()) { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) { e.setCancelled(true); return; } } } }

Target:
public void onPistonRetract(BlockPistonRetractEvent e) { if (BlockStorage.hasBlockInfo(e.getBlock())) { e.setCancelled(true); } else if (e.isSticky()) { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) { e.setCancelled(true); break; } } } }
Source:
protected Long toLong(BooleanWritable writable) throws IOException { return (long)( writable.get() ? 1:0); }

Target:
protected Long toLong(BooleanWritable writable) throws IOException { return writable.get() ? 1L : 0L; }