protected void report(Environment environment, CategorizedProblem problem) {
    if (problem == null) {
      throw new IllegalArgumentException("problem cannot be null");
    }

    File file = new File(new String(problem.getOriginatingFileName()));
    String filename = file.getAbsolutePath();

    String message = problem.getMessage() + " at " + filename + ":" + problem.getSourceLineNumber();

    if (problem.isError()) {
      if (!environment.getNoClasspath()) {
        // by default, compilation errors are notified as exception
        throw new ModelBuildingException(message);
      } else {
        // in noclasspath mode, errors are only reported
        environment.report(null, problem.isError() ? Level.ERROR : Level.WARN, message);
      }
    }
  }