Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dialyzer fixes and comments

  • Loading branch information...
commit f3622d26b47567aaa47f1cfd09a46f4b1aa6f992 1 parent 02c9022
@vinoski vinoski authored
View
2  src/yaws.erl
@@ -1850,6 +1850,8 @@ uid_to_name(Uid) ->
end.
load_setuid_drv() ->
+ %% below, ignore dialyzer warning:
+ %% "The pattern 'false' can never match the type 'true'"
Path = case yaws_generated:is_local_install() of
true ->
filename:dirname(code:which(?MODULE)) ++ "/../priv/lib";
View
2  src/yaws_api.erl
@@ -1046,7 +1046,7 @@ set_access_log(Bool) ->
%% interactively turn on|off tracing to the tty (as well)
%% typically useful in embedded mode
set_tty_trace(Bool) ->
- yaws_trace:set_trace_tty(Bool).
+ yaws_trace:set_tty_trace(Bool).
View
2  src/yaws_config.erl
@@ -454,6 +454,8 @@ make_default_sconf() ->
#sconf{docroot = filename:join([Y, "www"])}.
yaws_dir() ->
+ %% below, ignore dialyzer warning:
+ %% "The pattern 'false' can never match the type 'true'"
case yaws_generated:is_local_install() of
true ->
P = filename:split(code:which(?MODULE)),
View
2  src/yaws_revproxy.erl
@@ -517,6 +517,8 @@ get_connection_status(Version, ReqHdrs, RespHdrs) ->
end,
?Debug("Client Connection header: ~p~n", [CliConn]),
+ %% below, ignore dialyzer warning:
+ %% "The pattern 'true' can never match the type 'false'"
SrvConn = case ?proxy_keepalive of
true ->
case RespHdrs#headers.connection of
View
30 src/yaws_soap12_lib.erl
@@ -339,7 +339,7 @@ priv_dir() ->
initModel2(WsdlFile, ErlsomOptions, Path, Import, AddFiles) ->
WsdlName = filename:join([Path, "wsdl.xsd"]),
- IncludeWsdl = {"http://schemas.xmlsoap.org/wsdl/", "wsdl", WsdlName},
+ IncludeWsdl = {"http://schemas.xmlsoap.org/wsdl/", "wsdl", WsdlName},
{ok, WsdlModel} = erlsom:compile_xsd_file(
filename:join([Path, "wsdl11soap12.xsd"]),
[{prefix, "soap"},
@@ -392,7 +392,7 @@ parseWsdls([WsdlFile | Tail], WsdlModel, Options, {AccModel, AccOperations}) ->
%% processed as well).
%% For the moment, the namespace is ignored on operations etc.
%% this makes it a bit easier to deal with imported wsdl's.
- %% TODO uncomment if imports can be WSDL
+ %% TODO uncomment if imports can be WSDL
%%Acc3 = parseWsdls(Imports, WsdlModel, Options, Acc2),
parseWsdls(Tail, WsdlModel, Options, Acc2).
@@ -438,18 +438,12 @@ addSchemas([Xsd| Tail], AccModel, Options, ImportList) ->
addSchemaFiles([], AccModel, _Options, _ImportList) ->
AccModel;
addSchemaFiles([Xsd| Tail], AccModel, Options, ImportList) ->
- Model2 = case Xsd of
- undefined ->
- AccModel;
- _ ->
- {ok, Model} =
- erlsom:compile_xsd_file(
- get_file_with_path(Xsd),
- [{include_files, ImportList} |Options]),
- case AccModel of
- undefined -> Model;
- _ -> erlsom:add_model(AccModel, Model)
- end
+ {ok, Model} =
+ erlsom:compile_xsd_file(get_file_with_path(Xsd),
+ [{include_files, ImportList} |Options]),
+ Model2 = case AccModel of
+ undefined -> Model;
+ _ -> erlsom:add_model(AccModel, Model)
end,
addSchemaFiles(Tail, Model2, Options, ImportList).
@@ -494,7 +488,7 @@ http_request(URL, Action, Request, Options, Headers, ContentType) ->
end.
inets_request(URL, Action, Request, Options, Headers, ContentType) ->
- case Action of
+ case Action of
undefined ->
NHeaders = Headers;
_ ->
@@ -528,7 +522,7 @@ inets_request(URL, Action, Request, Options, Headers, ContentType) ->
ibrowse_request(URL, Action, Request, Options, Headers, ContentType) ->
case start_ibrowse() of
ok ->
- case Action of
+ case Action of
undefined ->
NewHeaders = [{"Content-Type", ContentType} | Headers];
_ ->
@@ -670,7 +664,7 @@ getTopLevelElements([#'wsdl:anyTopLevelOptionalElement'{choice = Tuple}| Tail],
end.
get_file_with_path(Url) ->
- case Url of
+ case Url of
"http://" ++ _ ->
undefined;
"file://" ++ FName ->
@@ -683,7 +677,7 @@ get_file_with_path(Url) ->
getImports(WsdlDirname, Definitions) ->
Imports = getTopLevelElements(Definitions, 'wsdl:tImport'),
lists:map(fun(Import) ->
- case WsdlDirname of
+ case WsdlDirname of
"http://" ++ _AbsDirname ->
WsdlDirname ++ "/" ++ Import#'wsdl:tImport'.location;
"file://" ++ _AbsDirname ->
View
2  src/yaws_sup_restarts.erl
@@ -39,6 +39,8 @@ init([]) ->
permanent, 5000, worker, [gen_event]},
+ %% below, ignore dialyzer warning:
+ %% "The pattern 'false' can never match the type 'true'"
SendFile = case yaws_sendfile:enabled() of
true ->
[{yaws_sendfile,
View
8 src/yaws_trace.erl
@@ -139,9 +139,11 @@ set_filter(Filter) ->
{ok, E} -> E;
_ -> throw({error, {invalid_filter, parse_failed}})
end,
- Result = case erl_eval:exprs(ExprList, []) of
- {value, R, _} -> R;
- _ -> throw({error, {invalid_filter, eval_failed}})
+ Result = try
+ erl_eval:exprs(ExprList, [])
+ catch
+ _:_ ->
+ throw({error, {invalid_filter, eval_failed}})
end,
gen_server:call(?MODULE, {set_filter, Result}, infinity).

4 comments on commit f3622d2

@kostis

The change to yaws_trace.erl does not look right to me. You probably want to write:

    try {value, Result, _} = erl_eval:exprs(ExprList, [])
    catch
        _:_ ->
            throw({error, {invalid_filter, eval_failed}})
    end,
    gen_server:call(?MODULE, {set_filter, Result}, infinity).

instead.

@vinoski
Collaborator

Oops, you're right, thanks for catching this. Fixed.

@kostis

hmm... I am right of course in catching the error, but the compiler does not like that way of writing this.
It has to be written:

try erl_eval:exprs(ExprList, []) of
    {value, Result, _} ->
         gen_server:call(?MODULE, {set_filter, Result}, infinity)
catch
     _:_ ->
         throw({error, {invalid_filter, eval_failed}})
end.

instead. Apologies for not checking it.

@vinoski
Collaborator

Hehe, and you'd think I'd at least try compiling it before declaring it fixed. I should just step away from the keyboard today.

Anyway, thanks again. I pushed the real fix.

Please sign in to comment.
Something went wrong with that request. Please try again.