auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static void validateReplicationOptions(Map<String, Object> replicationOptions) { if (replicationOptions != null && !replicationOptions.containsKey("class")) { throw new IllegalArgumentException("Replication Strategy 'class' should be provided"); } if (replicationOptions != null && !(replicationOptions.get("class") instanceof String)) { throw new IllegalArgumentException("Replication Strategy should be a type of String"); } }

Target:
static void validateReplicationOptions(Map<String, Object> replicationOptions) { if (replicationOptions != null && !replicationOptions.containsKey("class")) { throw new IllegalArgumentException("Replication Strategy 'class' should be provided"); } if (replicationOptions != null && !(replicationOptions.get("class") instanceof String)) { throw new IllegalArgumentException("Replication Strategy should be of type String"); } }
Source:
protected boolean isPreviewDataAvailable() { return showPreview; }

Target:
protected boolean isPreviewDataAvailable() { return true; }
Source:
public void testUpdatingOffHeap() { ResourcePools existing = mock(ResourcePools.class); ResourcePools toBeUpdated = mock(ResourcePools.class); Set<ResourceType> existingSet = new HashSet<ResourceType>(); Set<ResourceType> toBeUpdatedSet = new HashSet<ResourceType>(); existingSet.add(ResourceType.Core.HEAP); existingSet.add(ResourceType.Core.OFFHEAP); toBeUpdatedSet.add(ResourceType.Core.OFFHEAP); when(existing.getResourceTypeSet()).thenReturn(existingSet); when(toBeUpdated.getResourceTypeSet()).thenReturn(toBeUpdatedSet); ResourcePoolMerger merger = new ResourcePoolMerger(); try { merger.validateAndMerge(existing, toBeUpdated); } catch (Exception e) { assertThat(e instanceof UnsupportedOperationException, is(true)); } }

Target:
public void testUpdatingOffHeap() { ResourcePools existing = ResourcePoolsBuilder.newResourcePoolsBuilder().offheap(10L, MemoryUnit.MB).build(); ResourcePools toBeUpdated = ResourcePoolsBuilder.newResourcePoolsBuilder().offheap(50L, MemoryUnit.MB).build(); ResourcePoolMerger merger = new ResourcePoolMerger(); try { merger.validateAndMerge(existing, toBeUpdated); } catch (UnsupportedOperationException uoe) { assertThat(uoe.getMessage(), is("Updating OFFHEAP resource is not supported")); } }
Source:
private void handleBatch(ModelRun modelRun, DiseaseGroup diseaseGroup) { DateTime batchEndDate = modelRun.getBatchEndDate(); if (batchEndDate != null) { DateTime batchEndDateWithMaximumTime = getBatchEndDateWithMaximumTime(batchEndDate); List<Integer> occurrenceIDs = diseaseService.getDiseaseOccurrenceIDsForBatching(diseaseGroup.getId(), batchEndDateWithMaximumTime); LOGGER.info(String.format(VALIDATION_LOG_MESSAGE, modelRun.getId(), occurrenceIDs.size(), diseaseGroup.getId(), diseaseGroup.getName(), batchEndDateWithMaximumTime.toString("dd MMM yyyy"))); setValidationParametersForOccurrencesBatch(occurrenceIDs); diseaseOccurrenceHandlerHelper.setBatchingParameters(modelRun, occurrenceIDs.size()); LOGGER.info(String.format(VALIDATION_COMPLETED_LOG_MESSAGE, modelRun.getId())); } }

Target:
private void handleBatch(ModelRun modelRun, DiseaseGroup diseaseGroup) { DateTime batchEndDate = modelRun.getBatchEndDate(); if (batchEndDate != null) { DateTime batchEndDateWithMaximumTime = getBatchEndDateWithMaximumTime(batchEndDate); List<Integer> occurrenceIDs = diseaseService.getDiseaseOccurrenceIDsForBatching(diseaseGroup.getId(), batchEndDateWithMaximumTime); LOGGER.info(String.format(VALIDATION_LOG_MESSAGE, modelRun.getId(), occurrenceIDs.size(), diseaseGroup.getId(), diseaseGroup.getName(), batchEndDateWithMaximumTime.toString(LOG_DATE_FORMAT))); setValidationParametersForOccurrencesBatch(occurrenceIDs); diseaseOccurrenceHandlerHelper.setBatchingParameters(modelRun, occurrenceIDs.size()); LOGGER.info(String.format(VALIDATION_COMPLETED_LOG_MESSAGE, modelRun.getId())); } }
Source:
public void shutdown() { try { DefaultMonitorRegistry.getInstance().unregister(Monitors.newObjectMonitor(this)); } catch (Throwable t) { logger.error("Cannot shutdown monitor registry", t); } try { if (peerEurekaNodes != null) { for (PeerEurekaNode node : this.peerEurekaNodes.getPeerEurekaNodes()) { node.shutDown(); } } } catch (Throwable t) { logger.error("Cannot shutdown ReplicaAwareInstanceRegistry", t); } super.shutdown(); }

Target:
public void shutdown() { try { DefaultMonitorRegistry.getInstance().unregister(Monitors.newObjectMonitor(this)); } catch (Throwable t) { logger.error("Cannot shutdown monitor registry", t); } try { peerEurekaNodes.shutdown(); } catch (Throwable t) { logger.error("Cannot shutdown ReplicaAwareInstanceRegistry", t); } super.shutdown(); }
Source:
default <K, V> Map<K, V> toMap(Function<? super T, ? extends Map.Entry<? extends K, ? extends V>> f) { Objects.requireNonNull(f, "f is null"); return Map.<K, V> ofAll(toList().map(f::apply)); }

Target:
default <K, V> Map<K, V> toMap(Function<? super T, ? extends Map.Entry<? extends K, ? extends V>> f) { Objects.requireNonNull(f, "f is null"); return HashMap.<K, V> ofAll(toList().map(f::apply)); }
Source:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(getClass().getName()), Objects.hashCode(general), Objects.hashCode(backgroundSet), Objects.hashCode(fontSet), Objects.hashCode(dimensionsSet), Objects.hashCode(labels)); }

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(getClass()), Objects.hashCode(general), Objects.hashCode(backgroundSet), Objects.hashCode(fontSet), Objects.hashCode(dimensionsSet), Objects.hashCode(labels)); }
Source:
public void getVisitsByPatient_shouldReturnEmptyListGivenPatientWithNullPatientIdAndTrue() { Patient p = new Patient(); p.setPatientId(null); assertThat(visitService.getVisitsByPatient(p, true, true), is(empty())); }

Target:
public void getVisitsByPatient_shouldReturnEmptyListGivenPatientWithNullPatientIdAndTrue() { Patient p = new Patient(); p.setPatientId(null); assertThat(visitService.getVisitsByPatient(null, true, true), is(empty())); }
Source:
private Map<Address, List<LuceneWork>> partitionWorkByAddress(List<LuceneWork> works) { return works.stream().collect(Collectors.toMap(this::getLocation, Arrays::asList, (w1, w2) -> { w1.addAll(w2); return w1; })); }

Target:
private Map<Address, List<LuceneWork>> partitionWorkByAddress(List<LuceneWork> works) { return works.stream().collect(Collectors.toMap(this::getLocation, this::newList, (w1, w2) -> { w1.addAll(w2); return w1; })); }
Source:
public StructuredRecord transform(GenericRecord genericRecord) throws IOException { org.apache.avro.Schema genericRecordSchema = genericRecord.getSchema(); int hashCode = genericRecordSchema.hashCode(); co.cask.cdap.api.data.schema.Schema structuredSchema; if (schemaCache.containsKey(hashCode)) { structuredSchema = schemaCache.get(hashCode); } else { structuredSchema = co.cask.cdap.api.data.schema.Schema.parseJson(genericRecordSchema.toString()); schemaCache.put(hashCode, structuredSchema); } StructuredRecord.Builder builder = StructuredRecord.builder(structuredSchema); for (Schema.Field field : structuredSchema.getFields()) { String fieldName = field.getName(); builder.set(fieldName, convertField(genericRecord.get(fieldName), field.getSchema())); } return builder.build(); }

Target:
public StructuredRecord transform(GenericRecord genericRecord) throws IOException { org.apache.avro.Schema genericRecordSchema = genericRecord.getSchema(); int hashCode = genericRecordSchema.hashCode(); Schema structuredSchema; if (schemaCache.containsKey(hashCode)) { structuredSchema = schemaCache.get(hashCode); } else { structuredSchema = Schema.parseJson(genericRecordSchema.toString()); schemaCache.put(hashCode, structuredSchema); } StructuredRecord.Builder builder = StructuredRecord.builder(structuredSchema); for (Schema.Field field : structuredSchema.getFields()) { String fieldName = field.getName(); builder.set(fieldName, convertField(genericRecord.get(fieldName), field.getSchema())); } return builder.build(); }
Source:
private RulesObjectMapper() { this.mapper = new ObjectMapper(); SimpleFilterProvider filterProvider = new SimpleFilterProvider(); filterProvider.setFailOnUnknownId(false); filterProvider = filterProvider.addFilter("PoolAttributeFilter", SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "id")); filterProvider = filterProvider.addFilter("ProductPoolAttributeFilter", SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "productId", "id")); filterProvider = filterProvider.addFilter("ProvidedProductFilter", SimpleBeanPropertyFilter.serializeAllExcept("created", "updated")); filterProvider = filterProvider.addFilter("ConsumerFilter", SimpleBeanPropertyFilter.serializeAllExcept("idCert", "hypervisorId")); filterProvider = filterProvider.addFilter("EntitlementFilter", SimpleBeanPropertyFilter.serializeAllExcept("certificates", "consumer")); filterProvider = filterProvider.addFilter("OwnerFilter", SimpleBeanPropertyFilter.serializeAllExcept("parentOwner", "consumers", "activationKeys", "environments", "pools")); this.mapper.setFilters(filterProvider); this.mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); AnnotationIntrospector primary = new JacksonAnnotationIntrospector(); AnnotationIntrospector secondary = new JaxbAnnotationIntrospector( mapper.getTypeFactory()); AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary); this.mapper.setAnnotationIntrospector(pair); }

Target:
private RulesObjectMapper() { this.mapper = new ObjectMapper(); SimpleFilterProvider filterProvider = new SimpleFilterProvider(); filterProvider.setFailOnUnknownId(false); filterProvider = filterProvider.addFilter("PoolAttributeFilter", SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "id")); filterProvider = filterProvider.addFilter("ProductPoolAttributeFilter", SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "productId", "id")); filterProvider = filterProvider.addFilter("ProvidedProductFilter", SimpleBeanPropertyFilter.serializeAllExcept("created", "updated")); filterProvider = filterProvider.addFilter("ConsumerFilter", SimpleBeanPropertyFilter.serializeAllExcept("idCert")); filterProvider = filterProvider.addFilter("EntitlementFilter", SimpleBeanPropertyFilter.serializeAllExcept("certificates", "consumer")); filterProvider = filterProvider.addFilter("OwnerFilter", SimpleBeanPropertyFilter.serializeAllExcept("parentOwner", "consumers", "activationKeys", "environments", "pools")); this.mapper.setFilters(filterProvider); this.mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); AnnotationIntrospector primary = new JacksonAnnotationIntrospector(); AnnotationIntrospector secondary = new JaxbAnnotationIntrospector( mapper.getTypeFactory()); AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary); this.mapper.setAnnotationIntrospector(pair); }
Source:
public void with(String fieldName, Object value) { if (fieldName.startsWith("version")) { version = value instanceof Number ? ((Number) value).longValue() : Long.parseLong((String) value); } else if (fieldName.startsWith("apps")) { appsHashCode = (String) value; } }

Target:
public void with(String fieldName, Object value) { if (fieldName == null || value == null) { return; } if (fieldName.startsWith("version")) { try { version = value instanceof Number ? ((Number) value).longValue() : Long.parseLong((String) value); } catch (Exception e) { version = -1; logger.warn("Cannot parse version number {}; setting it to default == -1", value); } } else if (fieldName.startsWith("apps")) { if (value instanceof String) { appsHashCode = (String) value; } else { logger.warn("appsHashCode field is not a string, but {}", value.getClass()); } } }
Source:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Check logcat!"); setContentView(tv); printArgs("The", "Quick", "Brown", "Fox"); Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4)); Greeter greeter = new Greeter("Jake"); Log.d("Greeting", greeter.sayHello()); startSleepyThread(); synchronized (Boolean.TRUE){} }

Target:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Check logcat!"); setContentView(tv); printArgs("The", "Quick", "Brown", "Fox"); Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4)); Greeter greeter = new Greeter("Jake"); Log.d("Greeting", greeter.sayHello()); startSleepyThread(); }
Source:
public void stop() throws LifecycleException { stopContainer(); try { Files.delete(addonDir, true); } catch (IOException e) { throw new LifecycleException(e.getMessage()); } }

Target:
public void stop() throws LifecycleException { stopContainer(); try { Files.delete(addonDir, true); } catch (IOException e) { logger.fine(e.getMessage()); } }
Source:
private void logSessionData() { long sessionLengthSeconds = (sessionData.getLastTouchTime() - sessionData.getStartTime()) / DateUtils.SECOND_IN_MILLIS; log( "length", sessionLengthSeconds, "fromSearch", sessionData.getPagesFromSearch(), "fromRandom", sessionData.getPagesFromRandom(), "fromLanglink", sessionData.getPagesFromLangLink(), "fromInternal", sessionData.getPagesFromInternal(), "fromExternal", sessionData.getPagesFromExternal(), "fromHistory", sessionData.getPagesFromHistory(), "fromReadingList", sessionData.getPagesFromReadingList(), "fromDisambig", sessionData.getPagesFromDisambig(), "fromBack", sessionData.getPagesFromBack(), "noDescription", sessionData.getPagesWithNoDescription(), "fromSuggestedEdits", sessionData.getPagesFromSuggestedEdits(), "totalPages", sessionData.getTotalPages(), "leadLatency", sessionData.getLeadLatency(), "restLatency", sessionData.getRestLatency(), "languages", StringUtil.listToJsonArrayString(getApp().language().getAppLanguageCodes()), "apiMode", RbSwitch.INSTANCE.isRestBaseEnabled() ? 1 : 0 ); }

Target:
private void logSessionData() { long sessionLengthSeconds = (sessionData.getLastTouchTime() - sessionData.getStartTime()) / DateUtils.SECOND_IN_MILLIS; log( "length", sessionLengthSeconds, "fromSearch", sessionData.getPagesFromSearch(), "fromRandom", sessionData.getPagesFromRandom(), "fromLanglink", sessionData.getPagesFromLangLink(), "fromInternal", sessionData.getPagesFromInternal(), "fromExternal", sessionData.getPagesFromExternal(), "fromHistory", sessionData.getPagesFromHistory(), "fromReadingList", sessionData.getPagesFromReadingList(), "fromNearby", 0, "fromDisambig", sessionData.getPagesFromDisambig(), "fromBack", sessionData.getPagesFromBack(), "noDescription", sessionData.getPagesWithNoDescription(), "fromSuggestedEdits", sessionData.getPagesFromSuggestedEdits(), "totalPages", sessionData.getTotalPages(), "leadLatency", sessionData.getLeadLatency(), "restLatency", sessionData.getRestLatency(), "languages", StringUtil.listToJsonArrayString(getApp().language().getAppLanguageCodes()), "apiMode", RbSwitch.INSTANCE.isRestBaseEnabled() ? 1 : 0 ); }
Source:
public static ZoneOffset getDefault() { final TimeZone timeZone = TimeZone.getDefault(); final int seconds = timeZone .getRawOffset() / (int) MILLIS_PER_SECOND; return ZoneOffset.newBuilder() .setAmountSeconds(seconds) .setId(nullToEmpty(timeZone.getID())) .build(); }

Target:
public static ZoneOffset getDefault() { final TimeZone timeZone = TimeZone.getDefault(); return toZoneOffset(timeZone); }
Source:
public static Image map(RepoImage entity, Image template) { Image model = template != null ? template : new Image(); model.setId(entity.getRepoImageId()); model.setName(entity.getRepoImageName()); if (entity.getSize() != null) { model.setSize(entity.getSize().intValue()); } if (entity.getFileType() != null) { model.setFileType(map(entity.getFileType(), null)); } return model; }

Target:
public static Image map(RepoImage entity, Image template) { Image model = template != null ? template : new Image(); model.setId(entity.getRepoImageId()); model.setName(entity.getRepoImageName()); if (entity.isSetSize()) { model.setSize(entity.getSize().intValue()); } if (entity.isSetFileType()) { model.setFileType(map(entity.getFileType(), null)); } return model; }
Source:
private void createTaskStores(ContainerModel containerModel, JobContext jobContext, ContainerContext containerContext, Map<String, StorageEngineFactory<Object, Object>> storageEngineFactories, Map<String, SystemStream> changelogSystemStreams, Map<String, Serde<Object>> serdes, Map<TaskName, TaskInstanceMetrics> taskInstanceMetrics, Map<TaskName, TaskInstanceCollector> taskInstanceCollectors, StorageEngineFactory.StoreMode storeMode) { for (Map.Entry<TaskName, TaskModel> task : containerModel.getTasks().entrySet()) { TaskName taskName = task.getKey(); TaskModel taskModel = task.getValue(); for (String storeName : storageEngineFactories.keySet()) { if (this.taskStores.get(taskName) == null) { this.taskStores.put(taskName, new HashMap<>()); } if (this.taskStores.get(taskName).containsKey(storeName) && this.taskStores.get(taskName) .get(storeName) .getStoreProperties() .isPersistedToDisk()) { StorageEngine storageEngine = createStore(storeName, taskName, taskModel, jobContext, containerContext, storageEngineFactories, changelogSystemStreams, serdes, taskInstanceMetrics, taskInstanceCollectors, storeMode); this.taskStores.get(taskName).put(storeName, storageEngine); LOG.info("Re-created store for task because it a persistent store", storeName, taskName); } else if (!this.taskStores.get(taskName).containsKey(storeName)) { StorageEngine storageEngine = createStore(storeName, taskName, taskModel, jobContext, containerContext, storageEngineFactories, changelogSystemStreams, serdes, taskInstanceMetrics, taskInstanceCollectors, storeMode); this.taskStores.get(taskName).put(storeName, storageEngine); LOG.info("Created store for task {}", storeName, taskName); } else { LOG.info("Not re-creating store for task because it a non-persistent store", storeName, taskName); } } } }

Target:
private Map<TaskName, Map<String, StorageEngine>> createTaskStores(ContainerModel containerModel, JobContext jobContext, ContainerContext containerContext, Map<String, StorageEngineFactory<Object, Object>> storageEngineFactories, Map<String, SystemStream> changelogSystemStreams, Map<String, Serde<Object>> serdes, Map<TaskName, TaskInstanceMetrics> taskInstanceMetrics, Map<TaskName, TaskInstanceCollector> taskInstanceCollectors, StorageEngineFactory.StoreMode storeMode) { Map<TaskName, Map<String, StorageEngine>> taskStores = new HashMap<>(); for (Map.Entry<TaskName, TaskModel> task : containerModel.getTasks().entrySet()) { TaskName taskName = task.getKey(); TaskModel taskModel = task.getValue(); if (!taskStores.containsKey(taskName)) { taskStores.put(taskName, new HashMap<>()); } for (String storeName : storageEngineFactories.keySet()) { StorageEngine storageEngine = createStore(storeName, taskName, taskModel, jobContext, containerContext, storageEngineFactories, changelogSystemStreams, serdes, taskInstanceMetrics, taskInstanceCollectors, storeMode); taskStores.get(taskName).put(storeName, storageEngine); LOG.info("Created store for task {}", storeName, taskName); } } return taskStores; }
Source:
public void setReferenceMD5(final byte[] ref) { validateAlignmentSpanForReference(ref); if (! alignmentContext.getReferenceContext().isMappedSingleRef() && alignmentContext.getAlignmentStart() < 1) { referenceMD5 = new byte[MD5_BYTE_SIZE]; Arrays.fill(referenceMD5, (byte) 0); } else { final int span = Math.min(alignmentContext.getAlignmentSpan(), ref.length - alignmentContext.getAlignmentStart() + 1); if (alignmentContext.getAlignmentStart() + span > ref.length + 1) { throw new CRAMException("Invalid alignment boundaries."); } referenceMD5 = SequenceUtil.calculateMD5(ref, alignmentContext.getAlignmentStart() - 1, span); } }

Target:
public void setReferenceMD5(final byte[] ref) { validateAlignmentSpanForReference(ref); if (! alignmentContext.getReferenceContext().isMappedSingleRef() && alignmentContext.getAlignmentStart() < 1) { referenceMD5 = new byte[MD5_BYTE_SIZE]; } else { final int span = Math.min(alignmentContext.getAlignmentSpan(), ref.length - alignmentContext.getAlignmentStart() + 1); if (alignmentContext.getAlignmentStart() + span > ref.length + 1) { throw new CRAMException("Invalid alignment boundaries."); } referenceMD5 = SequenceUtil.calculateMD5(ref, alignmentContext.getAlignmentStart() - 1, span); } }
Source:
public void testPropagateAccountOptionsSpecified() throws IOException { Configuration conf = new Configuration(false); conf.set("fs.adl.account.dummy.oauth2.client.id", "dummyClientId"); conf.set("fs.adl.account.dummy.oauth2.credential", "dummyCredential"); conf.set("some.other.config", "someValue"); Configuration propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "dummy"); Assert.assertEquals("dummyClientId", propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); Assert.assertEquals("dummyCredential", propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); Assert.assertEquals("someValue", propagatedConf.get("some.other.config")); propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "anotherDummy"); Assert.assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); Assert.assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); Assert.assertEquals("someValue", propagatedConf.get("some.other.config")); }

Target:
public void testPropagateAccountOptionsSpecified() { Configuration conf = new Configuration(false); conf.set("fs.adl.account.dummy.oauth2.client.id", "dummyClientId"); conf.set("fs.adl.account.dummy.oauth2.credential", "dummyCredential"); conf.set("some.other.config", "someValue"); Configuration propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "dummy"); assertEquals("dummyClientId", propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); assertEquals("dummyCredential", propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); assertEquals("someValue", propagatedConf.get("some.other.config")); propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "anotherDummy"); assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); assertEquals("someValue", propagatedConf.get("some.other.config")); }
Source:
public StructuredFlowEvent createStucturedFlowEvent(Long stackId, FlowDetails flowDetails, Boolean detailed, Exception exception) { Stack stack = stackService.getByIdWithTransaction(stackId); String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : "sdx"; OperationDetails operationDetails = new OperationDetails(clock.getCurrentTimeMillis(), FLOW, resourceType, stackId, stack.getName(), nodeConfig.getId(), cbVersion, stack.getWorkspace().getId(), stack.getCreator().getUserId(), stack.getCreator().getUserName(), stack.getTenant().getName(), stack.getResourceCrn(), stack.getCreator().getUserCrn(), stack.getEnvironmentCrn(), null); StackDetails stackDetails = null; ClusterDetails clusterDetails = null; BlueprintDetails blueprintDetails = null; if (detailed) { stackDetails = conversionService.convert(stack, StackDetails.class); Cluster cluster = stack.getCluster(); if (cluster != null) { clusterDetails = clusterToClusterDetailsConverter.convert(cluster); blueprintDetails = conversionService.convert(cluster.getBlueprint(), BlueprintDetails.class); } } StructuredFlowEvent event = new StructuredFlowEvent(operationDetails, flowDetails, stackDetails, clusterDetails, blueprintDetails); if (exception != null) { event.setException(ExceptionUtils.getStackTrace(exception)); } return event; }

Target:
public StructuredFlowEvent createStucturedFlowEvent(Long stackId, FlowDetails flowDetails, Boolean detailed, Exception exception) { Stack stack = stackService.getByIdWithTransaction(stackId); String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : CloudbreakEventService.DATALAKE_RESOURCE_TYPE; OperationDetails operationDetails = new OperationDetails(clock.getCurrentTimeMillis(), FLOW, resourceType, stackId, stack.getName(), nodeConfig.getId(), cbVersion, stack.getWorkspace().getId(), stack.getCreator().getUserId(), stack.getCreator().getUserName(), stack.getTenant().getName(), stack.getResourceCrn(), stack.getCreator().getUserCrn(), stack.getEnvironmentCrn(), null); StackDetails stackDetails = null; ClusterDetails clusterDetails = null; BlueprintDetails blueprintDetails = null; if (detailed) { stackDetails = conversionService.convert(stack, StackDetails.class); Cluster cluster = stack.getCluster(); if (cluster != null) { clusterDetails = clusterToClusterDetailsConverter.convert(cluster); blueprintDetails = conversionService.convert(cluster.getBlueprint(), BlueprintDetails.class); } } StructuredFlowEvent event = new StructuredFlowEvent(operationDetails, flowDetails, stackDetails, clusterDetails, blueprintDetails); if (exception != null) { event.setException(ExceptionUtils.getStackTrace(exception)); } return event; }
Source:
private void startup() { executor = Executors.newSingleThreadExecutor(); consumer = new InstallationMetricsKafkaConsumer(metricsService); executor.execute(consumer); logger.debug("Consumer started.", InstallationMetricsKafkaConsumer.class); }

Target:
private void startup() { consumer = new InstallationMetricsKafkaConsumer(metricsService); executor.execute(consumer); logger.debug("Consumer started.", InstallationMetricsKafkaConsumer.class); }
Source:
protected void runVm() { setActionReturnValue(VMStatus.Down); if (getVdsToRunOn()) { VMStatus status = null; try { incrementVdsPendingVmsCount(); attachCd(); if (connectLunDisks(getVdsId())) { status = createVm(); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } } catch(VdcBLLException e) { VdcBllErrors errorCode = e.getErrorCode(); switch (errorCode) { case Done: case exist: case PROTOCOL_ERROR: throw e; default: } } finally { freeLock(); decrementVdsPendingVmsCount(); } setActionReturnValue(status); if (status.isRunning() || status == VMStatus.RestoringState) { setSucceeded(true); } else { log.infoFormat("Failed to run desktop {0}, rerun", getVm().getVmName()); setCommandShouldBeLogged(false); setSucceeded(true); rerun(); } } else { failedToRunVm(); setSucceeded(false); _isRerun = false; } }

Target:
protected void runVm() { setActionReturnValue(VMStatus.Down); if (getVdsToRunOn()) { VMStatus status = null; try { incrementVdsPendingVmsCount(); attachCd(); if (connectLunDisks(getVdsId())) { status = createVm(); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } } catch(VdcBLLException e) { VdcBllErrors errorCode = e.getErrorCode(); switch (errorCode) { case Done: case exist: case PROTOCOL_ERROR: throw e; default: } } finally { freeLock(); decrementVdsPendingVmsCount(); } setActionReturnValue(status); if (status != null && (status.isRunning() || status == VMStatus.RestoringState)) { setSucceeded(true); } else { log.infoFormat("Failed to run desktop {0}, rerun", getVm().getVmName()); setCommandShouldBeLogged(false); setSucceeded(true); rerun(); } } else { failedToRunVm(); setSucceeded(false); _isRerun = false; } }
Source:
public List<Relationship> getRelationshipsOfContentlet(String contentletInode, boolean hasParent) throws DotDataException, DotSecurityException { Contentlet cont = conAPI.find(contentletInode, user, true); if(hasParent){ return FactoryLocator.getRelationshipFactory().byParent(cont.getContentType()); } else{ return FactoryLocator.getRelationshipFactory().byChild(cont.getContentType()); } }

Target:
public List<Relationship> getRelationshipsOfContentlet(String contentletInode, boolean hasParent) throws DotDataException, DotSecurityException { Contentlet cont = conAPI.find(contentletInode, user, true); return (hasParent)? FactoryLocator.getRelationshipFactory().byParent(cont.getContentType()): FactoryLocator.getRelationshipFactory().byChild(cont.getContentType()); }
Source:
public Optional<CommandData> fill(DataContainer container, CommandData commandData) { if (container.contains(Keys.LAST_COMMAND_OUTPUT.getQuery()) || container.contains(Keys.SUCCESS_COUNT.getQuery()) || container.contains(Keys.COMMAND.getQuery()) || container.contains(Keys.TRACKS_OUTPUT.getQuery())) { return Optional.empty(); } @SuppressWarnings("unchecked") Optional<Text> lastCommandOutput = (Optional<Text>) container.get(Keys.LAST_COMMAND_OUTPUT.getQuery()).get(); int successCount = container.getInt(Keys.SUCCESS_COUNT.getQuery()).get(); String command = container.getString(Keys.COMMAND.getQuery()).get(); boolean tracksOutput = container.getBoolean(Keys.TRACKS_OUTPUT.getQuery()).get(); commandData.set(Keys.LAST_COMMAND_OUTPUT, lastCommandOutput); commandData.set(Keys.SUCCESS_COUNT, successCount); commandData.set(Keys.COMMAND, command); commandData.set(Keys.TRACKS_OUTPUT, tracksOutput); return Optional.of(commandData); }

Target:
public Optional<CommandData> fill(DataContainer container, CommandData commandData) { if (!container.contains( Keys.LAST_COMMAND_OUTPUT.getQuery(), Keys.SUCCESS_COUNT.getQuery(), Keys.COMMAND.getQuery(), Keys.TRACKS_OUTPUT.getQuery())) { return Optional.empty(); } @SuppressWarnings("unchecked") Optional<Text> lastCommandOutput = (Optional<Text>) container.get(Keys.LAST_COMMAND_OUTPUT.getQuery()).get(); int successCount = container.getInt(Keys.SUCCESS_COUNT.getQuery()).get(); String command = container.getString(Keys.COMMAND.getQuery()).get(); boolean tracksOutput = container.getBoolean(Keys.TRACKS_OUTPUT.getQuery()).get(); commandData.set(Keys.LAST_COMMAND_OUTPUT, lastCommandOutput); commandData.set(Keys.SUCCESS_COUNT, successCount); commandData.set(Keys.COMMAND, command); commandData.set(Keys.TRACKS_OUTPUT, tracksOutput); return Optional.of(commandData); }
Source:
public void computeAggStats_noData() { final DateTime dateLocal = DateTime.now(); final List<DeviceData> deviceDataList = Lists.newArrayList(); final List<TrackerMotion> trackerMotionList = Lists.newArrayList(); final AggStats aggStats = AggStatsComputer.computeAggStats(FAKE_ACCOUNT_ID, FAKE_DEVICE_ID_EXT, dateLocal, deviceDataList, trackerMotionList, Optional.<Device.Color>absent(), Optional.< Calibration>absent()); assertThat(aggStats.accountId, is(FAKE_ACCOUNT_ID)); System.out.println(aggStats.accountId); System.out.println(aggStats.externalDeviceId); System.out.println(aggStats.avgDailyTemp); }

Target:
public void computeAggStats_noData() { final DateTime dateLocal = DateTime.now(); final ImmutableList<DeviceData> deviceDataList = ImmutableList.copyOf(Lists.<DeviceData>newArrayList()); final ImmutableList<TrackerMotion> trackerMotionList = ImmutableList.copyOf(Lists.<TrackerMotion>newArrayList()); final AggStatsInputs aggStatsInputs = AggStatsInputs.create(Optional.<Device.Color>absent(), Optional.<Calibration>absent(), new Response(deviceDataList, Response.Status.SUCCESS, Optional.<Exception>absent()), trackerMotionList); final AggStats aggStats = AggStatsComputer.computeAggStats(FAKE_ACCOUNT_ID, FAKE_DEVICE_ID_EXT, dateLocal, aggStatsInputs); assertThat(aggStats.accountId, is(FAKE_ACCOUNT_ID)); }
Source:
public JLoadScenario getJaggerScenario() { JTestDefinition sleep_service_5ms_simple_http_query = JTestDefinition .builder(Id.of("sleep-service-5ms-simple-http-query-provider"), getEndpoints()) .withComment("sleep-service-5ms-simple-http-query-provider") .withQueryProvider(getQueries()) .withValidators(Collections.singletonList(NotNullResponseValidator.class)) .build(); JLoadProfile load = JLoadProfileRps.builder(RequestsPerSecond.of(100)) .withMaxLoadThreads(10) .withWarmUpTimeInSeconds(1) .build(); JTerminationCriteria termination = new JTerminationCriteriaIterations(IterationsNumber.of(1000), MaxDurationInSeconds.of(60)); JLoadTest test1 = JLoadTest.builder(Id.of("sleep-service-5ms-simple-http-query-provider"), sleep_service_5ms_simple_http_query, load, termination).build(); JParallelTestsGroup testGroup = JParallelTestsGroup.builder(Id.of("sleep-service-5ms-http-query-provider"), test1) .build(); return JLoadScenario.builder(Id.of("ciJaggerTestSuite"), testGroup).build(); }

Target:
public JLoadScenario getJaggerScenario() { JTestDefinition smokeTestDefinition = JTestDefinition .builder(Id.of("smoke-test-definition"), getEndpoints()) .withComment("smoke test") .withQueryProvider(getQueries()) .withValidators(Collections.singletonList(NotNullResponseValidator.class)) .build(); JLoadProfile load = JLoadProfileRps.builder(RequestsPerSecond.of(100)) .withMaxLoadThreads(10) .withWarmUpTimeInSeconds(1) .build(); JTerminationCriteria termination = new JTerminationCriteriaIterations(IterationsNumber.of(1000), MaxDurationInSeconds.of(60)); JLoadTest test1 = JLoadTest.builder(Id.of("smoke-test"), smokeTestDefinition, load, termination).build(); JParallelTestsGroup testGroup = JParallelTestsGroup.builder(Id.of("smoke-test-group"), test1) .build(); return JLoadScenario.builder(Id.of("JaggerSmokeTest"), testGroup).build(); }
Source:
public Integer getReferenceIndex() { if (null == mReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mReferenceName)) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mReferenceIndex = mHeader.getSequenceIndex(mReferenceName); } else { throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the reference index"); } } return mReferenceIndex; }

Target:
public Integer getReferenceIndex() { if (null == mReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mReferenceName)) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mReferenceIndex = mHeader.getSequenceIndex(mReferenceName); } else { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the reference index"); } } return mReferenceIndex; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } final View view = inflater.inflate(R.layout.fragment_course_outline, container, false); listView = (ListView) view.findViewById(R.id.outline_list); swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); errorNotification = new FullScreenErrorNotification(swipeContainer); loadingIndicator = view.findViewById(R.id.loading_indicator); flBulkDownload = view.findViewById(R.id.fl_bulk_download_container); courseDateViewModel = new ViewModelProvider(this, new ViewModelFactory()).get(CourseDateViewModel.class); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadingIndicator.setVisibility(View.GONE); errorNotification.hideError(); canFetchBannerInfo = true; getCourseComponentFromServer(false); } }); UiUtil.setSwipeRefreshLayoutColors(swipeContainer); restore(bundle); initListView(view); initObserver(); fetchCourseComponent(); trackAATestCourseOutline(); getCourseUpgradeFirebaseConfig(); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } final View view = inflater.inflate(R.layout.fragment_course_outline, container, false); listView = (ListView) view.findViewById(R.id.outline_list); swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); errorNotification = new FullScreenErrorNotification(swipeContainer); loadingIndicator = view.findViewById(R.id.loading_indicator); flBulkDownload = view.findViewById(R.id.fl_bulk_download_container); courseDateViewModel = new ViewModelProvider(this, new ViewModelFactory()).get(CourseDateViewModel.class); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadingIndicator.setVisibility(View.GONE); errorNotification.hideError(); getCourseComponentFromServer(false); } }); UiUtil.setSwipeRefreshLayoutColors(swipeContainer); restore(bundle); initListView(view); initObserver(); fetchCourseComponent(); trackAATestCourseOutline(); getCourseUpgradeFirebaseConfig(); return view; }
Source:
private AMethodWithItsArgs findBestMethodForVarargs(Set<Method> methods, JsonNode paramsNode) { for (Method method : methods) { if(method.getParameterTypes().length!=1) { continue; } if(method.isVarArgs()) { AMethodWithItsArgs matchedMethod = new AMethodWithItsArgs(method); if (paramsNode.isArray()) { ArrayNode arrayNode = ArrayNode.class.cast(paramsNode); for (int i = 0; i < paramsNode.size(); i++) { matchedMethod.arguments.add(arrayNode.get(i)); } } if (paramsNode.isObject()) { ObjectNode objectNode = ObjectNode.class.cast(paramsNode); Iterator<Map.Entry<String, JsonNode>> items = objectNode.fields(); while (items.hasNext()) { Map.Entry<String, JsonNode> item = items.next(); JsonNode name = JsonNodeFactory.instance.objectNode().put(item.getKey(),item.getKey()); matchedMethod.arguments.add(name.get(item.getKey())); matchedMethod.arguments.add(item.getValue()); } } return matchedMethod; } } return null; }

Target:
private AMethodWithItsArgs findBestMethodForVarargs(Set<Method> methods, JsonNode paramsNode) { for (Method method : methods) { if (method.getParameterTypes().length != 1) { continue; } if (method.isVarArgs()) { AMethodWithItsArgs matchedMethod = new AMethodWithItsArgs(method); if (paramsNode.isArray()) { ArrayNode arrayNode = ArrayNode.class.cast(paramsNode); for (int i = 0; i < paramsNode.size(); i++) { matchedMethod.addArgument(arrayNode.get(i)); } } if (paramsNode.isObject()) { ObjectNode objectNode = ObjectNode.class.cast(paramsNode); Iterator<Map.Entry<String,JsonNode>> items = objectNode.fields(); while (items.hasNext()) { Map.Entry<String,JsonNode> item = items.next(); JsonNode name = JsonNodeFactory.instance.objectNode().put(item.getKey(),item.getKey()); matchedMethod.addArgument(name.get(item.getKey())); matchedMethod.addArgument(item.getValue()); } } return matchedMethod; } } return null; }
Source:
public Response getServer(@PathParam("id") String queryId) { log.info("Get cancel query for queryId[%s]", queryId); queryManager.cancelQuery(queryId); return Response.status(Response.Status.ACCEPTED).build(); }

Target:
public Response getServer(@PathParam("id") String queryId) { if (log.isDebugEnabled()) { log.debug("Received cancel request for query [%s]", queryId); } queryManager.cancelQuery(queryId); return Response.status(Response.Status.ACCEPTED).build(); }
Source:
public String getUsage(ICommandSender commandSender) { return new TextComponentTranslation("commands.bloodmagic.network.usage").getFormattedText(); }

Target:
public String getUsage(ICommandSender commandSender) { return "commands.bloodmagic.network.usage"; }
Source:
public InputFormat<RowData, ?> getInputFormat() { if (!partitionKeys.isEmpty() && getOrFetchPartitions().isEmpty()) { return new CollectionInputFormat<>(new ArrayList<>(), null); } return createFormatFactory(formatProperties).createReader( new FileSystemFormatFactory.ReaderContext() { @Override public TableSchema getSchema() { return schema; } @Override public TypeInformation<?> createTypeInformation(DataType dataType) { DataType internalDataType = DataTypeUtils.transform( dataType, InternalConversionClassTransformation.INTERNAL_CLASS_TRANSFORM); return fromDataTypeToTypeInfo(internalDataType); } @Override public Map<String, String> getFormatProperties() { return formatProperties; } @Override public List<String> getPartitionKeys() { return partitionKeys; } @Override public String getDefaultPartName() { return defaultPartName; } @Override public Path[] getPaths() { if (partitionKeys.isEmpty()) { return new Path[] {path}; } else { return getOrFetchPartitions().stream() .map(FileSystemTableSource.this::toFullLinkedPartSpec) .map(PartitionPathUtils::generatePartitionPath) .map(n -> new Path(path, n)) .toArray(Path[]::new); } } @Override public int[] getProjectFields() { return readFields(); } @Override public long getPushedDownLimit() { return limit == null ? Long.MAX_VALUE : limit; } @Override public List<Expression> getPushedDownFilters() { return filters == null ? Collections.emptyList() : filters; } }); }

Target:
public InputFormat<RowData, ?> getInputFormat() { if (!partitionKeys.isEmpty() && getOrFetchPartitions().isEmpty()) { return new CollectionInputFormat<>(new ArrayList<>(), null); } return createFormatFactory(formatProperties).createReader( new FileSystemFormatFactory.ReaderContext() { @Override public TableSchema getSchema() { return schema; } @Override public Map<String, String> getFormatProperties() { return formatProperties; } @Override public List<String> getPartitionKeys() { return partitionKeys; } @Override public String getDefaultPartName() { return defaultPartName; } @Override public Path[] getPaths() { if (partitionKeys.isEmpty()) { return new Path[] {path}; } else { return getOrFetchPartitions().stream() .map(FileSystemTableSource.this::toFullLinkedPartSpec) .map(PartitionPathUtils::generatePartitionPath) .map(n -> new Path(path, n)) .toArray(Path[]::new); } } @Override public int[] getProjectFields() { return readFields(); } @Override public long getPushedDownLimit() { return limit == null ? Long.MAX_VALUE : limit; } @Override public List<Expression> getPushedDownFilters() { return filters == null ? Collections.emptyList() : filters; } }); }
Source:
public void processStanza(Stanza packet) { try { if(packetLogging.isLoggingEnabled( PacketLoggingService.ProtocolName.JABBER) && packet != null && getSocket() != null) { Socket socket = getSocket(); if(remoteAddress == null) { if (socket != null) { remoteAddress = socket.getInetAddress().getAddress(); localAddress = socket.getLocalAddress().getAddress(); } } int localPort = 0; int remotePort = 5222; if (socket != null) { localPort = socket.getLocalPort(); remotePort = connection.getPort(); } byte[] packetBytes; if(packet instanceof Message) { packetBytes = cloneAnonyMessage(packet) .toXML().toString().getBytes("UTF-8"); } else { packetBytes = packet.toXML().toString().getBytes("UTF-8"); } packetLogging.logPacket( PacketLoggingService.ProtocolName.JABBER, localAddress != null ? localAddress : new byte[4], localPort, remoteAddress != null ? remoteAddress: new byte[4], remotePort, PacketLoggingService.TransportName.TCP, true, packetBytes ); } } catch(Throwable t) { t.printStackTrace(); } }

Target:
public void processStanza(Stanza packet) { try { if(packetLogging.isLoggingEnabled( PacketLoggingService.ProtocolName.JABBER) && packet != null && getSocket() != null) { Socket socket = getSocket(); if(remoteAddress == null) { if (socket != null) { remoteAddress = socket.getInetAddress().getAddress(); localAddress = socket.getLocalAddress().getAddress(); } else { remoteAddress = new byte[4]; localAddress = new byte[4]; } } int localPort = 0; int remotePort = 5222; if (socket != null) { localPort = socket.getLocalPort(); remotePort = connection.getPort(); } byte[] packetBytes; if(packet instanceof Message) { packetBytes = cloneAnonyMessage(packet) .toXML().toString().getBytes("UTF-8"); } else { packetBytes = packet.toXML().toString().getBytes("UTF-8"); } packetLogging.logPacket( PacketLoggingService.ProtocolName.JABBER, localAddress, localPort, remoteAddress, remotePort, PacketLoggingService.TransportName.TCP, true, packetBytes ); } } catch(Throwable t) { t.printStackTrace(); } }
Source:
public void testReloadBrooklynPropertiesDeploy() { brooklynMgmt.reloadBrooklynProperties(); CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertNotNull(reloadedPlatform); Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-entity-basic-template.yaml")); AssemblyTemplate template = reloadedPlatform.pdp().registerDeploymentPlan(input); try { Assembly assembly = template.getInstantiator().newInstance().instantiate(template, reloadedPlatform); LOG.info("Test - created " + assembly); final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId()); LOG.info("App - " + app); Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { Assert.assertTrue(app.getAttribute(Startable.SERVICE_UP)); } }); } catch (Exception e) { LOG.warn("Unable to instantiate " + template + " (rethrowing): " + e); throw Exceptions.propagate(e); } }

Target:
public void testReloadBrooklynPropertiesDeploy() { brooklynMgmt.reloadBrooklynProperties(); CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertNotNull(reloadedPlatform); Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-entity-basic-template.yaml")); AssemblyTemplate template = reloadedPlatform.pdp().registerDeploymentPlan(input); try { Assembly assembly = template.getInstantiator().newInstance().instantiate(template, reloadedPlatform); LOG.info("Test - created " + assembly); final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId()); LOG.info("App - " + app); Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template"); EntityTestUtils.assertAttributeEqualsEventually(app, Startable.SERVICE_UP, true); } catch (Exception e) { LOG.warn("Unable to instantiate " + template + " (rethrowing): " + e); throw Exceptions.propagate(e); } }
Source:
private void resumeVm() { setVdsId(getVm().getRunOnVds()); if (getVds() != null) { initParametersForExternalNetworks(); try { VDSReturnValue result = getBackend().getResourceManager() .RunAsyncVdsCommand( VDSCommandType.Resume, new ResumeVDSCommandParameters(getVdsId(), getVm().getId()), this); setActionReturnValue(result.getReturnValue()); setSucceeded(result.getSucceeded()); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } finally { freeLock(); } } else { setActionReturnValue(getVm().getStatus()); } }

Target:
private void resumeVm() { setVdsId(getVm().getRunOnVds()); if (getVds() != null) { try { VDSReturnValue result = getBackend().getResourceManager() .RunAsyncVdsCommand( VDSCommandType.Resume, new ResumeVDSCommandParameters(getVdsId(), getVm().getId()), this); setActionReturnValue(result.getReturnValue()); setSucceeded(result.getSucceeded()); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } finally { freeLock(); } } else { setActionReturnValue(getVm().getStatus()); } }
Source:
public StatementTree TOP_STATEMENT() { return b.<StatementTree>nonterminal(PHPLexicalGrammar.TOP_STATEMENT) .is(b.firstOf( FUNCTION_DECLARATION(), NAMESPACE_STATEMENT(), USE_STATEMENT(), STATEMENT() )); }

Target:
public StatementTree TOP_STATEMENT() { return b.<StatementTree>nonterminal(PHPLexicalGrammar.TOP_STATEMENT).is( b.firstOf( CLASS_DECLARATION(), TRAIT_DECLARATION(), FUNCTION_DECLARATION(), INTERFACE_DECLARATION(), NAMESPACE_STATEMENT(), USE_STATEMENT(), CONSTANT_DECLARATION(), HALT_COMPILER_STATEMENT(), STATEMENT())); }
Source:
private ResponseEntity<Object> getPermissions(String uuid) { PID pid = PIDs.get(uuid); Map<String, Object> result = new HashMap<>(); result.put("action", "retrieve acls"); result.put("pid", pid.getId()); try { result.put("access controls", aclRetrievalService.getPermissions(AgentPrincipals.createFromThread(), pid)); } catch (Exception e) { result.put("error", e.getMessage()); if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to retrieve access controls for object with pid " + pid, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }

Target:
private ResponseEntity<Object> getPermissions(String uuid) { PID pid = PIDs.get(uuid); Map<String, Object> result = new HashMap<>(); result.put("action", "retrieve acls"); result.put("pid", pid.getId()); try { result.put("accessControls", aclRetrievalService.getPermissions(AgentPrincipals.createFromThread(), pid)); } catch (Exception e) { result.put("error", e.getMessage()); if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to retrieve access controls for object with pid " + pid, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }