NullPointerException in AvroSerializationProvider due to wrong resource path
----------------------------------------------------------------------------
Key: HSEARCH-921
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-921
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 4.0.0.Beta1
Reporter: Hardy Ferentschik
Priority: Critical
Fix For: 4.0.0.Beta2
From AvroSerializationProvider:
{code}
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 );
}
{code}
the problem is:
{code}
fullFileName = fullFileName.replace( '/', File.separatorChar );
{code}
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
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira