From 93b9f2c4885dd73505ce8e980e5e3f10817cafb5 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Tue, 19 Dec 2017 19:08:38 -0800 Subject: [PATCH] [infer][java] catch Invalid_argument exception when translating the bytecode to the Sawja JBir representation Reviewed By: sblackshear, mbouaziz, jvillard Differential Revision: D6602288 fbshipit-source-id: b63f6dc --- infer/src/backend/callbacks.ml | 2 +- infer/src/java/jTrans.ml | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/infer/src/backend/callbacks.ml b/infer/src/backend/callbacks.ml index c6d326e4b..8e9eb0457 100644 --- a/infer/src/backend/callbacks.ml +++ b/infer/src/backend/callbacks.ml @@ -108,7 +108,7 @@ let iterate_callbacks call_graph exe_env = let analyze_proc_name pname = match Ondemand.get_proc_desc pname with | None -> - L.(die InternalError) "Could not find proc desc for %a" Typ.Procname.pp pname + L.internal_error "Could not find proc desc for %a" Typ.Procname.pp pname | Some pdesc -> ignore (Ondemand.analyze_proc_desc pdesc pdesc) in diff --git a/infer/src/java/jTrans.ml b/infer/src/java/jTrans.ml index 56ee28e34..1308c0c5b 100644 --- a/infer/src/java/jTrans.ml +++ b/infer/src/java/jTrans.ml @@ -400,9 +400,15 @@ let create_cm_procdesc source_file program linereader icfg cm proc_name skip_imp procdesc in Some (procdesc, bytecode, jbir_code) - with JBir.Subroutine -> - L.internal_error "create_procdesc raised JBir.Subroutine on %a@." Typ.Procname.pp proc_name ; - None + with + | JBir.Subroutine -> + L.internal_error "create_procdesc raised JBir.Subroutine when translating %a in %a@." + Typ.Procname.pp proc_name SourceFile.pp source_file ; + None + | Invalid_argument msg -> + L.internal_error "create_procdesc raised Invalid_argument \"%s\" when translating %a in %a@." + msg Typ.Procname.pp proc_name SourceFile.pp source_file ; + None let builtin_new = Exp.Const (Const.Cfun BuiltinDecl.__new)