Merge branch 'hotfix/printstack_to_log_error_1014' into 'master'
hotfix: (e.printStack优化成log.error) See merge request universal/infrastructure/backend/oss!158
This commit is contained in:
commit
69420e7051
@ -211,7 +211,7 @@ public class WebFileController {
|
|||||||
response.addHeader("Content-Disposition", "attachment;filename=" + result.getFileName() + "." + result.getFileFormat());
|
response.addHeader("Content-Disposition", "attachment;filename=" + result.getFileName() + "." + result.getFileFormat());
|
||||||
IOUtils.copy(inputStream, outputStream);
|
IOUtils.copy(inputStream, outputStream);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("WebFileController#download exception", e);
|
||||||
} finally {
|
} finally {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|||||||
@ -181,7 +181,6 @@ public class AliOssServiceImpl implements AliOssService {
|
|||||||
// 返回uploadId,它是分片上传事件的唯一标识,您可以根据这个uploadId发起相关的操作,如取消分片上传、查询分片上传等。
|
// 返回uploadId,它是分片上传事件的唯一标识,您可以根据这个uploadId发起相关的操作,如取消分片上传、查询分片上传等。
|
||||||
return result.getUploadId();
|
return result.getUploadId();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
LogUtil.error("ali oss multipart upload init error = {}", e);
|
LogUtil.error("ali oss multipart upload init error = {}", e);
|
||||||
throw new BizException(MULTIPART_UPLOAD_INIT_ERROR);
|
throw new BizException(MULTIPART_UPLOAD_INIT_ERROR);
|
||||||
}
|
}
|
||||||
@ -211,7 +210,7 @@ public class AliOssServiceImpl implements AliOssService {
|
|||||||
// 每次上传分片之后,OSS的返回结果包含PartETag。
|
// 每次上传分片之后,OSS的返回结果包含PartETag。
|
||||||
return uploadPartResult.getPartETag();
|
return uploadPartResult.getPartETag();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("AliOssService#multipartUpload exception", e);
|
||||||
throw new BizException(MULTIPART_UPLOAD_ERROR);
|
throw new BizException(MULTIPART_UPLOAD_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,7 +265,7 @@ public class AliOssServiceImpl implements AliOssService {
|
|||||||
client.completeMultipartUpload(completeMultipartUploadRequest);
|
client.completeMultipartUpload(completeMultipartUploadRequest);
|
||||||
return getUrl(bucketName, tgtFileKey);
|
return getUrl(bucketName, tgtFileKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("AliOssService#multipartUploadFile exception", e);
|
||||||
throw new BizException(MULTIPART_UPLOAD_ERROR);
|
throw new BizException(MULTIPART_UPLOAD_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +279,7 @@ public class AliOssServiceImpl implements AliOssService {
|
|||||||
client.completeMultipartUpload(completeMultipartUploadRequest);
|
client.completeMultipartUpload(completeMultipartUploadRequest);
|
||||||
return getUrl(bucketName, tgtFileKey);
|
return getUrl(bucketName, tgtFileKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("AliOssService#multipartUploadComplete exception", e);
|
||||||
throw new BizException(MULTIPART_UPLOAD_COMPLETE_ERROR);
|
throw new BizException(MULTIPART_UPLOAD_COMPLETE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
* @author: mr.jie
|
* @author: mr.jie
|
||||||
* @date: 2021-07-29 18:42
|
* @date: 2021-07-29 18:42
|
||||||
**/
|
**/
|
||||||
|
@Slf4j
|
||||||
public class FileServiceTest extends SpringTestBase {
|
public class FileServiceTest extends SpringTestBase {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -44,9 +47,9 @@ public class FileServiceTest extends SpringTestBase {
|
|||||||
try (FileInputStream fileInputStream = new FileInputStream(file)) {
|
try (FileInputStream fileInputStream = new FileInputStream(file)) {
|
||||||
fileInputStream.read(bytes);
|
fileInputStream.read(bytes);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
log.error("upload FileNotFoundException", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("upload IOException", e);
|
||||||
}
|
}
|
||||||
// System.out.println(Arrays.toString(bytes));
|
// System.out.println(Arrays.toString(bytes));
|
||||||
dto.setFileContent(bytes);
|
dto.setFileContent(bytes);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user