From 46786198e218cf1c9e09e9f09a6b497da3af4d0e Mon Sep 17 00:00:00 2001 From: jateeter Date: Thu, 27 Feb 2014 12:26:41 -0500 Subject: [PATCH] Fixed Null Pointer problem in RetailCustomerServiceImpl. --- .../common/service/impl/RetailCustomerServiceImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/energyos/espi/common/service/impl/RetailCustomerServiceImpl.java b/src/main/java/org/energyos/espi/common/service/impl/RetailCustomerServiceImpl.java index 569234ac..5bc2a807 100755 --- a/src/main/java/org/energyos/espi/common/service/impl/RetailCustomerServiceImpl.java +++ b/src/main/java/org/energyos/espi/common/service/impl/RetailCustomerServiceImpl.java @@ -154,14 +154,16 @@ public Subscription associateByUUID(Long retailCustomerId, UUID uuid) { try { retailCustomer = resourceService.findById(retailCustomerId, RetailCustomer.class); - - usagePoint = resourceService.findByUUID(uuid, UsagePoint.class); - - if (usagePoint == null) { + try { + + usagePoint = resourceService.findByUUID(uuid, UsagePoint.class); + + } catch (Exception e) { usagePoint = new UsagePoint(); usagePoint.setUUID(uuid); usagePoint.setDescription("A Temporary UsagePoint Description"); + usagePoint.setServiceCategory(new ServiceCategory(ServiceCategory.ELECTRICITY_SERVICE)) ; resourceService.persist(usagePoint); }