You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2021/10/27 03:58:20 UTC

[servicecomb-java-chassis] branch master updated: [SCB-2350] When a new engine is created and delivered for the first time, the SDK reports an error null pointer. (#2627)

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a16a1e  [SCB-2350] When a new engine is created and delivered for the first time, the SDK reports an error null pointer. (#2627)
4a16a1e is described below

commit 4a16a1ec85d234f656eaa24b337b84ee4ee03cd8
Author: zyl <72...@users.noreply.github.com>
AuthorDate: Wed Oct 27 11:58:14 2021 +0800

    [SCB-2350] When a new engine is created and delivered for the first time, the SDK reports an error null pointer. (#2627)
---
 .../kie/client/model/ConfigurationsRequest.java    |  3 +-
 .../client/model/ConfigurationsRequestTest.java    | 33 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java
index cbf9647..549ac24 100644
--- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java
+++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequest.java
@@ -17,6 +17,7 @@
 
 package org.apache.servicecomb.config.kie.client.model;
 
+import java.util.HashMap;
 import java.util.Map;
 
 public class ConfigurationsRequest implements Comparable<ConfigurationsRequest> {
@@ -30,7 +31,7 @@ public class ConfigurationsRequest implements Comparable<ConfigurationsRequest>
 
   private String labelsQuery;
 
-  private Map<String, Object> lastRawData;
+  private Map<String, Object> lastRawData = new HashMap<>();
 
   public int getOrder() {
     return order;
diff --git a/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequestTest.java b/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequestTest.java
new file mode 100644
index 0000000..39701a4
--- /dev/null
+++ b/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/ConfigurationsRequestTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+
+package org.apache.servicecomb.config.kie.client.model;
+
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+
+class ConfigurationsRequestTest {
+
+  @Test
+  void getLastRawData() {
+    ConfigurationsRequest configurationsRequest = new ConfigurationsRequest();
+    Map<String, Object> lastRawData = configurationsRequest.getLastRawData();
+    Assert.assertEquals(lastRawData.size(), 0);
+  }
+}
\ No newline at end of file