From f857d7cbf9266b75cb775e484f2015bf8d02f927 Mon Sep 17 00:00:00 2001 From: David Steinkopff Date: Mon, 13 Jan 2020 16:45:07 +0100 Subject: [PATCH] HSEARCH-3801 Hibernate Search blocks loading of non hibernate batch jobs In reference of `org.jberet.spi.JobXmlResolver` it's defined that a resolver that is not responsible should return `null` instead of throwing a runtime exception ``` /** * Locates the job XML and creates a stream to the contents. * * @param jobXml the name of the job XML with a {@code .xml} suffix * @param classLoader the class loader for the application * * @return a stream of the job XML or {@code null} if the job XML content was not found * * @throws java.io.IOException if an error occurs creating the stream */ ``` Update HibernateSearchJobXmlResolver.java --- .../jsr352/jberet/impl/HibernateSearchJobXmlResolver.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/legacy/jsr352/jberet/src/main/java/org/hibernate/search/jsr352/jberet/impl/HibernateSearchJobXmlResolver.java b/legacy/jsr352/jberet/src/main/java/org/hibernate/search/jsr352/jberet/impl/HibernateSearchJobXmlResolver.java index ff1348355a5..c1c872227ed 100644 --- a/legacy/jsr352/jberet/src/main/java/org/hibernate/search/jsr352/jberet/impl/HibernateSearchJobXmlResolver.java +++ b/legacy/jsr352/jberet/src/main/java/org/hibernate/search/jsr352/jberet/impl/HibernateSearchJobXmlResolver.java @@ -15,7 +15,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import org.hibernate.search.exception.SearchException; import org.hibernate.search.jsr352.massindexing.MassIndexingJob; import org.jberet.spi.JobXmlResolver; @@ -47,7 +46,7 @@ public InputStream resolveJobXml(final String jobXml, final ClassLoader classLoa return classLoader.getResourceAsStream( path ); } else { - throw new SearchException( "Not a Hibernate Search JSR-352 job: " + jobXml ); + return null; } } }