Skip to content

Commit 53dee52

Browse files
Fix review comments
Co-authored-by: Dai MIKURUBE <dmikurube@acm.org>
1 parent 41163b9 commit 53dee52

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

embulk-input-mysql/src/main/java/org/embulk/input/mysql/MySQLInputPlugin.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ private void loadTimeZoneMappingsIfNeeded()
158158
// property file because the file should be in the same classpath with the class.
159159
// Here implements a workaround as a workaround.
160160
//
161-
// It's not 100% sure, but this workaround is necessary for Connector/J 5.x (com.mysql.jdbc.TimeUtil)
162-
// only.
161+
// This workaround seems required only for Connector/J 5.x (com.mysql.jdbc.TimeUtil),
162+
// not necessary for Connector/J 8.x (com.mysql.cj.util.TimeUtil).
163+
// TODO: Clarify for Connector/J 8.x just in case.
163164
Field f = null;
164165
try {
165166
Class<?> timeUtilClass = Class.forName("com.mysql.jdbc.TimeUtil");
@@ -176,9 +177,14 @@ private void loadTimeZoneMappingsIfNeeded()
176177
}
177178
}
178179
catch (ClassNotFoundException e) {
179-
// It appears that the user uses the Connector/J 8.x driver.
180-
// Do nothing;
180+
try {
181+
Class.forName("com.mysql.cj.util.TimeUtil");
182+
} catch (final ClassNotFoundException ex2) {
183+
// Throw if neither the Connector/J 5.x nor 8.x driver is found.
184+
throw new RuntimeException(e);
185+
}
181186
}
187+
// Pass-through if the Connector/J 8.x driver is found. }
182188
catch (IllegalAccessException | NoSuchFieldException | IOException e) {
183189
throw new RuntimeException(e);
184190
}

0 commit comments

Comments
 (0)