You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/12/18 06:44:52 UTC

[GitHub] liubao68 closed pull request #1030: [SCB-1074]minor fixes for mistakes and logs

liubao68 closed pull request #1030: [SCB-1074]minor fixes for mistakes and logs
URL: https://github.com/apache/servicecomb-java-chassis/pull/1030
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/RestCodec.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/RestCodec.java
index ac65d61a0..e93af56ed 100644
--- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/RestCodec.java
+++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/RestCodec.java
@@ -65,7 +65,7 @@ public static void argsToRest(Object[] args, RestOperationMeta restOperation,
 
       return paramValues;
     } catch (Exception e) {
-      LOG.error("Parameter is not valid for operation {}. ",
+      LOG.error("Parameter is not valid for operation {}. Message is {}.",
           restOperation.getOperationMeta().getMicroserviceQualifiedName(),
           ExceptionUtils.getExceptionMessageWithoutTrace(e));
       // give standard http error code for invalid parameter
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
index 90f3865da..2f0f14a23 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
@@ -51,7 +51,7 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration
     AddressResolverOptions addressResolverOptions = new AddressResolverOptions();
     addressResolverOptions
         .setServers(getStringListProperty(configSource,
-            AddressResolverOptions.DEFAULT_SEACH_DOMAINS,
+            AddressResolverOptions.DEFAULT_SERVERS,
             "addressResolver." + tag + ".servers",
             "addressResolver.servers"));
     addressResolverOptions
@@ -96,7 +96,7 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration
             "addressResolver.searchDomains"));
     addressResolverOptions
         .setNdots(getPositiveIntProperty(configSource,
-            AddressResolverOptions.DEFAULT_CACHE_MIN_TIME_TO_LIVE,
+            AddressResolverOptions.DEFAULT_NDOTS,
             "addressResolver." + tag + ".ndots",
             "addressResolver.ndots"));
     addressResolverOptions
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/task/MicroserviceWatchTask.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/task/MicroserviceWatchTask.java
index ab613786c..81d8d72a2 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/task/MicroserviceWatchTask.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/task/MicroserviceWatchTask.java
@@ -111,6 +111,11 @@ private void onMicroserviceInstanceChanged(MicroserviceInstanceChangedEvent chan
             changedEvent.getInstance().getEndpoints());
         break;
       default:
+        LOGGER.info("microservice {}/{}/{} UNKNOWN event action {}.",
+            changedEvent.getKey().getAppId(),
+            changedEvent.getKey().getServiceName(),
+            changedEvent.getKey().getVersion(),
+            changedEvent.getAction());
         break;
     }
 
diff --git a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/exception/ExceptionToProducerResponseConverters.java b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/exception/ExceptionToProducerResponseConverters.java
index d9f50da09..7b1d8ed97 100644
--- a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/exception/ExceptionToProducerResponseConverters.java
+++ b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/exception/ExceptionToProducerResponseConverters.java
@@ -22,8 +22,12 @@
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 import org.apache.servicecomb.swagger.invocation.Response;
 import org.apache.servicecomb.swagger.invocation.SwaggerInvocation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ExceptionToProducerResponseConverters {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionToProducerResponseConverters.class);
+
   private Map<Class<?>, ExceptionToProducerResponseConverter<Throwable>> exceptionToProducerResponseConverters =
       new HashMap<>();
 
@@ -60,6 +64,14 @@ public Response convertExceptionToResponse(SwaggerInvocation swaggerInvocation,
     if (converter == null) {
       converter = defaultConverter;
     }
-    return converter.convert(swaggerInvocation, e);
+    try {
+      return converter.convert(swaggerInvocation, e);
+    } catch (Throwable throwable) {
+      // In case users do not implement correctly and maybe discovered at runtime to cause asycResponse callback hang.
+      LOGGER
+          .error("ExceptionToProducerResponseConverter {} cannot throw exception, please fix it.", converter.getClass(),
+              throwable);
+      return Response.failResp(swaggerInvocation.getInvocationType(), e);
+    }
   }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services