服务器有的时候access log中报500错误
11 回复
@wendal 现在是只有access的log报500,其他没有错误,而且是偶尔出现这种情况
@wendal java这边没有报错,所以才诡异
@wendal @At("/upload")
@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" })
public Object upload(@Param("file") File file,
@Param("json") String json, @Param("type") String type) throws Exception {
String id = UuidMaker.getUuid();
if (!Strings.isBlank(json) && !Strings.isBlank(type)) {
Class<?> clazz = Class.forName(SysConfig.BUS_PACK_NAME+"." +type);
Object object = JSON.parseObject(json, clazz);
java.lang.reflect.Field field = clazz.getDeclaredField("id");
field.setAccessible(true);
field.set(object, id);
Object object2 = busService.insert(object);
if (object2 == null) {
return false;
}
}
if (!(file == null)) {
final String strfile = file.getAbsolutePath();
final File zipfile = new File(strfile);
String realPath = Mvcs.getServletContext().getRealPath(
"/resources/temp/");
final File agencyDir = new File(realPath);
if (!agencyDir.isDirectory()) {
agencyDir.mkdir();
}
ZipUtils.decompress(zipfile, agencyDir);
final File root = new File(agencyDir.toString());
final File[] files = root.listFiles();
for (File myfile : files) {
final String fName = myfile.getName();
/* 取得扩展名 */
final String end = fName.substring(fName.lastIndexOf(".") + 1,
fName.length()).toLowerCase();
if ("images".equals(FileType.getFileType(end))) {
final PicBean vo = new PicBean();
vo.setPic(FileUtil.dealWithImage(myfile));
vo.setBId(id);
final PicBean newVo = picService.insertPic(vo);
}
if ("video".equals(FileType.getFileType(end))) {
final VideoBean vo = new VideoBean();
vo.setVideo(FileUtil.dealWithVideo(myfile));
vo.setBId(id);
final VideoBean newVo = videoService.insertVideo(vo);
}
}
}
return true;
}
@wendal 是不是我抛出就不会报错?
@wendal 没有写@Ok和@Fail
@wendal 好,试试,谢谢
添加回复
请先登陆