@@ -110,14 +110,20 @@ int cmdline_optionst::doit()
110
110
{
111
111
if (!json_array_element.is_string ())
112
112
{
113
+ std::stringstream sstr;
114
+ sstr
115
+ << " Encountered a non-string element in the array of paths "
116
+ << " in the input JSON file." ;
113
117
msg.warning ()
114
- << " WARNING: Encountered a non-string element in the array of paths "
115
- << " in the input JSON file. Skipping this record."
118
+ << " WARNING: "
119
+ << sstr.str ()
120
+ << " Skipping this file."
116
121
<< messaget::eom;
122
+ errors.push_back (json_stringt (sstr.str ()));
123
+ ret_code=-7 ;
117
124
continue ;
118
125
}
119
126
120
- jsont class_json;
121
127
const std::string &class_file_pathname=json_array_element.value ;
122
128
if (!fileutl_file_exists (class_file_pathname))
123
129
{
@@ -131,77 +137,28 @@ int cmdline_optionst::doit()
131
137
<< sstr.str ()
132
138
<< " Skipping this file."
133
139
<< messaget::eom;
134
- class_json= json_stringt (sstr.str ());
140
+ errors. push_back ( json_stringt (sstr.str () ));
135
141
ret_code=-7 ;
142
+ continue ;
136
143
}
137
- else
138
- {
139
- try
140
- {
141
- java_bytecode_parse_treet parse_tree;
142
- if (java_bytecode_parse (
143
- class_file_pathname,
144
- parse_tree,
145
- ui_message_handler))
146
- {
147
- std::stringstream sstr;
148
- sstr
149
- << " The load of Java class file '"
150
- << class_file_pathname
151
- << " ' specified in '"
152
- << in_json_pathname
153
- << " ' has failed (by error return code from "
154
- << " 'java_bytecode_parse')." ;
155
- msg.warning ()
156
- << " WARNING: "
157
- << sstr.str ()
158
- << " Skipping this file."
159
- << messaget::eom;
160
- class_json=json_stringt (sstr.str ());
161
- ret_code=-7 ;
162
- }
163
- else
164
- {
165
- INVARIANT (parse_tree.loading_successful ,
166
- " False returned from 'java_bytecode_parse' should imply "
167
- " 'parse_tree.loading_successful' is True." );
168
144
169
- json_objectt class_props;
170
- {
171
- class_props[" name" ]=
172
- json_stringt (id2string (parse_tree.parsed_class .name ));
173
- class_props[" extends" ]=
174
- json_stringt (id2string (parse_tree.parsed_class .extends ));
175
- {
176
- json_arrayt interfaces;
177
- for (auto const &interface : parse_tree.parsed_class .implements )
178
- interfaces.push_back (json_stringt (id2string (interface)));
179
- class_props[" implements" ]=interfaces;
180
- }
181
- class_props[" is_abstract" ]=jsont::json_boolean (
182
- parse_tree.parsed_class .is_abstract );
183
- class_props[" is_public" ]=jsont::json_boolean (
184
- parse_tree.parsed_class .is_public );
185
- class_props[" is_private" ]=jsont::json_boolean (
186
- parse_tree.parsed_class .is_private );
187
- class_props[" is_protected" ]=jsont::json_boolean (
188
- parse_tree.parsed_class .is_protected );
189
- class_props[" is_enum" ]=jsont::json_boolean (
190
- parse_tree.parsed_class .is_enum );
191
- }
192
- class_json=class_props;
193
- }
194
- }
195
- catch (...)
145
+ jsont class_json;
146
+ try
147
+ {
148
+ java_bytecode_parse_treet parse_tree;
149
+ if (java_bytecode_parse (
150
+ class_file_pathname,
151
+ parse_tree,
152
+ ui_message_handler))
196
153
{
197
154
std::stringstream sstr;
198
155
sstr
199
156
<< " The load of Java class file '"
200
157
<< class_file_pathname
201
158
<< " ' specified in '"
202
159
<< in_json_pathname
203
- << " ' has failed (by throwing an exception). "
204
- << " " ;
160
+ << " ' has failed (by error return code from "
161
+ << " 'java_bytecode_parse'). " ;
205
162
msg.warning ()
206
163
<< " WARNING: "
207
164
<< sstr.str ()
@@ -210,6 +167,55 @@ int cmdline_optionst::doit()
210
167
class_json=json_stringt (sstr.str ());
211
168
ret_code=-7 ;
212
169
}
170
+ else
171
+ {
172
+ INVARIANT (parse_tree.loading_successful ,
173
+ " False returned from 'java_bytecode_parse' should imply "
174
+ " 'parse_tree.loading_successful' is True." );
175
+
176
+ json_objectt class_props;
177
+ {
178
+ class_props[" name" ]=
179
+ json_stringt (id2string (parse_tree.parsed_class .name ));
180
+ class_props[" extends" ]=
181
+ json_stringt (id2string (parse_tree.parsed_class .extends ));
182
+ {
183
+ json_arrayt interfaces;
184
+ for (auto const &interface : parse_tree.parsed_class .implements )
185
+ interfaces.push_back (json_stringt (id2string (interface)));
186
+ class_props[" implements" ]=interfaces;
187
+ }
188
+ class_props[" is_abstract" ]=jsont::json_boolean (
189
+ parse_tree.parsed_class .is_abstract );
190
+ class_props[" is_public" ]=jsont::json_boolean (
191
+ parse_tree.parsed_class .is_public );
192
+ class_props[" is_private" ]=jsont::json_boolean (
193
+ parse_tree.parsed_class .is_private );
194
+ class_props[" is_protected" ]=jsont::json_boolean (
195
+ parse_tree.parsed_class .is_protected );
196
+ class_props[" is_enum" ]=jsont::json_boolean (
197
+ parse_tree.parsed_class .is_enum );
198
+ }
199
+ class_json=class_props;
200
+ }
201
+ }
202
+ catch (...)
203
+ {
204
+ std::stringstream sstr;
205
+ sstr
206
+ << " The load of Java class file '"
207
+ << class_file_pathname
208
+ << " ' specified in '"
209
+ << in_json_pathname
210
+ << " ' has failed (by throwing an exception)."
211
+ << " " ;
212
+ msg.warning ()
213
+ << " WARNING: "
214
+ << sstr.str ()
215
+ << " Skipping this file."
216
+ << messaget::eom;
217
+ class_json=json_stringt (sstr.str ());
218
+ ret_code=-7 ;
213
219
}
214
220
if (class_json.is_string ())
215
221
errors.push_back (class_json);
0 commit comments