diff options
author | Alexis de Talhouët <adetalhouet89@gmail.com> | 2018-09-05 09:18:22 -0400 |
---|---|---|
committer | Alexis de Talhouët <adetalhouet89@gmail.com> | 2018-09-05 13:12:34 -0400 |
commit | 7df24c6223d040df3a13588932878c049e7cf584 (patch) | |
tree | 1bf163841946f531b70e8cc4aefb58f1e2a834a9 /netbox-client/provider/src/main | |
parent | a7268c8867a8363b9e67c99527af6b1f99e19608 (diff) |
Add missing agr and iterate on row
Change-Id: I65c34d1a059c12ec2c0fd7e76f0119571e175846
Issue-ID: CCSDK-341
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'netbox-client/provider/src/main')
-rw-r--r-- | netbox-client/provider/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImpl.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/netbox-client/provider/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImpl.java b/netbox-client/provider/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImpl.java index e7b5284ab..b54a35b50 100644 --- a/netbox-client/provider/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImpl.java +++ b/netbox-client/provider/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImpl.java @@ -64,7 +64,7 @@ public class NetboxClientImpl implements NetboxClient { private static final String ASSIGN_IP_SQL_STATEMENT = "INSERT INTO IPAM_IP_ASSIGNEMENT (service_instance_id, vf_module_id, prefix_id, ip_address_id, ip_address, ip_status, ip_response_json, external_key) \n" - + "VALUES (?, ?, ?, ?, ?, ?, ?)"; + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; private static final String UNASSIGN_IP_SQL_STATEMENT = "UPDATE IPAM_IP_ASSIGNEMENT SET ip_status = ? WHERE service_instance_id = ? AND external_key = ?"; private static final String GET_IP_ADDRESS_ID_SQL_STATEMENT = @@ -169,7 +169,11 @@ public class NetboxClientImpl implements NetboxClient { serviceInstanceId, externalKey); try (CachedRowSet row = dbLibService.getData(GET_IP_ADDRESS_ID_SQL_STATEMENT, args, null)) { - ipAddressId = row.getString("ip_address_id"); + if (row.next()) { + ipAddressId = row.getString("ip_address_id"); + } else { + throw new SQLException("Data not found."); + } } catch (SQLException e) { LOG.error(SQL_EXCEPTION_MESSAGE, e); return QueryStatus.FAILURE; |