Merge branch 'stable-2.12'
* stable-2.12: Make VelocityRuntimeProvider singleton, not RuntimeInstance Throw QueryParseException if the created phrase query is null Change-Id: I2ca604abd6bc0c14b95ea67fee4e63f8088621ca
This commit is contained in:
@@ -241,7 +241,12 @@ public class QueryBuilder<V> {
|
|||||||
throw new QueryParseException(
|
throw new QueryParseException(
|
||||||
"Full-text search over empty string not supported");
|
"Full-text search over empty string not supported");
|
||||||
}
|
}
|
||||||
return queryBuilder.createPhraseQuery(p.getField().getName(), value);
|
Query query = queryBuilder.createPhraseQuery(p.getField().getName(), value);
|
||||||
|
if (query == null) {
|
||||||
|
throw new QueryParseException(
|
||||||
|
"Cannot create full-text query with value: " + value);
|
||||||
|
}
|
||||||
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int toIndexTimeInMinutes(Date ts) {
|
public int toIndexTimeInMinutes(Date ts) {
|
||||||
|
|||||||
@@ -271,8 +271,7 @@ public class GerritGlobalModule extends FactoryModule {
|
|||||||
bind(ApprovalsUtil.class);
|
bind(ApprovalsUtil.class);
|
||||||
|
|
||||||
bind(RuntimeInstance.class)
|
bind(RuntimeInstance.class)
|
||||||
.toProvider(VelocityRuntimeProvider.class)
|
.toProvider(VelocityRuntimeProvider.class);
|
||||||
.in(SINGLETON);
|
|
||||||
bind(FromAddressGenerator.class).toProvider(
|
bind(FromAddressGenerator.class).toProvider(
|
||||||
FromAddressGeneratorProvider.class).in(SINGLETON);
|
FromAddressGeneratorProvider.class).in(SINGLETON);
|
||||||
bind(Boolean.class).annotatedWith(DisableReverseDnsLookup.class)
|
bind(Boolean.class).annotatedWith(DisableReverseDnsLookup.class)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.google.gerrit.server.config.SitePaths;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.ProvisionException;
|
import com.google.inject.ProvisionException;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.velocity.runtime.RuntimeConstants;
|
import org.apache.velocity.runtime.RuntimeConstants;
|
||||||
import org.apache.velocity.runtime.RuntimeInstance;
|
import org.apache.velocity.runtime.RuntimeInstance;
|
||||||
@@ -30,6 +31,7 @@ import java.nio.file.Files;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/** Configures Velocity template engine for sending email. */
|
/** Configures Velocity template engine for sending email. */
|
||||||
|
@Singleton
|
||||||
public class VelocityRuntimeProvider implements Provider<RuntimeInstance> {
|
public class VelocityRuntimeProvider implements Provider<RuntimeInstance> {
|
||||||
private final SitePaths site;
|
private final SitePaths site;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user