Skip to content

Commit 6ec1b51

Browse files
authored
Removed e.printStackTrace (#361)
1 parent 7da46c4 commit 6ec1b51

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cobj/codegen.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5048,7 +5048,7 @@ static void joutput_init_method(struct cb_program *prog) {
50485048
const char *prevprog;
50495049
cb_tree l;
50505050

5051-
joutput_line("public void init()");
5051+
joutput_line("public void init() ");
50525052
joutput_line("{");
50535053
joutput_indent_level += 2;
50545054
joutput_line("try {");
@@ -5269,8 +5269,10 @@ static void joutput_init_method(struct cb_program *prog) {
52695269
}
52705270

52715271
joutput_indent_level -= 2;
5272-
joutput_line("} catch(Exception e) {");
5273-
joutput_line(" e.printStackTrace();");
5272+
joutput_line("} catch(NullPointerException e) {");
5273+
joutput_line(" System.out.println(\"Error - NullpointerException\");");
5274+
joutput_line("} catch(IndexOutOfBoundsException e) {");
5275+
joutput_line(" System.out.println(\"Error - IndexOutOfBoundsException\");");
52745276
joutput_line("}");
52755277
joutput_indent_level -= 2;
52765278
joutput_line("}\n");
@@ -6118,6 +6120,8 @@ void codegen(struct cb_program *prog, const int nested, char **program_id_list,
61186120
joutput_line("import jp.osscons.opensourcecobol.libcobj.file.*;");
61196121
joutput_line("import jp.osscons.opensourcecobol.libcobj.ui.*;");
61206122
joutput_line("import java.util.Optional;");
6123+
joutput_line("import java.lang.NullPointerException;");
6124+
joutput_line("import java.lang.IndexOutOfBoundsException;");
61216125
joutput("\n");
61226126

61236127
/*if (!cb_flag_no_cobol_comment) {

0 commit comments

Comments
 (0)