[hibernate-issues] [Hibernate-JIRA] Resolved: (HSEARCH-921) NullPointerException in AvroSerializationProvider due to wrong resource path
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Wed Sep 21 09:21:35 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bernard resolved HSEARCH-921.
--------------------------------------
Resolution: Fixed
> 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
> Assignee: 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
More information about the hibernate-issues
mailing list