@@ -81,9 +81,9 @@ java_class_loadert::parse_tree_with_overlayst &java_class_loadert::operator()(
81
81
optionalt<java_bytecode_parse_treet> java_class_loadert::get_class_from_jar (
82
82
const irep_idt &class_name,
83
83
const std::string &jar_file,
84
+ const jar_indext &jar_index,
84
85
java_class_loader_limitt &class_loader_limit)
85
86
{
86
- jar_indext &jar_index = jars_by_path.at (jar_file);
87
87
auto jar_index_it = jar_index.find (class_name);
88
88
if (jar_index_it == jar_index.end ())
89
89
return {};
@@ -112,9 +112,11 @@ java_class_loadert::get_parse_tree(
112
112
// First add all given JAR files
113
113
for (const auto &jar_file : jar_files)
114
114
{
115
- read_jar_file (class_loader_limit, jar_file);
115
+ jar_index_optcreft index = read_jar_file (class_loader_limit, jar_file);
116
+ if (!index )
117
+ continue ;
116
118
optionalt<java_bytecode_parse_treet> parse_tree =
117
- get_class_from_jar (class_name, jar_file, class_loader_limit);
119
+ get_class_from_jar (class_name, jar_file, * index , class_loader_limit);
118
120
if (parse_tree)
119
121
parse_trees.push_back (*parse_tree);
120
122
}
@@ -130,23 +132,26 @@ java_class_loadert::get_parse_tree(
130
132
131
133
// This does not read from the jar file but from the jar_filet object we
132
134
// just created
133
- read_jar_file (class_loader_limit, core_models);
134
-
135
- optionalt<java_bytecode_parse_treet> parse_tree =
136
- get_class_from_jar (class_name, core_models, class_loader_limit);
137
- if (parse_tree)
138
- parse_trees.push_back (*parse_tree);
135
+ jar_index_optcreft index = read_jar_file (class_loader_limit, core_models);
136
+ if (index )
137
+ {
138
+ optionalt<java_bytecode_parse_treet> parse_tree =
139
+ get_class_from_jar (class_name, core_models, *index , class_loader_limit);
140
+ if (parse_tree)
141
+ parse_trees.push_back (*parse_tree);
142
+ }
139
143
}
140
144
141
145
// Then add everything on the class path
142
146
for (const auto &cp_entry : config.java .classpath )
143
147
{
144
148
if (has_suffix (cp_entry, " .jar" ))
145
149
{
146
- read_jar_file (class_loader_limit, cp_entry);
147
-
150
+ jar_index_optcreft index = read_jar_file (class_loader_limit, cp_entry);
151
+ if (!index )
152
+ continue ;
148
153
optionalt<java_bytecode_parse_treet> parse_tree =
149
- get_class_from_jar (class_name, cp_entry, class_loader_limit);
154
+ get_class_from_jar (class_name, cp_entry, * index , class_loader_limit);
150
155
if (parse_tree)
151
156
parse_trees.push_back (*parse_tree);
152
157
}
0 commit comments