fix issue in ui load 61/61261/1
authorMichael Lando <ml636r@att.com>
Mon, 20 Aug 2018 10:45:55 +0000 (13:45 +0300)
committerMichael Lando <ml636r@att.com>
Mon, 20 Aug 2018 10:45:55 +0000 (13:45 +0300)
in case the plugin response is not valid json.

Change-Id: Ib58158def846c14e85325c521b9b210f61e03ba3
Issue-ID: SDC-1666
Signed-off-by: Michael Lando <ml636r@att.com>
catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
catalog-ui/src/app/ng2/services/config.service.ts

index 4d466b1..f4cbe9a 100644 (file)
@@ -7,6 +7,7 @@ import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpHead;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
+import org.openecomp.sdc.exception.InvalidArgumentException;
 import org.openecomp.sdc.fe.config.ConfigurationManager;
 import org.openecomp.sdc.fe.config.PluginsConfiguration;
 import org.openecomp.sdc.fe.config.PluginsConfiguration.Plugin;
@@ -45,6 +46,8 @@ public class PluginStatusBL {
 
                if (pluginsConfiguration == null || pluginsConfiguration.getPluginsList() == null) {
                        log.warn("Configuration of type {} was not found", PluginsConfiguration.class);
+                       throw new InvalidArgumentException("the plugin configuration was not read successfully.");
+
                } else {
                        log.debug("The value returned from getConfig is {}", pluginsConfiguration);
                        connectionTimeout = pluginsConfiguration.getConnectionTimeout();
index 4371236..271a3b2 100644 (file)
@@ -67,7 +67,7 @@ public class ConfigServlet extends LoggingServlet {
                } catch (Exception e) {
                        FeEcompErrorManager.getInstance().logFeHttpLoggingError("FE Response");
                        log.error("Unexpected FE response logging error :", e);
-                       return Response.status(Status.OK).entity(null).build();
+                       return Response.status(Status.INTERNAL_SERVER_ERROR).entity("{}").build();
                }
 
        }
index 1774a66..326f069 100644 (file)
@@ -1,9 +1,6 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright (c) 2018 AT&T Intellectual Property.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Created by ob0695 on 4/9/2017.
+ *
+ *
  */
 
 import { Injectable, Inject } from '@angular/core';
@@ -75,16 +69,14 @@ export class ConfigService {
         return new Promise<PluginsConfiguration>((resolve) => {
             promise.then((pluginsData: Plugins) => {
                 PluginsConfiguration.plugins = pluginsData;
-                console.log('RESOLVED PLUGINS!!!');
                 resolve();
             }).catch((ex) => {
-                console.error("Error loading plugins configuration from BE", ex);
+                console.warn("Error loading plugins configuration from FE", ex);
 
                 PluginsConfiguration.plugins = [] as Plugins;
+                resolve();
             });
         });
-
-        // return promise;
     }
 
 }