aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java
index 1304fc24a7..85f9753634 100644
--- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java
+++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java
@@ -60,14 +60,15 @@ public class URNResource extends AbstractCockpitPluginResource{
public List<URNData> getUrnDataMap()
{
List<URNData> list = new ArrayList();
-
+ PreparedStatement psData = null;
+ ResultSet r = null;
try {
conn = getDBConnection();
- PreparedStatement psData = conn
+ psData = conn
.prepareStatement("select * from MSO_URN_MAPPING order by NAME_");
- ResultSet r = psData.executeQuery();
+ r = psData.executeQuery();
while(r.next())
{
@@ -78,14 +79,15 @@ public class URNResource extends AbstractCockpitPluginResource{
list.add(d);
}
-
- psData.close();
- conn.close();
} catch (Exception e)
{
e.printStackTrace();
+ } finally {
+ try { r.close(); } catch (Exception e) { /* ignored */ }
+ try { psData.close(); } catch (Exception e) { /* ignored */ }
+ try { conn.close(); } catch (Exception e) { /* ignored */ }
}
for(URNData d: list)
@@ -158,24 +160,26 @@ public class URNResource extends AbstractCockpitPluginResource{
nRow.setVer_("1");
final String myKey = key_;
final String myValue = value_;
-
+
+ PreparedStatement psData = null;
msoLogger.debug("----------- START ----------------------");
try {
conn = getDBConnection();
- PreparedStatement psData = conn
+ psData = conn
.prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')");
psData.executeUpdate();
- psData.close();
- conn.close();
//}
} catch (Exception e)
{
e.printStackTrace();
+ } finally {
+ try { psData.close(); } catch (Exception e) { /* ignored */ }
+ try { conn.close(); } catch (Exception e) { /* ignored */ }
}
// getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class);
}
@@ -184,21 +188,22 @@ public class URNResource extends AbstractCockpitPluginResource{
public void getPersistData(URNData d) {
//getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class);
-
+ PreparedStatement psData = null;
try {
conn = getDBConnection();
- PreparedStatement psData = conn
+ psData = conn
.prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'");
psData.executeUpdate();
- psData.close();
- conn.close();
} catch (Exception e)
{
e.printStackTrace();
+ } finally {
+ try { psData.close(); } catch (Exception e) { /* ignored */ }
+ try { conn.close(); } catch (Exception e) { /* ignored */ }
}
}