auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void handleDelayedWriteBookieFailure() { final Map<Integer, BookieSocketAddress> CopyDelayedWriteFailedBookies = new HashMap<Integer, BookieSocketAddress>(delayedWriteFailedBookies); delayedWriteFailedBookies.clear(); handleBookieFailure(CopyDelayedWriteFailedBookies); }

Target:
void handleDelayedWriteBookieFailure() { final Map<Integer, BookieSocketAddress> copyDelayedWriteFailedBookies = new HashMap<Integer, BookieSocketAddress>(delayedWriteFailedBookies); delayedWriteFailedBookies.clear(); handleBookieFailure(copyDelayedWriteFailedBookies); }
Source:
public void testArrayRemoveFunctionDoubleWithInt() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT ARRAY_REMOVE(doubles,10) FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); assertTrue(rs.next()); Double[] doubles = new Double[]{23.45,46.345,23.234,45.6,5.78}; Array array = conn.createArrayOf("DOUBLE", doubles); assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); }

Target:
public void testArrayRemoveFunctionDoubleWithInt() throws Exception { ResultSet rs = conn.createStatement().executeQuery( "SELECT ARRAY_REMOVE(doubles,10),doubles FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); assertTrue(rs.next()); assertEquals(conn.createArrayOf("DOUBLE", new Double[] { 23.45, 46.345, 23.234, 45.6, 5.78 }), rs.getArray(1)); assertEquals(conn.createArrayOf("DOUBLE", new Double[] { 10.0, 23.45, 46.345, 23.234, 45.6, 5.78 }), rs.getArray(2)); assertFalse(rs.next()); }
Source:
public void setConfigured(boolean configured) { this.configured = configured; }

Target:
protected void setConfigured(boolean configured) { this.configured = configured; }
Source:
private String[] updateInstancesAndGetInstanceNames(HelixAdmin dcAdmin, String partitionName, List<ReplicaId> replicaList, boolean sealed) { String[] instances = new String[replicaList.size()]; for (int i = 0; i < replicaList.size(); i++) { Replica replica = (Replica) replicaList.get(i); DataNodeId node = replica.getDataNodeId(); String instanceName = node.getHostname() + "_" + node.getPort(); instances[i] = instanceName; InstanceConfig instanceConfig = dcAdmin.getInstanceConfig(clusterName, instanceName); Map<String, String> diskInfo = instanceConfig.getRecord().getMapField(replica.getMountPath()); String replicasStr = diskInfo.get(REPLICAS_STR); replicasStr += replica.getPartition().getId() + REPLICAS_DELIM_STR; diskInfo.put(REPLICAS_STR, replicasStr); instanceConfig.getRecord().setMapField(replica.getMountPath(), diskInfo); if (sealed) { List<String> currentSealedPartitions = instanceConfig.getRecord().getListField(SEALED_STR); List<String> newSealedPartitionsList = new ArrayList<>(currentSealedPartitions); newSealedPartitionsList.add(partitionName); instanceConfig.getRecord().setListField(SEALED_STR, newSealedPartitionsList); } dcAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); } return instances; }

Target:
private String[] updateInstancesAndGetInstanceNames(HelixAdmin dcAdmin, String partitionName, List<ReplicaId> replicaList, boolean sealed) { String[] instances = new String[replicaList.size()]; for (int i = 0; i < replicaList.size(); i++) { Replica replica = (Replica) replicaList.get(i); DataNodeId node = replica.getDataNodeId(); String instanceName = getInstanceName(node); instances[i] = instanceName; InstanceConfig instanceConfig = dcAdmin.getInstanceConfig(clusterName, instanceName); Map<String, String> diskInfo = instanceConfig.getRecord().getMapField(replica.getMountPath()); String replicasStr = diskInfo.get(REPLICAS_STR); replicasStr += replica.getPartition().getId() + REPLICAS_DELIM_STR; diskInfo.put(REPLICAS_STR, replicasStr); instanceConfig.getRecord().setMapField(replica.getMountPath(), diskInfo); if (sealed) { List<String> currentSealedPartitions = instanceConfig.getRecord().getListField(SEALED_STR); List<String> newSealedPartitionsList = new ArrayList<>(currentSealedPartitions); newSealedPartitionsList.add(partitionName); instanceConfig.getRecord().setListField(SEALED_STR, newSealedPartitionsList); } } return instances; }
Source:
public void disconnect() { if (fExplicitConnect) { fHost.close(); } }

Target:
public void disconnect() { if (fExplicitConnect) { fHost.close(); fExplicitConnect = false; } }
Source:
public int compareTo(Object obj) { if (this == obj) { return 0; } if (obj == null) { return 1; } if (getClass() != obj.getClass()) { return 1; } RepositoryVersion other = (RepositoryVersion) obj; if (this.major == null || other.major == null) { return this.toString().compareTo(other.toString()); } int erg = this.major - other.major; if (erg != 0) { return erg; } if (this.minor != null && other.minor == null) { return 1; } else if (this.minor == null && other.minor != null) { return -1; } else if (this.minor != null && other.minor != null) { erg = this.minor - other.minor; if (erg != 0) { return erg; } } if (this.micro != null && other.micro == null) { return 1; } else if (this.micro == null && other.micro != null) { return -1; } else if (this.micro != null && other.micro != null) { erg = this.micro - other.micro; if (erg != 0) { return erg; } } if (this.qualifier != null && other.qualifier == null) { if (this.qualifier.equals("+")) { return 1; } else { return -1; } } if (this.qualifier == null && other.qualifier != null) { if (other.qualifier.equals("+")) { return -1; } else { return 1; } } if (this.qualifier != null && other.qualifier != null) { erg = this.qualifier.compareTo(other.qualifier); if (this.qualifier.equals("+") || other.qualifier.equals("+")) { return erg * -1; } if (erg != 0) { return erg; } } return 0; }

Target:
public int compareTo(Object obj) { if (this == obj) { return 0; } if (obj == null) { return 1; } if (getClass() != obj.getClass()) { return 1; } RepositoryVersion other = (RepositoryVersion) obj; if (this.major == null || other.major == null) { return this.orgVersion.compareTo(other.orgVersion); } int erg = this.major - other.major; if (erg != 0) { return erg; } if (this.minor != null && other.minor == null) { return 1; } else if (this.minor == null && other.minor != null) { return -1; } else if (this.minor != null && other.minor != null) { erg = this.minor - other.minor; if (erg != 0) { return erg; } } if (this.micro != null && other.micro == null) { return 1; } else if (this.micro == null && other.micro != null) { return -1; } else if (this.micro != null && other.micro != null) { erg = this.micro - other.micro; if (erg != 0) { return erg; } } if (this.qualifier != null && other.qualifier == null) { return -1; } else if (this.qualifier == null && other.qualifier != null) { return 1; } else if (this.qualifier != null && other.qualifier != null) { return this.qualifier.compareTo(other.qualifier); } return 0; }
Source:
public void run() { try { TERMINATE_MESSAGE_PROCESSING: while (true) { if (Thread.currentThread().isInterrupted()) { Thread.currentThread().interrupt(); break TERMINATE_MESSAGE_PROCESSING; } ControlMessage cm = null; try { while ((cm = controlMessageQueue.take()) != null) { switch (cm.getType()) { case SHUTDOWN: if (LOGGER.isInfoEnabled()) { LOGGER.info("shutdown requested"); } toShutdown = true; abruptShutdown = false; break; case ADD_WORKER: int workerId = cm.getWorkerId(); if (LOGGER.isInfoEnabled()) { LOGGER.info("received ADD_WORKER " + workerId); } connectionPool.putRemote( workerId, SocketInfo.fromProtobuf(cm.getRemoteAddress())); sendMessageToMaster(IPCUtils.addWorkerAckTM(workerId)); break; case SYSTEM_GC: if (LOGGER.isInfoEnabled()) { LOGGER.info("Trigger System GC"); } System.gc(); break; default: if (LOGGER.isErrorEnabled()) { LOGGER.error("Unexpected control message received at worker: " + cm.getType()); } } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } } catch (Throwable ee) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Unknown exception caught at control message processing.", ee); } } }

Target:
public void run() { try { TERMINATE_MESSAGE_PROCESSING: while (true) { if (Thread.currentThread().isInterrupted()) { Thread.currentThread().interrupt(); break TERMINATE_MESSAGE_PROCESSING; } ControlMessage cm = null; try { while ((cm = controlMessageQueue.take()) != null) { switch (cm.getType()) { case SHUTDOWN: if (LOGGER.isInfoEnabled()) { LOGGER.info("shutdown requested"); } toShutdown = true; abruptShutdown = false; break; case ADD_WORKER: int workerId = cm.getWorkerId(); if (LOGGER.isInfoEnabled()) { LOGGER.info("received ADD_WORKER " + workerId); } connectionPool.putRemote( workerId, SocketInfo.fromProtobuf(cm.getRemoteAddress())); sendMessageToMaster(IPCUtils.addWorkerAckTM(workerId)); break; case SYSTEM_GC: if (LOGGER.isDebugEnabled()) { LOGGER.debug("Trigger System GC"); } System.gc(); break; default: if (LOGGER.isErrorEnabled()) { LOGGER.error("Unexpected control message received at worker: " + cm.getType()); } } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } } catch (Throwable ee) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Unknown exception caught at control message processing.", ee); } } }
Source:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } MultiCurrencyValuesArray other = (MultiCurrencyValuesArray) obj; if (values.size() != other.values.size()) { return false; } for (Currency currency : values.keySet()) { double[] currencyValues = values.get(currency); double[] otherCurrencyValues = other.values.get(currency); if (otherCurrencyValues == null) { return false; } if (!Arrays.equals(currencyValues, otherCurrencyValues)) { return false; } } return true; }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { MultiCurrencyValuesArray other = (MultiCurrencyValuesArray) obj; return JodaBeanUtils.equal(values, other.values) && (size == other.size); } return false; }
Source:
public void addStore(PartitionId partitionId, ReplicationTest.StoreEventListener listener) { storesByPartition.computeIfAbsent(partitionId, partitionId1 -> new InMemoryStore(partitionId, infosByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<MessageInfo>>) partitionId2 -> new ArrayList<>()), buffersByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<ByteBuffer>>) partitionId22 -> new ArrayList<>()), listener)); }

Target:
void addStore(PartitionId partitionId, ReplicationTest.StoreEventListener listener) { storesByPartition.computeIfAbsent(partitionId, partitionId1 -> new InMemoryStore(partitionId, infosByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<MessageInfo>>) partitionId2 -> new ArrayList<>()), buffersByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<ByteBuffer>>) partitionId22 -> new ArrayList<>()), listener)); }
Source:
public void onProgress(long transferred, long total) { if (!notificationTitleChanged) { curNotification.setContentTitle(notificationProgressTitle); notificationTitleChanged = true; contribution.setState(Contribution.STATE_IN_PROGRESS); } if (transferred == total) { curNotification.setContentTitle(notificationFinishingTitle) .setTicker(notificationFinishingTitle) .setProgress(0, 100, true); } else { curNotification.setProgress(100, (int) (((double) transferred / (double) total) * 100), false); } notificationManager.notify(notificationTag, NOTIFICATION_UPLOAD_IN_PROGRESS, curNotification.build()); contribution.setTransferred(transferred); ExecutorUtils.get().submit(() -> appDatabase.getContributionDao().save(contribution)); }

Target:
public void onProgress(long transferred, long total) { if (!notificationTitleChanged) { curNotification.setContentTitle(notificationProgressTitle); notificationTitleChanged = true; contribution.setState(Contribution.STATE_IN_PROGRESS); } if (transferred == total) { curNotification.setContentTitle(notificationFinishingTitle) .setTicker(notificationFinishingTitle) .setProgress(0, 100, true); } else { curNotification.setProgress(100, (int) (((double) transferred / (double) total) * 100), false); } notificationManager.notify(notificationTag, NOTIFICATION_UPLOAD_IN_PROGRESS, curNotification.build()); contribution.setTransferred(transferred); compositeDisposable.add(contributionDao. save(contribution).subscribeOn(ioThreadScheduler) .observeOn(mainThreadScheduler) .subscribe()); }
Source:
@Override public void run() { try { while (!isInterrupted()) { ResetReason reason = sceneProvider.awaitSceneStateChange(); synchronized (bufferedScene) { sceneProvider.withSceneProtected(scene -> { if (reason.overwriteState()) { bufferedScene.copyState(scene); } if(reason.reloadMaterials()) { scene.importMaterials(); } bufferedScene.copyTransients(scene); finalizeAllFrames = scene.shouldFinalizeBuffer(); updateRenderState(scene); if (reason == ResetReason.SCENE_LOADED) { bufferedScene.swapBuffers(); sendSceneStatus(bufferedScene.sceneStatus()); } }); } initializeJobQueue(); if (mode == RenderMode.PREVIEW) { previewLoop(); } else { int spp, targetSpp; synchronized (bufferedScene) { spp = bufferedScene.spp; targetSpp = bufferedScene.getTargetSpp(); if (spp < targetSpp) { updateRenderProgress(); } } if (spp < targetSpp) { pathTraceLoop(); } else { sceneProvider.withEditSceneProtected(scene -> { scene.pauseRender(); updateRenderState(scene); }); } } if (headless) { break; } } } catch (InterruptedException e) { } catch (Throwable e) { Log.error("Unchecked exception in render manager", e); } stopWorkers(); }

Target:
@Override public void run() { try { while (!isInterrupted()) { ResetReason reason = sceneProvider.awaitSceneStateChange(); synchronized (bufferedScene) { sceneProvider.withSceneProtected(scene -> { if (reason.overwriteState()) { bufferedScene.copyState(scene); } if(reason == ResetReason.MATERIALS_CHANGED || reason == ResetReason.SCENE_LOADED) { scene.importMaterials(); } bufferedScene.copyTransients(scene); finalizeAllFrames = scene.shouldFinalizeBuffer(); updateRenderState(scene); if (reason == ResetReason.SCENE_LOADED) { bufferedScene.swapBuffers(); sendSceneStatus(bufferedScene.sceneStatus()); } }); } initializeJobQueue(); if (mode == RenderMode.PREVIEW) { previewLoop(); } else { int spp, targetSpp; synchronized (bufferedScene) { spp = bufferedScene.spp; targetSpp = bufferedScene.getTargetSpp(); if (spp < targetSpp) { updateRenderProgress(); } } if (spp < targetSpp) { pathTraceLoop(); } else { sceneProvider.withEditSceneProtected(scene -> { scene.pauseRender(); updateRenderState(scene); }); } } if (headless) { break; } } } catch (InterruptedException e) { } catch (Throwable e) { Log.error("Unchecked exception in render manager", e); } stopWorkers(); }
Source:
public void createFeedback(@RequestBody TrainingFeedbackDTO feedbackDTO) { TrainingFeedback feedback = new TrainingFeedback(feedbackDTO); trainingFeedbackService.addTrainingFeedback(feedback); feedbackDTO.setId(feedback.getId()); trainingFeedbackEventService.addEvent(new TrainingFeedbackEvent(feedbackDTO)); List<EventDTO> list = new ArrayList<>(); List<Event> events = new ArrayList<>(); events.addAll(trainingEventService.getUnwatchedEvents()); events.addAll(trainingFeedbackEventService.getUnwatchedEvents()); events.addAll(userFeedbackEventService.getUnwatchedEvents()); for (Event event: events){ list.add(event.toEventDTO()); } for (Map.Entry<DeferredResult<List<EventDTO>>, Integer> entry : EventController.eventRequests.entrySet()) { entry.getKey().setResult(list); } }

Target:
public void createFeedback(@RequestBody TrainingFeedbackDTO feedbackDTO) { TrainingFeedback feedback = new TrainingFeedback(feedbackDTO); trainingFeedbackService.addTrainingFeedback(feedback); feedbackDTO.setId(feedback.getId()); trainingFeedbackEventService.addEvent(new TrainingFeedbackEvent(feedbackDTO)); for (Map.Entry<DeferredResult<List<EventDTO>>, Integer> entry : EventController.eventRequests.entrySet()) { entry.getKey().setResult(getEvents()); } }
Source:
public List<ScoredCandidates<T>> generate(T content, ResultDescription desc) { desc.startStage("Generating equivalences"); Builder<ScoredCandidates<T>> generatedScores = ImmutableList.builder(); ImmutableList<Long> excludedIds = excludedUris.stream() .filter(id -> !id.contains("http")) .map(id -> codec.decode(id).longValue()) .collect(MoreCollectors.toImmutableList()); if (excludedUris.contains(content.getCanonicalUri()) || excludedIds.contains(content.getId())) { desc.appendText("Content %s is in equivalence blacklist and will not be equivalated", content.getCanonicalUri()); return generatedScores.build(); } if (!content.isActivelyPublished()) { return generatedScores.build(); } for (EquivalenceGenerator<T> generator : generators) { try { desc.startStage(generator.toString()); generatedScores.add(generator.generate(content, desc)); desc.finishStage(); } catch (Exception e) { throw new RuntimeException(String.format("Exception running %s for %s", generator, content), e); } } desc.finishStage(); return generatedScores.build(); }

Target:
public List<ScoredCandidates<T>> generate(T content, ResultDescription desc) { desc.startStage("Generating equivalences"); Builder<ScoredCandidates<T>> generatedScores = ImmutableList.builder(); ImmutableList<Long> excludedDecodedIds = excludedIds.stream() .map(id -> codec.decode(id).longValue()) .collect(MoreCollectors.toImmutableList()); if (excludedUris.contains(content.getCanonicalUri()) || excludedDecodedIds.contains(content.getId())) { desc.appendText("Content %s is in equivalence blacklist and will not be equivalated", content.getCanonicalUri()); return generatedScores.build(); } if (!content.isActivelyPublished()) { return generatedScores.build(); } for (EquivalenceGenerator<T> generator : generators) { try { desc.startStage(generator.toString()); generatedScores.add(generator.generate(content, desc)); desc.finishStage(); } catch (Exception e) { throw new RuntimeException(String.format("Exception running %s for %s", generator, content), e); } } desc.finishStage(); return generatedScores.build(); }
Source:
private static void runStatementWithRetry(ShouldRetry retryAnnotation, Statement base, Description description) { Preconditions.checkArgument(retryAnnotation.numAttempts() > 0, "Number of attempts should be positive, but found %s", retryAnnotation.numAttempts()); for (int attempt = 1; attempt <= retryAnnotation.numAttempts(); attempt++) { try { base.evaluate(); return; } catch (Throwable t) { log.info("Test {}.{} failed on attempt of {}.", description.getClassName(), description.getMethodName(), attempt, retryAnnotation.numAttempts()); if (attempt == retryAnnotation.numAttempts()) { throw Throwables.propagate(t); } } } }

Target:
private static void runStatementWithRetry(ShouldRetry retryAnnotation, Statement base, Description description) { Preconditions.checkArgument(retryAnnotation.numAttempts() > 0, "Number of attempts should be positive, but found %s", retryAnnotation.numAttempts()); for (int attempt = 1; attempt <= retryAnnotation.numAttempts(); attempt++) { try { base.evaluate(); log.info("Test {}.{} succeeded on attempt of {}.", description.getClassName(), description.getMethodName(), attempt, retryAnnotation.numAttempts()); return; } catch (Exception | AssertionError e) { logFailureAndThrowIfNeeded(retryAnnotation, description, attempt, e); } catch (Throwable t) { throw Throwables.propagate(t); } } }
Source:
private Result increment(final HRegion region, final OperationQuota quota, final MutationProto mutation, final CellScanner cells, long nonceGroup, ActivePolicyEnforcement spaceQuota) throws IOException { long before = EnvironmentEdgeManager.currentTime(); Increment increment = ProtobufUtil.toIncrement(mutation, cells); checkCellSizeLimit(region, increment); spaceQuota.getPolicyEnforcement(region).check(increment); quota.addMutation(increment); Result r = null; boolean canProceed = startNonceOperation(mutation, nonceGroup); boolean success = false; try { long nonce = mutation.hasNonce() ? mutation.getNonce() : HConstants.NO_NONCE; if (canProceed) { r = region.increment(increment, nonceGroup, nonce); } else { if (region.getCoprocessorHost() != null) { r = region.getCoprocessorHost().preIncrement(increment); } if (r == null) { List<Cell> results = region.get(toGet(increment), false, nonceGroup, nonce); r = Result.create(results); } if (region.getCoprocessorHost() != null) { r = region.getCoprocessorHost().postIncrement(increment, r); } } success = true; } finally { if (canProceed) { endNonceOperation(mutation, nonceGroup, success); } } final MetricsRegionServer metricsRegionServer = regionServer.getMetrics(); if (metricsRegionServer != null) { metricsRegionServer.updateIncrement(region.getTableDescriptor().getTableName(), EnvironmentEdgeManager.currentTime() - before); } return r == null ? Result.EMPTY_RESULT : r; }

Target:
private Result increment(final HRegion region, final OperationQuota quota, final MutationProto mutation, final CellScanner cells, long nonceGroup, ActivePolicyEnforcement spaceQuota) throws IOException { long before = EnvironmentEdgeManager.currentTime(); Increment increment = ProtobufUtil.toIncrement(mutation, cells); checkCellSizeLimit(region, increment); spaceQuota.getPolicyEnforcement(region).check(increment); quota.addMutation(increment); long nonce = mutation.hasNonce() ? mutation.getNonce() : HConstants.NO_NONCE; Result r = region.increment(increment, nonceGroup, nonce); final MetricsRegionServer metricsRegionServer = regionServer.getMetrics(); if (metricsRegionServer != null) { metricsRegionServer.updateIncrement(region.getTableDescriptor().getTableName(), EnvironmentEdgeManager.currentTime() - before); } return r == null ? Result.EMPTY_RESULT : r; }
Source:
private void InitVdsBroker() { log.infoFormat("vdsBroker({0},{1})", _vds.gethost_name(), _vds.getport()); String clusterVersion = _vds.getvds_group_compatibility_version().getValue(); int clientTimeOut = Config.<Integer> GetValue(ConfigValues.vdsTimeout, clusterVersion) * 1000; int connectionTimeOut = Config.<Integer>GetValue(ConfigValues.vdsConnectionTimeout, clusterVersion) * 1000; int clientRetries = Config.<Integer>GetValue(ConfigValues.vdsRetries, clusterVersion); Pair<VdsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(_vds.gethost_name(), _vds.getport(), clientTimeOut, connectionTimeOut, clientRetries, VdsServerConnector.class, Config.<Boolean> GetValue(ConfigValues.UseSecureConnectionWithServers)); _vdsProxy = new VdsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); }

Target:
private void InitVdsBroker() { log.infoFormat("Initialize vdsBroker ({0},{1})", _vds.getHostName(), _vds.getPort()); int clientTimeOut = Config.<Integer> GetValue(ConfigValues.vdsTimeout) * 1000; int connectionTimeOut = Config.<Integer>GetValue(ConfigValues.vdsConnectionTimeout) * 1000; int clientRetries = Config.<Integer>GetValue(ConfigValues.vdsRetries); Pair<VdsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(_vds.getHostName(), _vds.getPort(), clientTimeOut, connectionTimeOut, clientRetries, VdsServerConnector.class, Config.<Boolean> GetValue(ConfigValues.UseSecureConnectionWithServers)); _vdsProxy = new VdsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); }
Source:
private GrouperMetadataImpl getGrouperMetadata(String jobModelVersion, List<ProcessorNode> processorNodes) { Map<TaskName, String> taskToProcessorId = new HashMap<>(); Map<TaskName, List<SystemStreamPartition>> taskToSSPs = new HashMap<>(); if (jobModelVersion != null) { JobModel jobModel = readJobModelFromMetadataStore(jobModelVersion); if (jobModel != null) { for (ContainerModel containerModel : jobModel.getContainers().values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { taskToProcessorId.put(taskModel.getTaskName(), containerModel.getId()); for (SystemStreamPartition partition : taskModel.getSystemStreamPartitions()) { taskToSSPs.computeIfAbsent(taskModel.getTaskName(), k -> new ArrayList<>()); taskToSSPs.get(taskModel.getTaskName()).add(partition); } } } } } Map<String, LocationId> processorLocality = new HashMap<>(); for (ProcessorNode processorNode : processorNodes) { ProcessorData processorData = processorNode.getProcessorData(); processorLocality.put(processorData.getProcessorId(), processorData.getLocationId()); } Map<TaskName, LocationId> taskLocality = zkUtils.readTaskLocality(); return new GrouperMetadataImpl(processorLocality, taskLocality, taskToSSPs, taskToProcessorId); }

Target:
private GrouperMetadataImpl getGrouperMetadata(String jobModelVersion, List<ProcessorNode> processorNodes) { Map<TaskName, String> taskToProcessorId = new HashMap<>(); Map<TaskName, List<SystemStreamPartition>> taskToSSPs = new HashMap<>(); if (jobModelVersion != null) { JobModel jobModel = readJobModelFromMetadataStore(jobModelVersion); for (ContainerModel containerModel : jobModel.getContainers().values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { taskToProcessorId.put(taskModel.getTaskName(), containerModel.getId()); for (SystemStreamPartition partition : taskModel.getSystemStreamPartitions()) { taskToSSPs.computeIfAbsent(taskModel.getTaskName(), k -> new ArrayList<>()); taskToSSPs.get(taskModel.getTaskName()).add(partition); } } } } Map<String, LocationId> processorLocality = new HashMap<>(); for (ProcessorNode processorNode : processorNodes) { ProcessorData processorData = processorNode.getProcessorData(); processorLocality.put(processorData.getProcessorId(), processorData.getLocationId()); } Map<TaskName, LocationId> taskLocality = zkUtils.readTaskLocality(); return new GrouperMetadataImpl(processorLocality, taskLocality, taskToSSPs, taskToProcessorId); }
Source:
public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { return type instanceof Class && supportedTypes.contains(type) ? Optional.of(new LoggableBinderArgument<>(value, (p, i, v) -> p.setObject(i, value))) : Optional.empty(); }

Target:
public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { return Optional.of(type) .filter(Class.class::isInstance) .map(Class.class::cast) .map(supportedTypes::get) .map(sqlType -> ObjectArgument.of(value, sqlType)); }
Source:
public void destroy() { if (origin instanceof TemporaryVertex) ((TemporaryVertex) origin).dispose(); if (target instanceof TemporaryVertex) ((TemporaryVertex) target).dispose(); LOG.debug("ms Cleaning up temporary edges", temporaryEdges.size()); temporaryEdges.forEach(TemporaryEdge::dispose); temporaryEdges.clear(); temporaryVertices.forEach(graph::remove); temporaryVertices.clear(); }

Target:
public void destroy() { TemporaryVertex.disposeAll(temporaryVertices); temporaryVertices.clear(); }
Source:
public void endBlock() throws IOException { state = state.endBlock(); LOG.debug("{}: end block", out.getPos()); currentBlock.setRowCount(currentRecordCount); int blockSize = blocks.size(); if (fileEncryptor != null && blockSize > Short.MAX_VALUE) { throw new IOException("Number of row groups exceeds short max. Can't set ordinal"); } currentBlock.setOrdinal((short) blockSize); blocks.add(currentBlock); columnIndexes.add(currentColumnIndexes); offsetIndexes.add(currentOffsetIndexes); bloomFilters.add(currentBloomFilters); currentColumnIndexes = null; currentOffsetIndexes = null; currentBloomFilters = null; currentBlock = null; }

Target:
STATE endBlock() { return STARTED; }
Source:
NeoStores( File neoStoreFileName, Config config, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, final LogProvider logProvider, FileSystemAbstraction fileSystemAbstraction, VersionContextSupplier versionContextSupplier, RecordFormats recordFormats, boolean createIfNotExist, StoreType[] storeTypes, OpenOption[] openOptions ) { this.neoStoreFileName = neoStoreFileName; this.config = config; this.idGeneratorFactory = idGeneratorFactory; this.pageCache = pageCache; this.logProvider = logProvider; this.fileSystemAbstraction = fileSystemAbstraction; this.versionContextSupplier = versionContextSupplier; this.recordFormats = recordFormats; this.createIfNotExist = createIfNotExist; this.openOptions = openOptions; this.storeDir = neoStoreFileName.getParentFile(); verifyRecordFormat(); stores = new Object[StoreType.values().length]; try { for ( StoreType type : storeTypes ) { getOrCreateStore( type ); } } catch ( Exception initException ) { try { close(); } catch ( Exception closeException ) { initException.addSuppressed( closeException ); } throw initException; } initializedStores = storeTypes; }

Target:
NeoStores( File neoStoreFileName, Config config, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, final LogProvider logProvider, FileSystemAbstraction fileSystemAbstraction, VersionContextSupplier versionContextSupplier, RecordFormats recordFormats, boolean createIfNotExist, StoreType[] storeTypes, OpenOption[] openOptions ) { this.neoStoreFileName = neoStoreFileName; this.config = config; this.idGeneratorFactory = idGeneratorFactory; this.pageCache = pageCache; this.logProvider = logProvider; this.fileSystemAbstraction = fileSystemAbstraction; this.versionContextSupplier = versionContextSupplier; this.recordFormats = recordFormats; this.createIfNotExist = createIfNotExist; this.openOptions = openOptions; this.storeDir = neoStoreFileName.getParentFile(); verifyRecordFormat(); stores = new Object[StoreType.values().length]; try { for ( StoreType type : storeTypes ) { getOrCreateStore( type ); } } catch ( RuntimeException initException ) { try { close(); } catch ( RuntimeException closeException ) { initException.addSuppressed( closeException ); } throw initException; } initializedStores = storeTypes; }
Source:
public static <P extends PolicyConfiguration> P getCurrentPolicyConfiguration() throws PolicyContextException { String contextID; if (WildFlySecurityManager.isChecking()) { contextID = doPrivileged(new GetContextIDAction()); } else { contextID = PolicyContext.getContextID(); } try { ElytronPolicyConfigurationFactory policyConfigurationFactory = (ElytronPolicyConfigurationFactory) PolicyConfigurationFactory.getPolicyConfigurationFactory(); P policyConfiguration = (P) policyConfigurationFactory.getPolicyConfiguration(contextID); if (policyConfiguration == null) { throw log.authzInvalidPolicyContextIdentifier(contextID); } if (!policyConfiguration.inService()) { throw log.authzPolicyConfigurationNotInService(contextID); } return policyConfiguration; } catch (Exception e) { throw log.authzUnableToObtainPolicyConfiguration(contextID, e); } }

Target:
static <P extends PolicyConfiguration> P getCurrentPolicyConfiguration() throws PolicyContextException { String contextID; if (WildFlySecurityManager.isChecking()) { contextID = doPrivileged(GET_CONTEXT_ID); } else { contextID = PolicyContext.getContextID(); } if (contextID == null) { throw log.authzContextIdentifierNotSet(); } try { P policyConfiguration = (P) configurationRegistry.get(contextID); if (policyConfiguration == null) { throw log.authzInvalidPolicyContextIdentifier(contextID); } if (!policyConfiguration.inService()) { throw log.authzPolicyConfigurationNotInService(contextID); } return policyConfiguration; } catch (Exception e) { throw log.authzUnableToObtainPolicyConfiguration(contextID, e); } }
Source:
public SpanElement renderNodeContents(ProcessTreeNode node) { ProcessTreeNode.ProcessNodeType type = node.getType(); switch (type) { case MACHINE_NODE: return createMachineElement((MachineDto)node.getData()); case COMMAND_NODE: return createCommandElement(node); case TERMINAL_NODE: return createTerminalElement(node); case GIT_NODE: return createGitElement(node); default: return Elements.createSpanElement(); } }

Target:
public SpanElement renderNodeContents(ProcessTreeNode node) { ProcessTreeNode.ProcessNodeType type = node.getType(); switch (type) { case MACHINE_NODE: return createMachineElement((MachineDto)node.getData()); case COMMAND_NODE: return createCommandElement(node); case TERMINAL_NODE: return createTerminalElement(node); default: return Elements.createSpanElement(); } }
Source:
public ResponseEntity addOrUpdateRepository(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable String repositoryId, @ApiParam(value = "The repository object", required = true) @RequestBody Repository repository) throws IOException, JAXBException { try { logger.debug("Creating repository " + storageId + ":" + repositoryId + "..."); repository.setStorage(configurationManagementService.getStorage(storageId)); configurationManagementService.saveRepository(storageId, repository); final File repositoryBaseDir = new File(repository.getBasedir()); if (!repositoryBaseDir.exists()) { repositoryManagementService.createRepository(storageId, repository.getId()); } return ResponseEntity.ok(ResponseStatusEnum.OK.value()); } catch (IOException | JAXBException | RepositoryManagementStrategyException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ResponseStatusEnum.FAILED.value()); } }

Target:
public ResponseEntity addOrUpdateRepository(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable String repositoryId, @ApiParam(value = "The repository object", required = true) @RequestBody Repository repository) throws IOException, JAXBException { try { logger.debug("Creating repository " + storageId + ":" + repositoryId + "..."); repository.setStorage(configurationManagementService.getStorage(storageId)); configurationManagementService.saveRepository(storageId, repository); final File repositoryBaseDir = new File(repository.getBasedir()); if (!repositoryBaseDir.exists()) { repositoryManagementService.createRepository(storageId, repository.getId()); } return ResponseEntity.ok("The repository was updated successfully."); } catch (IOException | JAXBException | RepositoryManagementStrategyException e) { logger.error(e.getMessage(), e); return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } }
Source:
private void synchronizeNics(VM vm, CompensationContext compensationContext, DbUser user, VmInterfaceManager vmInterfaceManager) { VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(vm.getClusterId(), vm.getStoragePoolId(), AuditLogType.IMPORTEXPORT_SNAPSHOT_VM_INVALID_INTERFACES); vmInterfaceManager.removeAll(vm.getId()); for (VmNetworkInterface vmInterface : vm.getInterfaces()) { vmInterface.setVmId(vm.getId()); if (vmInterface.getId() == null) { vmInterface.setId(Guid.newGuid()); } vnicProfileHelper.updateNicWithVnicProfileForUser(vmInterface, user); vmInterfaceManager.add(vmInterface, compensationContext, true, false, vm.getOs(), vm.getCompatibilityVersion()); } vnicProfileHelper.auditInvalidInterfaces(vm.getName()); }

Target:
private void synchronizeNics(VM vm, CompensationContext compensationContext, DbUser user, VmInterfaceManager vmInterfaceManager) { VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(vm.getClusterId(), vm.getStoragePoolId(), AuditLogType.IMPORTEXPORT_SNAPSHOT_VM_INVALID_INTERFACES); MacPool macPool = vmInterfaceManager.getMacPool(); List<VmNic> dbNics = vmNicDao.getAllForVm(vm.getId()); List<VmNetworkInterface> newNics = vm.getInterfaces(); Map<String, Long> preexistingMacsUsageFrequency = countMacUsageFrequency(dbNics); Map<String, Long> macsFromRequestUsageFrequency = countMacUsageFrequency(newNics); vmInterfaceManager.removeAll(dbNics); releaseExtraMacs(macPool, preexistingMacsUsageFrequency, macsFromRequestUsageFrequency); for (VmNetworkInterface vmInterface : newNics) { vmInterface.setVmId(vm.getId()); if (vmInterface.getId() == null) { vmInterface.setId(Guid.newGuid()); } vnicProfileHelper.updateNicWithVnicProfileForUser(vmInterface, user); vmInterfaceManager.persistIface(vmInterface, compensationContext); } allocateMacsMissingInMacPool(macPool, preexistingMacsUsageFrequency, macsFromRequestUsageFrequency); vnicProfileHelper.auditInvalidInterfaces(vm.getName()); }
Source:
public Map<PlanNodeId, SplitSource> visitTableScan(TableScanNode node, Context context) { TableHandle table = node.getIsDelete() ? context.tableWriteInfo.getDeleteScanTableHandle().orElseThrow(() -> new IllegalStateException("deletesScanTableHandle is absent")) : node.getTable(); Supplier<SplitSource> splitSourceSupplier = () -> splitSourceProvider.getSplits( session, table, getSplitSchedulingStrategy(stageExecutionDescriptor, node.getId())); SplitSource splitSource = new LazySplitSource(splitSourceSupplier); splitSources.add(splitSource); return ImmutableMap.of(node.getId(), splitSource); }

Target:
public Map<PlanNodeId, SplitSource> visitTableScan(TableScanNode node, Context context) { TableHandle table; Optional<DeleteScanInfo> deleteScanInfo = context.getTableWriteInfo().getDeleteScanInfo(); if (deleteScanInfo.isPresent() && deleteScanInfo.get().getId() == node.getId()) { table = deleteScanInfo.get().getTableHandle(); } else { table = node.getTable(); } Supplier<SplitSource> splitSourceSupplier = () -> splitSourceProvider.getSplits( session, table, getSplitSchedulingStrategy(stageExecutionDescriptor, node.getId())); SplitSource splitSource = new LazySplitSource(splitSourceSupplier); splitSources.add(splitSource); return ImmutableMap.of(node.getId(), splitSource); }
Source:
public void addCursorBlock(String streamName, byte[] opaque) { m_checksumLock.writeLock().lock(); m_lastestOpaque = opaque; boolean expandCursorBuff = m_slotManager.addStream(streamName); m_staleSlotMapper = true; if (expandCursorBuff) { BBContainer newCursorBuff = DBBPool.allocateDirect(m_slotManager.m_cursorSpace); ByteBuffer b = m_cursorBuffer.b(); assert(b.position() == 0); newCursorBuff.b().put(b); newCursorBuff.b().position(0); m_lb = newCursorBuff.bD().asLongBuffer(); m_cursorBuffer.discard(); m_cursorBuffer = newCursorBuff; } m_checksumLock.writeLock().unlock(); }

Target:
public void addCursorBlock(String streamName, byte[] opaque) { try { m_checksumLock.writeLock().lock(); boolean expandCursorBuff = m_slotMapper.addStream(streamName, opaque); if (expandCursorBuff) { BBContainer newCursorBuff = DBBPool.allocateDirect(m_slotMapper.m_cursorSpace); ByteBuffer b = m_cursorBuffer.b(); assert(b.position() == 0); newCursorBuff.b().put(b); newCursorBuff.b().position(0); m_lb = newCursorBuff.bD().asLongBuffer(); m_cursorBuffer.discard(); m_cursorBuffer = newCursorBuff; } } finally { m_checksumLock.writeLock().unlock(); } }
Source:
private void addMpTermData(String mpId, StatisticalResultDTO doc) throws SQLException { if (mpId != null) { OntologyTermBean mpTerm = mpOntologyService.getTerm(mpId); if (mpTerm != null) { doc.setMpTermId(mpTerm.getId()); doc.setMpTermName(mpTerm.getName()); doc.setTopLevelMpTermId(mpOntologyService.getTopLevelDetail(mpId).getIds()); doc.setTopLevelMpTermName(mpOntologyService.getTopLevelDetail(mpId).getNames()); doc.setIntermediateMpTermId(mpOntologyService.getIntermediatesDetail(mpId).getIds()); doc.setIntermediateMpTermName(mpOntologyService.getIntermediatesDetail(mpId).getNames()); if (mpOntologyService.getAnatomyMappings(mpId) != null){ List<String> anatomyIds = mpOntologyService.getAnatomyMappings(mpId); for (String id: anatomyIds){ OntologyDAO currentOntologyService = null; if (id.startsWith("EMAPA")){ currentOntologyService = emapaOntologyService; } else if (id.startsWith("MA")){ currentOntologyService = maOntologyService; } doc.addAnatomyTermId(id); doc.addAnatomyTermName(currentOntologyService.getTerm(id).getName()); OntologyDetail maAncestors = currentOntologyService.getIntermediatesDetail(id); doc.setIntermediateAnatomyTermId(maAncestors.getIds()); doc.setIntermediateAnatomyTermName(maAncestors.getNames()); OntologyDetail maTopLevels = currentOntologyService.getSelectedTopLevelDetails(id); doc.setTopLevelAnatomyTermId(maTopLevels.getIds()); doc.setTopLevelAnatomyTermName(maTopLevels.getNames()); } } } } }

Target:
private void addMpTermData(String mpId, StatisticalResultDTO doc) throws SQLException { if (mpId != null) { OntologyTermBean mpTerm = mpOntologyService.getTerm(mpId); if (mpTerm != null) { doc.setMpTermId(mpTerm.getId()); doc.setMpTermName(mpTerm.getName()); doc.setTopLevelMpTermId(mpOntologyService.getTopLevelDetail(mpId).getIds()); doc.setTopLevelMpTermName(mpOntologyService.getTopLevelDetail(mpId).getNames()); doc.setIntermediateMpTermId(mpOntologyService.getIntermediatesDetail(mpId).getIds()); doc.setIntermediateMpTermName(mpOntologyService.getIntermediatesDetail(mpId).getNames()); if (mpOntologyService.getAnatomyMappings(mpId) != null){ List<String> anatomyIds = mpOntologyService.getAnatomyMappings(mpId); for (String id: anatomyIds){ OntologyDAO currentOntologyService = null; if (id.startsWith("EMAPA")){ currentOntologyService = emapaOntologyService; } else if (id.startsWith("MA")){ currentOntologyService = maOntologyService; } if (currentOntologyService != null){ doc.addAnatomyTermId(id); doc.addAnatomyTermName(currentOntologyService.getTerm(id).getName()); OntologyDetail anatomyIntermediateTerms = currentOntologyService.getIntermediatesDetail(id); doc.setIntermediateAnatomyTermId(anatomyIntermediateTerms.getIds()); doc.setIntermediateAnatomyTermName(anatomyIntermediateTerms.getNames()); OntologyDetail anatomyTopLevels = currentOntologyService.getSelectedTopLevelDetails(id); doc.setTopLevelAnatomyTermId(anatomyTopLevels.getIds()); doc.setTopLevelAnatomyTermName(anatomyTopLevels.getNames()); } } } } } }
Source:
public void unblockAllServicesOnDestination(PerunSession sess, String destinationName) throws FacilityNotExistsException, PrivilegeException { List<Destination> destinations = ((PerunBlImpl) sess.getPerun()).getServicesManagerBl().getDestinations(sess); for(Destination destination: destinations) { if(destination.getDestination().equals(destinationName)) { List<Facility> destinationFacilities = perunBl.getFacilitiesManager().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { log.warn("Trying to unblock services on destination by a user who is neither perunadmin nor admin of the facility"); continue; } getServicesManagerBl().unblockAllServicesOnDestination(sess, destination.getId()); } } }

Target:
public void unblockAllServicesOnDestination(PerunSession sess, String destinationName) throws FacilityNotExistsException, PrivilegeException { List<Destination> destinations = getServicesManagerBl().getDestinations(sess); for(Destination destination: destinations) { if(destination.getDestination().equals(destinationName)) { List<Facility> destinationFacilities = perunBl.getFacilitiesManagerBl().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { log.warn("Trying to unblock services on destination by a user who is neither perunadmin nor admin of the facility"); continue; } getServicesManagerBl().unblockAllServicesOnDestination(sess, destination.getId()); } } }
Source:
protected com.mongodb.client.model.IndexOptions convert(final IndexOptions options, final boolean background) { if (options.dropDups()) { throw new MappingException("dropDups value has been desupported by the server. Please set this value to false and " + "validate your system behaves as expected."); } com.mongodb.client.model.IndexOptions indexOptions = new com.mongodb.client.model.IndexOptions() .background(options.background() || background) .sparse(options.sparse()) .unique(options.unique()); if (!options.language().equals("")) { indexOptions.defaultLanguage(options.language()); } if (!options.languageOverride().equals("")) { indexOptions.languageOverride(options.languageOverride()); } if (!options.name().equals("")) { indexOptions.name(options.name()); } if (options.expireAfterSeconds() != -1) { indexOptions.expireAfter((long) options.expireAfterSeconds(), TimeUnit.SECONDS); } if (!options.collation().locale().equals("")) { indexOptions.collation(convert(options.collation())); } return indexOptions; }

Target:
private com.mongodb.client.model.IndexOptions convert(final IndexOptions options, final boolean background) { if (options.dropDups()) { LOG.warning("dropDups value is no longer supported by the server. Please set this value to false and " + "validate your system behaves as expected."); } com.mongodb.client.model.IndexOptions indexOptions = new com.mongodb.client.model.IndexOptions() .background(options.background() || background) .sparse(options.sparse()) .unique(options.unique()); if (!options.language().equals("")) { indexOptions.defaultLanguage(options.language()); } if (!options.languageOverride().equals("")) { indexOptions.languageOverride(options.languageOverride()); } if (!options.name().equals("")) { indexOptions.name(options.name()); } if (options.expireAfterSeconds() != -1) { indexOptions.expireAfter((long) options.expireAfterSeconds(), TimeUnit.SECONDS); } if (!options.collation().locale().equals("")) { indexOptions.collation(convert(options.collation())); } return indexOptions; }
Source:
public void checkExecutorHealth() { final Map<Optional<Executor>, List<ExecutableFlow>> exFlowMap = getFlowToExecutorMap(); for (final Map.Entry<Optional<Executor>, List<ExecutableFlow>> entry : exFlowMap.entrySet()) { final Optional<Executor> executorOption = entry.getKey(); if (!executorOption.isPresent()) { final String finalizeReason = "Executor id of this execution doesn't exist."; for (final ExecutableFlow flow : entry.getValue()) { this.logger.warn( String.format("Finalizing execution %s, %s", flow.getExecutionId(), finalizeReason)); ExecutionControllerUtils .finalizeFlow(this.executorLoader, this.alerterHolder, flow, finalizeReason, null); } continue; } final Executor executor = executorOption.get(); try { final Map<String, Object> results = this.apiGateway .callWithExecutionId(executor.getHost(), executor.getPort(), ConnectorParams.PING_ACTION, null, null); if (results == null || results.containsKey(ConnectorParams.RESPONSE_ERROR) || !results .containsKey(ConnectorParams.STATUS_PARAM) || !results.get(ConnectorParams.STATUS_PARAM) .equals(ConnectorParams.RESPONSE_ALIVE)) { throw new ExecutorManagerException("Status of executor " + executor.getId() + " is " + "not alive."); } } catch (final ExecutorManagerException e) { handleExecutorNotAliveCase(entry, executor, e); } } }

Target:
public void checkExecutorHealth() { final Map<Optional<Executor>, List<ExecutableFlow>> exFlowMap = getFlowToExecutorMap(); for (final Map.Entry<Optional<Executor>, List<ExecutableFlow>> entry : exFlowMap.entrySet()) { final Optional<Executor> executorOption = entry.getKey(); if (!executorOption.isPresent()) { final String finalizeReason = "Executor id of this execution doesn't exist."; for (final ExecutableFlow flow : entry.getValue()) { logger.warn( String.format("Finalizing execution %s, %s", flow.getExecutionId(), finalizeReason)); ExecutionControllerUtils .finalizeFlow(this.executorLoader, this.alerterHolder, flow, finalizeReason, null); } continue; } final Executor executor = executorOption.get(); try { final Map<String, Object> results = this.apiGateway .callWithExecutionId(executor.getHost(), executor.getPort(), ConnectorParams.PING_ACTION, null, null); if (results == null || results.containsKey(ConnectorParams.RESPONSE_ERROR) || !results .containsKey(ConnectorParams.STATUS_PARAM) || !results.get(ConnectorParams.STATUS_PARAM) .equals(ConnectorParams.RESPONSE_ALIVE)) { throw new ExecutorManagerException("Status of executor " + executor.getId() + " is " + "not alive."); } else { if (this.executorFailureCount.containsKey(executor.getId())) { this.executorFailureCount.put(executor.getId(), 0); } } } catch (final ExecutorManagerException e) { handleExecutorNotAliveCase(entry, executor, e); } } }
Source:
private boolean canDirectEdit() { boolean valid = !isInLayoutingModeDiagram(labeled); valid = valid && checkPrecondition(); return valid; }

Target:
public boolean canDirectEdit() { boolean valid = !isInLayoutingModeDiagram(labeled); valid = valid && checkPrecondition((DDiagramElement) labeled, directEditTool); return valid; }