This is an automated email from the ASF dual-hosted git repository.
vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 97cbb13 FINERACT-1004 Resolved NPE in
AddressWritePlatformServiceImpl.updateClientAddress()
97cbb13 is described below
commit 97cbb13c9cad077b7d4807bc3c8944b52094d9a0
Author: nnatarajan <[email protected]>
AuthorDate: Mon Jun 1 19:24:41 2020 -0600
FINERACT-1004 Resolved NPE in
AddressWritePlatformServiceImpl.updateClientAddress()
---
.../portfolio/address/service/AddressWritePlatformServiceImpl.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
index 1b98089..ec00d47 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
@@ -29,6 +29,7 @@ import
org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
import
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.address.domain.Address;
import org.apache.fineract.portfolio.address.domain.AddressRepository;
+import
org.apache.fineract.portfolio.address.exception.AddressNotFoundException;
import
org.apache.fineract.portfolio.address.serialization.AddressCommandFromApiJsonDeserializer;
import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.client.domain.ClientAddress;
@@ -183,6 +184,10 @@ public class AddressWritePlatformServiceImpl implements
AddressWritePlatformServ
final ClientAddress clientAddressObj =
this.clientAddressRepositoryWrapper
.findOneByClientIdAndAddressId(clientId, addressId);
+ if (clientAddressObj == null) {
+ throw new AddressNotFoundException(clientId);
+ }
+
final Address addobj = this.addressRepository.getOne(addressId);
if (!(command.stringValueOfParameterNamed("street").isEmpty())) {
@@ -281,10 +286,8 @@ public class AddressWritePlatformServiceImpl implements
AddressWritePlatformServ
final Boolean testActive =
command.booleanPrimitiveValueOfParameterNamed("isActive");
if (testActive != null) {
-
final boolean active =
command.booleanPrimitiveValueOfParameterNamed("isActive");
clientAddressObj.setIs_active(active);
-
}
return new
CommandProcessingResultBuilder().withCommandId(command.commandId())