Skip to content

Commit

Permalink
HSEARCH-2387 Convert RuntimeException to SearchException in FieldMeta…
Browse files Browse the repository at this point in the history
…dtaBuilderImpl
  • Loading branch information
DavideD authored and Sanne committed Dec 19, 2016
1 parent 800ed3d commit 1d767be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -12,6 +12,8 @@
import org.hibernate.search.bridge.spi.FieldMetadataBuilder;
import org.hibernate.search.bridge.spi.FieldMetadataCreationContext;
import org.hibernate.search.bridge.spi.FieldType;
import org.hibernate.search.util.logging.impl.Log;
import org.hibernate.search.util.logging.impl.LoggerFactory;

/**
* The internal implementation of {@link FieldMetadataBuilder}.
Expand All @@ -20,6 +22,8 @@
*/
class FieldMetadataBuilderImpl implements FieldMetadataBuilder {

private static final Log LOG = LoggerFactory.make();

private final Set<String> sortableFieldsAbsoluteNames = new LinkedHashSet<>();
private final Set<BridgeDefinedField> bridgeDefinedFields = new LinkedHashSet<>();
private final BackReference<DocumentFieldMetadata> fieldMetadata;
Expand Down Expand Up @@ -70,7 +74,7 @@ private <T extends FieldMetadataCreationContext> T create(Class<T> backend) {
return backend.getDeclaredConstructor( BridgeDefinedField.class, FieldMetadataCreationContext.class ).newInstance( field, this );
}
catch (Exception e) {
throw new RuntimeException( e );
throw LOG.cannotCreateBridgeDefinedField( backend, e );
}
}
}
Expand Down
Expand Up @@ -1006,4 +1006,6 @@ public interface Log extends BasicLogger {
@Message(id = 327, value = "Unsupported indexNullAs token type '%3$s' on field '%2$s' of entity '%1$s'." )
SearchException unsupportedNullTokenType(Class<?> entityType, String fieldName, Class<?> tokenType);

@Message(id = 328, value = "Cannot create context for class: %1$s" )
SearchException cannotCreateBridgeDefinedField(@FormatWith(ClassFormatter.class) Class<?> backend, @Cause Exception e);
}

0 comments on commit 1d767be

Please sign in to comment.