Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ConfigUtils.java #2562

Merged
merged 2 commits into from
Sep 26, 2018
Merged

Conversation

SuperDubbo
Copy link
Contributor

add scene judgement in windows environment Fix 2557

What is the purpose of the change

fix #2557

Brief changelog

add scene judgement in windows environment

Verifying this change

When run the testcase(com.alibaba.dubbo.config.AbstractInterfaceConfigTest#checkApplication1) in windows environment,It will be wrong.

So It should add scene judgement in windows environment(org.apache.dubbo.common.utils.ConfigUtils#loadProperties(java.lang.String, boolean, boolean),Line 220).

if (fileName.startsWith("/")) {
change to

if (fileName.startsWith("/")||fileName.matches("^[A-z]:\\\S+$")) {
the testcase (com.alibaba.dubbo.config.AbstractInterfaceConfigTest#checkApplication1) will go well.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

add scene judgement in windows environment Fix 2557
@@ -217,7 +217,8 @@ public static Properties loadProperties(String fileName, boolean allowMultiFile)
*/
public static Properties loadProperties(String fileName, boolean allowMultiFile, boolean optional) {
Properties properties = new Properties();
if (fileName.startsWith("/")) {
//add scene judgement in windows environment Fix 2557
if (fileName.startsWith("/")||fileName.matches("^[A-z]:\\\\\\S+$")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Would u pls format your code?

  2. Pls use doc as this:
    // add scene...
    Remember the space.

  3. pls add some unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.sorry,I do not format my code,I will do it.
2.ok.I will get the space.
3. the testcase(com.alibaba.dubbo.config.AbstractInterfaceConfigTest#checkApplication1) existed before

@codecov-io
Copy link

codecov-io commented Sep 26, 2018

Codecov Report

Merging #2562 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2562      +/-   ##
============================================
- Coverage     54.96%   54.93%   -0.04%     
+ Complexity     5278     5275       -3     
============================================
  Files           573      573              
  Lines         25517    25517              
  Branches       4531     4531              
============================================
- Hits          14026    14018       -8     
- Misses         9390     9392       +2     
- Partials       2101     2107       +6
Impacted Files Coverage Δ Complexity Δ
...ava/org/apache/dubbo/common/utils/ConfigUtils.java 71.72% <0%> (ø) 44 <0> (ø) ⬇️
.../dubbo/remoting/transport/netty4/NettyChannel.java 52.94% <0%> (-9.42%) 20% <0%> (-3%)
...e/dubbo/remoting/transport/netty4/NettyServer.java 72.13% <0%> (-3.28%) 9% <0%> (-1%)
...a/org/apache/dubbo/monitor/dubbo/DubboMonitor.java 87.85% <0%> (-1.87%) 15% <0%> (ø)
...bo/remoting/transport/netty/NettyCodecAdapter.java 53.12% <0%> (-1.57%) 3% <0%> (ø)
...ache/dubbo/remoting/transport/mina/MinaClient.java 56.92% <0%> (-1.54%) 8% <0%> (-1%)
.../java/org/apache/dubbo/config/ReferenceConfig.java 50.35% <0%> (-0.72%) 42% <0%> (ø)
...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java 59.16% <0%> (+0.83%) 31% <0%> (+1%) ⬆️
...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java 78.67% <0%> (+1.47%) 29% <0%> (ø) ⬇️
...he/dubbo/remoting/transport/netty/NettyServer.java 71.42% <0%> (+3.57%) 9% <0%> (+1%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 755bbf9...90f0588. Read the comment docs.

formate the code
add the space
Copy link
Contributor Author

@SuperDubbo SuperDubbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have do all as you list.@carryxyh

@@ -217,7 +217,8 @@ public static Properties loadProperties(String fileName, boolean allowMultiFile)
*/
public static Properties loadProperties(String fileName, boolean allowMultiFile, boolean optional) {
Properties properties = new Properties();
if (fileName.startsWith("/")) {
//add scene judgement in windows environment Fix 2557
if (fileName.startsWith("/")||fileName.matches("^[A-z]:\\\\\\S+$")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.sorry,I do not format my code,I will do it.
2.ok.I will get the space.
3. the testcase(com.alibaba.dubbo.config.AbstractInterfaceConfigTest#checkApplication1) existed before

@carryxyh
Copy link
Member

@SuperDubbo
Well done. LGTM

@diecui1202 diecui1202 merged commit cd7ba29 into apache:master Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants