Skip to content

Commit 152b832

Browse files
author
Chris Li
committed
Replace sneakythrows
1 parent 354cd89 commit 152b832

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

cdi-core/src/main/java/com/linkedin/cdi/extractor/AvroExtractor.java

+4-19
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ public Schema getSchema() {
9494
// take pre-defined fixed schema
9595
JsonArray schemaArray = jobKeys.getOutputSchema();
9696
setRowFilter(schemaArray);
97-
try {
98-
avroSchema = fromJsonSchema(schemaArray);
99-
} catch (Exception e) {
100-
throw new RuntimeException("Error converting Json schema to Avro schema", e);
101-
}
97+
avroSchema = fromJsonSchema(schemaArray);
10298
} else {
10399
avroSchema = processInputStream(0) ? avroExtractorKeys.getAvroOutputSchema()
104100
: createMinimumAvroSchema();
@@ -149,11 +145,7 @@ public GenericRecord readRecord(GenericRecord reuse) {
149145
GenericRecord row = extractDataField(getNext());
150146
AvroSchemaBasedFilter avroSchemaBasedFilter = (AvroSchemaBasedFilter) rowFilter;
151147
if (avroSchemaBasedFilter != null) {
152-
try {
153-
row = avroSchemaBasedFilter.filter(row);
154-
} catch (Exception e) {
155-
throw new RuntimeException("Error filtering row", e);
156-
}
148+
row = avroSchemaBasedFilter.filter(row);
157149
}
158150
return addDerivedFields(row);
159151
}
@@ -387,9 +379,8 @@ private String processDerivedFieldSource(GenericRecord row, String name, Map<Str
387379
* Utility method to convert JsonArray schema to avro schema
388380
* @param schema of JsonArray type
389381
* @return avro schema
390-
* @throws UnsupportedDateTypeException unsupported type exception
391382
*/
392-
private Schema fromJsonSchema(JsonArray schema) throws UnsupportedDateTypeException {
383+
private Schema fromJsonSchema(JsonArray schema){
393384
return AvroSchemaUtils.fromJsonSchema(schema, state);
394385
}
395386

@@ -487,12 +478,6 @@ private boolean isArrayOfRecord(Object payload) {
487478
* @return avro schema
488479
*/
489480
private Schema createMinimumAvroSchema() {
490-
Schema schema;
491-
try {
492-
schema = fromJsonSchema(createMinimumSchema());
493-
} catch (UnsupportedDateTypeException e) {
494-
throw new IllegalStateException("Should not get here since the minimum schema only contains supported types");
495-
}
496-
return schema;
481+
return fromJsonSchema(createMinimumSchema());
497482
}
498483
}

0 commit comments

Comments
 (0)