auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public VmRuntimeTicker(Ticker systemTicker, Duration loopSleep, Duration maxSafeVmPause) { this.systemTicker = requireNonNull(systemTicker, "systemTicker is null"); this.loopSleepMillis = requireNonNull(loopSleep, "loopSleep is null").toMillis(); checkArgument(loopSleepMillis > 0, "loopSleep must be at least 1 millis second"); this.maxSafeVmPauseNanos = requireNonNull(maxSafeVmPause, "maxSafeVmPause is null").roundTo(NANOSECONDS); checkArgument(maxSafeVmPauseNanos > MILLISECONDS.toNanos(loopSleepMillis) * 10, "maxSafeVmPause must be at least 10 times larger than loopSleep"); vmRuntimeMonitorThread = new Thread(this::updateLoop, "VM Runtime Monitor"); vmRuntimeMonitorThread.setDaemon(true); }

Target:
public VmRuntimeTicker(Ticker systemTicker, Duration loopSleep, Duration maxSafeVmPause) { this.systemTicker = requireNonNull(systemTicker, "systemTicker is null"); this.loopSleepMillis = requireNonNull(loopSleep, "loopSleep is null").toMillis(); checkArgument(loopSleepMillis > 0, "loopSleep must be at least 1 millis second"); this.maxSafeVmPauseNanos = requireNonNull(maxSafeVmPause, "maxSafeVmPause is null").roundTo(NANOSECONDS); checkArgument(maxSafeVmPauseNanos > MILLISECONDS.toNanos(loopSleepMillis) * 2, "maxSafeVmPause must be at least 2 times larger than loopSleep"); vmRuntimeMonitorThread = new Thread(this::updateLoop, "VM Runtime Monitor"); vmRuntimeMonitorThread.setDaemon(true); }
Source:
public boolean isMarshallable(Object o) { if (o instanceof String || o instanceof Long || o instanceof Integer || o instanceof Double || o instanceof Float || o instanceof Boolean || o instanceof byte[] || o instanceof Enum) { return true; } return getSerializationContext().canMarshall(o.getClass()); }

Target:
public boolean isMarshallable(Object o) { if (o instanceof String || o instanceof Long || o instanceof Integer || o instanceof Double || o instanceof Float || o instanceof Boolean || o instanceof byte[]) { return true; } return getSerializationContext().canMarshall(o.getClass()); }
Source:
public void testWorkspaceIdWithoutPrefixRule() throws Throwable { this.customServerEvaluationStrategy = new CustomServerEvaluationStrategy("10.0.0.1", "192.168.1.1", "<workspaceIdWithoutPrefix>", "http", "8080"); Map<String, String> portMapping = this.customServerEvaluationStrategy.getExternalAddressesAndPorts(containerInfo, "localhost"); Assert.assertTrue(portMapping.containsKey("4401/tcp")); Assert.assertEquals(portMapping.get("4401/tcp"), WORKSPACE_ID_VALUE.replaceFirst(CHE_WORKSPACE_ID_PREFIX, "")); }

Target:
public void testWorkspaceIdWithoutPrefixRule() throws Throwable { this.customServerEvaluationStrategy = new CustomServerEvaluationStrategy("10.0.0.1", "192.168.1.1", "<workspaceIdWithoutPrefix>", "http", "8080"); Map<String, String> portMapping = this.customServerEvaluationStrategy.getExternalAddressesAndPorts(containerInfo, "localhost"); Assert.assertTrue(portMapping.containsKey("4401/tcp")); Assert.assertEquals(portMapping.get("4401/tcp"), WORKSPACE_ID_WITHOUT_PREFIX_VALUE); }
Source:
protected Hardware automaticHardware(double cores, int ram, Optional<Float> diskSize) { HardwareBuilder builder = new HardwareBuilder(); if (diskSize.isPresent()) { if (diskSize.get() > 0.0f) builder.volume(new VolumeImpl(diskSize.get(), true, true)); } return builder .id(automaticHardwareIdSpecBuilder(cores, ram, diskSize.or(Optional.<Float>absent())).toString()) .ram(ram) .processor(new Processor(cores, 1.0)) .build(); }

Target:
protected Hardware automaticHardware(double cores, int ram, Optional<Float> diskSize) { HardwareBuilder builder = new HardwareBuilder(); if (diskSize.isPresent() && diskSize.get() > 0.0f) { builder.volume(new VolumeImpl(diskSize.get(), true, true)); } return builder .id(automaticHardwareIdSpecBuilder(cores, ram, diskSize).toString()) .ram(ram) .processor(new Processor(cores, 1.0)) .build(); }
Source:
protected static void showCountMessage(final Handler handler, final int msgId, final int count) { if (handler != null && (count <= 1 || count % 10 == 0)) { final Message msg = new Message(); msg.arg1 = msgId; msg.arg2 = count; handler.sendMessage(msg); } }

Target:
protected static void showCountMessage(final Handler handler, final int msgId, final int count) { if (handler != null && (count <= 1 || count % 10 == 0)) { handler.sendMessage(handler.obtainMessage(0, msgId, count)); } }
Source:
CHANNEL acquire( AdvertisedSocketAddress catchUpAddress ) throws Exception { CHANNEL channel = getIdleChannel( catchUpAddress ); if ( channel != null ) { if ( !channel.isActive() ) { dispose( channel ); channel = null; } } if ( channel == null ) { channel = factory.apply( catchUpAddress ); try { channel.connect(); assertActive( channel, catchUpAddress ); } catch ( Exception e ) { dispose( channel ); throw e; } } addActiveChannel( channel ); return channel; }

Target:
CHANNEL acquire( AdvertisedSocketAddress catchUpAddress ) throws Exception { CHANNEL channel = getIdleChannel( catchUpAddress ); if ( channel == null ) { channel = factory.apply( catchUpAddress ); try { channel.connect(); assertActive( channel, catchUpAddress ); } catch ( Exception e ) { channel.close(); throw e; } } addActiveChannel( channel ); return channel; }
Source:
private Object[] lookup(ProjectionBlock projectionBlock) { int numPkColumns = _joinKeys.size(); int numDocuments = projectionBlock.getNumDocs(); Object[][] pkColumns = new Object[numPkColumns][]; for (int i=0; i<numPkColumns; i++) { FieldSpec.DataType colType = _joinValueFieldSpecs.get(i).getDataType(); TransformFunction tf = _joinValueFunctions.get(i); switch (colType) { case STRING: pkColumns[i] = tf.transformToStringValuesSV(projectionBlock); break; case INT: pkColumns[i] = ArrayUtils.toObject(tf.transformToIntValuesSV(projectionBlock)); break; case LONG: pkColumns[i] = ArrayUtils.toObject(tf.transformToLongValuesSV(projectionBlock)); break; default: throw new IllegalStateException("Unknown column type for primary key"); } } Object[] resultSet = new Object[numDocuments]; for (int i=0; i<numDocuments; i++) { Object[] pkValues = new Object[numPkColumns]; for (int j=0; j<numPkColumns; j++) { pkValues[j] = pkColumns[j][i]; } GenericRow row = _dataManager.lookupRowByPrimaryKey(new PrimaryKey(pkValues)); if (row != null && row.getFieldToValueMap().containsKey(_dimColumnName)) { resultSet[i] = row.getValue(_dimColumnName); } } return resultSet; }

Target:
private Object[] lookup(ProjectionBlock projectionBlock) { int numPkColumns = _joinKeys.size(); int numDocuments = projectionBlock.getNumDocs(); Object[][] pkColumns = new Object[numPkColumns][]; for (int c = 0; c < numPkColumns; c++) { FieldSpec.DataType colType = _joinValueFieldSpecs.get(c).getDataType(); TransformFunction tf = _joinValueFunctions.get(c); switch (colType) { case INT: pkColumns[c] = ArrayUtils.toObject(tf.transformToIntValuesSV(projectionBlock)); break; case LONG: pkColumns[c] = ArrayUtils.toObject(tf.transformToLongValuesSV(projectionBlock)); break; case FLOAT: pkColumns[c] = ArrayUtils.toObject(tf.transformToFloatValuesSV(projectionBlock)); break; case DOUBLE: pkColumns[c] = ArrayUtils.toObject(tf.transformToDoubleValuesSV(projectionBlock)); break; case STRING: pkColumns[c] = tf.transformToStringValuesSV(projectionBlock); break; case BYTES: byte[][] primitiveValues = tf.transformToBytesValuesSV(projectionBlock); pkColumns[c] = new ByteArray[numDocuments]; for (int i = 0; i < numDocuments; i++) { pkColumns[c][i] = new ByteArray(primitiveValues[i]); } break; default: throw new IllegalStateException("Unknown column type for primary key"); } } Object[] resultSet = new Object[numDocuments]; Object[] pkValues = new Object[numPkColumns]; for (int i = 0; i < numDocuments; i++) { for (int c = 0; c < numPkColumns; c++) { pkValues[c] = pkColumns[c][i]; } GenericRow row = _dataManager.lookupRowByPrimaryKey(new PrimaryKey(pkValues)); if (row != null) { resultSet[i] = row.getValue(_dimColumnName); } } return resultSet; }
Source:
private void afterDeploymentValidation(@Observes final AfterDeploymentValidation avd, BeanManager eventBeanManager) { BeanManager beanManager = getBeanManager(module, eventBeanManager); instance = beanManager.createInstance(); addHealthChecks(HealthLiteral.INSTANCE, reporter::addHealthCheck, module, healthChecks); addHealthChecks(Liveness.Literal.INSTANCE, reporter::addLivenessCheck, module, livenessChecks); addHealthChecks(Readiness.Literal.INSTANCE, reporter::addReadinessCheck, module, readinessChecks); if (readinessChecks.isEmpty()) { Config config = ConfigProvider.getConfig(module.getClassLoader()); boolean disableDefaultprocedure = config.getOptionalValue("mp.health.disable-default-procedures", Boolean.class).orElse(false); if (!disableDefaultprocedure) { defaultReadinessCheck = new DefaultReadinessHealthCheck(module.getName()); reporter.addReadinessCheck(defaultReadinessCheck, module.getClassLoader()); } } }

Target:
private void afterDeploymentValidation(@Observes final AfterDeploymentValidation avd, BeanManager eventBeanManager) { BeanManager beanManager = CDI.current().getBeanManager(); instance = beanManager.createInstance(); addHealthChecks(HealthLiteral.INSTANCE, reporter::addHealthCheck, healthChecks); addHealthChecks(Liveness.Literal.INSTANCE, reporter::addLivenessCheck, livenessChecks); addHealthChecks(Readiness.Literal.INSTANCE, reporter::addReadinessCheck, readinessChecks); if (readinessChecks.isEmpty()) { Config config = ConfigProvider.getConfig(parentModule.getClassLoader()); boolean disableDefaultprocedure = config.getOptionalValue("mp.health.disable-default-procedures", Boolean.class).orElse(false); if (!disableDefaultprocedure) { defaultReadinessCheck = new DefaultReadinessHealthCheck(parentModule.getName()); reporter.addReadinessCheck(defaultReadinessCheck, parentModule.getClassLoader()); } } }
Source:
private QueuedTask findForcedTask() { QueuedTask _ret = null; QueuedTask task; List<QueuedTask> storage = new ArrayList<>(); while ((task = taskQueue.poll()) != null) { if (task.forceRun) { _ret = task; } else { storage.add(task); } } taskQueue.addAll(storage); return _ret; }

Target:
private QueuedTask findForcedTask() { QueuedTask forcedTask = null; QueuedTask task; List<QueuedTask> storage = new ArrayList<>(); while (forcedTask == null && (task = taskQueue.poll()) != null) { if (task.forceRun) { forcedTask = task; } else { storage.add(task); } } taskQueue.addAll(storage); return forcedTask; }
Source:
protected Document createDocument() { Document doc = createDOMImplementation().createDocument("", "database", createDocumentType()); doc.setXmlStandalone(true); return doc; }

Target:
protected Document createDocument() { Document doc = createDOMImplementation().createDocument(null, "database", createDocumentType()); doc.setXmlStandalone(true); return doc; }
Source:
public IfClosure(P predicate, C trueClosure, C falseClosure) { this.predicate = predicate; this.trueClosure = trueClosure; this.falseClosure = falseClosure; }

Target:
public IfClosure(P predicate, C trueClosure, C falseClosure) { validate(predicate, trueClosure, falseClosure); this.predicate = predicate; this.trueClosure = trueClosure; this.falseClosure = falseClosure; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DisplayFeature that = (DisplayFeature) o; if (mType != that.mType) return false; return mBounds.equals(that.mBounds); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DisplayFeature that = (DisplayFeature) o; return mType == that.mType && mBounds.equals(that.mBounds); }
Source:
private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = Lists.newArrayList(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments( renditionRefsToDelete.stream().map(IdRef::new).collect(Collectors.toList()).toArray( new DocumentRef[renditionRefsToDelete.size()])); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }

Target:
private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = new ArrayList<>(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments( renditionRefsToDelete.stream().map(IdRef::new).collect(Collectors.toList()).toArray( new DocumentRef[renditionRefsToDelete.size()])); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }
Source:
private static Object newInstance(Class<?> cls) { try { return cls.newInstance(); } catch (Throwable t) { try { Constructor<?>[] constructors = cls.getDeclaredConstructors(); if (constructors == null && constructors.length == 0) { throw new RuntimeException("Illegal constructor: " + cls.getName()); } Constructor<?> constructor = constructors[0]; if (constructor.getParameterTypes().length > 0) { for (Constructor<?> c : constructors) { if (c.getParameterTypes().length < constructor.getParameterTypes().length) { constructor = c; if (constructor.getParameterTypes().length == 0) { break; } } } } constructor.setAccessible(true); return constructor.newInstance(new Object[constructor.getParameterTypes().length]); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } }

Target:
private static Object newInstance(Class<?> cls) { try { return cls.newInstance(); } catch (Throwable t) { try { Constructor<?>[] constructors = cls.getDeclaredConstructors(); if (constructors.length == 0) { throw new RuntimeException("Illegal constructor: " + cls.getName()); } Constructor<?> constructor = constructors[0]; if (constructor.getParameterTypes().length > 0) { for (Constructor<?> c : constructors) { if (c.getParameterTypes().length < constructor.getParameterTypes().length) { constructor = c; if (constructor.getParameterTypes().length == 0) { break; } } } } constructor.setAccessible(true); return constructor.newInstance(new Object[constructor.getParameterTypes().length]); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } }
Source:
public void validate(Object target, Errors errors) { log.debug("{}.validate...", this.getClass().getName()); if (target == null) { return; } Person person = (Person) target; validatePersonName(errors, person); if (!person.getVoided() && person.hasZeroNotVoidedNames()) { errors.rejectValue("names", "Person.shouldHaveAtleastOneNonVoidedName"); } validatePersonAddress(errors, person); validateBirthDate(errors, person.getBirthdate()); validateDeathDate(errors, person.getDeathDate(), person.getBirthdate()); if (person.getVoided()) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "voidReason", "error.null"); } if (person.getDead()) { if (person.hasBothCauseOfDeathAndNonCodedCauseOfDeath()) { errors.rejectValue("causeOfDeath", "Person.dead.shouldHaveOnlyOneCauseOfDeathOrCauseOfDeathNonCodedSet"); } else if (person.isMissingCauseOfDeathAndNonCodedCauseOfDeath()) { errors.rejectValue("causeOfDeath", "Person.dead.causeOfDeathAndCauseOfDeathNonCodedNull"); } } ValidateUtil.validateFieldLengths(errors, Person.class, "gender", "personVoidReason"); }

Target:
public void validate(Object target, Errors errors) { log.debug("{}.validate...", this.getClass().getName()); if (target == null) { return; } Person person = (Person) target; validatePersonName(errors, person); if (!person.getVoided() && person.hasZeroNotVoidedNames()) { errors.rejectValue("names", "Person.shouldHaveAtleastOneNonVoidedName"); } validatePersonAddress(errors, person); validateBirthDate(errors, person.getBirthdate()); validateDeathDate(errors, person.getDeathDate(), person.getBirthdate()); if (person.getVoided()) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "voidReason", "error.null"); } if (person.getDead()) { if (person.getCauseOfDeath() != null && person.getCauseOfDeathNonCoded() != null) { errors.rejectValue("causeOfDeath", "Person.dead.shouldHaveOnlyOneCauseOfDeathOrCauseOfDeathNonCodedSet"); } else if (person.getCauseOfDeath() == null && person.getCauseOfDeathNonCoded() == null) { errors.rejectValue("causeOfDeath", "Person.dead.causeOfDeathAndCauseOfDeathNonCodedNull"); } } ValidateUtil.validateFieldLengths(errors, Person.class, "gender", "personVoidReason"); }
Source:
public void stop() { if (initiatedShutdown.compareAndSet(false, true)) { LOG.info("Shutting down JobCoordinator."); boolean shutdownSuccessful = false; metrics.isLeader.set(false); try { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } debounceTimer.stopScheduler(); if (leaderElector.amILeader()) { LOG.info("Resigning leadership for processorId: " + processorId); leaderElector.resignLeadership(); } LOG.info("Shutting down ZkUtils."); if (zkUtils != null) { zkUtils.close(); } LOG.debug("Shutting down system admins."); systemAdmins.stop(); if (streamPartitionCountMonitor != null) { streamPartitionCountMonitor.stop(); } if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } jobModelMetaStore.close(); shutdownSuccessful = true; } catch (Throwable t) { LOG.error("Encountered errors during job coordinator stop.", t); if (coordinatorListener != null) { coordinatorListener.onCoordinatorFailure(t); } } finally { LOG.info("Job Coordinator shutdown finished with ShutdownComplete=" + shutdownSuccessful); } } else { LOG.info("Job Coordinator shutdown is in progress!"); } }

Target:
public void stop() { if (initiatedShutdown.compareAndSet(false, true)) { LOG.info("Shutting down JobCoordinator."); boolean shutdownSuccessful = false; metrics.isLeader.set(false); try { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } debounceTimer.stopScheduler(); if (leaderElector.amILeader()) { LOG.info("Resigning leadership for processorId: " + processorId); leaderElector.resignLeadership(); } LOG.info("Shutting down ZkUtils."); if (zkUtils != null) { zkUtils.close(); } LOG.debug("Shutting down system admins."); systemAdmins.stop(); if (streamPartitionCountMonitor != null) { streamPartitionCountMonitor.stop(); } if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } jobModelMetadataStore.close(); shutdownSuccessful = true; } catch (Throwable t) { LOG.error("Encountered errors during job coordinator stop.", t); if (coordinatorListener != null) { coordinatorListener.onCoordinatorFailure(t); } } finally { LOG.info("Job Coordinator shutdown finished with ShutdownComplete=" + shutdownSuccessful); } } else { LOG.info("Job Coordinator shutdown is in progress!"); } }
Source:
public double getCrossValidatedLoss(PredictiveModelBuilder<? extends PredictiveModel> predictiveModelBuilder, Iterable<? extends AbstractInstance> rawTrainingData) { initializeTrainingAndValidationSets(rawTrainingData); double runningLoss = 0; double runningWeightOfValidationSet = 0; while (true) { PredictiveModel predictiveModel = predictiveModelBuilder.buildPredictiveModel(trainingDataToAddToPredictiveModel); runningLoss += crossValLoss.getLoss(validationSet, predictiveModel) * weightOfValidationSet; runningWeightOfValidationSet += weightOfValidationSet; logger.info("running Loss: " + runningLoss / runningWeightOfValidationSet); updateCrossValidationAndTrainingSets(); if (validationSet.size() == 0) break; } final double averageLoss = runningLoss / runningWeightOfValidationSet; logger.info("Average loss: " + averageLoss + ", runningWeight: " + runningWeightOfValidationSet); return averageLoss; }

Target:
public double getCrossValidatedLoss(PredictiveModelBuilder<? extends PredictiveModel> predictiveModelBuilder, Iterable<? extends AbstractInstance> rawTrainingData) { initializeTrainingAndValidationSets(rawTrainingData); double runningLoss = 0; double runningWeightOfValidationSet = 0; while (!validationSet.isEmpty()) { PredictiveModel predictiveModel = predictiveModelBuilder.buildPredictiveModel(trainingDataToAddToPredictiveModel); runningLoss += crossValLoss.getLoss(validationSet, predictiveModel) * weightOfValidationSet; runningWeightOfValidationSet += weightOfValidationSet; logger.info("running Loss: " + runningLoss / runningWeightOfValidationSet + ", running weight: " + runningWeightOfValidationSet); updateTrainingSet(); updateCrossValidationSet(); } final double averageLoss = runningLoss / runningWeightOfValidationSet; logger.info("Average loss: " + averageLoss + ", runningWeight: " + runningWeightOfValidationSet); return averageLoss; }
Source:
public boolean checkQuotaValidationForAddEdit(Quota quota, List<String> messages) { if (quota == null) { messages.add(VdcBllMessages.QUOTA_IS_NOT_VALID.toString()); return false; } if (getQuotaDao().getQuotaByQuotaName(quota.getQuotaName(), quota.getStoragePoolId()) != null) { messages.add(VdcBllMessages.QUOTA_NAME_ALREADY_EXISTS.toString()); return false; } if (!validateQuotaStorageLimitation(quota, messages)) { return false; } if (!validateQuotaVdsGroupLimitation(quota, messages)) { return false; } return true; }

Target:
public boolean checkQuotaValidationForAddEdit(Quota quota, List<String> messages) { if (quota == null) { messages.add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); return false; } if (!validateQuotaStorageLimitation(quota, messages)) { return false; } if (!validateQuotaVdsGroupLimitation(quota, messages)) { return false; } return true; }
Source:
public void close() throws IOException { try { reassign(Collections.emptySet()); for (final EventConsumer.LowLevelConsumer consumer : eventConsumers.values()) { consumer.close(); } } catch (final InvalidCursorException e) { throw new IOException(e); } }

Target:
public void close() throws IOException { try { reassign(Collections.emptySet()); } catch (final InvalidCursorException e) { throw new IOException(e); } }
Source:
public void start() { threads = Lists.newLinkedList(); delay = command.getScenarioContext().getWorkloadConfiguration().getDelay(); log.debug("Going to execute command {}.", command); totalSamplesRequested = command.getScenarioContext().getWorkloadConfiguration().getSamples(); samplesLeft.set(totalSamplesRequested); for (int i = 0; i < command.getThreads(); i++) { addThread(); } log.debug("Threads are scheduled"); }

Target:
public void start() { threads = Lists.newLinkedList(); delay = command.getScenarioContext().getWorkloadConfiguration().getDelay(); log.debug("Going to execute command {}.", command); totalSamplesCountRequested = command.getScenarioContext().getWorkloadConfiguration().getSamples(); leftSamplesCount.set(totalSamplesCountRequested); for (int i = 0; i < command.getThreads(); i++) { addThread(); } log.debug("Threads are scheduled"); }
Source:
public DAnalysisSelector getAnalysisSelector() { return this.analysisSelector; }

Target:
public DAnalysisSelector getAnalysisSelector() { if (this.getServices() instanceof DAnalysisSessionService) { return ((DAnalysisSessionService) this.getServices()).getAnalysisSelector(); } return null; }
Source:
public void setUp() throws IOException { Path storageBasedir = Paths.get(ConfigurationResourceResolver.getVaultDirectory() + "/storages/storage0"); generateArtifact(storageBasedir.toAbsolutePath().toString() + "/org/carlspring/strongbox/strongbox-utils/8.2/strongbox-utils-8.2.jar"); }

Target:
public void setUp() throws IOException { Path storageBasedir = Paths.get(ConfigurationResourceResolver.getVaultDirectory(), "storages", "storage0", "org", "carlspring", "strongbox", "strongbox-utils", "8.2", "strongbox-utils-8.2.jar"); generateArtifact(storageBasedir.toAbsolutePath().toString()); }
Source:
private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { IBreakpoint newBreakpoint = null; Object[] children = container.getChildren(); for (Object element2 : refContainer.getChildren()) { Object element = getElement(children, element2); if (element == null) { if (element2 instanceof BreakpointContainer) { BreakpointContainer.addChildContainer(container, (BreakpointContainer) element2, containerDelta); } else if(element2 instanceof IBreakpoint) { BreakpointContainer.addBreakpoint(container, (IBreakpoint) element2, containerDelta); if (newBreakpoint == null) { newBreakpoint = (IBreakpoint) element2; } } } else if (element instanceof BreakpointContainer) { ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) element2); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) element2, childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); } } return newBreakpoint; }

Target:
private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { IBreakpoint newBreakpoint = null; Object[] children = container.getChildren(); for (Object childElement : refContainer.getChildren()) { Object element = getElement(children, childElement); if (element == null) { if (childElement instanceof BreakpointContainer) { BreakpointContainer.addChildContainer(container, (BreakpointContainer) childElement, containerDelta); } else if(childElement instanceof IBreakpoint) { BreakpointContainer.addBreakpoint(container, (IBreakpoint) childElement, containerDelta); if (newBreakpoint == null) { newBreakpoint = (IBreakpoint) childElement; } } } else if (element instanceof BreakpointContainer) { ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) childElement); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) childElement, childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); } } return newBreakpoint; }
Source:
private void augmentRenameableTextField(){ menuBarNameArea.getChildren().removeAll(nameBox, renameButton); this.getChildren().remove(menuBarCloseButton); menuBarNameArea.getChildren().addAll(renameableTextField); menuBarNameArea.setMinWidth(NAME_AREA_EDIT_WIDTH); menuBarNameArea.setMaxWidth(NAME_AREA_EDIT_WIDTH); Tooltip.install(menuBarConfirmButton, new Tooltip("Confirm")); Tooltip.install(menuBarUndoButton, new Tooltip("Undo")); this.getChildren().addAll(menuBarConfirmButton, menuBarUndoButton); }

Target:
private void augmentRenameableTextField(){ menuBarNameArea.getChildren().removeAll(nameBox, renameButton); this.getChildren().remove(menuBarCloseButton); menuBarNameArea.getChildren().addAll(renameableTextField); menuBarNameArea.setMinWidth(NAME_AREA_EDIT_WIDTH); menuBarNameArea.setMaxWidth(NAME_AREA_EDIT_WIDTH); Tooltip.install(menuBarConfirmButton, new Tooltip("Confirm this name change of the panel")); Tooltip undoTip = new Tooltip("Abandon this name change and go back to the previous name"); undoTip.setPrefWidth(TOOLTIP_WRAP_WIDTH); Tooltip.install(menuBarUndoButton, undoTip); this.getChildren().addAll(menuBarConfirmButton, menuBarUndoButton); }
Source:
public RealMatrix getTransitionProbabilityMatrix(final int distance) { final RealMatrix result = get(distance).getMatrix().copy(); result.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int to, final int from, final double logProbability) { return Math.exp(logProbability); } }); return result; }

Target:
protected RealMatrix getTransitionProbabilityMatrix(final int distance) { final RealMatrix result = get(distance).getMatrix().copy(); result.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int to, final int from, final double logProbability) { return Math.exp(logProbability); } }); return result; }
Source:
public void assetFileValidFile() throws IOException { Realm.deleteRealm(defaultConfig); Context context = InstrumentationRegistry.getInstrumentation().getContext(); RealmConfiguration configuration = new RealmConfiguration.Builder(context, "asset_file.realm") .build(); Realm.deleteRealm(configuration); realm = Realm.getInstance(configuration); File realmFile = new File(configuration.getPath()); assertTrue(realmFile.exists()); assertEquals(10, realm.where(Owner.class).count()); assertEquals(10, realm.where(Cat.class).count()); realm.close(); configFactory.copyRealmFromAssets(context, "asset_file.realm", "asset_file_copy.realm"); File copyFromAsset = new File(configFactory.getRoot(), "asset_file_copy.realm"); assertTrue(copyFromAsset.exists()); assertEquals(realmFile.length(), copyFromAsset.length()); Realm.deleteRealm(configuration); assertFalse(realmFile.exists()); }

Target:
public void assetFileValidFile() throws IOException { Context context = InstrumentationRegistry.getInstrumentation().getContext(); Realm.deleteRealm(new RealmConfiguration.Builder(context).build()); RealmConfiguration configuration = new RealmConfiguration.Builder(context).assetFile(context, "asset_file.realm") .build(); Realm.deleteRealm(configuration); File realmFile = new File(configuration.getPath()); assertFalse(realmFile.exists()); realm = Realm.getInstance(configuration); assertTrue(realmFile.exists()); assertEquals(10, realm.where(Owner.class).count()); assertEquals(10, realm.where(Cat.class).count()); realm.close(); configFactory.copyRealmFromAssets(context, "asset_file.realm", "asset_file_copy.realm"); File copyFromAsset = new File(configFactory.getRoot(), "asset_file_copy.realm"); assertTrue(copyFromAsset.exists()); Realm.deleteRealm(configuration); assertFalse(realmFile.exists()); }
Source:
public static ValidationResult setAndValidateCpuProfile(VmBase vmBase, Version version) { if (!FeatureSupported.cpuQoS(version)) return ValidationResult.VALID; if (vmBase.getCpuProfileId() == null) { List<CpuProfile> cpuProfiles = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId()); if (cpuProfiles.size() > 0) { vmBase.setCpuProfileId(cpuProfiles.get(0).getId()); return ValidationResult.VALID; } else { return new ValidationResult(EngineMessage.ACTION_TYPE_CPU_PROFILE_EMPTY); } } else { return new CpuProfileValidator(vmBase.getCpuProfileId()).isParentEntityValid(vmBase.getVdsGroupId()); } }

Target:
public static ValidationResult setAndValidateCpuProfile(VmBase vmBase, Version version) { if (!FeatureSupported.cpuQoS(version)) return ValidationResult.VALID; if (vmBase.getCpuProfileId() == null) { return assignFirstCpuProfile(vmBase); } else { return new CpuProfileValidator(vmBase.getCpuProfileId()).isParentEntityValid(vmBase.getVdsGroupId()); } }
Source:
private IPath getRepositoryPath() { Repository repo = null; if (repositoryMapping != null) repo = repositoryMapping.getRepository(); else if (input instanceof Repository) repo = (Repository) input; if (repo != null) new Path(repo.getWorkTree().getAbsolutePath()); return null; }

Target:
private IPath getRepositoryPath() { Repository repo = null; if (repositoryMapping != null) repo = repositoryMapping.getRepository(); else if (input instanceof Repository) repo = (Repository) input; if (repo != null) return new Path(repo.getWorkTree().getAbsolutePath()); return null; }
Source:
protected void configure() { bindI18n(); bind(JsonProvider.class); configureJPA(); bind(BeanValidationEventListener.class).toProvider(ValidationListenerProvider.class); bind(MessageInterpolator.class).to(CandlepinMessageInterpolator.class); bind(ComplianceSnapshotCurator.class); bind(ConsumerStateCurator.class); bind(ObjectMapper.class).toInstance(new GutterballObjectMapper()); configureEventHandlers(); bind(EventManager.class).asEagerSingleton(); configureEventReciever(); Multibinder<Report> reports = Multibinder.newSetBinder(binder(), Report.class); reports.addBinding().to(ConsumerStatusReport.class); reports.addBinding().to(ConsumerTrendReport.class); bind(ReportFactory.class); bind(StatusResource.class); bind(ReportsResource.class); bind(UnsupportedMediaTypeExceptionMapper.class); bind(UnauthorizedExceptionMapper.class); bind(NotFoundExceptionMapper.class); bind(NotAcceptableExceptionMapper.class); bind(NoLogWebApplicationExceptionMapper.class); bind(MethodNotAllowedExceptionMapper.class); bind(InternalServerErrorExceptionMapper.class); bind(DefaultOptionsMethodExceptionMapper.class); bind(BadRequestExceptionMapper.class); bind(RollbackExceptionMapper.class); bind(ValidationExceptionMapper.class); bind(WebApplicationExceptionMapper.class); bind(FailureExceptionMapper.class); bind(ReaderExceptionMapper.class); bind(WriterExceptionMapper.class); bind(CandlepinExceptionMapper.class); bind(RuntimeExceptionMapper.class); bind(JAXBUnmarshalExceptionMapper.class); bind(JAXBMarshalExceptionMapper.class); bind(OAuthInterceptor.class); }

Target:
protected void configure() { bindI18n(); bind(JsonProvider.class); configureJPA(); bind(BeanValidationEventListener.class).toProvider(ValidationListenerProvider.class); bind(MessageInterpolator.class).to(CandlepinMessageInterpolator.class); bind(ComplianceSnapshotCurator.class); bind(ConsumerStateCurator.class); bind(ObjectMapper.class).toInstance(new GutterballObjectMapper()); configureEventHandlers(); bind(EventManager.class).asEagerSingleton(); configureEventReciever(); Multibinder<Report> reports = Multibinder.newSetBinder(binder(), Report.class); reports.addBinding().to(ConsumerStatusReport.class); reports.addBinding().to(ConsumerTrendReport.class); bind(ReportFactory.class); bind(StatusResource.class); bind(ReportsResource.class); bind(UnsupportedMediaTypeExceptionMapper.class); bind(UnauthorizedExceptionMapper.class); bind(NotFoundExceptionMapper.class); bind(NotAcceptableExceptionMapper.class); bind(NoLogWebApplicationExceptionMapper.class); bind(MethodNotAllowedExceptionMapper.class); bind(InternalServerErrorExceptionMapper.class); bind(DefaultOptionsMethodExceptionMapper.class); bind(BadRequestExceptionMapper.class); bind(RollbackExceptionMapper.class); bind(ValidationExceptionMapper.class); bind(WebApplicationExceptionMapper.class); bind(FailureExceptionMapper.class); bind(ReaderExceptionMapper.class); bind(WriterExceptionMapper.class); bind(CandlepinExceptionMapper.class); bind(RuntimeExceptionMapper.class); bind(JAXBUnmarshalExceptionMapper.class); bind(JAXBMarshalExceptionMapper.class); this.configureOAuth(); }
Source:
public Job peek() throws IOException { final List<Job> jobs = this.peek(1); return (null != jobs) && (jobs.size() > 0) ? jobs.get(0) : null; }

Target:
public Job peek() throws IOException { final List<Job> jobs = this.peek(1); return (null != jobs) && (!jobs.isEmpty()) ? jobs.get(0) : null; }
Source:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; Change change = StoredValues.CHANGE.get(engine); Project.NameKey name = change.getProject(); if (!a1.unify(SymbolTerm.intern(name.get()), engine.trail)) { return engine.fail(); } return cont; }

Target:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; Change change = StoredValues.CHANGE.get(engine); Project.NameKey name = change.getProject(); if (!a1.unify(SymbolTerm.create(name.get()), engine.trail)) { return engine.fail(); } return cont; }
Source:
private static Map<String, Integer> calculateCRC32Partitions(File cacheDir) throws IgniteCheckedException { assert cacheDir.isDirectory() : cacheDir.getAbsolutePath(); Map<String, Integer> result = new HashMap<>(); try { try (DirectoryStream<Path> partFiles = newDirectoryStream(cacheDir.toPath(), p -> p.toFile().getName().startsWith(PART_FILE_PREFIX) && p.toFile().getName().endsWith(FILE_SUFFIX)) ) { for (Path path : partFiles) result.put(path.toFile().getName(), FastCrc.calcCrc(path.toFile())); } return result; } catch (IOException e) { throw new IgniteCheckedException(e); } }

Target:
private static Map<String, Integer> calculateCRC32Partitions(File cacheDir) { assert cacheDir.isDirectory() : cacheDir.getAbsolutePath(); Map<String, Integer> result = new HashMap<>(); try { try (DirectoryStream<Path> partFiles = newDirectoryStream(cacheDir.toPath(), p -> p.toFile().getName().startsWith(PART_FILE_PREFIX) && p.toFile().getName().endsWith(FILE_SUFFIX)) ) { for (Path path : partFiles) result.put(path.toFile().getName(), FastCrc.calcCrc(path.toFile())); } return result; } catch (IOException e) { throw new IgniteException(e); } }
Source:
public static <T> T getService(Class<T> clazz, String filter, long waitTimeMillis) { Bundle bundle = FrameworkUtil.getBundle(OsgiUtil.class); checkStarted(bundle); BundleContext context = bundle.getBundleContext(); Assert.assertNotNull(context); ServiceReference<T> reference = null; int totalWaitTime = 0; do { try { Collection<ServiceReference<T>> references = context.getServiceReferences(clazz, filter); if (references != null && !references.isEmpty()) { reference = references.iterator().next(); } } catch (Exception ex) { } finally { try { if (totalWaitTime < waitTimeMillis && reference == null) { Thread.sleep(100); totalWaitTime += 100; } } catch (InterruptedException ex1) { } } } while (totalWaitTime < waitTimeMillis && reference == null); Assert.assertNotNull(String.format("Unable to find service [%s]", clazz), reference); T service = context.getService(reference); System.err.println("service = "+service); Assert.assertNotNull(String.format("Unable to find service instance for [%s]", clazz), service); return service; }

Target:
public static <T> T getService(Class<T> clazz, String filter, long waitTimeMillis) { Bundle bundle = FrameworkUtil.getBundle(OsgiUtil.class); checkStarted(bundle); BundleContext context = bundle.getBundleContext(); Assert.assertNotNull(context); ServiceReference<T> reference = null; int totalWaitTime = 0; do { try { Collection<ServiceReference<T>> references = context.getServiceReferences(clazz, filter); if (references != null && !references.isEmpty()) { reference = references.iterator().next(); } } catch (Exception ex) { } finally { try { if (totalWaitTime < waitTimeMillis && reference == null) { Thread.sleep(100); totalWaitTime += 100; } } catch (InterruptedException ex1) { } } } while (totalWaitTime < waitTimeMillis && reference == null); Assert.assertNotNull(String.format("Unable to find service [%s]", clazz), reference); T service = context.getService(reference); Assert.assertNotNull(String.format("Unable to find service instance for [%s]", clazz), service); return service; }
Source:
public static void updateBurns() { VANILLA_BURNS.clear(); FurnaceTileEntity.getBurnTimes().entrySet().forEach(e -> VANILLA_BURNS.put(e.getKey().delegate, e.getValue())); }

Target:
public static synchronized void updateBurns() { VANILLA_BURNS.clear(); FurnaceTileEntity.getBurnTimes().entrySet().forEach(e -> VANILLA_BURNS.put(e.getKey().delegate, e.getValue())); }
Source:
public void testAddMenusWithExperimentalPerspective() { when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true); List<MenuItem> items = new ArrayList<>(); items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build(); when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString())) .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0])); presenter.addMenus(menus); verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString()); verify(presenter.canHideMenuItemByIdentifier, times(3)).put(any(), any()); verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(2)).show(); verify(presenter.canHideMenuItemByIdentifier.get(SECOND_PERSPECTIVE_ID), times(1)).hide(); verify(presenter.canHideMenuItemByIdentifier.get(THIRD_PERSPECTIVE_ID), times(2)).show(); }

Target:
public void testAddMenusWithExperimentalPerspective() { when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true); List<MenuItem> items = new ArrayList<>(); items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build(); when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString())) .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0])); presenter.addMenus(menus); verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString()); verify(presenter.canHideMenuItemByIdentifier, times(3)).put(any(), any()); verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(2)).show(); verify(presenter.canHideMenuItemByIdentifier.get(SECOND_PERSPECTIVE_ID)).hide(); verify(presenter.canHideMenuItemByIdentifier.get(THIRD_PERSPECTIVE_ID), times(2)).show(); }
Source:
public String shadow$getName() { return this.translation.get(); }

Target:
public String shadow$getName() { if (this.name == null) { this.name = shadow$getTranslation().get(); } return this.name; }
Source:
public ManualCondition newInstance(StaplerRequest req, JSONObject formData) throws FormException { ManualCondition instance = new ManualCondition(); instance.users = formData.getString("users"); instance.executeButtonLabel = instance.getExecuteButtonLabel(); instance.parameterDefinitions = Descriptor.newInstancesFromHeteroList(req, formData, "parameters", ParameterDefinition.all()); return instance; }

Target:
public ManualCondition newInstance(StaplerRequest req, JSONObject formData) throws FormException { ManualCondition instance = new ManualCondition(); instance.users = formData.getString("users"); instance.parameterDefinitions = Descriptor.newInstancesFromHeteroList(req, formData, "parameters", ParameterDefinition.all()); return instance; }
Source:
private static void assertCompositeEqualPredicate(CompositeEqualPredicate expected, Predicate actual) { assertTrue(actual instanceof CompositeEqualPredicate); CompositeEqualPredicate actualEqualPredicate = (CompositeEqualPredicate) actual; assertEquals(expected.indexName, actualEqualPredicate.indexName); assertEquals(expected.components, actualEqualPredicate.components); assertEquals(expected.value, actualEqualPredicate.value); }

Target:
private static void assertCompositeEqualPredicate(CompositeEqualPredicate expected, Predicate actual) { assertTrue(actual instanceof CompositeEqualPredicate); CompositeEqualPredicate actualEqualPredicate = (CompositeEqualPredicate) actual; assertEquals(expected.indexName, actualEqualPredicate.indexName); assertArrayEquals(expected.components, actualEqualPredicate.components); assertEquals(expected.value, actualEqualPredicate.value); }
Source:
private List<ConnectionType> getAllInputMainConnectors(NodeType nodeType) { List<ConnectionType> allInputConnectors = ComponentUtilities.getNodeInputConnections(nodeType); Iterator<ConnectionType> connectionIter = allInputConnectors.iterator(); while (connectionIter.hasNext()) { ConnectionType nextConnector = connectionIter.next(); if (!nextConnector.getConnectorName().equals("FLOW")) { connectionIter.remove(); } } return allInputConnectors; }

Target:
private List<ConnectionType> getAllInputMainConnectors(NodeType nodeType) { List<ConnectionType> allInputConnectors = ComponentUtilities.getNodeInputConnections(nodeType); Iterator<ConnectionType> connectionIter = allInputConnectors.iterator(); while (connectionIter.hasNext()) { ConnectionType nextConnector = connectionIter.next(); if (!"FLOW".equals(nextConnector.getConnectorName())) { connectionIter.remove(); } } return allInputConnectors; }
Source:
private void initOrgUnitFragment(OrgUnit orgUnit) { LinearLayout changeLayout = (LinearLayout) findViewById(R.id.dashboard_planning_init); changeLayout.setVisibility(View.GONE); changeLayout = (LinearLayout) findViewById(R.id.dashboard_planning_orgunit); changeLayout.setVisibility(View.VISIBLE); plannedOrgUnitsFragment = new PlannedPerOrgUnitFragment(); plannedOrgUnitsFragment.setArguments(getIntent().getExtras()); replaceListFragment(R.id.dashboard_planning_orgunit, plannedOrgUnitsFragment); plannedOrgUnitsFragment.reloadData(); }

Target:
private void initOrgUnitFragment(OrgUnit orgUnit) { findViewById(R.id.dashboard_planning_init).setVisibility(View.GONE); findViewById(R.id.dashboard_planning_orgunit).setVisibility(View.VISIBLE); plannedOrgUnitsFragment = new PlannedPerOrgUnitFragment(); plannedOrgUnitsFragment.setArguments(getIntent().getExtras()); replaceListFragment(R.id.dashboard_planning_orgunit, plannedOrgUnitsFragment); plannedOrgUnitsFragment.reloadData(); }
Source:
public void exportStats() throws Exception { List<Stat> stats = getStats(); if (mConfig.getProgressMonitorAsJson()) { System.out.println(JSONArray.toJSONString(stats)); } else { for (Stat stat : stats) { exportToTsdb(stat.getMetric(), stat.getTags(), stat.getValue()); } } }

Target:
public void exportStats() throws Exception { List<Stat> stats = getStats(); System.out.println(JSONArray.toJSONString(stats)); if (mConfig.getTsdbHostport() != null && !mConfig.getTsdbHostport().isEmpty()) { for (Stat stat : stats) { exportToTsdb(stat); } } }