aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/zusammen-tools/src
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2017-12-31 10:32:59 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-01-02 09:48:22 +0000
commit5a0e6a563d39e6a7b48d6c2ad261520f0c39cb55 (patch)
treeb5b36b7f78f8397dc136e37fdc10fb828e553f87 /openecomp-be/tools/zusammen-tools/src
parentda5dfcd1a354807d13849c7f4ead535ccfa722fa (diff)
sonar issue fix - exception handling
remove exception handling which does nothing to handle the error Issue-ID: SDC-835 Change-Id: I45e0bc203e15b41f907641bfda130f20e1f00f54 Signed-off-by: shrek2000 <orenkle@amdocs.com>
Diffstat (limited to 'openecomp-be/tools/zusammen-tools/src')
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java19
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java7
-rw-r--r--openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java5
3 files changed, 15 insertions, 16 deletions
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
index b5486f57be..aac1202506 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
@@ -45,7 +45,7 @@ public final class ExportDataCommand {
public static final String JOIN_DELIMITER_SPLITTER = "\\$\\#";
public static final String MAP_DELIMITER = "!@";
public static final String MAP_DELIMITER_SPLITTER = "\\!\\@";
- public static final int THREAD_POOL_SIZE = 4;
+ public static final int THREAD_POOL_SIZE = 6;
private ExportDataCommand() {
}
@@ -56,7 +56,7 @@ public final class ExportDataCommand {
CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
initDir(rootDir);
- try(Session session = CassandraSessionFactory.getSession()) {
+ try (Session session = CassandraSessionFactory.getSession()) {
final Set<String> filteredItems = Sets.newHashSet(filterItem);
Set<String> fis = filteredItems.stream().map(fi -> fi.replaceAll("\\r", "")).collect(Collectors.toSet());
Map<String, List<String>> queries;
@@ -95,23 +95,28 @@ public final class ExportDataCommand {
}
- private static boolean executeQuery(final Session session, final String query, final Set<String> filteredItems, final String filteredColumn,
+ private static void executeQuery(final Session session, final String query, final Set<String> filteredItems, final String filteredColumn,
final Set<String> vlms, final CountDownLatch donequerying, Executor executor) {
ResultSetFuture resultSetFuture = session.executeAsync(query);
Futures.addCallback(resultSetFuture, new FutureCallback<ResultSet>() {
@Override
public void onSuccess(ResultSet resultSet) {
- new ExportSerializer().serializeResult(resultSet, filteredItems, filteredColumn, vlms);
- donequerying.countDown();
+ try {
+ Utils.printMessage(logger, "Start to serialize " + query);
+ new ExportSerializer().serializeResult(resultSet, filteredItems, filteredColumn, vlms);
+ donequerying.countDown();
+ } catch (Exception e){
+ Utils.logError(logger, "Serialization failed :" + query, e);
+ System.exit(-1);
+ }
}
@Override
public void onFailure(Throwable t) {
Utils.logError(logger, "Query failed :" + query, t);
- donequerying.countDown();
+ System.exit(-1);
}
}, executor);
- return true;
}
private static void zipPath(Path rootDir) throws IOException {
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
index 3c917b1c7e..0098f21eb2 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
@@ -52,8 +52,7 @@ public class ExportSerializer {
ColumnDefinition columnDefinition = tableData.definitions.get(i);
Name name = dataTypesMap.get(columnDefinition.getType());
boolean checkForVLM = isElementTable && columnDefinition.getName().equals(ELEMENT_INFO_COLUMN_NAME);
- Object data;
- data = convertByType(vlms, row, i, name, checkForVLM);
+ Object data = convertByType(vlms, row, i, name, checkForVLM);
rowData.add(data.toString());
}
tableData.rows.add(rowData);
@@ -128,7 +127,6 @@ public class ExportSerializer {
}
protected String extractVlm(String injson) {
- try {
if (injson == null){
return null;
}
@@ -145,8 +143,5 @@ public class ExportSerializer {
return null;
}
return vendorId.getAsString();
- } catch (Exception ex){
- return null;
- }
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java
index 7b43c4624f..a5a1ff2cbc 100644
--- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java
+++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java
@@ -33,11 +33,10 @@ public class VLMExtractTest {
}
- @Test
+ @Test(expectedExceptions = IllegalStateException.class)
public void failToExtractVLMBecauseJsonIsCorrupted(){
String elemenet_info_string = "gfhhhghgh";
- String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
- assertNull(extractedVlmId);
+ new CustomExportSerializer().extractVlm(elemenet_info_string);
}
private static final class CustomExportSerializer extends ExportSerializer{