Skip to content

Commit

Permalink
Merge branch '3.3' into fix/native_enum
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyHZM authored Jan 24, 2024
2 parents 5c46fbd + 9211a91 commit dacb2ba
Show file tree
Hide file tree
Showing 49 changed files with 375 additions and 2,161 deletions.
49 changes: 44 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,55 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
tab_width = 4
max_line_length = 120
insert_final_newline = true
trim_trailing_whitespace = true

# 4 space indentation
[*.{java,xml}]
indent_style = space
indent_size = 4
[*.java]
ij_java_continuation_indent_size = 8
ij_java_keep_control_statement_in_one_line = false
ij_java_for_brace_force = always
ij_java_if_brace_force = always
ij_java_keep_first_column_comment = false
ij_java_keep_line_breaks = false
ij_java_keep_simple_blocks_in_one_line = true
ij_java_keep_simple_classes_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_methods_in_one_line = true
ij_java_keep_blank_lines_in_code = 1
ij_java_keep_blank_lines_in_declarations = 1
ij_java_class_count_to_use_import_on_demand = 999
ij_java_names_count_to_use_import_on_demand = 999
ij_java_imports_layout = org.apache.dubbo.**, |, javax.**, |, java.**, |, *, |, $*
ij_java_insert_inner_class_imports = true
ij_java_space_before_array_initializer_left_brace = true
ij_java_method_parameters_new_line_after_left_paren = true
ij_java_wrap_comments = true
ij_java_wrap_long_lines = true
ij_java_enum_constants_wrap = split_into_lines
ij_java_method_call_chain_wrap = split_into_lines
ij_java_method_parameters_wrap = on_every_item
ij_java_extends_list_wrap = on_every_item
ij_java_extends_keyword_wrap = normal
ij_java_binary_operation_wrap = normal
ij_java_binary_operation_sign_on_next_line = true

[*.json]
tab_width = 2

[*.{yml,yaml}]
indent_size = 2

[*.xml]
ij_xml_attribute_wrap = off
ij_xml_text_wrap = off
ij_xml_keep_blank_lines = 1

[pom.xml]
indent_size = 2
61 changes: 55 additions & 6 deletions .github/workflows/build-and-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,49 @@ env:
'

jobs:
check-format:
name: Check if code needs formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Maven
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Check if code aligns with code style
id: check
run: mvn --log-file mvn.log spotless:check
continue-on-error: true
- name: Upload checkstyle result
uses: actions/upload-artifact@v4
with:
name: checkstyle-result
path: mvn.log
- name: Generate Summary for successful run
if: ${{ steps.check.outcome == 'success' }}
run: |
echo ":ballot_box_with_check: Kudos! No formatting issues found!" >> $GITHUB_STEP_SUMMARY
- name: Generate Summary for failed run
if: ${{ steps.check.outcome == 'failure' }}
run: |
echo "## :negative_squared_cross_mark: Formatting issues found!" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat mvn.log | grep "ERROR" | sed 's/Check if code needs formatting Check if code aligns with code style [0-9A-Z:.-]\+//' | sed 's/\[ERROR] //' | head -n -11 >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "Please run \`mvn spotless:apply\` to fix the formatting issues." >> $GITHUB_STEP_SUMMARY
- name: Fail if code needs formatting
if: ${{ steps.check.outcome == 'failure' }}
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
core.setFailed("Formatting issues found!")
license:
name: "Check License"
needs: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -43,6 +85,8 @@ jobs:
mode: check

build-source:
name: "Build Dubbo"
needs: check-format
runs-on: ubuntu-latest
outputs:
version: ${{ steps.dubbo-version.outputs.version }}
Expand Down Expand Up @@ -98,6 +142,7 @@ jobs:
unit-test-prepare:
name: "Preparation for Unit Test"
needs: check-format
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -146,7 +191,7 @@ jobs:
echo "--- End Print Rsa Public Key"
unit-test:
needs: [build-source, unit-test-prepare]
needs: [check-format, build-source, unit-test-prepare]
name: "Unit Test On ubuntu-latest"
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -212,6 +257,7 @@ jobs:
path: "**/target/site/**/jacoco.xml"

samples-test-prepare:
needs: check-format
runs-on: ubuntu-latest
env:
JOB_COUNT: 3
Expand All @@ -229,7 +275,7 @@ jobs:
name: samples-test-list
path: test/jobs
samples-test-job:
needs: [build-source, samples-test-prepare]
needs: [check-format, build-source, samples-test-prepare]
name: "Samples Test on ubuntu-latest (JobId: ${{matrix.job_id}})"
runs-on: ubuntu-latest
timeout-minutes: 90
Expand Down Expand Up @@ -296,7 +342,7 @@ jobs:
name: samples-test-result
path: test/jobs/*-result*
samples-test-result:
needs: [samples-test-job]
needs: [check-format, samples-test-job]
if: always()
runs-on: ubuntu-latest
env:
Expand All @@ -315,6 +361,7 @@ jobs:
run: ./test/scripts/merge-test-results.sh

integration-test-prepare:
needs: check-format
runs-on: ubuntu-latest
env:
JOB_COUNT: 3
Expand All @@ -332,7 +379,7 @@ jobs:
name: test-list
path: test/jobs
integration-test-job:
needs: [build-source, integration-test-prepare]
needs: [check-format, build-source, integration-test-prepare]
name: "Integration Test on ubuntu-latest (JobId: ${{matrix.job_id}})"
runs-on: ubuntu-latest
timeout-minutes: 90
Expand Down Expand Up @@ -399,7 +446,7 @@ jobs:
name: test-result
path: test/jobs/*-result*
integration-test-result:
needs: [integration-test-job]
needs: [check-format, integration-test-job]
if: always()
runs-on: ubuntu-latest
env:
Expand All @@ -419,7 +466,7 @@ jobs:

jacoco-result-merge:
runs-on: ubuntu-latest
needs: [integration-test-result, samples-test-result, unit-test]
needs: [check-format, integration-test-result, samples-test-result, unit-test]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -475,6 +522,7 @@ jobs:
verbose: true

error-code-inspecting:
needs: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -513,6 +561,7 @@ jobs:
path: ${{ github.workspace }}/dubbo-test-tools/dubbo-error-code-inspector/error-inspection-result.txt

native-image-inspecting:
needs: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache Dubbo
Copyright 2018-2023 The Apache Software Foundation
Copyright 2018-2024 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
12 changes: 7 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
Below is a table that shows versions that we accept security fixes.

| Version | Supported |
| ------- | ------------------ |
| 3.0.x | :white_check_mark: |
| 2.7.x | :white_check_mark: |
| 2.6.x | :white_check_mark: |
|---------| ------------------ |
| 3.3.x | :white_check_mark: |
| 3.2.x | :white_check_mark: |
| 3.1.x | :white_check_mark: |
| 3.0.x | :x: |
| 2.7.x | :x: |
| 2.6.x | :x: |
| 2.5.x | :x: |


## Reporting a Vulnerability

The Apache Software Foundation takes a rigorous standpoint in annihilating the security issues in its software projects. Apache Dubbo is highly sensitive and forthcoming to issues pertaining to its features and functionality.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ protected Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, Load
return invokeWithContext(invoker, invocation);
} catch (RpcException e) {
if (e.isNoInvokerAvailableAfterFilter()) {
log.debug("No available provider for service" + getUrl().getServiceKey() + " on group "
+ invoker.getUrl().getGroup() + ", will continue to try another group.");
log.debug(
"No available provider for service" + getUrl().getServiceKey() + " on group "
+ invoker.getUrl().getGroup() + ", will continue to try another group.",
e);
} else {
throw e;
}
Expand All @@ -93,7 +95,21 @@ protected Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, Load
for (final Invoker<T> invoker : invokers) {
RpcInvocation subInvocation = new RpcInvocation(invocation, invoker);
subInvocation.setAttachment(Constants.ASYNC_KEY, "true");
results.put(invoker.getUrl().getServiceKey(), invokeWithContext(invoker, subInvocation));
try {
results.put(invoker.getUrl().getServiceKey(), invokeWithContext(invoker, subInvocation));
} catch (RpcException e) {
if (e.isNoInvokerAvailableAfterFilter()) {
log.warn(
LoggerCodeConstants.CLUSTER_NO_VALID_PROVIDER,
e.getCause().getMessage(),
"",
"No available provider for service" + getUrl().getServiceKey() + " on group "
+ invoker.getUrl().getGroup() + ", will continue to try another group.",
e);
} else {
throw e;
}
}
}

Object result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ private void dumpJStack() {
if (!guard.tryAcquire()) {
return;
}
// To avoid multiple dump, check again
if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
return;
}

ExecutorService pool = Executors.newSingleThreadExecutor();
ExecutorService pool = null;
try {
// To avoid multiple dump, check again
if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
return;
}
pool = Executors.newSingleThreadExecutor();
pool.execute(() -> {
String dumpPath = getDumpPath();

Expand All @@ -190,12 +190,14 @@ private void dumpJStack() {
logger.error(COMMON_UNEXPECTED_CREATE_DUMP, "", "", "dump jStack error", t);
} finally {
lastPrintTime = System.currentTimeMillis();
guard.release();
}
});
} finally {
guard.release();
// must shutdown thread pool ,if not will lead to OOM
pool.shutdown();
if (pool != null) {
pool.shutdown();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ public void setPayload(Integer payload) {
this.payload = payload;
}

@Parameter(excluded = true, attribute = false)
public Boolean getUseJavaPackageAsPath() {
return useJavaPackageAsPath;
}

@Parameter(excluded = true)
public void setUseJavaPackageAsPath(Boolean useJavaPackageAsPath) {
this.useJavaPackageAsPath = useJavaPackageAsPath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ class URLStrParserTest {
testCases.add("dubbo://192.168.1.1");
testCases.add("dubbo://192.168.1.1?");
testCases.add("dubbo://127.0.0.1?test=中文测试");
testCases.add(
"dubbo://admin:[email protected]:28113/org.test.api.DemoService$Iface?anyhost=true&application=demo-service&dubbo=2.6.1&generic=false&interface=org.test.api.DemoService$Iface&methods=orbCompare,checkText,checkPicture&pid=65557&revision=1.4.17&service.filter=bootMetrics&side=provider&status=server&threads=200&timestamp=1583136298859&version=1.0.0");
testCases.add("dubbo://admin:[email protected]:28113/org.test.api"
+ ".DemoService$Iface?anyhost=true&application=demo-service&dubbo=2.6.1&generic=false&interface=org"
+ ".test.api.DemoService$Iface&methods=orbCompare,checkText,checkPicture&pid=65557&revision=1.4"
+ ".17&service.filter=bootMetrics&side=provider&status=server&threads=200&timestamp=1583136298859"
+ "&version=1.0.0");
// super long text test
testCases.add("dubbo://192.168.1.1/" + RandomString.make(10240));
testCases.add("file:/path/to/file.txt");
Expand All @@ -57,8 +60,8 @@ class URLStrParserTest {
errorEncodedCases.add("dubbo%3a192.168.1.1%3fabc%3dabc");
errorEncodedCases.add("%3a%2f%2f192.168.1.1%3fabc%3dabc");
errorEncodedCases.add("%3a%2f192.168.1.1%3fabc%3dabc");
errorEncodedCases.add(
"dubbo%3a%2f%2f127.0.0.1%3ftest%3d%e2%96%b2%e2%96%bc%e2%97%80%e2%96%b6%e2%86%90%e2%86%91%e2%86%92%e2%86%93%e2%86%94%e2%86%95%e2%88%9e%c2%b1%e9%be%98%e9%9d%90%e9%bd%89%9%d%b");
errorEncodedCases.add("dubbo%3a%2f%2f127.0.0.1%3ftest%3d%e2%96%b2%e2%96%bc%e2%97%80%e2%96%b6%e2%86%90%e2%86"
+ "%91%e2%86%92%e2%86%93%e2%86%94%e2%86%95%e2%88%9e%c2%b1%e9%be%98%e9%9d%90%e9%bd%89%9%d%b");
}

@Test
Expand Down Expand Up @@ -93,4 +96,17 @@ void testDefault() {
assertThat(url2.getParameter("timeout"), equalTo("5678"));
assertThat(url2.getParameter("default.timeout"), equalTo("5678"));
}

@Test
void testPond() {
String str = "https://a#@b";

URL url1 = URL.valueOf(str);
URL url2 = URLStrParser.parseDecodedStr(str);

Assertions.assertEquals("https", url1.getProtocol());
Assertions.assertEquals("https", url2.getProtocol());
Assertions.assertEquals("a", url1.getHost());
Assertions.assertEquals("a", url2.getHost());
}
}
2 changes: 1 addition & 1 deletion dubbo-demo/dubbo-demo-spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<skip_maven_deploy>true</skip_maven_deploy>
<spring-boot.version>2.7.18</spring-boot.version>
<spring-boot-maven-plugin.version>2.7.18</spring-boot-maven-plugin.version>
<micrometer-core.version>1.12.1</micrometer-core.version>
<micrometer-core.version>1.12.2</micrometer-core.version>
</properties>

<dependencyManagement>
Expand Down
Loading

0 comments on commit dacb2ba

Please sign in to comment.