fix validasi directory
This commit is contained in:
		| @@ -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()) | ||||
|   | ||||
| @@ -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()) | ||||
|   | ||||
| @@ -48,6 +48,10 @@ public class Constants { | ||||
|     public static final String ERR_TTL_10011 = "Proses Gagal"; | ||||
|     public static final String ERR_MSG_10011 = "Gagal decrypt password, masukkan password yg ter-encrypt"; | ||||
|  | ||||
|     public static final String ERR_CODE_10012 = "10012"; | ||||
|     public static final String ERR_TTL_10012 = "Proses Gagal"; | ||||
|     public static final String ERR_MSG_10012 = "Pastikan directori penimpanan file tersedia : %s"; | ||||
|  | ||||
|     public static final String ERR_CODE_40041 = "40041"; | ||||
|     public static final String ERR_TTL_40041 = "Terjadi Gangguan"; | ||||
|     public static final String ERR_MSG_40041 = "Masalah Koneksi System"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user