[dubbo] branch master updated: fix NPE when check=false is set and provider is empty. (#6376)

2020-06-28 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 7447f33  fix NPE when check=false is set and provider is empty. (#6376)
7447f33 is described below

commit 7447f3372d960ce9d73331ad6c16d34448853b51
Author: ken.lj 
AuthorDate: Sun Jun 28 22:18:03 2020 +0800

fix NPE when check=false is set and provider is empty. (#6376)

fixes #6228
---
 .../src/main/java/org/apache/dubbo/rpc/model/ConsumerModel.java| 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ConsumerModel.java 
b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ConsumerModel.java
index 9dca2e8..e49888d 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ConsumerModel.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ConsumerModel.java
@@ -138,7 +138,12 @@ public class ConsumerModel {
 }
 
 public void initMethodModels() {
-Class[] interfaceList = 
serviceMetadata.getTarget().getClass().getInterfaces();
+Class[] interfaceList = null;
+if (proxyObject == null) {
+interfaceList = new Class[]{referenceConfig.getActualInterface()};
+} else {
+interfaceList = proxyObject.getClass().getInterfaces();
+}
 for (Class interfaceClass : interfaceList) {
 for (Method method : interfaceClass.getMethods()) {
 methodModels.put(method, new ConsumerMethodModel(method));



[dubbo-hessian-lite] 01/01: whitelist patch

2020-06-28 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch whitelist
in repository https://gitbox.apache.org/repos/asf/dubbo-hessian-lite.git

commit 7e34368fbf3eed6ce24350d9faed871f82976d8a
Author: ken.lj 
AuthorDate: Sun Jun 28 22:19:19 2020 +0800

whitelist patch
---
 pom.xml|   2 +-
 .../com/caucho/hessian/io/BasicDeserializer.java   |   5 +
 .../com/caucho/hessian/io/ClassFactory.java| 174 +
 .../caucho/hessian/io/CollectionDeserializer.java  |   5 +
 .../com/caucho/hessian/io/SerializerFactory.java   |  22 ++-
 5 files changed, 206 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 51633fd..80e32d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
 com.alibaba
 hessian-lite
 jar
-3.2.7
+3.2.8-SNAPSHOT
 Hessian Lite(Dubbo embed version)
 
 
diff --git 
a/src/main/java/com/alibaba/com/caucho/hessian/io/BasicDeserializer.java 
b/src/main/java/com/alibaba/com/caucho/hessian/io/BasicDeserializer.java
index dc631e5..81146ca 100644
--- a/src/main/java/com/alibaba/com/caucho/hessian/io/BasicDeserializer.java
+++ b/src/main/java/com/alibaba/com/caucho/hessian/io/BasicDeserializer.java
@@ -607,4 +607,9 @@ public class BasicDeserializer extends AbstractDeserializer 
{
 throw new UnsupportedOperationException(String.valueOf(this));
 }
 }
+
+public String toString()
+{
+return getClass().getSimpleName() + "[" + _code + "]";
+}
 }
diff --git a/src/main/java/com/alibaba/com/caucho/hessian/io/ClassFactory.java 
b/src/main/java/com/alibaba/com/caucho/hessian/io/ClassFactory.java
new file mode 100644
index 000..b7a3775
--- /dev/null
+++ b/src/main/java/com/alibaba/com/caucho/hessian/io/ClassFactory.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2001-2004 Caucho Technology, Inc.  All rights reserved.
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *any, must include the following acknowlegement:
+ *   "This product includes software developed by the
+ *Caucho Technology (http://www.caucho.com/)."
+ *Alternately, this acknowlegement may appear in the software itself,
+ *if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "Hessian", "Resin", and "Caucho" must not be used to
+ *endorse or promote products derived from this software without prior
+ *written permission. For written permission, please contact
+ *i...@caucho.com.
+ *
+ * 5. Products derived from this software may not be called "Resin"
+ *nor may "Resin" appear in their names without prior written
+ *permission of Caucho Technology.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL CAUCHO TECHNOLOGY OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @author Scott Ferguson
+ */
+
+package com.alibaba.com.caucho.hessian.io;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.regex.Pattern;
+
+/**
+ * Loads a class from the classloader.
+ */
+public class ClassFactory
+{
+private static ArrayList _staticAllowList;
+
+private ClassLoader _loader;
+private boolean _isWhitelist;
+
+private ArrayList _allowList;
+
+ClassFactory(ClassLoader loader)
+{
+_loader = loader;
+}
+
+public Class load(String className)
+throws ClassNotFoundException
+{
+if (isAllow(className)) {
+return Class.forName(className, false, _loader);
+}
+else {
+return HashMap.class;
+}
+}
+
+private boolean isAllow(String className)
+{
+ArrayList allowList = _allowList;
+
+if (allowList == null) {
+

[dubbo-hessian-lite] branch whitelist created (now 7e34368)

2020-06-28 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a change to branch whitelist
in repository https://gitbox.apache.org/repos/asf/dubbo-hessian-lite.git.


  at 7e34368  whitelist patch

This branch includes the following new commits:

 new 7e34368  whitelist patch

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[dubbo-go] branch develop updated (2550126 -> 89e3bee)

2020-06-28 Thread joezou
This is an automated email from the ASF dual-hosted git repository.

joezou pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git.


from 2550126  Merge pull request #613 from wenxuwan/master
 new 1cdcf0b  Fix: code linter warnings
 new 51df26a  Mod: split long string at grpc_invoker_test.go
 new 89e3bee  Merge pull request #628 from 
watermelo/feature/optCodesForProtocolDir

The 2230 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 protocol/dubbo/client_test.go  | 37 --
 protocol/dubbo/codec_test.go   |  2 +-
 protocol/dubbo/dubbo_invoker_test.go   |  4 +--
 protocol/dubbo/dubbo_protocol_test.go  | 30 --
 protocol/grpc/common_test.go   |  2 +-
 protocol/grpc/grpc_invoker_test.go | 10 +-
 protocol/grpc/grpc_protocol_test.go|  8 ++---
 protocol/jsonrpc/http_test.go  | 16 ++
 protocol/jsonrpc/json.go   | 12 +++
 protocol/jsonrpc/json_test.go  |  8 ++---
 protocol/jsonrpc/jsonrpc_invoker_test.go   |  2 +-
 protocol/jsonrpc/jsonrpc_protocol_test.go  |  4 +--
 protocol/protocolwrapper/mock_protocol_filter.go   |  2 +-
 .../protocol_filter_wrapper_test.go|  4 +--
 protocol/rest/client/client_impl/resty_client.go   |  2 +-
 .../rest/config/reader/rest_config_reader_test.go  |  4 +--
 protocol/rest/rest_invoker_test.go | 16 ++
 protocol/rest/rest_protocol_test.go| 16 +++---
 protocol/rpc_status.go |  4 +--
 protocol/rpc_status_test.go| 20 +++-
 20 files changed, 106 insertions(+), 97 deletions(-)



[dubbo] branch master updated: fix #6306. support TypeBuilder sort (#6365)

2020-06-28 Thread mercyblitz
This is an automated email from the ASF dual-hosted git repository.

mercyblitz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 80acc24  fix #6306.  support TypeBuilder sort (#6365)
80acc24 is described below

commit 80acc241da3dd50f4eb66cc1b8ae7e2a88d9fe2c
Author: cvictory 
AuthorDate: Mon Jun 29 14:42:23 2020 +0800

fix #6306.  support TypeBuilder sort (#6365)

* fix #6306. support TypeBuilder sort

* fix #6306. support TypeBuilder sort

* fix #6306. support TypeBuilder sort

* remove unused import

* add license for test file
---
 .../metadata/definition/TypeDefinitionBuilder.java | 10 +++
 .../metadata/definition/builder/TypeBuilder.java   |  3 ++-
 .../metadata/definition/Test3TypeBuilder.java} | 30 +++--
 .../metadata/definition/TestTypeBuilder.java}  | 30 +++--
 .../definition/TypeDefinitionBuilderTest.java} | 31 +-
 ...e.dubbo.metadata.definition.builder.TypeBuilder |  2 ++
 6 files changed, 52 insertions(+), 54 deletions(-)

diff --git 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilder.java
 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilder.java
index d1275e7..fe99d2e 100755
--- 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilder.java
+++ 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilder.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import static org.apache.dubbo.common.utils.ClassUtils.isSimpleType;
 
@@ -36,15 +37,12 @@ import static 
org.apache.dubbo.common.utils.ClassUtils.isSimpleType;
  */
 public class TypeDefinitionBuilder {
 private static final Logger logger = 
LoggerFactory.getLogger(TypeDefinitionBuilder.class);
-private static final List BUILDERS;
+static final List BUILDERS;
 
 static {
-List builders = new ArrayList<>();
 ExtensionLoader extensionLoader = 
ExtensionLoader.getExtensionLoader(TypeBuilder.class);
-for (String extensionName : extensionLoader.getSupportedExtensions()) {
-builders.add(extensionLoader.getExtension(extensionName));
-}
-BUILDERS = builders;
+Set tbs = 
extensionLoader.getSupportedExtensionInstances();
+BUILDERS = new ArrayList<>(tbs);
 }
 
 public static TypeDefinition build(Type type, Class clazz, 
Map, TypeDefinition> typeCache) {
diff --git 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
index d7022bd..57673fe 100755
--- 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
+++ 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
@@ -17,6 +17,7 @@
 package org.apache.dubbo.metadata.definition.builder;
 
 import org.apache.dubbo.common.extension.SPI;
+import org.apache.dubbo.common.lang.Prioritized;
 import org.apache.dubbo.metadata.definition.model.TypeDefinition;
 
 import java.lang.reflect.Type;
@@ -26,7 +27,7 @@ import java.util.Map;
  * 2015/1/27.
  */
 @SPI
-public interface TypeBuilder {
+public interface TypeBuilder extends Prioritized {
 
 /**
  * Whether the build accept the type or class passed in.
diff --git 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
 
b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/Test3TypeBuilder.java
old mode 100755
new mode 100644
similarity index 63%
copy from 
dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
copy to 
dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/Test3TypeBuilder.java
index d7022bd..075a69e
--- 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/builder/TypeBuilder.java
+++ 
b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/Test3TypeBuilder.java
@@ -14,28 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.metadata.definition.builder;
+package org.apache.dubbo.metadata.definition;
 
-import org.apache.dubbo.common.extension.SPI;
+import org.apache.dubbo.metadata.definition.builder.TypeBuilder;
 import org.apache.dubbo.metadata.definition.model.TypeDefinition;
 
 import java.l