private String isClassNotFoundException(Throwable e) { if (e instanceof ClassNotFoundException) { return e.getMessage(); } if (e.getCause() != null) { return isClassNotFoundException(e.getCause()); } return null; }
private String isClassNotFoundException(Throwable e) { if (e instanceof ClassNotFoundException) { return e.getMessage(); } if (e.getCause() != null) { return isClassNotFoundException(e.getCause()); } return null; }
@SuppressWarnings("unchecked") private ReflectionRowReader<T> getReflectionRowReader() { if (rowReader == null) { try { // this can throw a runtime exception from a ClassNotFoundException Type type = typeRepresentation.toType(); rowReader = new ReflectionRowReader<>(objectSchema, (TypeToken<T>) TypeToken.of(type)); } catch (RuntimeException e) { String missingClass = isClassNotFoundException(e); if (missingClass != null) { LOG.error("Cannot load dataset because class {} could not be found. This is probably because the " + "type parameter of the dataset is not present in the dataset's jar file. See the developer " + "guide for more information.", missingClass); } throw e; } } return rowReader; }
@SuppressWarnings("unchecked") private ReflectionRowReader<T> getReflectionRowReader() { if (rowReader == null) { try { // this can throw a runtime exception from a ClassNotFoundException Type type = typeRepresentation.toType(); rowReader = new ReflectionRowReader<>(objectSchema, (TypeToken<T>) TypeToken.of(type)); } catch (RuntimeException e) { String missingClass = isClassNotFoundException(e); if (missingClass != null) { LOG.error("Cannot load dataset because class {} could not be found. This is probably because the " + "type parameter of the dataset is not present in the dataset's jar file. See the developer " + "guide for more information.", missingClass); } throw e; } } return rowReader; }