20
20
import java .io .FileNotFoundException ;
21
21
import java .io .IOException ;
22
22
import java .io .InputStream ;
23
+ import org .apache .avro .AvroRuntimeException ;
23
24
import org .apache .avro .Schema ;
24
25
import org .apache .avro .Schema .Parser ;
25
- import org .apache .avro .SchemaParseException ;
26
26
import org .apache .kafka .common .config .ConfigException ;
27
27
import org .slf4j .Logger ;
28
28
import org .slf4j .LoggerFactory ;
@@ -35,7 +35,7 @@ public static Schema getSchemaFromSchemaString(String schemaString) {
35
35
Schema schema ;
36
36
try {
37
37
schema = schemaParser .parse (schemaString );
38
- } catch (SchemaParseException e ) {
38
+ } catch (AvroRuntimeException e ) {
39
39
log .error ("Unable to parse the provided schema" , e );
40
40
throw new ConfigException ("Unable to parse the provided schema" );
41
41
}
@@ -56,11 +56,11 @@ public static Schema getSchemaFromSchemaFileName(String schemaFileName) {
56
56
schema = schemaParser .parse (
57
57
DatagenTask .class .getClassLoader ().getResourceAsStream (schemaFileName )
58
58
);
59
- } catch (SchemaParseException | IOException i ) {
59
+ } catch (AvroRuntimeException | IOException i ) {
60
60
log .error ("Unable to parse the provided schema" , i );
61
61
throw new ConfigException ("Unable to parse the provided schema" );
62
62
}
63
- } catch (SchemaParseException | IOException e ) {
63
+ } catch (AvroRuntimeException | IOException e ) {
64
64
log .error ("Unable to parse the provided schema" , e );
65
65
throw new ConfigException ("Unable to parse the provided schema" );
66
66
}
0 commit comments