Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 4678619

Browse files
committed
Fixed Null Pointer problem in RetailCustomerServiceImpl.
1 parent 4fc61a0 commit 4678619

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/energyos/espi/common/service/impl/RetailCustomerServiceImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,16 @@ public Subscription associateByUUID(Long retailCustomerId, UUID uuid) {
154154

155155
try {
156156
retailCustomer = resourceService.findById(retailCustomerId, RetailCustomer.class);
157-
158-
usagePoint = resourceService.findByUUID(uuid, UsagePoint.class);
159-
160-
if (usagePoint == null) {
157+
try {
158+
159+
usagePoint = resourceService.findByUUID(uuid, UsagePoint.class);
160+
161+
} catch (Exception e) {
161162

162163
usagePoint = new UsagePoint();
163164
usagePoint.setUUID(uuid);
164165
usagePoint.setDescription("A Temporary UsagePoint Description");
166+
usagePoint.setServiceCategory(new ServiceCategory(ServiceCategory.ELECTRICITY_SERVICE)) ;
165167
resourceService.persist(usagePoint);
166168

167169
}

0 commit comments

Comments
 (0)