NutzCN Logo
问答 我按照入门手册写的,log.info报错
发布于 2663天前 作者 qq_1f9f8282 3336 次浏览 复制 上一个帖子 下一个帖子
标签:
	@AdaptBy(type=UploadAdaptor.class, args={"${app.root}/WEB-INF/tmp/user_avatar", "8192", "utf-8", "20000", "102400"})
	@POST
	@Ok(">>:/user/profile")
	@At("/avatar")
	public void uploadAvatar(@Param("file")TempFile tf, @Attr(scope=Scope.SESSION, value="me")int userId, AdaptorErrorContext err) {
		String msg = null;
		if (err != null && err.getAdaptorErr() != null) {
			msg = "文件大小不符合规定!";
		} else if (tf == null) {
			msg = "空文件";
		} else {
			UserProfile profile = get(userId);
			try{
				BufferedImage image = Images.read(tf.getFile());
				image = Images.zoomScale(image, 128, 128);
				ByteArrayOutputStream out = new ByteArrayOutputStream();
                Images.writeJpeg(image, out, 0.8f);
                profile.setAvatar(out.toByteArray());
                dao.update(profile, "^avatar$");
			} catch(DaoException e) {
				log.info("System Error", e);
                msg = "系统错误";
			} catch (Throwable e) {
				msg = "图片格式错误";
			}
		}
		
		if (msg != null)
            Mvcs.getHttpSession().setAttribute("upload-error-msg", msg);
	}
4 回复

log cannot be resolved

加入下列属性,均导入nutz的类

private static final Log log = Logs.get();

添加回复
请先登陆
回到顶部