diff options
Diffstat (limited to 'src')
7 files changed, 33 insertions, 30 deletions
diff --git a/src/main/java/org/openecomp/sparky/config/oxm/OxmModelLoader.java b/src/main/java/org/openecomp/sparky/config/oxm/OxmModelLoader.java index 8a2cc6e..2a19551 100644 --- a/src/main/java/org/openecomp/sparky/config/oxm/OxmModelLoader.java +++ b/src/main/java/org/openecomp/sparky/config/oxm/OxmModelLoader.java @@ -50,7 +50,6 @@ import org.openecomp.sparky.logging.AaiUiMsgs; import org.openecomp.sparky.synchronizer.entity.SuggestionSearchEntity; import org.openecomp.sparky.viewandinspect.config.TierSupportUiConstants; - /** * The Class OxmModelLoader. */ @@ -133,27 +132,24 @@ public class OxmModelLoader { */ public void loadModel(String version) { String fileName = loadOxmFileName(version); - InputStream inputStream; - try { - inputStream = new FileInputStream(new File(fileName)); - } catch (FileNotFoundException fnf) { - LOG.info(AaiUiMsgs.OXM_READ_ERROR_NONVERBOSE); - LOG.error(AaiUiMsgs.OXM_READ_ERROR_VERBOSE, fileName); - return; - } - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, inputStream); - try { - final DynamicJAXBContext oxmContext = DynamicJAXBContextFactory - .createContextFromOXM(Thread.currentThread().getContextClassLoader(), properties); + try(FileInputStream inputStream = new FileInputStream(new File(fileName))) { + Map<String, Object> properties = new HashMap<String, Object>(); + properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, inputStream); - parseOxmContext(oxmContext); - // populateSearchableOxmModel(); - LOG.info(AaiUiMsgs.OXM_LOAD_SUCCESS); + final DynamicJAXBContext oxmContext = DynamicJAXBContextFactory + .createContextFromOXM(Thread.currentThread() + .getContextClassLoader(), properties); + parseOxmContext(oxmContext); + // populateSearchableOxmModel(); + LOG.info(AaiUiMsgs.OXM_LOAD_SUCCESS); + + } catch (FileNotFoundException fnf) { + LOG.info(AaiUiMsgs.OXM_READ_ERROR_NONVERBOSE); + LOG.error(AaiUiMsgs.OXM_READ_ERROR_VERBOSE, fileName); } catch (Exception exc) { - LOG.info(AaiUiMsgs.OXM_PARSE_ERROR_NONVERBOSE); - LOG.error(AaiUiMsgs.OXM_PARSE_ERROR_VERBOSE, fileName, exc.getMessage()); + LOG.info(AaiUiMsgs.OXM_PARSE_ERROR_NONVERBOSE); + LOG.error(AaiUiMsgs.OXM_PARSE_ERROR_VERBOSE, fileName, exc.getMessage()); } } diff --git a/src/main/java/org/openecomp/sparky/synchronizer/AggregationSynchronizer.java b/src/main/java/org/openecomp/sparky/synchronizer/AggregationSynchronizer.java index 2d7429c..2fd67c3 100644 --- a/src/main/java/org/openecomp/sparky/synchronizer/AggregationSynchronizer.java +++ b/src/main/java/org/openecomp/sparky/synchronizer/AggregationSynchronizer.java @@ -632,6 +632,7 @@ public class AggregationSynchronizer extends AbstractEntitySynchronizer "Could not deserialize JSON (representing operation result) as node tree. " + "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage(); LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message); + return; } JsonNode resultData = rootNode.get("result-data"); diff --git a/src/main/java/org/openecomp/sparky/synchronizer/CrossEntityReferenceSynchronizer.java b/src/main/java/org/openecomp/sparky/synchronizer/CrossEntityReferenceSynchronizer.java index c825040..1e3e85c 100644 --- a/src/main/java/org/openecomp/sparky/synchronizer/CrossEntityReferenceSynchronizer.java +++ b/src/main/java/org/openecomp/sparky/synchronizer/CrossEntityReferenceSynchronizer.java @@ -338,7 +338,10 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer try { rootNode = mapper.readTree(jsonResult); } catch (IOException exc) { - // TODO // TODO -> LOG, waht should be logged here? + String message = "Could not deserialize JSON (representing operation result) as node tree. " + + "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage(); + LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message); + return; } JsonNode resultData = rootNode.get("result-data"); @@ -576,7 +579,7 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer } } else { - String message = "Entity sync failed because AAI query failed with error " + aaiQueryResult.getResult(); + String message = "Entity sync failed because AAI query failed with error "; LOG.error(AaiUiMsgs.ENTITY_SYNC_FAILED_QUERY_ERROR, message); } diff --git a/src/main/java/org/openecomp/sparky/synchronizer/ElasticSearchIndexCleaner.java b/src/main/java/org/openecomp/sparky/synchronizer/ElasticSearchIndexCleaner.java index b23764c..9ef4fe6 100644 --- a/src/main/java/org/openecomp/sparky/synchronizer/ElasticSearchIndexCleaner.java +++ b/src/main/java/org/openecomp/sparky/synchronizer/ElasticSearchIndexCleaner.java @@ -521,11 +521,6 @@ public class ElasticSearchIndexCleaner implements IndexCleaner { } JsonNode rootNode = parseElasticSearchResult(opResult.getResult()); - boolean timedOut = Boolean.parseBoolean(getFieldValue(rootNode, "timed_out")); - final String tookStr = getFieldValue(rootNode, "took"); - int tookInMs = (tookStr == null) ? 0 : Integer.parseInt(tookStr); - - JsonNode hitsNode = rootNode.get("hits"); /* * Check the result for success / failure, and enumerate all the index ids that resulted in @@ -533,6 +528,11 @@ public class ElasticSearchIndexCleaner implements IndexCleaner { */ if (rootNode != null) { + boolean timedOut = Boolean.parseBoolean(getFieldValue(rootNode, "timed_out")); + final String tookStr = getFieldValue(rootNode, "took"); + int tookInMs = (tookStr == null) ? 0 : Integer.parseInt(tookStr); + + JsonNode hitsNode = rootNode.get("hits"); if (timedOut) { LOG.info(AaiUiMsgs.COLLECT_TIME_WITH_ERROR, "Scroll Context", String.valueOf(tookInMs)); @@ -576,6 +576,9 @@ public class ElasticSearchIndexCleaner implements IndexCleaner { } } + } else { + // scroll context get failed, nothing else to do + LOG.error(AaiUiMsgs.ERROR_GENERIC, opResult.toString()); } return OperationState.OK; diff --git a/src/main/java/org/openecomp/sparky/synchronizer/GeoSynchronizer.java b/src/main/java/org/openecomp/sparky/synchronizer/GeoSynchronizer.java index c8d3b95..493f3c9 100644 --- a/src/main/java/org/openecomp/sparky/synchronizer/GeoSynchronizer.java +++ b/src/main/java/org/openecomp/sparky/synchronizer/GeoSynchronizer.java @@ -250,6 +250,7 @@ public class GeoSynchronizer extends AbstractEntitySynchronizer implements Index rootNode = mapper.readTree(jsonResult); } catch (IOException exc) { LOG.error(AaiUiMsgs.ERROR_GENERIC, exc); + return; } JsonNode resultData = rootNode.get("result-data"); diff --git a/src/main/java/org/openecomp/sparky/viewandinspect/entity/ActiveInventoryNode.java b/src/main/java/org/openecomp/sparky/viewandinspect/entity/ActiveInventoryNode.java index aef710d..fc0f074 100644 --- a/src/main/java/org/openecomp/sparky/viewandinspect/entity/ActiveInventoryNode.java +++ b/src/main/java/org/openecomp/sparky/viewandinspect/entity/ActiveInventoryNode.java @@ -166,7 +166,7 @@ public class ActiveInventoryNode { public void addQueryParams(Collection<String> params) { - if (params != null & params.size() > 0) { + if (params != null && !params.isEmpty()) { for (String param : params) { addQueryParam(param); diff --git a/src/main/java/org/openecomp/sparky/viewandinspect/services/VisualizationService.java b/src/main/java/org/openecomp/sparky/viewandinspect/services/VisualizationService.java index 63d4e59..e3f57aa 100644 --- a/src/main/java/org/openecomp/sparky/viewandinspect/services/VisualizationService.java +++ b/src/main/java/org/openecomp/sparky/viewandinspect/services/VisualizationService.java @@ -347,10 +347,9 @@ public class VisualizationService { try { output = transformer .generateVisualizationOutput((System.currentTimeMillis() - opStartTimeInMs), graphMeta); - } catch (JsonProcessingException exc) { - throw new ServletException("Caught an exception while generation visualization output", exc); - } catch (IOException exc) { + } catch (Exception exc) { LOG.error(AaiUiMsgs.FAILURE_TO_PROCESS_REQUEST, exc.getLocalizedMessage()); + throw new ServletException("Caught an exception while generation visualization output", exc); } output.setInlineMessage(visContext.getInlineMessage()); |