auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected ExtendedComponent convertDocToExtendedComponent(IBranchPath branchPath, Document doc) { final String iconId = doc.get(Mappings.iconId().fieldName()); final List<Integer> types = Mappings.type().getValues(doc); final String id; if (types.isEmpty()) { id = Long.toString(SnomedMappings.memberReferencedComponentId().getValue(doc)); } else { id = Long.toString(SnomedMappings.id().getValue(doc)); } final short terminologyComponentId; if (types.size() == 1) { terminologyComponentId = types.get(0).shortValue(); } else { terminologyComponentId = SnomedTerminologyComponentConstants.CONCEPT_NUMBER; } final String terminologyComponentIdAsString = CoreTerminologyBroker.getInstance().getTerminologyComponentId(terminologyComponentId); final IComponentNameProvider nameProvider = CoreTerminologyBroker.getInstance().getNameProviderFactory(terminologyComponentIdAsString).getNameProvider(); final String label = nameProvider.getComponentLabel(branchPath, id); return new ExtendedComponentImpl(id, label, iconId, terminologyComponentId); }

Target:
protected ExtendedComponent convertDocToExtendedComponent(IBranchPath branchPath, Document doc) { final String iconId = doc.get(Mappings.iconId().fieldName()); final List<Integer> types = Mappings.type().getValues(doc); final String id; if (types.isEmpty()) { id = Long.toString(SnomedMappings.memberReferencedComponentId().getValue(doc)); } else { id = Long.toString(SnomedMappings.id().getValue(doc)); } final short terminologyComponentId; if (types.isEmpty()) { terminologyComponentId = SnomedMappings.memberReferencedComponentType().getShortValue(doc); } else if (types.size() == 1) { terminologyComponentId = types.get(0).shortValue(); } else { terminologyComponentId = SnomedTerminologyComponentConstants.CONCEPT_NUMBER; } final String terminologyComponentIdAsString = CoreTerminologyBroker.getInstance().getTerminologyComponentId(terminologyComponentId); final IComponentNameProvider nameProvider = CoreTerminologyBroker.getInstance().getNameProviderFactory(terminologyComponentIdAsString).getNameProvider(); final String label = nameProvider.getComponentLabel(branchPath, id); if (types.isEmpty()) { return new ExtendedComponentImpl(SnomedMappings.memberUuid().getValue(doc), label, iconId, SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER); } else { return new ExtendedComponentImpl(id, label, iconId, terminologyComponentId); } }
Source:
protected Map<String, Object> extractCustomAttributes(String xml) { final Document document = XmlUtils.newDocument(xml); final HashMap<String, Object> attributes = new HashMap<String, Object>(); NodeList attributeList = document.getElementsByTagName("cas:attribute"); for (int i = 0; i < attributeList.getLength(); i++) { final Node attribute = attributeList.item(i); if (attribute.getAttributes().getLength() > 0) { attributes.put(attribute.getAttributes().getNamedItem("name").getNodeValue(), attribute.getAttributes().getNamedItem("value").getNodeValue()); } else { attributes.put(attribute.getLocalName(), attribute.getNodeValue()); } } return attributes; }

Target:
protected Map<String, Object> extractCustomAttributes(String xml) { final Document document = XmlUtils.newDocument(xml); final NodeList attributeList = document.getElementsByTagName("cas:attribute"); if (attributeList.getLength() == 0) { return super.extractCustomAttributes(xml); } final HashMap<String, Object> attributes = new HashMap<String, Object>(); for (int i = 0; i < attributeList.getLength(); i++) { final Node casAttributeNode = attributeList.item(i); final NamedNodeMap nodeAttributes = casAttributeNode.getAttributes(); final String name = nodeAttributes.getNamedItem("name").getNodeValue(); final String value = nodeAttributes.getNamedItem("value").getTextContent(); final Object mapValue = attributes.get(name); if (mapValue != null) { if (mapValue instanceof List) { ((List) mapValue).add(value); } else { final LinkedList<Object> list = new LinkedList<Object>(); list.add(mapValue); list.add(value); attributes.put(name, list); } } else { attributes.put(name, value); } } return attributes; }
Source:
public void testAccuracyStrategyTypeParamsSetttings() throws ResolverConfigurationValidationException { expectedException.expect(ResolverConfigurationValidationException.class); expectedException.expectMessage( "'Audit' parameter value in 'Resolver configuration.policy.strategy params' settings " + "must be bigger than 'Resolver configuration.policy.strategy.strategy params.block'."); final Policy policy = new Policy(); final Strategy strategy = new Strategy(); strategy.setStrategyType(StrategyType.accuracy); final StrategyParams strategyParams = new StrategyParams(); strategyParams.setAudit(50); strategyParams.setBlock(30); strategy.setStrategyParams(strategyParams); policy.setStrategy(strategy); resolverConfiguration.setPolicies(Collections.singletonList(policy)); validator.accuracyStrategyTypeParamsSetttings(resolverConfiguration); }

Target:
public void testAccuracyStrategyTypeParamsSetttings() throws ResolverConfigurationValidationException { expectedException.expect(ResolverConfigurationValidationException.class); expectedException.expectMessage("'Audit' parameter value in 'Resolver configuration.policy.strategy params' settings " + "must not be bigger than 'Resolver configuration.policy.strategy.strategy params.block' but " + "for the special case where either 'Audit' or 'Block' are 0. None of the parameters can be outside <0, 100>."); final Policy policy = new Policy(); final Strategy strategy = new Strategy(); strategy.setStrategyType(StrategyType.accuracy); final StrategyParams strategyParams = new StrategyParams(); strategyParams.setAudit(50); strategyParams.setBlock(30); strategy.setStrategyParams(strategyParams); policy.setStrategy(strategy); resolverConfiguration.setPolicies(Collections.singletonList(policy)); validator.accuracyStrategyTypeParamsSetttings(resolverConfiguration); }
Source:
private List<ExtensionComponent<T>> ensureLoaded() { if(extensions!=null) return extensions; if (jenkins != null && jenkins.getInitLevel().compareTo(InitMilestone.PLUGINS_PREPARED) < 0) return legacyInstances; synchronized (getLoadLock()) { if(extensions==null) { List<ExtensionComponent<T>> r = load(); r.addAll(legacyInstances); extensions = sort(r); } return extensions; } }

Target:
private List<ExtensionComponent<T>> ensureLoaded() { if(extensions!=null) return extensions; if (jenkins == null || jenkins.getInitLevel().compareTo(InitMilestone.PLUGINS_PREPARED) < 0) return legacyInstances; synchronized (getLoadLock()) { if(extensions==null) { List<ExtensionComponent<T>> r = load(); r.addAll(legacyInstances); extensions = sort(r); } return extensions; } }
Source:
public void onAdd(SolApplication solApplication) { continueControl.setEnabled(SaveManager.resourceExists("prevShip.ini")); }

Target:
public void onAdd(SolApplication solApplication) { continueControl.setEnabled(SaveManager.hasPrevShip("prevShip.ini")); }
Source:
public void createExternalDataset(@Nullable Schema schema) { DatasetProperties datasetProperties; if (schema == null) { datasetProperties = DatasetProperties.EMPTY; } else { datasetProperties = DatasetProperties.of(Collections.singletonMap(DatasetProperties.SCHEMA, schema.toString())); } try { if (!context.datasetExists(dataset)) { context.createDataset(dataset, Constants.EXTERNAL_DATASET_TYPE, datasetProperties); } else { LOG.info("Failed to create dataset with schema {}. A dataset with the given name already exists.", dataset, schema); } } catch (DatasetManagementException e) { throw new RuntimeException(String.format("Failed to create dataset %s with schema %s.", dataset, schema), e); } }

Target:
public void createExternalDataset(@Nullable Schema schema) { DatasetProperties datasetProperties; if (schema == null) { datasetProperties = DatasetProperties.EMPTY; } else { datasetProperties = DatasetProperties.of(Collections.singletonMap(DatasetProperties.SCHEMA, schema.toString())); } try { if (!context.datasetExists(dataset)) { context.createDataset(dataset, Constants.EXTERNAL_DATASET_TYPE, datasetProperties); } } catch (InstanceConflictException e) { return; } catch (DatasetManagementException e) { throw new RuntimeException(String.format("Failed to create dataset %s with schema %s.", dataset, schema), e); } }
Source:
public CacheResource parse(ConfigResource parent, IdString id) throws AuthException, ResourceNotFoundException { final CurrentUser user = self.get(); if (user instanceof AnonymousUser) { throw new AuthException("Authentication required"); } else if(!(user.isIdentifiedUser())) { throw new ResourceNotFoundException(); } if (!user.getCapabilities().canViewCaches()) { throw new AuthException("not allowed to view caches"); } String cacheName = id.get(); String pluginName = "gerrit"; int i = cacheName.indexOf('-'); if (i != -1) { pluginName = cacheName.substring(0, i); cacheName = cacheName.length() > i + 1 ? cacheName.substring(i + 1) : ""; } Provider<Cache<?, ?>> cacheProvider = cacheMap.byPlugin(pluginName).get(cacheName); if (cacheProvider == null) { throw new ResourceNotFoundException(id); } return new CacheResource(pluginName, cacheName, cacheProvider); }

Target:
public CacheResource parse(ConfigResource parent, IdString id) throws AuthException, ResourceNotFoundException { final CurrentUser user = self.get(); if (user instanceof AnonymousUser) { throw new AuthException("Authentication required"); } else if(!(user.isIdentifiedUser())) { throw new ResourceNotFoundException(); } if (!user.getCapabilities().canViewCaches()) { throw new AuthException("not allowed to view caches"); } String cacheName = id.get(); String pluginName = "gerrit"; int i = cacheName.lastIndexOf('-'); if (i != -1) { pluginName = cacheName.substring(0, i); cacheName = cacheName.length() > i + 1 ? cacheName.substring(i + 1) : ""; } Provider<Cache<?, ?>> cacheProvider = cacheMap.byPlugin(pluginName).get(cacheName); if (cacheProvider == null) { throw new ResourceNotFoundException(id); } return new CacheResource(pluginName, cacheName, cacheProvider); }
Source:
private ContextHandler servletContextHandler(ManagementContext managementContext) { ResourceConfig config = new DefaultResourceConfig(); for (Object r: BrooklynRestApi.getAllResources()) config.getSingletons().add(r); config.getSingletons().add(new ShutdownRequestListenerProvider(new TestShutdownRequestListener())); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT, managementContext); ServletHolder servletHolder = new ServletHolder(new ServletContainer(config)); context.addServlet(servletHolder, "/*"); context.setContextPath("/"); installBrooklynFilters(context, this.filters); return context; }

Target:
private ContextHandler servletContextHandler(ManagementContext managementContext) { ResourceConfig config = new DefaultResourceConfig(); for (Object r: BrooklynRestApi.getAllResources()) config.getSingletons().add(r); config.getSingletons().add(new ShutdownHandlerProvider(shutdownListener)); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT, managementContext); ServletHolder servletHolder = new ServletHolder(new ServletContainer(config)); context.addServlet(servletHolder, "/*"); context.setContextPath("/"); installBrooklynFilters(context, this.filters); return context; }
Source:
protected AbstractEndpoint extractEndpoint(Binding<MessageChannel> binding) { Assert.isInstanceOf(DefaultBinding.class, binding, "Binding not of expected type, found " + binding.getClass().getName() + " instead"); DirectFieldAccessor accessor = new DirectFieldAccessor(binding); return (AbstractEndpoint) accessor.getPropertyValue("endpoint"); }

Target:
protected AbstractEndpoint extractEndpoint(Binding<MessageChannel> binding) { DirectFieldAccessor accessor = new DirectFieldAccessor(binding); return (AbstractEndpoint) accessor.getPropertyValue("endpoint"); }
Source:
protected void drawGui(ResourceLocation rl) { if(rl != null) { System.out.println(width+" "+height+" "+xSize+" "+ySize); bindTexture(rl); guiLeft = (width - xSize) / 2; guiTop = (height - ySize) / 2; if(guiTab == 0) { drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize - PlayerInventory.invYSize); } else if(guiTab == 1) { drawTexturedModalRect(guiLeft, guiTop, 0, 86, xSize, ySize - PlayerInventory.invYSize); } } if(drawInventory) PlayerInventory.drawInventory(this, width, height, ySize - PlayerInventory.invYSize); }

Target:
protected void drawGui(ResourceLocation rl) { if(rl != null) { bindTexture(rl); guiLeft = (width - xSize) / 2; guiTop = (height - ySize) / 2; if(guiTab == 0) { drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize - PlayerInventory.invYSize); } else if(guiTab == 1) { drawTexturedModalRect(guiLeft, guiTop, 0, 86, xSize, ySize - PlayerInventory.invYSize); } } if(drawInventory) PlayerInventory.drawInventory(this, width, height, ySize - PlayerInventory.invYSize); }
Source:
private HashMap<String, Integer> calculationForProgress(List<?> tasks) { HashMap<String, Integer> results = new HashMap<>(); int open = 0; int inProcessing = 0; int closed = 0; int locked = 0; for (Object task : tasks) { if (task instanceof Task) { if (((Task)task).getProcessingStatusEnum() == TaskStatus.DONE) { closed++; } else if (((Task)task).getProcessingStatusEnum() == TaskStatus.OPEN) { open++; } else if (((Task)task).getProcessingStatusEnum() == TaskStatus.LOCKED) { locked++; } else { inProcessing++; } } else if (task instanceof TaskDTO) { if (((TaskDTO)task).getProcessingStatus() == TaskStatus.DONE) { closed++; } else if (((TaskDTO)task).getProcessingStatus() == TaskStatus.OPEN) { open++; } else if (((TaskDTO)task).getProcessingStatus() == TaskStatus.LOCKED) { locked++; } else { inProcessing++; } } else { throw new InvalidParameterException("List should contain tasks as Bean or DTO!"); } } results.put("closed", closed); results.put("inProcessing", inProcessing); results.put("open", open); results.put("locked", locked); if ((open + inProcessing + closed + locked) == 0) { results.put("locked", 1); } return results; }

Target:
private HashMap<String, Integer> calculationForProgress(List<?> tasks) { HashMap<String, Integer> results = new HashMap<>(); int open = 0; int inProcessing = 0; int closed = 0; int locked = 0; for (Object task : tasks) { if (task instanceof Task) { if (((Task)task).getProcessingStatusEnum() == TaskStatus.DONE) { closed++; } else if (((Task)task).getProcessingStatusEnum() == TaskStatus.OPEN) { open++; } else if (((Task)task).getProcessingStatusEnum() == TaskStatus.LOCKED) { locked++; } else { inProcessing++; } } else if (task instanceof TaskDTO) { if (((TaskDTO)task).getProcessingStatus() == TaskStatus.DONE) { closed++; } else if (((TaskDTO)task).getProcessingStatus() == TaskStatus.OPEN) { open++; } else if (((TaskDTO)task).getProcessingStatus() == TaskStatus.LOCKED) { locked++; } else { inProcessing++; } } else { throw new IllegalArgumentException("List should contain tasks as Bean or DTO!"); } } results.put("closed", closed); results.put("inProcessing", inProcessing); results.put("open", open); results.put("locked", locked); if ((open + inProcessing + closed + locked) == 0) { results.put("locked", 1); } return results; }
Source:
public SamzaResourceRequest(int numCores, int memoryMB, String preferredHost, String processorId) { this(numCores, memoryMB, preferredHost, processorId, Instant.now(), null); }

Target:
public SamzaResourceRequest(int numCores, int memoryMB, String preferredHost, String processorId) { this(numCores, memoryMB, preferredHost, processorId, Instant.now(), ImmutableSet.of()); }
Source:
public void bridgeShouldInitialize() { waitForAssert(() -> assertEquals(ThingStatus.ONLINE, bridge.getStatus())); }

Target:
public void bridgeShouldInitialize() { assertEquals(ThingStatus.ONLINE, bridge.getStatus()); }
Source:
public void addEntry(String resourceTag, String stateUnitKey, String state, InstanceConfig config) { if (!stateInfoMap.containsKey(state)) { Comparator<InstanceConfig> comparator = new Comparator<InstanceConfig>() { @Override public int compare(InstanceConfig o1, InstanceConfig o2) { if (o1 == o2) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } int compareTo = o1.getHostName().compareTo(o2.getHostName()); if (compareTo == 0) { return o1.getPort().compareTo(o2.getPort()); } else { return compareTo; } } }; stateInfoMap.put(state, new TreeSet<InstanceConfig>(comparator)); } Set<InstanceConfig> set = stateInfoMap.get(state); set.add(config); if (!partitionInfoMap.containsKey(stateUnitKey)) { partitionInfoMap.put(stateUnitKey, new PartitionInfo()); } PartitionInfo stateUnitKeyInfo = partitionInfoMap.get(stateUnitKey); stateUnitKeyInfo.addEntry(state, config); if (!tagResourceInfoMap.containsKey(resourceTag)) { tagResourceInfoMap.put(resourceTag, new ResourceInfo()); } ResourceInfo resourceInfo = tagResourceInfoMap.get(resourceTag); resourceInfo.addEntry(stateUnitKey, state, config); }

Target:
public void addEntry(String resourceTag, String stateUnitKey, String state, InstanceConfig config) { aggregatedResourceInfo.addEntry(stateUnitKey, state, config); if (!tagToResourceMap.containsKey(resourceTag)) { tagToResourceMap.put(resourceTag, new ResourceInfo()); } ResourceInfo resourceInfo = tagToResourceMap.get(resourceTag); resourceInfo.addEntry(stateUnitKey, state, config); }
Source:
public TracerProvider(Iterable<Tracer> tracers) { this.tracers = tracers; }

Target:
public TracerProvider(Iterable<Tracer> tracers) { Objects.requireNonNull(tracers, "'tracers' cannot be null."); tracers.forEach(e -> this.tracers.add(e)); }
Source:
public <T extends Node> void walk(Class<T> nodeType, Consumer<T> consumer) { new TreeVisitor() { @Override public void process(Node node) { if (nodeType.isInstance(node)) { consumer.accept(nodeType.cast(node)); } } }.visitPreOrder(this); }

Target:
public <T extends Node> void walk(Class<T> nodeType, Consumer<T> consumer) { walk(TreeTraversal.PREORDER, node -> { if (nodeType.isAssignableFrom(node.getClass())) { consumer.accept(nodeType.cast(node)); } }); }
Source:
private void handleChange(Collection collection, Vertex vertex) { GraphTraversal<Vertex, Vertex> traversal = graphWrapper.getGraph().traversal().V(vertex.id()); String docCaption = traversal.asAdmin().clone() .union(collection.getDisplayName().traversalJson()) .next() .getOrElse(jsn("")) .asText(); if (collection.getEntityTypeName().equals("wwdocument")) { Collection wwpersons = collection.getVre().getCollectionForCollectionName("wwpersons").get(); List<String> authors = traversal.out("isCreatedBy") .union(wwpersons.getDisplayName().traversalJson()).map(x -> x.get().getOrElse(jsn("")).asText()) .toList(); Collections.sort(authors); String authorCaption = String.join( "; ", authors ); docCaption = authorCaption + " " + docCaption; } indexHandler.addToQuickSearchIndex(collection, docCaption, vertex); }

Target:
private void handleChange(Collection collection, Vertex vertex) { GraphTraversal<Vertex, Vertex> traversal = graphWrapper.getGraph().traversal().V(vertex.id()); String docCaption = traversal.asAdmin().clone() .union(collection.getDisplayName().traversalJson()) .next() .getOrElse(jsn("")) .asText(); if (collection.getEntityTypeName().equals("wwdocument")) { Collection wwpersons = collection.getVre().getCollectionForCollectionName("wwpersons").get(); List<String> authors = traversal.out("isCreatedBy") .union(wwpersons.getDisplayName().traversalJson()) .map(x -> x.get().getOrElse(jsn("")).asText()) .toList(); Collections.sort(authors); String authorCaption = String.join( "; ", authors ); docCaption = authorCaption + " " + docCaption; } indexHandler.insertIntoQuickSearchIndex(collection, docCaption, vertex); }
Source:
public <T extends MetaParam> void replace(Class<T> type, Function<T, T> f) { int hole = -1; for (int i = 0; i < metas.length; ++i) { MetaParam<?> m = metas[i]; if (m == null) { hole = i; } else if (m != null && m.getClass().isAssignableFrom(type)) { T newMeta = f.apply((T) m); assert newMeta == null || type.isInstance(newMeta); if (newMeta == null) { --length; } metas[i] = newMeta; assert checkLength(); return; } } T newMeta = f.apply(null); if (newMeta == null) { assert checkLength(); return; } else if (hole < 0) { ++length; MetaParam<?>[] newMetas = Arrays.copyOf(metas, metas.length + 1); newMetas[newMetas.length - 1] = newMeta; metas = newMetas; } else { ++length; metas[hole] = newMeta; } assert checkLength(); }

Target:
public <T extends MetaParam> void replace(Class<T> type, Function<T, T> f) { int hole = -1; for (int i = 0; i < metas.length; ++i) { MetaParam<?> m = metas[i]; if (m == null) { hole = i; } else if (m.getClass().isAssignableFrom(type)) { T newMeta = f.apply((T) m); assert newMeta == null || type.isInstance(newMeta); if (newMeta == null) { --length; } metas[i] = newMeta; assert checkLength(); return; } } T newMeta = f.apply(null); if (newMeta == null) { assert checkLength(); return; } else if (hole < 0) { ++length; MetaParam<?>[] newMetas = Arrays.copyOf(metas, metas.length + 1); newMetas[newMetas.length - 1] = newMeta; metas = newMetas; } else { ++length; metas[hole] = newMeta; } assert checkLength(); }
Source:
public final void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); basicInitialize(descriptor); String data = descriptor.getData(); if (IArtifactDescriptor.DOWNLOAD_CHECKSUM.concat(".").concat(algorithmId).equals(data)) expectedChecksum = ChecksumHelper.getChecksums(context, IArtifactDescriptor.DOWNLOAD_CHECKSUM).get(algorithmId); else if (IArtifactDescriptor.ARTIFACT_CHECKSUM.concat(".").concat(algorithmId).equals(data)) expectedChecksum = ChecksumHelper.getChecksums(context, IArtifactDescriptor.ARTIFACT_CHECKSUM).get(algorithmId); else expectedChecksum = data; if (ofNullable(expectedChecksum).orElse("").isEmpty()) { int code = (descriptor == null) ? IStatus.ERROR : descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO; setStatus(new Status(code, Activator.ID, NLS.bind(Messages.Error_invalid_checksum, algorithmName, expectedChecksum))); } }

Target:
public final void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); basicInitialize(descriptor); if (!getStatus().isOK()) { return; } String data = descriptor.getData(); if (IArtifactDescriptor.DOWNLOAD_CHECKSUM.concat(".").concat(algorithmId).equals(data)) expectedChecksum = ChecksumHelper.getChecksums(context, IArtifactDescriptor.DOWNLOAD_CHECKSUM).get(algorithmId); else if (IArtifactDescriptor.ARTIFACT_CHECKSUM.concat(".").concat(algorithmId).equals(data)) expectedChecksum = ChecksumHelper.getChecksums(context, IArtifactDescriptor.ARTIFACT_CHECKSUM).get(algorithmId); else expectedChecksum = data; if (ofNullable(expectedChecksum).orElse("").isEmpty()) { int code = buildErrorCode(descriptor); setStatus(new Status(code, Activator.ID, NLS.bind(Messages.Error_invalid_checksum, algorithmName, expectedChecksum))); } }
Source:
public int hashCode() { int result = diskImage.hashCode(); result = 31 * result + vms.hashCode(); return result; }

Target:
public int hashCode() { return Objects.hash(diskImage, vms, id); }
Source:
public void package_relative_import() { Map<String, Symbol> osSymbols = TypeShed.symbolsForModule("os").stream().collect(Collectors.toMap(Symbol::name, Function.identity(), AmbiguousSymbolImpl::mergeTwoSymbols)); Symbol sysSymbol = osSymbols.get("sys"); assertThat(sysSymbol.kind()).isEqualTo(Kind.AMBIGUOUS); Symbol timesResult = osSymbols.get("times_result"); assertThat(timesResult.kind()).isEqualTo(Kind.CLASS); Map<String, Symbol> requestsSymbols = TypeShed.symbolsForModule("requests").stream().collect(Collectors.toMap(Symbol::name, Function.identity(), AmbiguousSymbolImpl::mergeTwoSymbols)); Symbol requestSymbol = requestsSymbols.get("request"); assertThat(requestSymbol.kind()).isEqualTo(Kind.FUNCTION); assertThat(requestSymbol.fullyQualifiedName()).isEqualTo("requests.api.request"); }

Target:
public void package_relative_import() { Map<String, Symbol> osSymbols = TypeShed.symbolsForModule("os").stream().collect(Collectors.toMap(Symbol::name, Function.identity(), AmbiguousSymbolImpl::create)); Symbol sysSymbol = osSymbols.get("sys"); assertThat(sysSymbol.kind()).isEqualTo(Kind.AMBIGUOUS); Symbol timesResult = osSymbols.get("times_result"); assertThat(timesResult.kind()).isEqualTo(Kind.CLASS); assertThat(timesResult.fullyQualifiedName()).isEqualTo("posix.times_result"); Map<String, Symbol> requestsSymbols = TypeShed.symbolsForModule("requests").stream().collect(Collectors.toMap(Symbol::name, Function.identity(), AmbiguousSymbolImpl::create)); Symbol requestSymbol = requestsSymbols.get("request"); assertThat(requestSymbol.kind()).isEqualTo(Kind.FUNCTION); assertThat(requestSymbol.fullyQualifiedName()).isEqualTo("requests.api.request"); }
Source:
public void shutdown(IRecordProcessorCheckpointer checkpointer, ShutdownReason reason) { LOGGER.warn("SHUTDOWN: {}", reason.toString()); if(reason == ShutdownReason.TERMINATE) { try { checkpointer.checkpoint(); } catch (InvalidStateException e) { LOGGER.error(e.getMessage()); } catch (ShutdownException e) { LOGGER.error(e.getMessage()); } } }

Target:
public void shutdown(IRecordProcessorCheckpointer checkpointer, ShutdownReason reason) { LOGGER.warn("SHUTDOWN: {}", reason.toString()); if (Objects.equals(ShutdownReason.TERMINATE, reason)) { try { checkpointer.checkpoint(); } catch (InvalidStateException e) { LOGGER.error(e.getMessage()); } catch (ShutdownException e) { LOGGER.error(e.getMessage()); } } }
Source:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return new ITmfTreeColumnDataProvider() { @Override public List<@Nullable TmfTreeColumnData> getColumnData() { return ImmutableList.of( createTmfTreeColumnData(COLUMN_NAMES[0], NonNullUtils.checkNotNull(Comparator.comparing(SegmentStoreStatisticsEntry::getName))), createTmfTreeColumnData(COLUMN_NAMES[1], NonNullUtils.checkNotNull(Comparator.comparingLong(s -> s.getEntry().getMin()))), createTmfTreeColumnData(COLUMN_NAMES[2], NonNullUtils.checkNotNull(Comparator.comparingLong(s -> s.getEntry().getMax()))), createTmfTreeColumnData(COLUMN_NAMES[3], NonNullUtils.checkNotNull(Comparator.comparingDouble(s -> s.getEntry().getMean()))), createTmfTreeColumnData(COLUMN_NAMES[4], NonNullUtils.checkNotNull(Comparator.comparingDouble(s -> s.getEntry().getStdDev()))), createTmfTreeColumnData(COLUMN_NAMES[5], NonNullUtils.checkNotNull(Comparator.comparingLong(s -> s.getEntry().getNbElements()))), createTmfTreeColumnData(COLUMN_NAMES[6], NonNullUtils.checkNotNull(Comparator.comparingDouble(s -> s.getEntry().getTotal()))), new TmfTreeColumnData("")); } }; }

Target:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return new ITmfTreeColumnDataProvider() { @Override public List<@Nullable TmfTreeColumnData> getColumnData() { return ImmutableList.of( createTmfTreeColumnData(COLUMN_NAMES[0], Objects.requireNonNull(Comparator.comparing(SegmentStoreStatisticsEntry::getName))), createTmfTreeColumnData(COLUMN_NAMES[1], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getMin()))), createTmfTreeColumnData(COLUMN_NAMES[2], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getMax()))), createTmfTreeColumnData(COLUMN_NAMES[3], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getMean()))), createTmfTreeColumnData(COLUMN_NAMES[4], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getStdDev()))), createTmfTreeColumnData(COLUMN_NAMES[5], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getNbElements()))), createTmfTreeColumnData(COLUMN_NAMES[6], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getTotal()))), new TmfTreeColumnData("")); } }; }
Source:
public void onEvent(CacheEvent<K, V> event) { final EventType type = event.getType(); LOGGER.trace("Cache Event notified for event type {}", type); CacheEventWrapper<K, V> cacheEventWrapper = new CacheEventWrapper<K, V>(event); if(eventThreadLocal.get().isEmpty()) { eventThreadLocal.setOrdered(orderedListenerCount.get() != 0); } eventThreadLocal.get().add(cacheEventWrapper); markFailedCacheEventsInThreadLocal(); if (eventThreadLocal.isOrdered()) { ConcurrentLinkedQueue<CacheEventWrapper> eventWrapperQueue = getEventQueue(event.getKey()); eventWrapperQueue.add(cacheEventWrapper); } }

Target:
public void onEvent(CacheEvent<K, V> event) { final EventType type = event.getType(); EventThreadLocal threadLocal = eventThreadLocal; LOGGER.trace("Cache Event notified for event type {}", type); CacheEventWrapper<K, V> cacheEventWrapper = new CacheEventWrapper<K, V>(event); if (hasListeners()) { threadLocal.verifyOrderedDispatch(orderedListenerCount.get() != 0); threadLocal.addToEventList(cacheEventWrapper); if (threadLocal.isOrdered()) { ConcurrentLinkedQueue<CacheEventWrapper> eventWrapperQueue = getEventQueue(event.getKey()); eventWrapperQueue.add(cacheEventWrapper); } } }
Source:
public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) { if (fAverageCharWidth == null) { fAverageCharWidth = gc.getFontMetrics().getAverageCharWidth(); } if (bounds.width <= fAverageCharWidth) { return; } if (!(event instanceof FlamegraphEvent)) { return; } String funcSymbol = ""; ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace(); if (activeTrace != null) { FlamegraphEvent fgEvent = (FlamegraphEvent) event; funcSymbol = getFuntionSymbol(fgEvent); } gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); Utils.drawText(gc, funcSymbol, bounds.x, bounds.y, bounds.width, bounds.height, true, true); }

Target:
public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) { if (fAverageCharWidth == null) { fAverageCharWidth = gc.getFontMetrics().getAverageCharWidth(); } if (bounds.width <= fAverageCharWidth) { return; } if (!(event instanceof FlamegraphEvent)) { return; } String funcSymbol = ""; ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace(); if (activeTrace != null) { FlamegraphEvent fgEvent = (FlamegraphEvent) event; funcSymbol = getFunctionSymbol(fgEvent); } gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); Utils.drawText(gc, funcSymbol, bounds.x, bounds.y, bounds.width, bounds.height, true, true); }
Source:
public void saveToFile(Object object) { try { Writer writer = new OutputStreamWriter(new FileOutputStream(jsonFile) , CHARSET); gson.toJson(object, object.getClass(), writer); writer.close(); } catch (IOException e) { logger.error("Failed to save object to JSON", e); } }

Target:
public void saveToFile(Object object) throws IOException { createDirectories(); Writer writer = new OutputStreamWriter(new FileOutputStream(jsonFile) , CHARSET); gson.toJson(object, object.getClass(), writer); writer.close(); }
Source:
public void testReadWriteMergeHeads() throws IOException { assertEquals(db.readMergeHeads(), null); db.writeMergeHeads(Arrays.asList(ObjectId.zeroId(), ObjectId.fromString(sampleId))); assertEquals(db.readMergeHeads().size(), 2); assertEquals(db.readMergeHeads().get(0), ObjectId.zeroId()); assertEquals(db.readMergeHeads().get(1), ObjectId.fromString(sampleId)); db.writeMergeHeads(Collections.EMPTY_LIST); assertEquals(db.readMergeHeads(), null); FileOutputStream fos = new FileOutputStream(new File(db.getDirectory(), Constants.MERGE_HEAD)); try { fos.write(sampleId.getBytes(Constants.CHARACTER_ENCODING)); } finally { fos.close(); } assertEquals(db.readMergeHeads().size(), 1); assertEquals(db.readMergeHeads().get(0), ObjectId.fromString(sampleId)); }

Target:
public void testReadWriteMergeHeads() throws IOException { assertEquals(db.readMergeHeads(), null); db.writeMergeHeads(Arrays.asList(ObjectId.zeroId(), ObjectId.fromString(sampleId))); assertEquals(read(new File(db.getDirectory(), "MERGE_HEAD")), "0000000000000000000000000000000000000000\n1c6db447abdbb291b25f07be38ea0b1bf94947c5\n"); assertEquals(db.readMergeHeads().size(), 2); assertEquals(db.readMergeHeads().get(0), ObjectId.zeroId()); assertEquals(db.readMergeHeads().get(1), ObjectId.fromString(sampleId)); FileOutputStream fos = new FileOutputStream(new File(db.getDirectory(), "MERGE_HEAD")); try { fos.write("0000000000000000000000000000000000000000\n1c6db447abdbb291b25f07be38ea0b1bf94947c5\n".getBytes(Constants.CHARACTER_ENCODING)); } finally { fos.close(); } assertEquals(db.readMergeHeads().size(), 2); assertEquals(db.readMergeHeads().get(0), ObjectId.zeroId()); assertEquals(db.readMergeHeads().get(1), ObjectId.fromString(sampleId)); db.writeMergeHeads(Collections.EMPTY_LIST); assertEquals(read(new File(db.getDirectory(), "MERGE_HEAD")), ""); assertEquals(db.readMergeHeads(), null); fos = new FileOutputStream(new File(db.getDirectory(), "MERGE_HEAD")); try { fos.write(sampleId.getBytes(Constants.CHARACTER_ENCODING)); } finally { fos.close(); } assertEquals(db.readMergeHeads().size(), 1); assertEquals(db.readMergeHeads().get(0), ObjectId.fromString(sampleId)); }
Source:
@Test public void testAddElementTooLarge() throws IOException { QueueFile queue = new QueueFile(file); byte[] newBigValue = new byte[QueueFile.MAX_ELEMENT_SIZE + 1]; try { queue.add(newBigValue); fail("Should have failed with IllegalArgumentException for element too large."); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("Adding element that is " + (QueueFile.MAX_ELEMENT_SIZE + 1) + " to queue with max" + " element size " + QueueFile.MAX_ELEMENT_SIZE + "."); } finally { queue.close(); } }

Target:
@Test public void testAddElementTooLarge() throws IOException { int testMaxElementSize = 1000; QueueFile queue = new QueueFile(file, testMaxElementSize); byte[] newBigValue = new byte[testMaxElementSize + 1]; try { queue.add(newBigValue); fail("Should have failed with IllegalArgumentException for element too large."); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("Adding element that is " + (testMaxElementSize + 1) + " to queue with max" + " element size " + testMaxElementSize + "."); } finally { queue.close(); } }
Source:
public void mapExternalLunDisks(List<LunDisk> luns, Map<String, Object> externalLunMap) { luns.forEach(lunDisk -> { if (externalLunMap != null) { LunDisk targetLunDisk = (LunDisk) externalLunMap.get(lunDisk.getId().toString()); if (targetLunDisk != null) { lunDisk.setLun(targetLunDisk.getLun()); lunDisk.getLun() .getLunConnections() .forEach(conn -> conn.setStorageType(lunDisk.getLun().getLunType())); } } }); }

Target:
public void mapExternalLunDisks(List<LunDisk> luns, Map<String, Object> externalLunMap) { luns.forEach(lunDisk -> { if (externalLunMap != null) { LunDisk targetLunDisk = (LunDisk) externalLunMap.get(lunDisk.getId().toString()); if (targetLunDisk != null) { log.info("Mapping LUN disk '{}' to '{}'", lunDisk.getLun().getLUNId(), targetLunDisk.getLun().getLUNId()); lunDisk.setLun(targetLunDisk.getLun()); lunDisk.getLun() .getLunConnections() .forEach(conn -> conn.setStorageType(lunDisk.getLun().getLunType())); } else { log.warn("No LUN disk will be mapped, LUN '{}' was not found", targetLunDisk.getLun().getLUNId()); } } }); }
Source:
private void putPropertyIfAbsent(URL url, Properties properties, String propertyName) { String propertyValue = url.getParameter(propertyName); if (propertyValue != null && propertyValue.length() != 0) { properties.setProperty(propertyName, propertyValue); } }

Target:
private void putPropertyIfAbsent(URL url, Properties properties, String propertyName) { String propertyValue = url.getParameter(propertyName); if (propertyValue != null && propertyValue.trim().length() != 0) { properties.setProperty(propertyName, propertyValue); } }
Source:
protected DocumentTypeDescriptor mergeDocumentTypeDescriptors(DocumentTypeDescriptor src, DocumentTypeDescriptor dst) { return (DocumentTypeDescriptor) dst.clone().merge(src); }

Target:
protected DocumentTypeDescriptor mergeDocumentTypeDescriptors(DocumentTypeDescriptor src, DocumentTypeDescriptor dst) { return dst.clone().merge(src); }
Source:
public void setLayoutBehaviour(LinearLayoutManager linearLayoutManager, RecyclerMessageAdapter adapter) { setActionBarLayoutBehaviour(linearLayoutManager,adapter); setFabLayoutBehaviour(linearLayoutManager,adapter); }

Target:
public void setLayoutBehaviour(LinearLayoutManager linearLayoutManager, RecyclerMessageAdapter adapter) { CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams(); layoutParams.setBehavior(new RemoveViewsOnScroll(linearLayoutManager, adapter)); appBarLayout.requestLayout(); layoutParams = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); layoutParams.setBehavior(new RemoveViewsOnScroll(linearLayoutManager, adapter)); fab.setLayoutParams(layoutParams); topSnackBar.setMessagesLayoutManager(linearLayoutManager); topSnackBar.setMessagesAdapter(adapter); }
Source:
public static int getLoginDuration() { SharedPreferences properties = CommCareApplication._().getCurrentApp().getAppPreferences(); return Integer.parseInt(properties.getString(LOGIN_DURATION, "28800")); }

Target:
public static int getLoginDuration() { SharedPreferences properties = CommCareApplication._().getCurrentApp().getAppPreferences(); try { return Integer.parseInt(properties.getString(LOGIN_DURATION, "28800")); } catch (NumberFormatException e) { return 28000; } }
Source:
private boolean updateMetadataIfPossible(LedgerMetadata metadata, LedgerMetadata newMeta) { if (metadata.isNewerThan(newMeta)) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : reread metadata because local metadata is newer.", new Object[]{ledgerId, ensembleChangeIdx}); } rereadMetadata(this); return true; } if (metadata.isConflictWith(newMeta)) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : metadata is conflicted, local metadata = \n \n," + " zk metadata = \n \n", ledgerId, ensembleChangeIdx, metadata, newMeta); } return false; } if (LOG.isDebugEnabled()) { LOG.info("[EnsembleChange-L{}-{}] : resolved ledger metadata conflict and writing to zookeeper," + " local meta data is \n \n, zk meta data is \n {}.", ledgerId, ensembleChangeIdx, metadata, newMeta); } metadata.setVersion(newMeta.getVersion()); metadata.mergeEnsembles(newMeta.getEnsembles()); if (!areFailedBookiesReplaced(metadata, ensembleInfo)) { try { ensembleInfo = replaceBookieInMetadata(ensembleInfo.failedBookies, numEnsembleChanges.get()); } catch (BKException.BKNotEnoughBookiesException e) { LOG.error("Could not get additional bookie to remake ensemble, closing ledger: {}", ledgerId); handleUnrecoverableErrorDuringAdd(e.getCode()); return false; } } writeLedgerConfig(new ChangeEnsembleCb(ensembleInfo, curBlockAddCompletions, ensembleChangeIdx)); return true; }

Target:
private boolean updateMetadataIfPossible(LedgerMetadata metadata, LedgerMetadata newMeta) { if (metadata.isNewerThan(newMeta)) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : reread metadata because local metadata is newer.", new Object[]{ledgerId, ensembleChangeIdx}); } rereadMetadata(this); return true; } if (metadata.isConflictWith(newMeta)) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : metadata is conflicted, local metadata = \n \n," + " zk metadata = \n \n", ledgerId, ensembleChangeIdx, metadata, newMeta); } return false; } if (LOG.isDebugEnabled()) { LOG.info("[EnsembleChange-L{}-{}] : resolved ledger metadata conflict and writing to zookeeper," + " local meta data is \n \n, zk meta data is \n {}.", ledgerId, ensembleChangeIdx, metadata, newMeta); } metadata.setVersion(newMeta.getVersion()); metadata.mergeEnsembles(newMeta.getEnsembles()); if (!areFailedBookiesReplaced(metadata, ensembleInfo)) { try { ensembleInfo = replaceBookieInMetadata(ensembleInfo.failedBookies, numEnsembleChanges.get()); } catch (BKException.BKNotEnoughBookiesException e) { LOG.error("Could not get additional bookie to remake ensemble, closing ledger: {}", ledgerId); return false; } } writeLedgerConfig(new ChangeEnsembleCb(ensembleInfo, curBlockAddCompletions, ensembleChangeIdx)); return true; }
Source:
public void adsVideoPageAdsMobile() { adsVideoPageAdsDesktop(); }

Target:
public void adsVideoPageAdsMobile() { adsVideoPageAds(); }
Source:
public void createRulesTest() { PylintRuleRepository ruleRepository = new PylintRuleRepository(new RulesDefinitionXmlLoader()); RulesDefinition.Context context = new RulesDefinition.Context(); ruleRepository.define(context); RulesDefinition.Repository repository = context.repository(PylintRuleRepository.REPOSITORY_KEY); assertThat(repository.language()).isEqualTo("py"); assertThat(repository.name()).isEqualTo("Pylint"); List<RulesDefinition.Rule> rules = repository.rules(); assertThat(rules).isNotNull(); assertThat(rules).hasSize(322); long rulesWithoutRemediationCost = rules.stream() .filter(rule -> rule.debtRemediationFunction() == null) .count(); assertThat(rulesWithoutRemediationCost).isEqualTo(28); }

Target:
public void createRulesTest() { PylintRuleRepository ruleRepository = new PylintRuleRepository(new RulesDefinitionXmlLoader()); RulesDefinition.Context context = new RulesDefinition.Context(); ruleRepository.define(context); RulesDefinition.Repository repository = context.repository(PylintRuleRepository.REPOSITORY_KEY); assertThat(repository.language()).isEqualTo("py"); assertThat(repository.name()).isEqualTo("Pylint"); List<RulesDefinition.Rule> rules = repository.rules(); assertThat(rules).isNotNull(); assertThat(rules).hasSize(325); long rulesWithoutRemediationCost = rules.stream() .filter(rule -> rule.debtRemediationFunction() == null) .count(); assertThat(rulesWithoutRemediationCost).isEqualTo(28); }
Source:
public static <E, K, V, M extends Map<K, V>> TCollector<E, ?, M> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<M> mapFactory) { return TCollector.of(mapFactory, (map, el) -> map.merge(keyMapper.apply(el), valueMapper.apply(el), mergeFunction), (m1, m2) -> { m2.forEach((k, v) -> m1.merge(k, v, mergeFunction)); return m1; }, TCollector.Characteristics.IDENTITY_FINISH); }

Target:
public static <E, K, V, M extends Map<K, V>> TCollector<E, ?, M> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<M> mapFactory) { return TCollector.of(mapFactory, (map, el) -> map.merge(keyMapper.apply(el), valueMapper.apply(el), mergeFunction), (m1, m2) -> { for (Map.Entry<K, V> e : m2.entrySet()) { m1.merge(e.getKey(), e.getValue(), mergeFunction); } return m1; }, TCollector.Characteristics.IDENTITY_FINISH); }
Source:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_CREATE) .setDescription("Create a project.<br/>" + "Requires 'Create Projects' permission<br/>" + "Since 6.3, the response format has been updated and does not contain the database ID anymore<br/>" + "Since 6.3, the 'key' parameter has been renamed 'project'") .setSince("4.0") .setPost(true) .setResponseExample(getClass().getResource("create-example.json")) .setHandler(this); action.setChangelog( new Change("6.3", "The response format has been updated and does not contain the database ID anymore"), new Change("6.3", "The 'key' parameter has been renamed 'project'")); action.createParam(PARAM_PROJECT) .setDescription("Key of the project") .setDeprecatedKey(DEPRECATED_PARAM_KEY, "6.3") .setRequired(true) .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_NAME) .setDescription("Name of the project") .setRequired(true) .setExampleValue("SonarQube"); action.createParam(PARAM_BRANCH) .setDescription("SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0'") .setExampleValue("branch-5.0"); action.createParam(PARAM_VISIBILITY) .setDescription("Whether the created project should be visible to everyone, or only specific user/groups.<br/>" + "If no visibility is specified, the default project visibility of the organization will be used.") .setRequired(false) .setInternal(true) .setSince("6.4") .setPossibleValues("private", "public"); support.addOrganizationParam(action); }

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_CREATE) .setDescription("Create a project.<br/>" + "Requires 'Create Projects' permission") .setSince("4.0") .setPost(true) .setResponseExample(getClass().getResource("create-example.json")) .setHandler(this); action.setChangelog( new Change("6.3", "The response format has been updated and does not contain the database ID anymore"), new Change("6.3", "The 'key' parameter has been renamed 'project'")); action.createParam(PARAM_PROJECT) .setDescription("Key of the project") .setDeprecatedKey(DEPRECATED_PARAM_KEY, "6.3") .setRequired(true) .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_NAME) .setDescription("Name of the project") .setRequired(true) .setExampleValue("SonarQube"); action.createParam(PARAM_BRANCH) .setDescription("SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0'") .setExampleValue("branch-5.0"); action.createParam(PARAM_VISIBILITY) .setDescription("Whether the created project should be visible to everyone, or only specific user/groups.<br/>" + "If no visibility is specified, the default project visibility of the organization will be used.") .setRequired(false) .setInternal(true) .setSince("6.4") .setPossibleValues("private", "public"); support.addOrganizationParam(action); }
Source:
public void define(Context context) { NewController controller = context.createController("orchestrator") .setDescription("Orchestrator web service"); controller.createAction("reset") .setDescription("Reset data") .setSince("Orchestrator 3.4") .setInternal(true) .setPost(true) .setHandler(new RequestHandler() { public void handle(Request request, Response response) throws Exception { backendCleanup.resetData(); } }); controller.done(); }

Target:
public void define(Context context) { NewController controller = context.createController("orchestrator") .setDescription("Orchestrator web service"); controller.createAction("reset") .setDescription("Reset data") .setSince("Orchestrator 3.4") .setInternal(true) .setPost(true) .setHandler(new RequestHandler() { @Override public void handle(Request request, Response response) throws Exception { backendCleanup.resetData(); } }); controller.done(); }