Skip to content

Commit e3b54fe

Browse files
authored
Merge pull request #25 from embulk/descriptive-ClassCastException-for-missing-getObjectNode
Throw an Exception that has a more descriptive message when trying to invoke getObjectNode for non-embulk-core DataSourceImpl
2 parents 8696101 + 29576b0 commit e3b54fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/embulk/util/config/Compat.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ private static Optional<String> callToJsonIfAvailable(final DataSource source) {
133133
private static ObjectNode callGetObjectNodeAndRebuildIfAvailable(final DataSource source, final ObjectMapper mapper) {
134134
final Class<? extends DataSource> coreDataSourceImplClass = source.getClass();
135135
if (!coreDataSourceImplClass.getCanonicalName().equals("org.embulk.config.DataSourceImpl")) {
136-
throw new ClassCastException("DataSource specified is not org.embulk.config.DataSourceImpl.");
136+
throw new ClassCastException(
137+
"DataSource specified is not org.embulk.config.DataSourceImpl. "
138+
+ "The DataSource instance is unexpected to implement getObjectNode(). "
139+
+ "DataSource class: " + source.getClass());
137140
}
138141
final Method getObjectNode = getGetObjectNodeMethod(coreDataSourceImplClass);
139142
if (getObjectNode == null) {

0 commit comments

Comments
 (0)