Skip to content

Commit 39d7cc2

Browse files
Use ReflectiveOperationException in WideRecord test helper
Narrow catch blocks from generic Exception to ReflectiveOperationException and throw AssertionError for clearer test failure diagnostics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7577447 commit 39d7cc2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

modules/json/test/org/apache/axis2/json/streaming/FieldFilteringMessageFormatterTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,27 +481,27 @@ public static WideRecord createTestRecord() {
481481
for (int n = 0; n < 30; n++) {
482482
try {
483483
r.getClass().getField("s" + n).set(r, "val_" + n);
484-
} catch (Exception e) { throw new RuntimeException(e); }
484+
} catch (ReflectiveOperationException e) { throw new AssertionError("Field setup failed", e); }
485485
}
486486
for (int n = 0; n < 40; n++) {
487487
try {
488488
r.getClass().getField("d" + n).setDouble(r, n * 1.1);
489-
} catch (Exception e) { throw new RuntimeException(e); }
489+
} catch (ReflectiveOperationException e) { throw new AssertionError("Field setup failed", e); }
490490
}
491491
for (int n = 0; n < 25; n++) {
492492
try {
493493
r.getClass().getField("i" + n).setInt(r, n * 100);
494-
} catch (Exception e) { throw new RuntimeException(e); }
494+
} catch (ReflectiveOperationException e) { throw new AssertionError("Field setup failed", e); }
495495
}
496496
for (int n = 0; n < 20; n++) {
497497
try {
498498
r.getClass().getField("l" + n).setLong(r, n * 1000000L);
499-
} catch (Exception e) { throw new RuntimeException(e); }
499+
} catch (ReflectiveOperationException e) { throw new AssertionError("Field setup failed", e); }
500500
}
501501
for (int n = 0; n < 12; n++) {
502502
try {
503503
r.getClass().getField("b" + n).setBoolean(r, n % 2 == 0);
504-
} catch (Exception e) { throw new RuntimeException(e); }
504+
} catch (ReflectiveOperationException e) { throw new AssertionError("Field setup failed", e); }
505505
}
506506
return r;
507507
}

0 commit comments

Comments
 (0)