auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static long calculateGrouping(long groupId, List<Integer> columns, List<List<Integer>> groupingSetDescriptors) { long grouping = (1L << columns.size()) - 1; List<Integer> groupingSet = groupingSetDescriptors.get((int) groupId); for (Integer groupingColumn : groupingSet) { int index = columns.indexOf(groupingColumn); if (index != -1) { grouping = grouping & ~(1L << (columns.size() - 1 - index)); } } return grouping; }

Target:
static long calculateGrouping(long groupId, List<Integer> columns, List<List<Integer>> groupingSetDescriptors) { long grouping = (1L << columns.size()) - 1; List<Integer> groupingSet = groupingSetDescriptors.get(toIntExact(groupId)); for (Integer groupingColumn : groupingSet) { int index = columns.indexOf(groupingColumn); if (index != -1) { grouping = grouping & ~(1L << (columns.size() - 1 - index)); } } return grouping; }
Source:
public MaxHitRateTracker(int defaultTimeRangeInSeconds, int maxTimeRangeInSeconds) { super(maxTimeRangeInSeconds, (int) (maxTimeRangeInSeconds * 1000L / ONE_SECOND_BUCKET_WIDTH_MS)); _defaultTimeRangeMs = defaultTimeRangeInSeconds * 1000L; _maxTimeRangeMs = maxTimeRangeInSeconds * 1000L; }

Target:
private MaxHitRateTracker(int defaultTimeRangeInSeconds, int maxTimeRangeInSeconds) { super(maxTimeRangeInSeconds, (int) (maxTimeRangeInSeconds * 1000L / ONE_SECOND_BUCKET_WIDTH_MS)); _defaultTimeRangeMs = defaultTimeRangeInSeconds * 1000L; _maxTimeRangeMs = maxTimeRangeInSeconds * 1000L; }
Source:
public void initializeUI(UIBuilder builder) throws Exception { Project project = getSelectedProject(builder); if (project.hasFacet(StackFacet.class)) { StackFacet facet = project.getFacet(StackFacet.class); Iterable valueChoices = jaxrsVersion.getValueChoices(); Set newChoices = facet.getStack().filter(CDIFacet.class, valueChoices); jaxrsVersion.setValueChoices(newChoices); jaxrsVersion.setDefaultValue((RestFacet) null); } List<RestFacet> valueChoices = Lists.toList(jaxrsVersion.getValueChoices()); int size = valueChoices.size(); if (size == 1) { jaxrsVersion.setDefaultValue(valueChoices.get(0)); } else if (size > 1) { builder.add(jaxrsVersion); } configureActivationStrategy(builder.getUIContext(), project); builder.add(applicationPath).add(config).add(targetPackage).add(className); }

Target:
public void initializeUI(UIBuilder builder) throws Exception { Project project = getSelectedProject(builder); if (filterValueChoicesFromStack(project, jaxrsVersion)) { builder.add(jaxrsVersion); } configureActivationStrategy(builder.getUIContext(), project); builder.add(applicationPath).add(config).add(targetPackage).add(className); }
Source:
private String getDisplayPlaceValue() { if (diagramElement != null) { return NotationUtils.getStringValue((View) diagramElement, StereotypeDisplayUtils.STEREOTYPE_PROPERTY_LOCATION, "Compartment"); } else { return null; } }

Target:
private String getDisplayPlaceValue() { if (diagramElement != null) { return NotationUtils.getStringValue((View) diagramElement, StereotypeDisplayUtils.STEREOTYPE_PROPERTY_LOCATION, DEFAULT_LOCATION); } else { return null; } }
Source:
public static <T> T decode(DnsRecord record) { DnsRecordType type = record.type(); Function<DnsRecord, ?> decoder = decoders.get(type); if (decoder == null) { throw new IllegalStateException("Unsupported resource record type [id: " + type + "]."); } T result = null; try { result = (T) decoder.apply(record); } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e.getCause()); } return result; }

Target:
public static <T> T decode(DnsRecord record) { DnsRecordType type = record.type(); Function<DnsRecord, ?> decoder = decoders.get(type); if (decoder == null) { throw new IllegalStateException("Unsupported resource record type [id: " + type + "]."); } T result = null; try { result = (T) decoder.apply(record); } catch (Exception e) { log.error(e.getMessage(), e.getCause()); } return result; }
Source:
private void lockNotificationSequenceForUpdate() throws MetaException { if (sqlGenerator.getDbProduct() == DatabaseProduct.DERBY && directSql != null) { directSql.lockDbTable("NOTIFICATION_SEQUENCE"); } else { String selectQuery = "select \"NEXT_EVENT_ID\" from \"NOTIFICATION_SEQUENCE\""; String lockingQuery = sqlGenerator.addForUpdateClause(selectQuery); new RetryingExecutor(conf, () -> { prepareQuotes(); Query query = pm.newQuery("javax.jdo.query.SQL", lockingQuery); query.setUnique(true); query.execute(); query.closeAll(); }).run(); } }

Target:
private void lockNotificationSequenceForUpdate() throws MetaException { if (sqlGenerator.getDbProduct() == DatabaseProduct.DERBY && directSql != null) { new RetryingExecutor(conf, () -> { directSql.lockDbTable("NOTIFICATION_SEQUENCE"); }).run(); } else { String selectQuery = "select \"NEXT_EVENT_ID\" from \"NOTIFICATION_SEQUENCE\""; String lockingQuery = sqlGenerator.addForUpdateClause(selectQuery); new RetryingExecutor(conf, () -> { prepareQuotes(); Query query = pm.newQuery("javax.jdo.query.SQL", lockingQuery); query.setUnique(true); query.execute(); query.closeAll(); }).run(); } }
Source:
default void deleteToken(String processorName, int segment) throws UnableToClaimTokenException { throw new UnsupportedOperationException(""); }

Target:
default void deleteToken(String processorName, int segment) throws UnableToClaimTokenException { throw new UnsupportedOperationException("Explicit initialization (which is required to reliably delete tokens) is not supported by this TokenStore implementation"); }
Source:
public WorkDefinitionMatch getWorkDefinitionMatch(String id) { return WorkDefinitionFactory.get().getWorkDefinition(id); }

Target:
public WorkDefinitionMatch getWorkDefinitionMatch(String id) { return factory.getWorkDefinition(id); }
Source:
public void testResourceBoundary() { String[] charBuffer = {"~", "!", "@", "#", "%", "^", "*", "+", "=", "{", "}", "|", "\\", "<", ">", "\"", "\'", ";"}; for (String aCharBuffer : charBuffer) { try { System.out.println(aCharBuffer); resourceAdminServiceClient.addTextResource(PARENT_PATH + "/" + WSO2_COLL, TEXT_FILE_NAME + aCharBuffer, "text/plain", "sample", "Hello world"); log.error("Invalid resource added with illigal character " + aCharBuffer); resourceAdminServiceClient.deleteResource("/TestAutomation"); fail("Invalid resource added with illigal character " + aCharBuffer); } catch (Exception e) { assertTrue(e.getMessage().contains( "contains one or more illegal characters (~!@#;%^*()+={}|\\<>\"',)" + "" + ""), "Invalid resource added with illigal character " + aCharBuffer); } } }

Target:
public void testResourceBoundary() { String[] charBuffer = {"~", "!", "@", "#", "%", "^", "*", "+", "=", "{", "}", "|", "\\", "<", ">", "\"", "\'", ";"}; for (String aCharBuffer : charBuffer) { try { resourceAdminServiceClient.addTextResource(PARENT_PATH + "/" + WSO2_COLL, TEXT_FILE_NAME + aCharBuffer, "text/plain", "sample", "Hello world"); log.error("Invalid resource added with illigal character " + aCharBuffer); resourceAdminServiceClient.deleteResource("/TestAutomation"); fail("Invalid resource added with illigal character " + aCharBuffer); } catch (Exception e) { assertTrue(e.getMessage().contains( "contains one or more illegal characters (~!@#;%^*()+={}|\\<>\"',)" + "" + ""), "Invalid resource added with illigal character " + aCharBuffer); } } }
Source:
ValidClientsByTaskLoadQueue(final Map<UUID, ClientState> clientStates, final BiFunction<UUID, TaskId, Boolean> validClientCriteria) { clientsByTaskLoad = getClientPriorityQueueByTaskLoad(clientStates); this.validClientCriteria = validClientCriteria; }

Target:
ValidClientsByTaskLoadQueue(final Map<UUID, ClientState> clientStates, final BiFunction<UUID, TaskId, Boolean> validClientCriteria) { this.validClientCriteria = validClientCriteria; clientsByTaskLoad = new PriorityQueue<>( (client, other) -> { final double clientTaskLoad = clientStates.get(client).taskLoad(); final double otherTaskLoad = clientStates.get(other).taskLoad(); if (clientTaskLoad < otherTaskLoad) { return -1; } else if (clientTaskLoad > otherTaskLoad) { return 1; } else { return client.compareTo(other); } }); }
Source:
public CachedRemoteStreamProvider(int size) { cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("preConfigured", CacheConfigurationBuilder.newCacheConfigurationBuilder(URL.class, AudioStreamCache.class, ResourcePoolsBuilder.newResourcePoolsBuilder().heap(size, MemoryUnit.MB)) .build()) .build(true); }

Target:
public CachedRemoteStreamProvider(int size) { log.info("Create AudioCache with size: " + size + "Mb"); cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("preConfigured", CacheConfigurationBuilder.newCacheConfigurationBuilder(URL.class, ByteStreamCache.class, ResourcePoolsBuilder.newResourcePoolsBuilder().heap(size, MemoryUnit.MB)) .build()) .build(true); sizeChangedListener = new ByteStreamCache.ISizeChangedListener() { @Override public void onSizeChanged(final URL uri, final ByteStreamCache self) { log.debug("onSizeChanged for " + uri); getCache().put(uri, self); } }; }
Source:
public String toString() { return "Container{" + "id='" + id + '\'' + ", names=" + names + ", created='" + created + '\'' + ", path='" + path + '\'' + ", args=" + Arrays.toString(args) + ", config=" + config + ", state=" + state + ", image='" + image + '\'' + ", networkSettings=" + networkSettings + ", sysInitPath='" + sysInitPath + '\'' + ", resolvConfPath='" + resolvConfPath + '\'' + ", volumes=" + volumes + ", sizeRw=" + sizeRw + ", sizeRootFs=" + sizeRootFs + ", command='" + command + '\'' + ", status='" + status + '\'' + ", hostConfig=" + hostConfig + ", ports=" + ports + '}'; }

Target:
public String toString() { return Objects.toStringHelper(this) .add("id", id) .add("name", name) .add("created", created) .add("path", path) .add("args", args) .add("containerConfig", containerConfig) .add("state", state) .add("image", image) .add("networkSettings", networkSettings) .add("resolvConfPath", resolvConfPath) .add("driver", driver) .add("execDriver", execDriver) .add("volumes", volumes) .add("volumesRW", volumesRW) .add("command", command) .add("status", status) .add("hostConfig", hostConfig) .add("ports", ports) .add("hostnamePath", hostnamePath) .toString(); }
Source:
public Integer getNumberOfFiles(URI directory) { int count = 0; if (directory.isAbsolute()) { if (isDirectory(directory)) { ArrayList<URI> children = getSubUris(directory); for (URI aChildren : children) { if (isDirectory(aChildren)) { count += getNumberOfFiles(aChildren); } else { count += 1; } } } } else { directory = getAbsoluteURI(directory, MappingType.DATA, null, null); ArrayList<URI> children = getSubUris(directory); if (isDirectory(directory)) { for (URI aChildren : children) { if (isDirectory(aChildren)) { count += getNumberOfFiles(aChildren); } else { count += 1; } } } } return count; }

Target:
public Integer getNumberOfFiles(URI directory) { int count = 0; if (directory.isAbsolute()) { count += iterateOverDirectories(directory); } else { directory = getAbsoluteURI(directory, MappingType.DATA, null, null); count += iterateOverDirectories(directory); } return count; }
Source:
protected HdfsSinkConnectorConfig(ConfigDef configDef, Map<String, String> props) { super(configDef, props); ConfigDef storageCommonConfigDef = StorageCommonConfig.newConfigDef(STORAGE_CLASS_RECOMMENDER); commonConfig = new StorageCommonConfig(storageCommonConfigDef, originalsStrings()); hiveConfig = new HiveConfig(originalsStrings()); ConfigDef partitionerConfigDef = PartitionerConfig.newConfigDef(PARTITIONER_CLASS_RECOMMENDER); partitionerConfig = new PartitionerConfig(partitionerConfigDef, originalsStrings()); this.name = parseName(originalsStrings()); this.hadoopConfig = new Configuration(); this.url = extractUrl(originalsStrings()); addToGlobal(hiveConfig); addToGlobal(partitionerConfig); addToGlobal(commonConfig); addToGlobal(this); }

Target:
protected HdfsSinkConnectorConfig(ConfigDef configDef, Map<String, String> props) { super(configDef, props); ConfigDef storageCommonConfigDef = StorageCommonConfig.newConfigDef(STORAGE_CLASS_RECOMMENDER); commonConfig = new StorageCommonConfig(storageCommonConfigDef, originalsStrings()); hiveConfig = new HiveConfig(originalsStrings()); ConfigDef partitionerConfigDef = PartitionerConfig.newConfigDef(PARTITIONER_CLASS_RECOMMENDER); partitionerConfig = new PartitionerConfig(partitionerConfigDef, originalsStrings()); this.name = parseName(originalsStrings()); this.hadoopConfig = new Configuration(); addToGlobal(hiveConfig); addToGlobal(partitionerConfig); addToGlobal(commonConfig); addToGlobal(this); this.url = extractUrl(); }
Source:
private void addPublicIpAddress() { String publicIPAddressName = name + "publicip"; String dnsLabelPrefix = name; PublicIPAddressProperties.Builder properties = PublicIPAddressProperties.builder(); if (!dnsLabelPrefix.isEmpty()) { properties.dnsSettings(DnsSettings.builder().domainNameLabel(dnsLabelPrefix).build()); variables.put("dnsLabelPrefix", dnsLabelPrefix); } properties.publicIPAllocationMethod("Dynamic"); variables.put("publicIPAddressName", publicIPAddressName); variables.put("publicIPAddressReference", "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"); ResourceDefinition publicIpAddress = ResourceDefinition.builder() .name("[variables('publicIPAddressName')]") .type("Microsoft.Network/publicIPAddresses") .location(location) .apiVersion("2015-06-15") .properties(properties.build()) .build(); resources.add(publicIpAddress); }

Target:
private void addPublicIpAddress() { String publicIPAddressName = name + "publicip"; String dnsLabelPrefix = name; PublicIPAddressProperties.Builder properties = PublicIPAddressProperties.builder(); if (!dnsLabelPrefix.isEmpty()) { properties.dnsSettings(DnsSettings.builder().domainNameLabel(dnsLabelPrefix).build()); variables.put("dnsLabelPrefix", dnsLabelPrefix); } properties.publicIPAllocationMethod("Dynamic"); variables.put("publicIPAddressName", publicIPAddressName); variables.put("publicIPAddressReference", "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"); ResourceDefinition publicIpAddress = ResourceDefinition.builder() .name("[variables('publicIPAddressName')]") .type("Microsoft.Network/publicIPAddresses") .location(location) .apiVersion(STORAGE_API_VERSION) .properties(properties.build()) .build(); resources.add(publicIpAddress); }
Source:
private boolean isRGBValuesChange(Notification notification) { return ViewpointPackage.Literals.RGB_VALUES.getEStructuralFeatures().contains(notification.getFeature()) && notification.getNotifier() instanceof RGBValues; }

Target:
private boolean isRGBValuesChange(Notification notification) { return ViewpointPackage.Literals.RGB_VALUES.getEStructuralFeatures().contains(notification.getFeature()); }
Source:
public Map<TopicPartition, OffsetAndMetadata> fetchCommittedOffsets(final Set<TopicPartition> partitions, final Timer timer) { if (partitions.isEmpty()) return Collections.emptyMap(); final Generation generation = generationIfStable(); if (pendingCommittedOffsetRequest != null && !pendingCommittedOffsetRequest.sameRequest(partitions, generation)) { pendingCommittedOffsetRequest = null; } do { if (!ensureCoordinatorReady(timer)) return null; final RequestFuture<Map<TopicPartition, OffsetAndMetadata>> future; if (pendingCommittedOffsetRequest != null) { future = pendingCommittedOffsetRequest.response; } else { future = sendOffsetFetchRequest(partitions); pendingCommittedOffsetRequest = new PendingCommittedOffsetRequest(partitions, generation, future); } client.poll(future, timer); if (future.isDone()) { pendingCommittedOffsetRequest = null; if (future.succeeded()) { return future.value(); } else if (!future.isRetriable()) { throw future.exception(); } else { timer.sleep(rebalanceConfig.retryBackoffMs); } } else { return null; } } while (timer.notExpired()); return null; }

Target:
public Map<TopicPartition, OffsetAndMetadata> fetchCommittedOffsets(final Set<TopicPartition> partitions, final Timer timer) { if (partitions.isEmpty()) return Collections.emptyMap(); final Generation generationForOffsetRequest = generationIfStable(); if (pendingCommittedOffsetRequest != null && !pendingCommittedOffsetRequest.sameRequest(partitions, generationForOffsetRequest)) { pendingCommittedOffsetRequest = null; } do { if (!ensureCoordinatorReady(timer)) return null; final RequestFuture<Map<TopicPartition, OffsetAndMetadata>> future; if (pendingCommittedOffsetRequest != null) { future = pendingCommittedOffsetRequest.response; } else { future = sendOffsetFetchRequest(partitions); pendingCommittedOffsetRequest = new PendingCommittedOffsetRequest(partitions, generationForOffsetRequest, future); } client.poll(future, timer); if (future.isDone()) { pendingCommittedOffsetRequest = null; if (future.succeeded()) { return future.value(); } else if (!future.isRetriable()) { throw future.exception(); } else { timer.sleep(rebalanceConfig.retryBackoffMs); } } else { return null; } } while (timer.notExpired()); return null; }
Source:
protected void detectBrowserProperties(UserAgentAnalyzer userAgentAnalyzer) { nl.basjes.parse.useragent.UserAgent parsedUserAgent = userAgentAnalyzer .parse(getUserAgent()); String userAgentName = parsedUserAgent.getValue("AgentName"); properties.setBrowserKonqueror(UserAgent.KONQUEROR.getUaStrings().contains(userAgentName)); properties.setBrowserChrome(UserAgent.CHROME.getUaStrings().contains(userAgentName)); properties.setBrowserEdge(UserAgent.EDGE.getUaStrings().contains(userAgentName)); properties.setBrowserSafari(UserAgent.SAFARI.getUaStrings().contains(userAgentName)); properties.setBrowserOpera(UserAgent.OPERA.getUaStrings().contains(userAgentName)); properties.setBrowserInternetExplorer( UserAgent.INTERNET_EXPLORER.getUaStrings().contains(userAgentName)); boolean isFireFox = UserAgent.FIREFOX.getUaStrings() .contains(parsedUserAgent.getValue("AgentName")); if (isFireFox) { properties.setBrowserMozillaFirefox(true); properties.setBrowserMozilla(true); } else { properties.setBrowserMozilla( UserAgent.MOZILLA.getUaStrings().contains(parsedUserAgent.getValue("AgentName"))); } setBrowserVersion(parsedUserAgent); log.debug("determined user agent: {}", properties); }

Target:
protected void detectBrowserProperties(UserAgentAnalyzer userAgentAnalyzer) { nl.basjes.parse.useragent.UserAgent parsedUserAgent = userAgentAnalyzer .parse(getUserAgent()); String userAgentName = parsedUserAgent.getValue("AgentName"); properties.setBrowserKonqueror(UserAgent.KONQUEROR.getUaStrings().contains(userAgentName)); properties.setBrowserChrome(UserAgent.CHROME.getUaStrings().contains(userAgentName)); properties.setBrowserEdge(UserAgent.EDGE.getUaStrings().contains(userAgentName)); properties.setBrowserSafari(UserAgent.SAFARI.getUaStrings().contains(userAgentName)); properties.setBrowserOpera(UserAgent.OPERA.getUaStrings().contains(userAgentName)); properties.setBrowserInternetExplorer( UserAgent.INTERNET_EXPLORER.getUaStrings().contains(userAgentName)); boolean isFireFox = UserAgent.FIREFOX.getUaStrings().contains(userAgentName); if (isFireFox) { properties.setBrowserMozillaFirefox(true); properties.setBrowserMozilla(true); } else { properties.setBrowserMozilla(UserAgent.MOZILLA.getUaStrings().contains(userAgentName)); } setBrowserVersion(parsedUserAgent); log.debug("determined user agent: {}", properties); }
Source:
private void onConfirmDelete() { int deletedVideoCount = 0; ArrayList<SectionItemInterface> list = adapter.getSelectedItems(); if (list != null) { for (SectionItemInterface section : list) { if (section.isDownload()) { DownloadEntry de = (DownloadEntry) section; environment.getStorage().removeDownload(de); deletedVideoCount++; adapter.remove(section); } } } notifyAdapter(); videoListView.setOnItemClickListener(adapter); setCheckBoxVisible(false); if (deletedVideoCount > 0) { UiUtil.showMessage(getView(), ResourceUtil.getFormattedStringForQuantity(getResources(), R.plurals.deleted_video, "video_count", deletedVideoCount).toString()); } getView().findViewById(R.id.delete_btn).setVisibility(View.GONE); getView().findViewById(R.id.edit_btn).setVisibility(View.VISIBLE); getView().findViewById(R.id.cancel_btn).setVisibility(View.GONE); }

Target:
private void onConfirmDelete() { int deletedVideoCount = 0; ArrayList<SectionItemInterface> list = adapter.getSelectedItems(); if (list != null) { for (SectionItemInterface section : list) { if (section.isDownload()) { DownloadEntry de = (DownloadEntry) section; environment.getStorage().removeDownload(de); deletedVideoCount++; adapter.remove(section); } } } addToRecentAdapter(); notifyAdapter(); videoListView.setOnItemClickListener(adapter); setCheckBoxVisible(false); if (deletedVideoCount > 0) { UiUtil.showMessage(getView(), ResourceUtil.getFormattedStringForQuantity(getResources(), R.plurals.deleted_video, "video_count", deletedVideoCount).toString()); } getView().findViewById(R.id.delete_btn).setVisibility(View.GONE); getView().findViewById(R.id.edit_btn).setVisibility(View.VISIBLE); getView().findViewById(R.id.cancel_btn).setVisibility(View.GONE); }
Source:
private void expandSection(final FormToolkit toolkit, Section section) { reviewsComposite = toolkit.createComposite(section); section.setClient(reviewsComposite); reviewsComposite.setLayout(EditorUtil.createSectionClientLayout()); getTaskEditorPage().registerDefaultDropListener(section); createReviewsTable(toolkit, reviewsComposite); toolkit.paintBordersFor(reviewsComposite); section.setClient(reviewsComposite); }

Target:
private void expandSection(final FormToolkit toolkit, Section section) { reviewsComposite = toolkit.createComposite(section); section.setClient(reviewsComposite); reviewsComposite.setLayout(EditorUtil.createSectionClientLayout()); getTaskEditorPage().registerDefaultDropListener(section); createReviewsTable(toolkit, reviewsComposite); toolkit.paintBordersFor(reviewsComposite); }
Source:
public String getURL(boolean forceSkinAction) throws Exception { XWikiContext xcontext = this.xcontextProvider.get(); URL resourceUrl = this.xcontextProvider.get().getEngineContext().getResource(this.getPath()); Map<String, String> parameters = new LinkedHashMap<>(); Path resourcePath = Paths.get(resourceUrl.toURI()); FileTime lastModifiedTime = Files.getLastModifiedTime(resourcePath); parameters.put("cache-version", String.valueOf(lastModifiedTime.toMillis())); XWikiURLFactory urlf = xcontext.getURLFactory(); URL url; if (forceSkinAction) { url = urlf.createSkinURL(this.resourceName, "skins", getRepository().getId(), xcontext); } else { url = urlf.createSkinURL(this.resourceName, getRepository().getId(), xcontext); } url = urlf.addQueryParameters(url, parameters); return urlf.getURL(url, xcontext); }

Target:
public String getURL(boolean forceSkinAction) throws Exception { XWikiContext xcontext = this.xcontextProvider.get(); Map<String, Object> parameters = new LinkedHashMap<>(); if (this.urlConfiguration.useResourceLastModificationDate()) { try { URL resourceUrl = this.xcontextProvider.get().getEngineContext().getResource(this.getPath()); Path resourcePath = Paths.get(resourceUrl.toURI()); FileTime lastModifiedTime = Files.getLastModifiedTime(resourcePath); parameters.put(XWiki.CACHE_VERSION, String.valueOf(lastModifiedTime.toMillis())); } catch (Exception e) { parameters.put(XWiki.CACHE_VERSION, xcontext.getWiki().getVersion()); } } else { parameters.put(XWiki.CACHE_VERSION, xcontext.getWiki().getVersion()); } XWikiURLFactory urlf = xcontext.getURLFactory(); URL url; if (forceSkinAction) { url = urlf.createSkinURL(this.resourceName, "skins", getRepository().getId(), xcontext, parameters); } else { url = urlf.createSkinURL(this.resourceName, getRepository().getId(), xcontext, parameters); } return urlf.getURL(url, xcontext); }
Source:
private Collection<FeedbackResponse> getFeedbackResponseEntitiesForReceiverForQuestionInSection( String feedbackQuestionId, String receiver, String section) { Map<String, FeedbackResponse> FeedbackResponseList = new HashMap<String,FeedbackResponse>(); Query q = getPM().newQuery(FeedbackResponse.class); q.declareParameters("String feedbackQuestionIdParam, String receiverParam, String sectionParam"); q.setFilter("feedbackQuestionId == feedbackQuestionIdParam && receiver == receiverParam " + "&& giverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponse> firstQueryResponses = (List<FeedbackResponse>) q.execute(feedbackQuestionId, receiver, section); for(FeedbackResponse response : firstQueryResponses){ if (!JDOHelper.isDeleted(response)) { FeedbackResponseList.put(response.getId(), response); } } q.setFilter("feedbackQuestionId == feedbackQuestionIdParam && receiver == receiverParam " + "&& receiverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponse> secondQueryResponses = (List<FeedbackResponse>) q.execute(feedbackQuestionId, receiver, section); for(FeedbackResponse response : secondQueryResponses){ if (!JDOHelper.isDeleted(response)) { FeedbackResponseList.put(response.getId(), response); } } return FeedbackResponseList.values(); }

Target:
private Collection<FeedbackResponse> getFeedbackResponseEntitiesForReceiverForQuestionInSection( String feedbackQuestionId, String receiver, String section) { Map<String, FeedbackResponse> feedbackResponses = new HashMap<String,FeedbackResponse>(); Query q = getPM().newQuery(FeedbackResponse.class); q.declareParameters("String feedbackQuestionIdParam, String receiverParam, String sectionParam"); q.setFilter("feedbackQuestionId == feedbackQuestionIdParam && receiver == receiverParam " + "&& giverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponse> firstQueryResponses = (List<FeedbackResponse>) q.execute(feedbackQuestionId, receiver, section); for(FeedbackResponse response : firstQueryResponses){ if (!JDOHelper.isDeleted(response)) { feedbackResponses.put(response.getId(), response); } } q.setFilter("feedbackQuestionId == feedbackQuestionIdParam && receiver == receiverParam " + "&& receiverSection == sectionParam"); @SuppressWarnings("unchecked") List<FeedbackResponse> secondQueryResponses = (List<FeedbackResponse>) q.execute(feedbackQuestionId, receiver, section); for(FeedbackResponse response : secondQueryResponses){ if (!JDOHelper.isDeleted(response)) { feedbackResponses.put(response.getId(), response); } } return feedbackResponses.values(); }
Source:
private boolean createZkRealm(String realm) { if (_zkClient.exists(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm)) { LOG.warn("createZkRealm() called for realm: {}, but this realm already exists! Namespace: {}", realm, _namespace); return true; } else { try { _zkClient.createPersistent(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm); _zkClient.writeData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm, new ZNRecord(realm)); } catch (Exception e) { LOG.error("Failed to create ZkRealm: {}, Namespace: ", realm, _namespace); return false; } } return true; }

Target:
private boolean createZkRealm(String realm) { if (_zkClient.exists(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm)) { LOG.warn("createZkRealm() called for realm: {}, but this realm already exists! Namespace: {}", realm, _namespace); return true; } try { _zkClient.createPersistent(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm); _zkClient.writeData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm, new ZNRecord(realm)); } catch (Exception e) { LOG.error("Failed to create ZkRealm: {}, Namespace: ", realm, _namespace); return false; } return true; }
Source:
public DynamicItem<T> get() { return new DynamicItem<T>(find(injector, type), null, key); }

Target:
public DynamicItem<T> get() { return new DynamicItem<T>(key, find(injector, type), "gerrit"); }
Source:
public ReadOnlyDictionaryInterface getDictionary(String key) { int index = indexForColumnName(key); return index >= 0 ? getDictionary(index) : null; }

Target:
public ReadOnlyDictionary getDictionary(String key) { int index = indexForColumnName(key); return index >= 0 ? getDictionary(index) : null; }
Source:
@Test public void testSandboxUsesSelectedBinding() throws Exception { SecureGroovyScript sgs = new SecureGroovyScript("return a++", true, null); Binding b = new Binding(); b.setVariable("a", 5); SecureGroovyScript.PreparedScript script = sgs.configuringWithKeyItem().prepare(Jenkins.getInstance().getPluginManager().uberClassLoader, b); try { Object res = script.run(); assertTrue((int) res == 5); assertTrue((int) b.getVariable("a") == 6); res = script.run(); assertTrue((int) res == 6); assertTrue((int) b.getVariable("a") == 7); } catch (Exception e) { script.cleanUp(); throw e; } }

Target:
@Test public void testSandboxUsesSelectedBinding() throws Exception { SecureGroovyScript sgs = new SecureGroovyScript("return a++", true, null); Binding b = new Binding(); b.setVariable("a", 5); try(SecureGroovyScript.PreparedScript script = sgs.configuringWithKeyItem().prepare(Jenkins.getInstance().getPluginManager().uberClassLoader, b)) { Object res = script.run(); assertTrue((int) res == 5); assertTrue((int) b.getVariable("a") == 6); res = script.run(); assertTrue((int) res == 6); assertTrue((int) b.getVariable("a") == 7); } }
Source:
public com.alliander.osgp.dto.valueobjects.smartmetering.PeriodicMeterReadsContainerGas convertTo( final PeriodicMeterReadsContainerGas source, final Type<com.alliander.osgp.dto.valueobjects.smartmetering.PeriodicMeterReadsContainerGas> destinationType) { final List<PeriodicMeterReadsGas> r = new ArrayList<>(source.getPeriodicMeterReadsGas().size()); for (final com.alliander.osgp.domain.core.valueobjects.smartmetering.PeriodicMeterReadsGas pmr : source .getPeriodicMeterReadsGas()) { r.add(new PeriodicMeterReadsGas(pmr.getLogTime(), PeriodType.valueOf(pmr.getPeriodType().name()), pmr .getConsumption(), pmr.getCaptureTime())); } return new com.alliander.osgp.dto.valueobjects.smartmetering.PeriodicMeterReadsContainerGas( source.getDeviceIdentification(), r); }

Target:
public com.alliander.osgp.dto.valueobjects.smartmetering.PeriodicMeterReadsContainerGas convertTo( final PeriodicMeterReadsContainerGas source, final Type<com.alliander.osgp.dto.valueobjects.smartmetering.PeriodicMeterReadsContainerGas> destinationType) { final List<MeterReadsGas> meterReadsGas = new ArrayList<>(source.getMeterReadsGas().size()); for (final com.alliander.osgp.domain.core.valueobjects.smartmetering.MeterReadsGas pmr : source .getMeterReadsGas()) { meterReadsGas.add(new MeterReadsGas(pmr.getLogTime(), pmr.getConsumption(), pmr.getCaptureTime())); } return new com.alliander.osgp.dto.valueobjects.smartmetering.PeriodicMeterReadsContainerGas( PeriodType.valueOf(source.getPeriodType().name()), meterReadsGas); }
Source:
protected void appendWorkToDeadLetterQueue() { try { String key = getCategory() + ":" + getId(); StreamService service = Framework.getService(StreamService.class); if (service != null) { service.getLogManager(DEFAULT_LOG_MANAGER) .getAppender(DEAD_LETTER_QUEUE) .append(key, Record.of(key, WorkComputation.serialize(this))); } } catch (IllegalArgumentException e) { log.debug("No default log manager, don't save work in failure to a dead letter queue"); } catch (Exception e) { log.error("Failed to save work: " + getId() + " in dead letter queue", e); } }

Target:
protected void appendWorkToDeadLetterQueue() { if (!State.RUNNING.equals(getWorkInstanceState())) { return; } try { String key = getCategory() + ":" + getId(); StreamService service = Framework.getService(StreamService.class); if (service != null) { service.getLogManager(DEFAULT_LOG_MANAGER) .getAppender(DEAD_LETTER_QUEUE) .append(key, Record.of(key, WorkComputation.serialize(this))); } } catch (IllegalArgumentException e) { log.debug("No default log manager, don't save work in failure to a dead letter queue"); } catch (Exception e) { log.error("Failed to save work: " + getId() + " in dead letter queue", e); } }
Source:
private Mono<ClientHttpResponse> execute(HttpComponentsClientHttpRequest request, HttpClientContext context) { Flux<ByteBuffer> byteBufferFlux = request.getByteBufferFlux(); ReactiveEntityProducer reactiveEntityProducer = createReactiveEntityProducer(request, byteBufferFlux); BasicRequestProducer basicRequestProducer = new BasicRequestProducer(request.getHttpRequest(), reactiveEntityProducer); return Mono.<Message<HttpResponse, Publisher<ByteBuffer>>>create(sink -> { ReactiveResponseConsumer reactiveResponseConsumer = new ReactiveResponseConsumer(new MonoFutureCallbackAdapter<>(sink)); this.client.execute(basicRequestProducer, reactiveResponseConsumer, context, null); }).map(message -> new HttpComponentsClientHttpResponse(this.dataBufferFactory, message, context)); }

Target:
private Mono<ClientHttpResponse> execute(HttpComponentsClientHttpRequest request, HttpClientContext context) { AsyncRequestProducer requestProducer = request.toRequestProducer(); return Mono.<Message<HttpResponse, Publisher<ByteBuffer>>>create(sink -> { ReactiveResponseConsumer reactiveResponseConsumer = new ReactiveResponseConsumer(new MonoFutureCallbackAdapter(sink)); this.client.execute(requestProducer, reactiveResponseConsumer, context, null); }).map(message -> new HttpComponentsClientHttpResponse(this.dataBufferFactory, message, context)); }
Source:
private void applyGroupDefaults(GrpcChannelKey key, NettyChannelBuilder channelBuilder, AlluxioConfiguration conf) { long keepAliveTimeMs = conf.getMs(PropertyKey.Template.USER_NETWORK_KEEPALIVE_TIME_MS .format(key.getNetworkGroup().getPropertyCode())); long keepAliveTimeoutMs = conf.getMs(PropertyKey.Template.USER_NETWORK_KEEPALIVE_TIMEOUT_MS .format(key.getNetworkGroup().getPropertyCode())); long inboundMessageSizeBytes = conf.getBytes(PropertyKey.Template.USER_NETWORK_MAX_INBOUND_MESSAGE_SIZE .format(key.getNetworkGroup().getPropertyCode())); long flowControlWindow = conf.getBytes(PropertyKey.Template.USER_NETWORK_FLOWCONTROL_WINDOW .format(key.getNetworkGroup().getPropertyCode())); Class<? extends Channel> channelType = NettyUtils.getChannelClass( !(key.getServerAddress().getSocketAddress() instanceof InetSocketAddress), PropertyKey.Template.USER_NETWORK_NETTY_CHANNEL .format(key.getNetworkGroup().getPropertyCode()), conf); EventLoopGroup eventLoopGroup = acquireNetworkEventLoop(key, conf); channelBuilder.keepAliveTime(keepAliveTimeMs, TimeUnit.MILLISECONDS); channelBuilder.keepAliveTimeout(keepAliveTimeoutMs, TimeUnit.MILLISECONDS); channelBuilder.maxInboundMetadataSize((int) inboundMessageSizeBytes); channelBuilder.flowControlWindow((int) flowControlWindow); channelBuilder.channelType(channelType); channelBuilder.eventLoopGroup(eventLoopGroup); channelBuilder.usePlaintext(); }

Target:
private NettyChannelBuilder applyGroupDefaults(GrpcChannelKey key, NettyChannelBuilder channelBuilder, AlluxioConfiguration conf) { long keepAliveTimeMs = conf.getMs(PropertyKey.Template.USER_NETWORK_KEEPALIVE_TIME_MS .format(key.getNetworkGroup().getPropertyCode())); long keepAliveTimeoutMs = conf.getMs(PropertyKey.Template.USER_NETWORK_KEEPALIVE_TIMEOUT_MS .format(key.getNetworkGroup().getPropertyCode())); long inboundMessageSizeBytes = conf.getBytes(PropertyKey.Template.USER_NETWORK_MAX_INBOUND_MESSAGE_SIZE .format(key.getNetworkGroup().getPropertyCode())); long flowControlWindow = conf.getBytes(PropertyKey.Template.USER_NETWORK_FLOWCONTROL_WINDOW .format(key.getNetworkGroup().getPropertyCode())); Class<? extends Channel> channelType = NettyUtils.getChannelClass( !(key.getServerAddress().getSocketAddress() instanceof InetSocketAddress), PropertyKey.Template.USER_NETWORK_NETTY_CHANNEL .format(key.getNetworkGroup().getPropertyCode()), conf); EventLoopGroup eventLoopGroup = acquireNetworkEventLoop(key, conf); channelBuilder.keepAliveTime(keepAliveTimeMs, TimeUnit.MILLISECONDS); channelBuilder.keepAliveTimeout(keepAliveTimeoutMs, TimeUnit.MILLISECONDS); channelBuilder.maxInboundMetadataSize((int) inboundMessageSizeBytes); channelBuilder.flowControlWindow((int) flowControlWindow); channelBuilder.channelType(channelType); channelBuilder.eventLoopGroup(eventLoopGroup); channelBuilder.usePlaintext(); return channelBuilder; }
Source:
private static boolean isAwsEndpoint(String endpoint) { return (endpoint.startsWith("s3.") || endpoint.startsWith("s3-accelerate.")) && (endpoint.endsWith(".amazonaws.com") || endpoint.endsWith(".amazonaws.com.cn")); }

Target:
private boolean isAwsEndpoint(String endpoint) { return (endpoint.startsWith("s3.") || isAwsAccelerateEndpoint(endpoint)) && (endpoint.endsWith(".amazonaws.com") || endpoint.endsWith(".amazonaws.com.cn")); }
Source:
public void close() throws IOException { mEvictorTask.cancel(true); mEvictor.shutdownNow(); try { mEvictor.awaitTermination(2, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Failed to await evictor termination", e); } }

Target:
public void close() throws IOException { mEvictorTask.cancel(true); mEvictor.shutdownNow(); try { mEvictor.awaitTermination(2, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Failed to await LockPool evictor termination", e); } }
Source:
private String getHeaderLine(int headerLineNo) { String header = getHeaderLines().get(headerLineNo); if (header.isEmpty()) { header = EMPTY_LINE_PATTERN; } return header; }

Target:
private String getHeaderLine(int headerLineNo) { String line = getHeaderLines().get(headerLineNo); if (line.isEmpty()) { line = EMPTY_LINE_PATTERN; } return line; }
Source:
public List<CredentialRepresentation> credentials(){ auth.users().requireView(user); List<CredentialModel> models = session.userCredentialManager().getStoredCredentials(realm, user); models.forEach(c -> c.setSecretData(null)); return models.stream().map(ModelToRepresentation::toRepresentation).collect(Collectors.toList()); }

Target:
public List<CredentialRepresentation> credentials(){ auth.users().requireManage(user); List<CredentialModel> models = session.userCredentialManager().getStoredCredentials(realm, user); models.forEach(c -> c.setSecretData(null)); return models.stream().map(ModelToRepresentation::toRepresentation).collect(Collectors.toList()); }
Source:
public static SubmoduleWalk forIndex(Repository repository) throws IOException { SubmoduleWalk generator = new SubmoduleWalk(repository); try { DirCache index = repository.readDirCache(); generator.setTree(new DirCacheIterator(index)); if (repository.isBare()) generator.setRootTree(new DirCacheIterator(index)); else generator.useWorkingTree = true; } catch (IOException e) { generator.release(); throw e; } return generator; }

Target:
public static SubmoduleWalk forIndex(Repository repository) throws IOException { SubmoduleWalk generator = new SubmoduleWalk(repository); try { DirCache index = repository.readDirCache(); generator.setTree(new DirCacheIterator(index)); generator.useWorkingTree = true; } catch (IOException e) { generator.release(); throw e; } return generator; }
Source:
AstPackageExplorer(Language language) { availableNodeNames = getClasses("net.sourceforge.pmd.lang." + language.getTerseName() + ".ast") .filter(clazz -> clazz.getSimpleName().startsWith("AST")) .filter(clazz -> !clazz.isInterface() && !Modifier.isAbstract(clazz.getModifiers())) .map(m -> m.getSimpleName().substring("AST".length())) .collect(Collectors.toList()); }

Target:
AstPackageExplorer(Language language) { availableNodeNames = getClasses("net.sourceforge.pmd.lang." + language.getTerseName() + ".ast") .filter(clazz -> clazz.getSimpleName().startsWith("AST")) .filter(clazz -> !clazz.isInterface() && !Modifier.isAbstract(clazz.getModifiers())) .map(m -> m.getSimpleName().substring("AST".length())) .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList)); }
Source:
public void updateAlertInTree(Alert originalAlert, Alert alert) { if (Constant.isLowMemoryOptionSet()) { return; } this.getTreeModel().updatePath(originalAlert, alert); if (isInFilter(alert)) { this.getFilteredTreeModel().updatePath(originalAlert, alert); } this.recalcAlerts(); if (View.isInitialised()) { JTree alertTree = this.getAlertPanel().getTreeAlert(); alertTree.setExpandsSelectedPaths(true); alertTree.setSelectionPath(findAlertInTree(alert)); alertTree.scrollPathToVisible(findAlertInTree(alert)); } }

Target:
public void updateAlertInTree(Alert originalAlert, Alert alert) { if (Constant.isLowMemoryOptionSet()) { return; } this.getTreeModel().updatePath(originalAlert, alert); if (isInFilter(alert)) { this.getFilteredTreeModel().updatePath(originalAlert, alert); } this.recalcAlerts(); if (View.isInitialised()) { JTree alertTree = this.getAlertPanel().getTreeAlert(); TreePath alertPath = new TreePath(getTreeModel().getAlertNode(alert).getPath()); alertTree.setSelectionPath(alertPath); alertTree.scrollPathToVisible(alertPath); } }
Source:
private RevWalk getRevCommits() { RevWalk revWalk = new RevWalk(repo); revWalk.sort(RevSort.COMMIT_TIME_DESC, true); revWalk.sort(RevSort.BOUNDARY, true); AnyObjectId headId = getHeadId(); try { revWalk.markStart(revWalk.parseCommit(headId)); } catch (IOException e) { MessageDialog.openError(getShell(), UIText.TagAction_errorDuringTagging, UIText.TagAction_errorWhileGettingRevCommits); } return revWalk; }

Target:
private RevWalk getRevCommits() { RevWalk revWalk = new RevWalk(repo); revWalk.sort(RevSort.COMMIT_TIME_DESC, true); revWalk.sort(RevSort.BOUNDARY, true); try { AnyObjectId headId = repo.resolve(Constants.HEAD); revWalk.markStart(revWalk.parseCommit(headId)); } catch (IOException e) { ErrorDialog.openError(getShell(), UIText.TagAction_errorDuringTagging, UIText.TagAction_errorWhileGettingRevCommits, new Status( IStatus.ERROR, Activator.getPluginId(), e .getMessage(), e)); } return revWalk; }
Source:
public static Date parseISO8601(String dateString) throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); date.setTime(sdf.parse(dateString).getTime()); return date; }

Target:
public static Date parseISO8601(String dateString) throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_FORMAT_STRING); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); date.setTime(sdf.parse(dateString).getTime()); return date; }
Source:
private Promise<CommandImpl> add(final CommandImpl command) { final CommandDto commandDto = dtoFactory.createDto(CommandDto.class) .withName(getUniqueCommandName(command.getType(), command.getName())) .withCommandLine(command.getCommandLine()) .withType(command.getType()) .withAttributes(command.getAttributes()); return workspaceServiceClient.addCommand(appContext.getWorkspaceId(), commandDto).then(new Function<WorkspaceDto, CommandImpl>() { @Override public CommandImpl apply(WorkspaceDto arg) throws FunctionException { final CommandImpl newCommand = new CommandImpl(commandDto.getName(), command.getCommandLine(), command.getType(), command.getAttributes()); commands.put(newCommand.getName(), newCommand); fireCommandAdded(newCommand); return newCommand; } }); }

Target:
private Promise<CommandImpl> add(final CommandImpl command) { final CommandDto commandDto = dtoFactory.createDto(CommandDto.class) .withName(getUniqueCommandName(command.getType(), command.getName())) .withCommandLine(command.getCommandLine()) .withType(command.getType()) .withAttributes(command.getAttributes()); return workspaceServiceClient.addCommand(appContext.getWorkspaceId(), commandDto).then(new Function<WorkspaceDto, CommandImpl>() { @Override public CommandImpl apply(WorkspaceDto arg) throws FunctionException { final CommandImpl newCommand = new CommandImpl(command); newCommand.setName(commandDto.getName()); commands.put(newCommand.getName(), newCommand); fireCommandAdded(newCommand); return newCommand; } }); }
Source:
private final String getSessionIndex(Assertion subjectAssertion) { List<AuthnStatement> authnStatements = subjectAssertion.getAuthnStatements(); if(authnStatements != null && authnStatements.size() > 0) { AuthnStatement statement = authnStatements.get(0); return statement.getSessionIndex(); } return null; }

Target:
private final String getSessionIndex(Assertion subjectAssertion) { List<AuthnStatement> authnStatements = subjectAssertion.getAuthnStatements(); if(authnStatements != null && authnStatements.size() > 0) { AuthnStatement statement = authnStatements.get(0); if(statement != null) { return statement.getSessionIndex(); } } return null; }
Source:
private ConnectionFactory getConnectionFactory(ConnectionFactory connectionFactory) { if (connectionFactory == null) { if (System.getProperties().getProperty("com.api.client.should_use_proxy") != null) { return new DefaultConnectionFactory(defaultProxy()); } return new DefaultConnectionFactory(); } return connectionFactory; }

Target:
private ConnectionFactory getConnectionFactory(ConnectionFactory connectionFactory) { if (connectionFactory == null) { if (System.getProperty("com.api.client.should_use_proxy") != null) { return new DefaultConnectionFactory(defaultProxy()); } return new DefaultConnectionFactory(); } return connectionFactory; }
Source:
private JmxTableHandle getJmxTableHandle(SchemaTableName tableName) { try { String canonicalName = new ObjectName(tableName.getTableName()).getCanonicalName(); Optional<ObjectName> objectName = mbeanServer.queryNames(WILDCARD, null).stream() .filter(name -> canonicalName.equalsIgnoreCase(name.getCanonicalName())) .findFirst(); if (!objectName.isPresent()) { return null; } MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(objectName.get()); ImmutableList.Builder<JmxColumnHandle> columns = ImmutableList.builder(); columns.add(new JmxColumnHandle(NODE_COLUMN_NAME, createUnboundedVarcharType())); Arrays.stream(mbeanInfo.getAttributes()) .filter(MBeanAttributeInfo::isReadable) .map(attribute -> new JmxColumnHandle(attribute.getName(), getColumnType(attribute))) .sorted(Comparator.comparing(JmxColumnHandle::getColumnName)) .forEach(columns::add); return new JmxTableHandle(objectName.get().toString(), columns.build(), true); } catch (JMException e) { return null; } }

Target:
private JmxTableHandle getJmxTableHandle(SchemaTableName tableName) { try { String objectNamePattern = toPattern(tableName.getTableName().toLowerCase(ENGLISH)); List<ObjectName> objectNames = mbeanServer.queryNames(WILDCARD, null).stream() .filter(name -> name.getCanonicalName().toLowerCase(ENGLISH).matches(objectNamePattern)) .collect(toImmutableList()); if (objectNames.isEmpty()) { return null; } List<JmxColumnHandle> columns = new ArrayList<>(); columns.add(new JmxColumnHandle(NODE_COLUMN_NAME, createUnboundedVarcharType())); columns.add(new JmxColumnHandle(OBJECT_NAME_NAME, createUnboundedVarcharType())); for (ObjectName objectName : objectNames) { MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(objectName); getColumnHandles(mbeanInfo).forEach(columns::add); } columns = columns.stream() .distinct() .sorted(comparing(JmxColumnHandle::getColumnName)) .collect(toImmutableList()); return new JmxTableHandle(tableName, objectNames.stream().map(ObjectName::toString).collect(toImmutableList()), columns, true); } catch (JMException e) { return null; } }
Source:
public int compareTo(FitnessAndQuality o) { if (fitness == o.fitness) { if (quality == o.quality) { return 0; } return quality < o.quality ? -1 : 1; } return fitness < o.fitness ? -1 : 1; }

Target:
public int compareTo(FitnessAndQuality o) { if (fitness == o.fitness) { if (quality == o.quality) { return 0; } else { return quality < o.quality ? -1 : 1; } } else { return fitness < o.fitness ? -1 : 1; } }
Source:
@Test public void finderThrowsLessNiceErrorInEditMode() { View view = new View(Robolectric.application); try { ButterKnife.Finder.VIEW.findRequiredView(view, android.R.id.button1, "yo mama"); } catch (IllegalStateException e) { assertThat(e).hasMessage("Required view '<unavailable while editing>' " + "with ID " + android.R.id.button1 + " for yo mama was not found. If this view is optional add '@Nullable' annotation."); } }

Target:
@Test public void finderThrowsLessNiceErrorInEditMode() { View view = new View(Robolectric.application); try { ButterKnife.Finder.VIEW.findRequiredView(view, android.R.id.button1, "yo mama"); fail("View 'button1' with ID " + android.R.id.button1 + " should not have been found."); } catch (IllegalStateException e) { assertThat(e).hasMessage("Required view '<unavailable while editing>' " + "with ID " + android.R.id.button1 + " for yo mama was not found. If this view is optional add '@Nullable' annotation."); } }