全局过滤器的安装

在安装全局过滤器的时候,发现ImageFilter没有对应的ImageFilterBeanInfo,以至于后台会报


ERROR com.jdon.jivejdon.util.BeanUtils - java.lang.ClassNotFoundException: com.jdon.jivejdon.model.message.output.html.beaninfo.ImageFilterBeanInfo
这个错误。
这个问题如何解决了,是不是4.2版本把ImageFilter废弃掉了,改用UploadImageFilter了?
[该贴被weiweishouwang于2011-05-09 17:59修改过]

见项目的install.txt文档

这个问题的确存在,BeanUtils.java
中的方法getPropertyDescriptors
在加载beaninfo的时候少了一层beaninfo
com.jdon.jivejdon.model.message.output.html.HTMLFilterBeanInfo
应该是
com.jdon.jivejdon.model.message.output.html.beaninfo.HTMLFilterBeanInfo

我现在把这个方法改成
try {
String className=beanClass.getName();
FilterBeanInfo beanInfo = (FilterBeanInfo) Class.forName(className.substring(0,className.lastIndexOf("."))+".beaninfo"+className.substring(className.lastIndexOf("."))+ "BeanInfo").newInstance();
return beanInfo.getPropertyDescriptors();
} catch (Exception e) {
logger.error(e);
}
就可以了

的确是废掉了

install.txt文档里面关于过滤器的安装如下,包含了ImageFilter


起初设置要进入管理依据下面顺序安装下面过滤器:
1 HTMLFilter HTMLFilter
2 CodeHighlighter CodeHighlighter
3 TextStyle TextStyle
4 Newline Newline
5 URLConverter URLConverter
6 ImageFilter ImageFilter
7 Profanity Profanity
8 UploadImageFilter UploadImageFilter
9 UploadFileFilter UploadFileFilter
10 bodymasking
11 hotkeys
12 QuoteRegexFilter

BeanUtils.java中的方法getPropertyDescriptors
在加载beaninfo的时候少了一层beaninfo
com.jdon.jivejdon.model.message.output.html.HTMLFilterBeanInfo
应该是
com.jdon.jivejdon.model.message.output.html.beaninfo.HTMLFilterBeanInfo
改成

try {
String packageNm = beanClass.getPackage().getName();
FilterBeanInfo beanInfo = (FilterBeanInfo) Class.forName(packageNm + ".beaninfo." + beanClass.getSimpleName() + "BeanInfo").newInstance();
return beanInfo.getPropertyDescriptors();
} catch (Exception e) {
logger.error(e);
}

改之后,

ERROR com.jdon.jivejdon.util.BeanUtils - java.lang.ClassNotFoundException: com.jdon.jivejdon.model.message.output.html.beaninfo.ImageFilterBeanInfo

错误还在。
我感觉,确实废掉了ImageFilter。
可以把数据库里的那条ImageFilter数据删掉吗?
[该贴被weiweishouwang于2011-05-10 11:01修改过]

2011年05月10日 09:24 "@liuliu123"的内容
的确是废掉了 ...

我也觉得废掉了,谢谢了!

ImageFilter是用来作为显示图片的,和UploadImageFilter都需要啊。
ImageFilter是没有beanInfo,可是也不应该报错啊,要不你做一个beaninfo吧:


public class ImageFilterBeanInfo extends FilterBeanInfo {

public static final String[] PROPERTY_NAMES = new String[0];

public ImageFilterBeanInfo() {
super();
}

public Class getBeanClass() {
return ImageFilter.class;
}

public String[] getPropertyNames() {
return PROPERTY_NAMES;
}

public String getName() {
return "ImageFilter";
}

}