aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2019-03-04 14:30:26 +0100
committerJosé Valim <[email protected]>2019-03-04 14:33:26 +0100
commit4ff5cdd7ec35201e70e54f908f6a6805d42e5fb1 (patch)
tree716e734fec73a5dc9bd7eb59f122f405a5c80bfb
parent0341e571fb1d16415b5663366f3128ba4dfbd123 (diff)
downloadotp-4ff5cdd7ec35201e70e54f908f6a6805d42e5fb1.tar.gz
otp-4ff5cdd7ec35201e70e54f908f6a6805d42e5fb1.tar.bz2
otp-4ff5cdd7ec35201e70e54f908f6a6805d42e5fb1.zip
Error on duplicated config apps/keys in -config
Continuation of d92eb79322. Erlang/OTP 21.3 warned on those cases and now we will raise on Erlang/OTP 22.0.
-rw-r--r--lib/kernel/src/application_controller.erl27
-rw-r--r--lib/kernel/test/application_SUITE.erl17
2 files changed, 17 insertions, 27 deletions
diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl
index 9a8091fb2e..7715dca7c6 100644
--- a/lib/kernel/src/application_controller.erl
+++ b/lib/kernel/src/application_controller.erl
@@ -537,14 +537,12 @@ check_conf_data(ConfData) when is_list(ConfData) ->
{AppName, List} when is_atom(AppName), is_list(List) ->
case lists:keymember(AppName, 1, ConfDataRem) of
true ->
- ?LOG_WARNING("duplicate application config: " ++ atom_to_list(AppName));
+ {error, "duplicate application config: " ++ atom_to_list(AppName)};
false ->
- ok
- end,
-
- case check_para(List, AppName) of
- ok -> check_conf_data(ConfDataRem);
- Error -> Error
+ case check_para(List, AppName) of
+ ok -> check_conf_data(ConfDataRem);
+ Error -> Error
+ end
end;
{AppName, List} when is_list(List) ->
ErrMsg = "application: "
@@ -570,15 +568,14 @@ check_para([], _AppName) ->
check_para([{Para, Val} | ParaList], AppName) when is_atom(Para) ->
case lists:keymember(Para, 1, ParaList) of
true ->
- ?LOG_WARNING("application: " ++ atom_to_list(AppName) ++
- "; duplicate parameter: " ++ atom_to_list(Para));
+ ErrMsg = "application: " ++ atom_to_list(AppName)
+ ++ "; duplicate parameter: " ++ atom_to_list(Para),
+ {error, ErrMsg};
false ->
- ok
- end,
-
- case check_para_value(Para, Val, AppName) of
- ok -> check_para(ParaList, AppName);
- {error, _} = Error -> Error
+ case check_para_value(Para, Val, AppName) of
+ ok -> check_para(ParaList, AppName);
+ {error, _} = Error -> Error
+ end
end;
check_para([{Para, _Val} | _ParaList], AppName) ->
{error, "application: " ++ atom_to_list(AppName) ++ "; invalid parameter name: " ++
diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl
index 94d7c17712..1ab554db7c 100644
--- a/lib/kernel/test/application_SUITE.erl
+++ b/lib/kernel/test/application_SUITE.erl
@@ -2020,18 +2020,11 @@ set_env_errors(Conf) when is_list(Conf) ->
"application: kernel; erroneous parameter: distributed" =
badarg_msg(fun() -> application:set_env([{kernel, [{distributed, config}]}]) end),
- %% This will raise in the future
- ct:capture_start(),
- _ = application:set_env([{foo, []}, {foo, []}]),
- timer:sleep(100),
- ct:capture_stop(),
- [_ | _] = string:find(ct:capture_get(), "duplicate application config: foo"),
-
- ct:capture_start(),
- _ = application:set_env([{foo, [{bar, baz}, {bar, bat}]}]),
- timer:sleep(100),
- ct:capture_stop(),
- [_ | _] = string:find(ct:capture_get(), "application: foo; duplicate parameter: bar"),
+ "duplicate application config: foo" =
+ badarg_msg(fun() -> application:set_env([{foo, []}, {foo, []}]) end),
+
+ "application: foo; duplicate parameter: bar" =
+ badarg_msg(fun() -> application:set_env([{foo, [{bar, baz}, {bar, bat}]}]) end),
ok.