From 5cfc7e85c588967f7d7435b1408ccde230f11f0a Mon Sep 17 00:00:00 2001 From: Madhukar Date: Thu, 3 Jul 2014 12:06:12 +0530 Subject: [PATCH] MIFOSX-1396 Delete code displaying dataintegration issue --- .../CodeValueWritePlatformServiceJpaRepositoryImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java index cefecebf3..91c610d15 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java @@ -152,6 +152,9 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue .build(); } catch (final DataIntegrityViolationException dve) { logger.error(dve.getMessage(), dve); + final Throwable realCause = dve.getMostSpecificCause(); + if (realCause.getMessage().contains("code_value")) { throw new PlatformDataIntegrityException("error.msg.codeValue.in.use", + "This code value is in use", codeValueId); } throw new PlatformDataIntegrityException("error.msg.code.value.unknown.data.integrity.issue", "Unknown data integrity issue with resource: " + dve.getMostSpecificCause().getMessage()); }