Skip to content
Permalink
Browse files
merge form master
  • Loading branch information
DLive committed Jun 27, 2019
2 parents a5a0cde + cdfcff9 commit 91faffcf749b1abd4610580fe38ea5ad81bc0e61
Showing 7 changed files with 80 additions and 32 deletions.
@@ -0,0 +1,35 @@
---
name: Dubbo-erlang issue report template
about: If you would like to report a issue to dubbo-erlang, please use this template.

---

- [ ] I have searched the [issues](https://github.com/apache/dubbo-erlang/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo-erlang version: xxx
* Operating System version: xxx
* Erlang version: xxx

### Steps to reproduce this issue

1. xxx
2. xxx
3. xxx

Pls. provide [GitHub address] to reproduce this issue.

### Expected Result

What do you expected from the above steps?

### Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

```
Just put your stack trace here!
```
@@ -0,0 +1,20 @@
## What is the purpose of the change

XXXXX

## Brief changelog

XXXXX

## Verifying this change

XXXXX

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

- [x] Make sure there is a [GITHUB_issue](https://github.com/apache/dubbo-erlang/issues) field 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 sample in [samples](https://github.com/apache/dubbo-erlang/samples).
- [ ] Run `rebar3 eunit` & `rebar3 ct --sys_config config_example/sys.config` to make sure unit-test and integration-test pass.
- [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
@@ -16,7 +16,7 @@ script:
- ./rebar3 compile
- ./rebar3 eunit -c
- ./rebar3 ct -c --sys_config config_example/sys.config
- ./rebar3 codecov analyze
- ./rebar3 as test codecov analyze

after_success:
- codecov
@@ -30,7 +30,7 @@ Start
Add dubblerl to rebar.config with your project
```erlang
{deps, [
{dubboerl, {git, "https://github.com/apache/incubator-dubbo-erlang.git", {branch, "master"}}}
{dubboerl, {git, "https://github.com/apache/dubbo-erlang.git", {branch, "master"}}}
]}.
```

@@ -77,5 +77,5 @@ Reference the demo project [dubboerl_demo](./samples/dubboerl_demo)

More Documents
------
Reference [Docs](docs/index.md)
Reference [Docs](http://dubbo.apache.org/en-us/docs/user/languages/erlang/start.html)

@@ -6,8 +6,7 @@
{project_app_dirs, ["."]}.

{plugins, [
rebar3_hex,
{rebar3_codecov, "0.1.0"}
rebar3_hex
]}.

{provider_hooks,
@@ -21,17 +20,19 @@

{deps, [
{erlzk, ".*", {git, "https://github.com/huaban/erlzk.git", {tag, "v0.6.2"}}},
{ranch, ".*", {git, "https://github.com/ninenines/ranch.git", {tag, "1.4.0"}}},
{ranch, ".*", {git, "https://github.com/ninenines/ranch.git", {tag, "1.4.0"}}},
{poolboy, ".*", {git, "https://github.com/devinus/poolboy.git", {tag, "1.5.1"}}},
{jiffy, "0.15.1"},
{hooks,{git,"https://github.com/benoitc/hooks.git",{tag,"2.1.0"}}}
{jsx, "2.10.0"}
]}.


{profiles,[
{test,
[
{extra_src_dirs, ["test"]}
{extra_src_dirs, ["test"]},
{plugins, [
{rebar3_codecov, "0.1.0"}
]}
]
}
]}.
@@ -3,11 +3,7 @@
{git,"https://github.com/huaban/erlzk.git",
{ref,"aa7190ee2343ac1341cea3edc9b9eea36c591708"}},
0},
{<<"hooks">>,
{git,"https://github.com/benoitc/hooks.git",
{ref,"d4872554a27c0ee9c2166d18000f725f8c3dc8a8"}},
0},
{<<"jiffy">>,{pkg,<<"jiffy">>,<<"0.15.1">>},0},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.10.0">>},0},
{<<"poolboy">>,
{git,"https://github.com/devinus/poolboy.git",
{ref,"3bb48a893ff5598f7c73731ac17545206d259fac"}},
@@ -18,5 +14,5 @@
0}]}.
[
{pkg_hash,[
{<<"jiffy">>, <<"BE83B09388DA1A6C7E798207C9D6A1C4D71BB95FCC387D37D35861788F49AB97">>}]}
{<<"jsx">>, <<"77760560D6AC2B8C51FD4C980E9E19B784016AA70BE354CE746472C33BEB0B1C">>}]}
].
@@ -48,12 +48,12 @@ encode_request_data(dubbo_rpc_invocation, _Request, Data, State) ->
?LINE_SEPERATOR
],
{ArgsBin, _} = encode_arguments(Data, State),
AttachBinay = jiffy:encode({Data#dubbo_rpc_invocation.attachments}, []),
AttachBinay = jsx:encode(Data#dubbo_rpc_invocation.attachments),
RequestData = erlang:iolist_to_binary(RequestList ++ [ArgsBin, AttachBinay, ?LINE_SEPERATOR]),
{ok, RequestData};
encode_request_data(dubbo_event, _Request, Data, _State) ->
%% @todo 确认该数据类型
Bin = jiffy:encode(Data),
Bin = jsx:encode(Data),
{ok, Bin}.


@@ -74,7 +74,7 @@ encode_response_data(Response) ->
{ok, Bin}.

encode_response_data(dubbo_event, _Response, Data, State) ->
Bin = jiffy:encode(Data, []),
Bin = jsx:encode(Data),
{ok, Bin};
encode_response_data(dubbo_rpc_invocation, _Response, Data, State) ->
Result = case Data of
@@ -156,19 +156,19 @@ decode_response(dubbo_rpc_invocation, Res, Data) ->
DataList = binary:split(Data, <<"\n">>, [global]),
[TypeBin | DataList1] = DataList,
%% {Rest,Type,State} = cotton_hessian:decode(Data,cotton_hessian:init()),
Type = jiffy:decode(TypeBin),
Type = jsx:decode(TypeBin),

case Type of
?RESPONSE_VALUE ->
%% {_,Object,DecodeState} = cotton_hessian:decode(Rest,State),
[Value | _] = DataList1,
Object = jiffy:decode(Value, [return_maps]),
Object = jsx:decode(Value, [return_maps]),
{ok, Res#dubbo_response{data = Object}};
?RESPONSE_NULL_VALUE ->
{ok, Res#dubbo_response{data = null}};
?RESPONSE_WITH_EXCEPTION ->
[ExceptionValue | _] = DataList1,
ExceptionObject = jiffy:decode(ExceptionValue),
ExceptionObject = jsx:decode(ExceptionValue),
{ok, Res#dubbo_response{data = ExceptionObject}};
Other ->
logger:error("server response unkonw info ~p", [Other]),
@@ -196,10 +196,8 @@ decode_request(dubbo_rpc_invocation, Req, Data) ->
{ok, Req2};

decode_request(dubbo_event, Req, Data) ->
%% DataList = binary:split(Data,<<"\n">>),
logger:debug("dubbo_event datalist ~w", [Data]),
Result = jiffy:decode(Data, []),
%% {_Rest,undefined,_NewState} = cotton_hessian:decode(Data,cotton_hessian:init()),
Result = jsx:decode(Data),
{ok, Req#dubbo_request{data = Result}}.

decode_request_body(Data, State, List) ->
@@ -217,13 +215,11 @@ decode_request_body(Data, State, List) ->

decode_request_body([ParseType | List], [DataItem | Data], State, ResultList)
when ParseType == dubbo;ParseType == path;ParseType == version;ParseType == method_name ->
DecodeData = jiffy:decode(DataItem, [return_maps]),
DecodeData = jsx:decode(DataItem, [return_maps]),
decode_request_body(List, Data, State, [DecodeData] ++ ResultList);

decode_request_body([desc_and_args | List], [DescBin | Data], State, ResultList) ->
ParameterDesc = jiffy:decode(DescBin, []),

%% {Rest,ParameterDesc,State1 } = cotton_hessian:decode(Data,State),
ParameterDesc = jsx:decode(DescBin),
if
size(ParameterDesc) == 0 ->
decode_request_body(List, Data, State, [[], []] ++ ResultList);
@@ -233,7 +229,7 @@ decode_request_body([desc_and_args | List], [DescBin | Data], State, ResultList)
decode_request_body(List, RestData, NewState, [ArgsObjList, ParameterDesc] ++ ResultList)
end;
decode_request_body([attachments | List], [DataItem | Data], State, ResultList) ->
Attachments = jiffy:decode(DataItem, [return_maps]),
Attachments = jsx:decode(DataItem, [return_maps]),
%% AttachmentsList = dict:to_list(Attachments#map.dict),
decode_request_body(List, Data, State, [Attachments] ++ ResultList);
decode_request_body([_Type1 | List], Data, State, ResultList) ->
@@ -250,7 +246,7 @@ decode_request_body_args([ArgsType | RestList], Data, State, ArgsObjList) when A
decode_request_body_args(RestList, Data, State, ArgsObjList);

decode_request_body_args([ArgsType | RestList], [DataItem | Data], State, ArgsObjList) ->
ArgObj = jiffy:decode(DataItem, [return_maps]),
ArgObj = jsx:decode(DataItem, [return_maps]),
%% {Rest,ArgObj,NewState } = cotton_hessian:decode(Data,State),
ArgObj2 = dubbo_type_transfer:jsonobj_to_native(ArgsType, ArgObj, State),
decode_request_body_args(RestList, Data, State, ArgsObjList ++ [ArgObj2]).
@@ -270,8 +266,8 @@ string_encode(Data) when is_tuple(Data) ->
fun({I, E}, Acc) ->
Acc#{E => element(I, Data)}
end, #{}, lists:zip(lists:seq(2, length(Fields) + 1), Fields)),
jiffy:encode(MapValue)
jsx:encode(MapValue)
end;

string_encode(Data) ->
jiffy:encode(Data).
jsx:encode(Data).

0 comments on commit 91faffc

Please sign in to comment.