Merge branch 'apache-3.1' into apache-3.2

This commit is contained in:
Albumen Kevin 2022-10-23 12:16:15 +08:00
commit 5dedd53db4
5 changed files with 23 additions and 25 deletions

View File

@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.0
ref: "3.0"
- name: Check License
uses: apache/skywalking-eyes@main
env:
@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.0
ref: "3.0"
path: dubbo
- uses: actions/setup-java@v1
with:
@ -148,7 +148,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.0
ref: "3.0"
- name: "Set up JDK ${{ matrix.jdk }}"
uses: actions/setup-java@v1
with:

View File

@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.1
ref: "3.1"
- name: Check License
uses: apache/skywalking-eyes@main
env:
@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.1
ref: "3.1"
path: dubbo
- uses: actions/setup-java@v1
with:
@ -148,7 +148,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.1
ref: "3.1"
- name: "Set up JDK ${{ matrix.jdk }}"
uses: actions/setup-java@v1
with:
@ -188,7 +188,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.1
ref: "3.1"
- name: "Set up JDK ${{ matrix.jdk }}"
uses: actions/setup-java@v1
with:

View File

@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.2
ref: "3.2"
- name: Check License
uses: apache/skywalking-eyes@main
env:
@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.2
ref: "3.2"
path: dubbo
- uses: actions/setup-java@v1
with:
@ -148,7 +148,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.2
ref: "3.2"
- name: "Set up JDK ${{ matrix.jdk }}"
uses: actions/setup-java@v1
with:
@ -188,7 +188,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 3.2
ref: "3.2"
- name: "Set up JDK ${{ matrix.jdk }}"
uses: actions/setup-java@v1
with:

View File

@ -26,16 +26,17 @@ import com.alibaba.com.caucho.hessian.io.SerializerFactory;
@SPI(value = "default", scope = ExtensionScope.FRAMEWORK)
public interface Hessian2FactoryInitializer {
String WHITELIST = "dubbo.application.hessian2.whitelist";
String ALLOW = "dubbo.application.hessian2.allow";
String DENY = "dubbo.application.hessian2.deny";
String ALLOW = System.getProperty("dubbo.application.hessian2.allow");
String DENY = System.getProperty("dubbo.application.hessian2.deny");
String WHITELIST = System.getProperty("dubbo.application.hessian2.whitelist");
String ALLOW_NON_SERIALIZABLE = System.getProperty("dubbo.hessian.allowNonSerializable", "false");
SerializerFactory getSerializerFactory();
static Hessian2FactoryInitializer getInstance() {
ExtensionLoader<Hessian2FactoryInitializer> loader = FrameworkModel.defaultModel().getExtensionLoader(Hessian2FactoryInitializer.class);
String whitelist = System.getProperty(WHITELIST);
if (StringUtils.isNotEmpty(whitelist)) {
if (StringUtils.isNotEmpty(WHITELIST)) {
return loader.getExtension("whitelist");
}
return loader.getDefaultExtension();

View File

@ -29,25 +29,22 @@ public class WhitelistHessian2FactoryInitializer extends AbstractHessian2Factory
@Override
public SerializerFactory createSerializerFactory() {
SerializerFactory serializerFactory = new Hessian2SerializerFactory();
String whiteList = System.getProperty(WHITELIST);
if ("true".equals(whiteList)) {
if ("true".equals(WHITELIST)) {
serializerFactory.getClassFactory().setWhitelist(true);
String allowPattern = System.getProperty(ALLOW);
if (StringUtils.isNotEmpty(allowPattern)) {
for (String pattern : allowPattern.split(";")) {
if (StringUtils.isNotEmpty(ALLOW)) {
for (String pattern : ALLOW.split(";")) {
serializerFactory.getClassFactory().allow(pattern);
}
}
} else {
serializerFactory.getClassFactory().setWhitelist(false);
String denyPattern = System.getProperty(DENY);
if (StringUtils.isNotEmpty(denyPattern)) {
for (String pattern : denyPattern.split(";")) {
if (StringUtils.isNotEmpty(DENY)) {
for (String pattern : DENY.split(";")) {
serializerFactory.getClassFactory().deny(pattern);
}
}
}
serializerFactory.setAllowNonSerializable(Boolean.parseBoolean(System.getProperty("dubbo.hessian.allowNonSerializable", "false")));
serializerFactory.setAllowNonSerializable(Boolean.parseBoolean(ALLOW_NON_SERIALIZABLE));
serializerFactory.getClassFactory().allow("org.apache.dubbo.*");
return serializerFactory;
}