NullPointerException in AvroSerializationProvider due to wrong resource path

Description

From AvroSerializationProvider:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 private void parseSchema(String filename) { String fullFileName = V1_PATH + filename + ".avro"; fullFileName = fullFileName.replace( '/', File.separatorChar ); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream( fullFileName ); String messageSchemaAsString; try { messageSchemaAsString = readInputStream( in, fullFileName ); } finally { try { in.close(); } catch ( IOException e ) { //we don't care } } schemas.put( filename, messageSchemaAsString ); }

the problem is:

1 fullFileName = fullFileName.replace( '/', File.separatorChar );

Since the files are loaded from the jar the forward slash has to be used regardless. On windows you will get a wrong file name and the loading of the resource will fail.

See also: https://forum.hibernate.org/viewtopic.php?f=9&t=1012548

Environment

None

Status

Assignee

Unassigned

Reporter

Hardy Ferentschik

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Fix versions

Affects versions

4.0.0.Beta1

Priority

Critical