使用UploadManager 上传文件 在定时任务中,执行如下代码
private String uploadFile(File file, String urlPath) {
String token = auth.uploadToken(urlPath);
try {
UploadManager uploadManager = new UploadManager();
System.out.println(file.isFile());
Response res = uploadManager.put(file, file.getName(), token);
MyRet ret = res.jsonToObject(MyRet.class);
log.info(res.toString());
log.info(res.bodyString());
if (StringUtils.isNotBlank(res.bodyString())) {
return Const.QINIU_URL + ret.key;
}
} catch (QiniuException e) {
log.info(e.getMessage());
} catch (Exception e) {
log.info(e.getMessage());
}
异常也没有显示也无法捕获到,在 UploadManager uploadManager = new UploadManager();
这句就报错了