This is an automated email from the ASF dual-hosted git repository.
huxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new cb59913 Optimize code: Fix Constructor to determine illegal logic
problems (#3197)
cb59913 is described below
commit cb599135f99d20372d1c227814326df8995b37fc
Author: 于玉桔 <[email protected]>
AuthorDate: Sun Jan 20 09:34:47 2019 +0800
Optimize code: Fix Constructor to determine illegal logic problems (#3197)
---
.../src/main/java/org/apache/dubbo/common/utils/PojoUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
index 2198709..18998dc 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
@@ -520,7 +520,14 @@ public class PojoUtils {
} catch (Throwable t) {
try {
Constructor<?>[] constructors = cls.getDeclaredConstructors();
- if (constructors != null && constructors.length == 0) {
+ /**
+ * From Javadoc java.lang.Class#getDeclaredConstructors
+ * This method returns an array of Constructor objects
reflecting all the constructors
+ * declared by the class represented by this Class object.
+ * This method returns an array of length 0,
+ * if this Class object represents an interface, a primitive
type, an array class, or void.
+ */
+ if (constructors.length == 0) {
throw new RuntimeException("Illegal constructor: " +
cls.getName());
}
Constructor<?> constructor = constructors[0];