Skip to content

Commit 0c0f43a

Browse files
committed
Replacing DatagenTaskException with ConnectException
1 parent f2847f2 commit 0c0f43a

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/main/java/io/confluent/kafka/connect/datagen/DatagenTask.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void start(Map<String, String> props) {
162162
}
163163

164164
@Override
165-
public List<SourceRecord> poll() throws InterruptedException {
165+
public List<SourceRecord> poll() throws ConnectException {
166166

167167
if (maxInterval > 0) {
168168
try {
@@ -230,7 +230,7 @@ public List<SourceRecord> poll() throws InterruptedException {
230230
return records;
231231
}
232232

233-
private GenericRecord generateRecord() throws DatagenTaskException {
233+
private GenericRecord generateRecord() throws ConnectException {
234234
Future<Object> generatedObjectFuture = generateExecutor.submit(generator::generate);
235235
Long timeout = config.getGenerateTimeout();
236236
Object generatedObject;
@@ -241,12 +241,12 @@ private GenericRecord generateRecord() throws DatagenTaskException {
241241
generatedObject = generatedObjectFuture.get(timeout, TimeUnit.MILLISECONDS);
242242
}
243243
} catch (InterruptedException | ExecutionException e) {
244-
throw new DatagenTaskException("Unable to generate random record", e);
244+
throw new ConnectException("Unable to generate random record", e);
245245
} catch (TimeoutException e) {
246-
throw new DatagenTaskException("Record generation timed out", e);
246+
throw new ConnectException("Record generation timed out", e);
247247
}
248248
if (!(generatedObject instanceof GenericRecord)) {
249-
throw new DatagenTaskException(String.format(
249+
throw new ConnectException(String.format(
250250
"Expected Avro Random Generator to return instance of GenericRecord, found %s instead",
251251
generatedObject.getClass().getName()
252252
));

src/main/java/io/confluent/kafka/connect/datagen/DatagenTaskException.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)