@@ -289,6 +289,15 @@ private static Object CallMethod(String className, String methodName, Object tar
289
289
, e . Message ) ) ;
290
290
}
291
291
catch ( Exception e ) {
292
+ // Converting checked exceptions to unchecked RuntimeException (java-specific comment).
293
+ //
294
+ // If typography utils throws an exception at this point, we consider it as unrecoverable situation for
295
+ // its callers (layouting methods). Presence of typography module in class path is checked before.
296
+ // It's might be more suitable to wrap checked exceptions at a bit higher level, but we do it here for
297
+ // the sake of convenience.
298
+ //
299
+ // The RuntimeException exception is used instead of, for example, PdfException, because failure here is
300
+ // unexpected and is not connected to PDF documents processing.
292
301
throw new Exception ( e . ToString ( ) , e ) ;
293
302
}
294
303
return null ;
@@ -306,6 +315,15 @@ private static Object CallConstructor(String className, Type[] parameterTypes, p
306
315
logger . Warn ( MessageFormatUtil . Format ( "Cannot find class {0}" , className ) ) ;
307
316
}
308
317
catch ( Exception exc ) {
318
+ // Converting checked exceptions to unchecked RuntimeException (java-specific comment).
319
+ //
320
+ // If typography utils throws an exception at this point, we consider it as unrecoverable situation for
321
+ // its callers (layouting methods). Presence of typography module in class path is checked before.
322
+ // It's might be more suitable to wrap checked exceptions at a bit higher level, but we do it here for
323
+ // the sake of convenience.
324
+ //
325
+ // The RuntimeException exception is used instead of, for example, PdfException, because failure here is
326
+ // unexpected and is not connected to PDF documents processing.
309
327
throw new Exception ( exc . ToString ( ) , exc ) ;
310
328
}
311
329
return null ;
0 commit comments