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

BaseEntity.fetchUsers会报一个异常 #31

Closed
LiHaoGit opened this issue Dec 6, 2016 · 4 comments
Closed

BaseEntity.fetchUsers会报一个异常 #31

LiHaoGit opened this issue Dec 6, 2016 · 4 comments
Labels

Comments

@LiHaoGit
Copy link

LiHaoGit commented Dec 6, 2016

    public static List<String> fetchUsers(String str) {
        List<String> ats = new ArrayList<>();
        String pattern = "@";
        Pattern regex = Pattern.compile(pattern);
        Matcher regexMatcher = regex.matcher(str);
        while (regexMatcher.find()) {
            ats.add(regexMatcher.group(1));
        }
        return ats;
    }

我测试了一下,这里会报一个No group 1的异常

String test = "@dd 1 @dd 2"
BaseEntity.fetchUsers(test);
@atjiu
Copy link
Owner

atjiu commented Dec 6, 2016

修改了下正则 ,详见 2f0988a

@LiHaoGit
Copy link
Author

LiHaoGit commented Dec 6, 2016

另外https://github.com/tomoya92/pybbs/blob/master/src/main/java/cn/tomoya/common/BaseEntity.java#L26

这里的siteConfig为null吧,我这里获得的是一个null值

@atjiu
Copy link
Owner

atjiu commented Dec 6, 2016

@LiHaoGit 才发现,@功能没有做处理,明天我看看吧

@LiHaoGit
Copy link
Author

LiHaoGit commented Dec 6, 2016

@tomoya92 我发了一个pr去掉@了,并且把过过滤html的配置了一下,使用相对地址

@atjiu atjiu added the bug label Dec 9, 2016
@atjiu atjiu closed this as completed Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants