Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-1340

"serializeAndRecover" testing utility swallows exceptions

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Labels:

      Description

      Class TestUtils (in the "test" part of the repository) contains a "serializeAndRecover" method that catches "IOException" and "ClassNotFoundException" and just returns "null".

      When testing code changes, some unit tests can thus throw "NullPointerException". Even if the returned value is checked for "null", there is no trace as to what caused it (the original stack trace is lost).

      I propose to wrap the exception in a "RuntimeException" and rethrow it.

        Attachments

          Activity

            People

            • Assignee:
              erans Gilles
              Reporter:
              erans Gilles
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: