Skip to content

Commit

Permalink
HSEARCH-1815 Improve log message when SerializationProvider is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Jun 30, 2015
1 parent 3f2ecf2 commit 1044417
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -25,6 +25,7 @@
import org.hibernate.search.engine.integration.impl.ExtendedSearchIntegrator;
import org.hibernate.search.engine.service.spi.ServiceManager;
import org.hibernate.search.engine.spi.EntityIndexBinding;
import org.hibernate.search.exception.SearchException;
import org.hibernate.search.indexes.impl.PropertiesParseHelper;
import org.hibernate.search.indexes.serialization.impl.LuceneWorkSerializerImpl;
import org.hibernate.search.indexes.serialization.spi.LuceneWorkSerializer;
Expand Down Expand Up @@ -143,13 +144,22 @@ public void optimize() {
@Override
public LuceneWorkSerializer getSerializer() {
if ( serializer == null ) {
serializationProvider = serviceManager.requestService( SerializationProvider.class );
serializationProvider = requestSerializationProvider();
serializer = new LuceneWorkSerializerImpl( serializationProvider, boundSearchIntegrator );
log.indexManagerUsesSerializationService( this.indexName, this.serializer.describeSerializer() );
}
return serializer;
}

private SerializationProvider requestSerializationProvider() {
try {
return serviceManager.requestService( SerializationProvider.class );
}
catch (SearchException se) {
throw log.serializationProviderNotFoundException( se );
}
}

//Not exposed on the IndexManager interface
public BackendQueueProcessor getBackendQueueProcessor() {
return backend;
Expand Down
Expand Up @@ -824,4 +824,8 @@ public interface Log extends BasicLogger {
@LogMessage(level = Level.DEBUG)
@Message(id = 274, value = "Executing Lucene query '%s'" )
void executingLuceneQuery(Query luceneQuery);

@Message(id = 275, value = "SerializationProvider service not found on the classpath. You should check that an implementation exists and it's correctly registered as a service."
+ " If that's not the case, you can also create a custom implementation or add \"org.hibernate:hibernate-search-serialization-avro\" on the classpath")
SearchException serializationProviderNotFoundException(@Cause Exception cause);
}

0 comments on commit 1044417

Please sign in to comment.