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/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 5fd41d7 dubbox升级dubbo版本的兼容性问题 (#3996)
5fd41d7 is described below
commit 5fd41d7b27b8bfa4230df2dc48c7c0d57b0ef98c
Author: Ian Luo <[email protected]>
AuthorDate: Wed May 8 17:22:51 2019 +0800
dubbox升级dubbo版本的兼容性问题 (#3996)
Fixes #3537
---
.../main/java/org/apache/dubbo/common/Version.java | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java
index ffbc312..a015b44 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java
@@ -37,7 +37,7 @@ import java.util.regex.Pattern;
*/
public final class Version {
private static final Logger logger =
LoggerFactory.getLogger(Version.class);
-
+
private static final Pattern PREFIX_DIGITS_PATTERN =
Pattern.compile("^([0-9]*).*");
// Dubbo RPC protocol version, for compatibility, it must not be between
2.0.10 ~ 2.6.2
@@ -104,6 +104,11 @@ public final class Version {
return false;
}
+ // 2.8.x is reserved for dubbox
+ if (iVersion >= 2080000 && iVersion < 2090000) {
+ return false;
+ }
+
return iVersion >= LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT;
}
@@ -157,19 +162,19 @@ public final class Version {
return version;
}
}
-
+
// guess version fro jar file name if nothing's found from
MANIFEST.MF
CodeSource codeSource = cls.getProtectionDomain().getCodeSource();
if (codeSource == null) {
logger.info("No codeSource for class " + cls.getName() + "
when getVersion, use default version " + defaultVersion);
return defaultVersion;
- }
-
+ }
+
String file = codeSource.getLocation().getFile();
if (!StringUtils.isEmpty(file) && file.endsWith(".jar")) {
version = getFromFile(file);
}
-
+
// return default version if no version info is found
return StringUtils.isEmpty(version) ? defaultVersion : version;
} catch (Throwable e) {
@@ -185,19 +190,19 @@ public final class Version {
private static String getFromFile(String file) {
// remove suffix ".jar": "path/to/group-module-x.y.z"
file = file.substring(0, file.length() - 4);
-
+
// remove path: "group-module-x.y.z"
int i = file.lastIndexOf('/');
if (i >= 0) {
file = file.substring(i + 1);
}
-
+
// remove group: "module-x.y.z"
i = file.indexOf("-");
if (i >= 0) {
file = file.substring(i + 1);
}
-
+
// remove module: "x.y.z"
while (file.length() > 0 && !Character.isDigit(file.charAt(0))) {
i = file.indexOf("-");