Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compartor exception in post list #2854

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

guqing
Copy link
Member

@guqing guqing commented Dec 6, 2022

What type of PR is this?

/kind bugfix
/area core

What this PR does / why we need it:

修复文章列表查询时的类型转换错误

文章列表查询将 collectList 错写为 collectSortedList 导致此 Contributor cannot be cast to class java.lang.Comparable
collectSortedList 会使用 Arrays.sort(a, (Comparator) c),这需要目标类实现 Comparable 才行,而此处并不需要自然排序。

Which issue(s) this PR fixes:

Fixes #2830

Special notes for your reviewer:

此 bug 的复现方式为:
编辑一篇文章保存后,在使用另一个用户账户编辑此文章并发布就会出现,而使用此 PR 后问题消失,此问题只对 Contributor 这个类型有效它不是自定义模型类,而 Tag 和 Category 都是自定义模型 继承了 AbstractExtension 而它 实现了 Comparable 接口。

/cc @halo-dev/sig-halo

Does this PR introduce a user-facing change?

修复文章列表查询时的类型转换错误

@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. area/core Issues or PRs related to the Halo Core labels Dec 6, 2022
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 6, 2022

@guqing: The label(s) kind/bugfix cannot be applied, because the repository doesn't have them.

In response to this:

What type of PR is this?

/kind bugfix
/area core

What this PR does / why we need it:

修复文章列表查询时的类型转换错误

文章列表查询将 collectList 错写为 collectSortedList 导致此 Contributor cannot be cast to class java.lang.Comparable
collectSortedList 会使用 Arrays.sort(a, (Comparator) c),这需要目标类实现 Comparable 才行,而此处并不需要自然排序。

Which issue(s) this PR fixes:

Fixes #2830

Special notes for your reviewer:

/cc @halo-dev/sig-halo

Does this PR introduce a user-facing change?

修复文章列表查询时的类型转换错误

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@guqing
Copy link
Member Author

guqing commented Dec 6, 2022

/kind bug

@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 6, 2022
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

成功复现,并通过此 PR 测试可以成功修复。

/lgtm

image

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2022
@ruibaby ruibaby added this to the 2.0.1 milestone Dec 6, 2022
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 6, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 6, 2022
@f2c-ci-robot f2c-ci-robot bot merged commit 14b210e into halo-dev:main Dec 6, 2022
@guqing guqing deleted the bugfix/2830 branch December 6, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

控制台文章查询列表报错
3 participants