2022-06-05 18:48
@杜福忠 (jfinal 4.9.16 + cos 2022.2) 或 (jfinal 4.9.19 + cos 2020.4) 都报同样的错误。
jfinal 4.9.16 + cos 2020.4 不报错
2022-06-05 11:53
前端js
// 上传文件
function sendFile(file, obj) {
var data = new FormData();
data.append("file", file);
data.append("uploadType", 'article');
data.append("action", "uploadimage");
$.ajax({
type: "POST",
url: ctx + "common/upload/uploadImage",//ctx + "/tool/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$(obj).summernote('editor.insertImage', result.url, result.fileName);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
2022-06-04 11:34
参数result是null时,CaffeineKit put会报错。
参考j2cache做法,做了如下调整:传入null值时,生成1个空对象
CaffeineKit:
public static void put(String cacheName, Object key, Object value) {
getOrAddCache(cacheName).put(key, (null == value)? newNullObject() : value);
}
private static NullObject newNullObject() {
return new NullObject();
}
NullObject:
public class NullObject implements Serializable {
}