fix validasi directory

This commit is contained in:
dirgantarasiahaan
2023-05-30 15:35:28 +07:00
parent 9399ceec36
commit ff2a77032f
3 changed files with 23 additions and 10 deletions

View File

@ -40,10 +40,16 @@ public class PostDrpUploadDokumenPendukungService implements BaseService<DrpDoku
File path = new File(pathFileUploadPendukung + fileName);
path.createNewFile();
FileOutputStream output = new FileOutputStream(path);
output.write(file.getBytes());
output.close();
try {
FileOutputStream output = new FileOutputStream(path);
output.write(file.getBytes());
output.close();
} catch (Exception ex) {
throw new BusinessException(Constants.ERR_CODE_10012,
Constants.ERR_TTL_10012,
String.format(Constants.ERR_MSG_10012, pathFileUploadPendukung));
}
return DrpDokumenResponse.builder()
.jenisDokumenId(input.getJenisDokumenId())

View File

@ -1,9 +1,7 @@
package com.iconplus.smartproc.service.drp;
import com.iconplus.smartproc.exception.BusinessException;
import com.iconplus.smartproc.helper.model.EmptyResponse;
import com.iconplus.smartproc.helper.service.BaseService;
import com.iconplus.smartproc.model.entity.DrpDokumen;
import com.iconplus.smartproc.model.request.DrpDokumenRequest;
import com.iconplus.smartproc.model.response.DrpDokumenResponse;
import com.iconplus.smartproc.repository.DrpDokumenRepository;
@ -42,10 +40,15 @@ public class PostDrpUploadDokumenRKAPService implements BaseService<DrpDokumenRe
File path = new File(pathFileUploadRkap + fileName);
path.createNewFile();
FileOutputStream output = new FileOutputStream(path);
output.write(file.getBytes());
output.close();
try {
FileOutputStream output = new FileOutputStream(path);
output.write(file.getBytes());
output.close();
} catch (Exception ex) {
throw new BusinessException(Constants.ERR_CODE_10012,
Constants.ERR_TTL_10012,
String.format(Constants.ERR_MSG_10012, pathFileUploadRkap));
}
return DrpDokumenResponse.builder()
.jenisDokumenId(input.getJenisDokumenId())