code cleanup
This commit is contained in:
parent
d05842eb15
commit
02ce47d1a0
22 changed files with 86 additions and 83 deletions
|
@ -86,7 +86,7 @@ public class FessBoot extends TomcatBoot {
|
|||
.asDevelopment(isNoneEnv()).bootAwait();
|
||||
}
|
||||
|
||||
public static void shutdown(String[] args) {
|
||||
public static void shutdown(final String[] args) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -316,10 +316,10 @@ public class JsonApiManager extends BaseApiManager {
|
|||
return;
|
||||
}
|
||||
|
||||
String seed = request.getParameter("seed");
|
||||
String[] tags = request.getParameterValues("labels");
|
||||
String[] fields = request.getParameterValues("fields");
|
||||
String[] excludes = StringUtil.EMPTY_STRINGS;// TODO
|
||||
final String seed = request.getParameter("seed");
|
||||
final String[] tags = request.getParameterValues("labels");
|
||||
final String[] fields = request.getParameterValues("fields");
|
||||
final String[] excludes = StringUtil.EMPTY_STRINGS;// TODO
|
||||
|
||||
final PopularWordHelper popularWordHelper = ComponentUtil.getPopularWordHelper();
|
||||
|
||||
|
@ -675,13 +675,13 @@ public class JsonApiManager extends BaseApiManager {
|
|||
|
||||
private final HttpServletRequest request;
|
||||
|
||||
private FessConfig fessConfig;
|
||||
private final FessConfig fessConfig;
|
||||
|
||||
private int startPosition = -1;
|
||||
|
||||
private int pageSize = -1;
|
||||
|
||||
protected SearchApiRequestParams(final HttpServletRequest request, FessConfig fessConfig) {
|
||||
protected SearchApiRequestParams(final HttpServletRequest request, final FessConfig fessConfig) {
|
||||
this.request = request;
|
||||
this.fessConfig = fessConfig;
|
||||
}
|
||||
|
|
|
@ -112,8 +112,8 @@ public class SearchService {
|
|||
fessConfig.getIndexDocumentType(),
|
||||
searchRequestBuilder -> {
|
||||
if (StringUtil.isNotBlank(sortField)) {
|
||||
String[] sort = sortField.split("\\.");
|
||||
SortBuilder sortBuilder = SortBuilders.fieldSort(sort[0]);
|
||||
final String[] sort = sortField.split("\\.");
|
||||
final SortBuilder sortBuilder = SortBuilders.fieldSort(sort[0]);
|
||||
if ("asc".equals(sort[1])) {
|
||||
sortBuilder.order(SortOrder.ASC);
|
||||
} else if ("desc".equals(sort[1])) {
|
||||
|
|
|
@ -306,7 +306,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable {
|
|||
return asHtml(path_AdminDesign_AdminDesignJsp).useForm(DesignForm.class);
|
||||
}
|
||||
|
||||
private HtmlResponse asListHtml(UploadForm uploadForm) {
|
||||
private HtmlResponse asListHtml(final UploadForm uploadForm) {
|
||||
return asHtml(path_AdminDesign_AdminDesignJsp).useForm(DesignForm.class, setup -> {
|
||||
setup.setup(form -> {
|
||||
copyBeanToBean(uploadForm, form, op -> op.include("designFile", "designFileName"));
|
||||
|
|
|
@ -108,7 +108,7 @@ public class AdminGeneralAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessSendTestmail(GLOBAL));
|
||||
updateProperty(Constants.NOTIFICATION_TO_PROPERTY, form.notificationTo);
|
||||
crawlerProperties.store();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to send a test mail.", e);
|
||||
saveError(messages -> messages.addErrorsFailedToSendTestmail(GLOBAL));
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class AdminGeneralAction extends FessAdminAction {
|
|||
return redirect(getClass());
|
||||
}
|
||||
|
||||
private String getCheckboxValue(String value) {
|
||||
private String getCheckboxValue(final String value) {
|
||||
return Constants.ON.equalsIgnoreCase(value) ? Constants.TRUE : Constants.FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ public class FessLoginAssist extends TypicalLoginAssist<String, FessUserBean, Fe
|
|||
}
|
||||
|
||||
@Override
|
||||
public OptionalEntity<FessUser> findLoginUser(String username, String password) {
|
||||
OptionalEntity<FessUser> ldapUser = ComponentUtil.getLdapManager().login(username, password);
|
||||
public OptionalEntity<FessUser> findLoginUser(final String username, final String password) {
|
||||
final OptionalEntity<FessUser> ldapUser = ComponentUtil.getLdapManager().login(username, password);
|
||||
if (ldapUser.isPresent()) {
|
||||
return ldapUser;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class LoginAction extends FessSearchAction {
|
|||
return getUserBean().map(user -> redirectByUser(user)).orElse(asHtml(path_Login_IndexJsp));
|
||||
}
|
||||
|
||||
private HtmlResponse redirectByUser(FessUserBean user) {
|
||||
private HtmlResponse redirectByUser(final FessUserBean user) {
|
||||
if (!user.hasRoles(fessConfig.getAuthenticationAdminRolesAsArray())) {
|
||||
return redirectToRoot();
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ public class SearchAction extends FessSearchAction {
|
|||
|
||||
protected static class WebRenderData extends SearchRenderData {
|
||||
|
||||
public void register(RenderData data) {
|
||||
public void register(final RenderData data) {
|
||||
RenderDataUtil.register(data, "queryId", queryId);
|
||||
RenderDataUtil.register(data, "documentItems", documentItems);
|
||||
RenderDataUtil.register(data, "facetResponse", facetResponse);
|
||||
|
|
|
@ -224,7 +224,7 @@ public class FessEsClient implements Client {
|
|||
|
||||
@PostConstruct
|
||||
public void open() {
|
||||
FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
|
||||
final String transportAddressesValue = System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES);
|
||||
if (StringUtil.isNotBlank(transportAddressesValue)) {
|
||||
|
|
|
@ -45,11 +45,13 @@ public class User extends BsUser implements FessUser {
|
|||
asDocMeta().id(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRoleNames() {
|
||||
return StreamUtil.of(getRoles()).map(role -> new String(Base64.getDecoder().decode(role), Constants.CHARSET_UTF_8))
|
||||
.toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroupNames() {
|
||||
return StreamUtil.of(getGroups()).map(group -> new String(Base64.getDecoder().decode(group), Constants.CHARSET_UTF_8))
|
||||
.toArray(n -> new String[n]);
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.codelibs.fess.helper;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -51,44 +50,46 @@ public class PopularWordHelper {
|
|||
.expireAfterWrite(fessConfig.getSuggestPopularWordCacheExpireAsInteger().longValue(), TimeUnit.MINUTES).build();
|
||||
}
|
||||
|
||||
public List<String> getWordList(String seed, String[] tags, String[] fields, String[] excludes) {
|
||||
RoleQueryHelper roleQueryHelper = ComponentUtil.getRoleQueryHelper();
|
||||
String[] roles = roleQueryHelper.build().stream().toArray(n -> new String[n]);
|
||||
public List<String> getWordList(final String seed, final String[] tags, final String[] fields, final String[] excludes) {
|
||||
final RoleQueryHelper roleQueryHelper = ComponentUtil.getRoleQueryHelper();
|
||||
final String[] roles = roleQueryHelper.build().stream().toArray(n -> new String[n]);
|
||||
return getWordList(seed, tags, roles, fields, excludes);
|
||||
}
|
||||
|
||||
public List<String> getWordList(String seed, String[] tags, String[] roles, String[] fields, String[] excludes) {
|
||||
public List<String> getWordList(final String seed, final String[] tags, final String[] roles, final String[] fields,
|
||||
final String[] excludes) {
|
||||
try {
|
||||
return cache.get(getCacheKey(seed, tags, roles, fields, excludes), new Callable<List<String>>() {
|
||||
@Override
|
||||
public List<String> call() throws Exception {
|
||||
final List<String> wordList = new ArrayList<String>();
|
||||
SuggestHelper suggestHelper = ComponentUtil.getSuggestHelper();
|
||||
final PopularWordsRequestBuilder popularWordsRequestBuilder =
|
||||
suggestHelper.suggester().popularWords().setSize(fessConfig.getSuggestPopularWordSizeAsInteger().intValue())
|
||||
.setWindowSize(fessConfig.getSuggestPopularWordWindowSizeAsInteger().intValue());
|
||||
if (seed != null) {
|
||||
popularWordsRequestBuilder.setSeed(seed);
|
||||
}
|
||||
StreamUtil.of(tags).forEach(tag -> popularWordsRequestBuilder.addTag(tag));
|
||||
StreamUtil.of(roles).forEach(role -> popularWordsRequestBuilder.addRole(role));
|
||||
StreamUtil.of(fields).forEach(field -> popularWordsRequestBuilder.addField(field));
|
||||
StreamUtil.of(excludes).forEach(exclude -> popularWordsRequestBuilder.addExcludeWord(exclude));
|
||||
popularWordsRequestBuilder.execute().then(r -> {
|
||||
r.getItems().stream().forEach(item -> wordList.add(item.getText()));
|
||||
}).error(t -> logger.warn("Failed to generate popular words.", t));
|
||||
return cache.get(
|
||||
getCacheKey(seed, tags, roles, fields, excludes),
|
||||
() -> {
|
||||
final List<String> wordList = new ArrayList<String>();
|
||||
final SuggestHelper suggestHelper = ComponentUtil.getSuggestHelper();
|
||||
final PopularWordsRequestBuilder popularWordsRequestBuilder =
|
||||
suggestHelper.suggester().popularWords()
|
||||
.setSize(fessConfig.getSuggestPopularWordSizeAsInteger().intValue())
|
||||
.setWindowSize(fessConfig.getSuggestPopularWordWindowSizeAsInteger().intValue());
|
||||
if (seed != null) {
|
||||
popularWordsRequestBuilder.setSeed(seed);
|
||||
}
|
||||
StreamUtil.of(tags).forEach(tag -> popularWordsRequestBuilder.addTag(tag));
|
||||
StreamUtil.of(roles).forEach(role -> popularWordsRequestBuilder.addRole(role));
|
||||
StreamUtil.of(fields).forEach(field -> popularWordsRequestBuilder.addField(field));
|
||||
StreamUtil.of(excludes).forEach(exclude -> popularWordsRequestBuilder.addExcludeWord(exclude));
|
||||
popularWordsRequestBuilder.execute().then(r -> {
|
||||
r.getItems().stream().forEach(item -> wordList.add(item.getText()));
|
||||
}).error(t -> logger.warn("Failed to generate popular words.", t));
|
||||
|
||||
return wordList;
|
||||
}
|
||||
});
|
||||
} catch (ExecutionException e) {
|
||||
return wordList;
|
||||
});
|
||||
} catch (final ExecutionException e) {
|
||||
logger.warn("Failed to load popular words.", e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
protected String getCacheKey(String seed, String[] tags, String[] roles, String[] fields, String[] excludes) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
protected String getCacheKey(final String seed, final String[] tags, final String[] roles, final String[] fields,
|
||||
final String[] excludes) {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(seed).append(CACHE_KEY_SPLITTER);
|
||||
StreamUtil.of(tags).sorted().reduce((l, r) -> l + r).ifPresent(v -> buf.append(v));
|
||||
buf.append(CACHE_KEY_SPLITTER);
|
||||
|
|
|
@ -41,15 +41,15 @@ public class SambaHelper {
|
|||
return convert(sid.getType(), sid.getAccountName());
|
||||
}
|
||||
|
||||
public String getRoleByUser(String name) {
|
||||
public String getRoleByUser(final String name) {
|
||||
return convert(SID_TYPE_USER, name);
|
||||
}
|
||||
|
||||
public String getRoleByGroup(String name) {
|
||||
public String getRoleByGroup(final String name) {
|
||||
return convert(SID_TYPE_DOM_GRP, name);
|
||||
}
|
||||
|
||||
protected String convert(int type, String name) {
|
||||
protected String convert(final int type, final String name) {
|
||||
return type + name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SuggestHelper {
|
|||
|
||||
private List<String> contentFieldList;
|
||||
|
||||
private List<Pattern> roleFilterList = new ArrayList<>();
|
||||
private final List<Pattern> roleFilterList = new ArrayList<>();
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
@ -274,7 +274,7 @@ public class SuggestHelper {
|
|||
suggester.indexer().deleteBadWord(badWord);
|
||||
}
|
||||
|
||||
private Stream<String> stream(String value) {
|
||||
private Stream<String> stream(final String value) {
|
||||
return StreamUtil.of(value.split(",")).filter(v -> StringUtil.isNotBlank(v));
|
||||
}
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ public class ViewHelper implements Serializable {
|
|||
|
||||
String cache = DocumentUtil.getValue(doc, fessConfig.getIndexFieldCache(), String.class);
|
||||
if (cache != null) {
|
||||
String mimetype = DocumentUtil.getValue(doc, fessConfig.getIndexFieldMimetype(), String.class);
|
||||
final String mimetype = DocumentUtil.getValue(doc, fessConfig.getIndexFieldMimetype(), String.class);
|
||||
if (!ComponentUtil.getFessConfig().isHtmlMimetypeForCache(mimetype)) {
|
||||
cache = StringEscapeUtils.escapeHtml4(cache);
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ import org.slf4j.LoggerFactory;
|
|||
public class LdapManager {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AdLoginInfoFilter.class);
|
||||
|
||||
public OptionalEntity<FessUser> login(String username, String password) {
|
||||
FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
String providerUrl = fessConfig.getLdapProviderUrl();
|
||||
public OptionalEntity<FessUser> login(final String username, final String password) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final String providerUrl = fessConfig.getLdapProviderUrl();
|
||||
|
||||
if (StringUtil.isBlank(providerUrl)) {
|
||||
return OptionalEntity.empty();
|
||||
|
@ -52,7 +52,7 @@ public class LdapManager {
|
|||
|
||||
DirContext ctx = null;
|
||||
try {
|
||||
Hashtable<String, String> env = new Hashtable<>();
|
||||
final Hashtable<String, String> env = new Hashtable<>();
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, fessConfig.getLdapInitialContextFactory());
|
||||
env.put(Context.SECURITY_AUTHENTICATION, fessConfig.getLdapSecurityAuthentication());
|
||||
env.put(Context.PROVIDER_URL, providerUrl);
|
||||
|
@ -63,13 +63,13 @@ public class LdapManager {
|
|||
logger.debug("Logged in.", ctx);
|
||||
}
|
||||
return OptionalEntity.of(createLdapUser(username, env));
|
||||
} catch (NamingException e) {
|
||||
} catch (final NamingException e) {
|
||||
logger.debug("Login failed.", e);
|
||||
} finally {
|
||||
if (ctx != null) {
|
||||
try {
|
||||
ctx.close();
|
||||
} catch (NamingException e) {
|
||||
} catch (final NamingException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
@ -77,13 +77,13 @@ public class LdapManager {
|
|||
return OptionalEntity.empty();
|
||||
}
|
||||
|
||||
protected LdapUser createLdapUser(String username, Hashtable<String, String> env) {
|
||||
protected LdapUser createLdapUser(final String username, final Hashtable<String, String> env) {
|
||||
return new LdapUser(env, username);
|
||||
}
|
||||
|
||||
public String[] getRoles(final LdapUser ldapUser, String bindDn, String accountFilter) {
|
||||
SambaHelper sambaHelper = ComponentUtil.getSambaHelper();
|
||||
FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
public String[] getRoles(final LdapUser ldapUser, final String bindDn, final String accountFilter) {
|
||||
final SambaHelper sambaHelper = ComponentUtil.getSambaHelper();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final List<String> roleList = new ArrayList<String>();
|
||||
|
||||
if (fessConfig.isSmbRoleAsUser()) {
|
||||
|
@ -113,7 +113,7 @@ public class LdapManager {
|
|||
}
|
||||
|
||||
for (int i = 0; i < attr.size(); i++) {
|
||||
Object attrValue = attr.get(i);
|
||||
final Object attrValue = attr.get(i);
|
||||
if (attrValue != null) {
|
||||
// TODO replace with regexp
|
||||
String strTmp = attrValue.toString();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class LdapUser implements FessUser {
|
|||
|
||||
protected String[] roles = null;
|
||||
|
||||
public LdapUser(Hashtable<String, String> env, String name) {
|
||||
public LdapUser(final Hashtable<String, String> env, final String name) {
|
||||
this.env = env;
|
||||
this.name = name;
|
||||
}
|
||||
|
|
|
@ -21,15 +21,15 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.codelibs.fess.util.StreamUtil;
|
||||
|
||||
public interface FessProp {
|
||||
public default String getProperty(String key) {
|
||||
public default String getProperty(final String key) {
|
||||
return ComponentUtil.getCrawlerProperties().getProperty(key);
|
||||
}
|
||||
|
||||
public default String getProperty(String key, String defaultValue) {
|
||||
public default String getProperty(final String key, final String defaultValue) {
|
||||
return ComponentUtil.getCrawlerProperties().getProperty(key, defaultValue);
|
||||
}
|
||||
|
||||
public default void setLoginRequired(boolean value) {
|
||||
public default void setLoginRequired(final boolean value) {
|
||||
ComponentUtil.getCrawlerProperties().setProperty(Constants.LOGIN_REQUIRED_PROPERTY, value ? Constants.TRUE : Constants.FALSE);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public interface FessProp {
|
|||
return getProperty(Constants.LDAP_PROVIDER_URL);
|
||||
}
|
||||
|
||||
public default String getLdapSecurityPrincipal(String username) {
|
||||
public default String getLdapSecurityPrincipal(final String username) {
|
||||
return String.format(getProperty(Constants.LDAP_SECURITY_PRINCIPAL, StringUtil.EMPTY), username);
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ public interface FessProp {
|
|||
|
||||
String getCrawlerDocumentCacheHtmlMimetypes();
|
||||
|
||||
public default boolean isHtmlMimetypeForCache(String mimetype) {
|
||||
String[] mimetypes = getCrawlerDocumentCacheHtmlMimetypes().split(",");
|
||||
public default boolean isHtmlMimetypeForCache(final String mimetype) {
|
||||
final String[] mimetypes = getCrawlerDocumentCacheHtmlMimetypes().split(",");
|
||||
if (mimetypes.length == 1 && StringUtil.isBlank(mimetypes[0])) {
|
||||
return true;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ public interface FessProp {
|
|||
|
||||
String getCrawlerDocumentCacheSupportedMimetypes();
|
||||
|
||||
public default boolean isSupportedDocumentCacheMimetypes(String mimetype) {
|
||||
String[] mimetypes = getCrawlerDocumentCacheSupportedMimetypes().split(",");
|
||||
public default boolean isSupportedDocumentCacheMimetypes(final String mimetype) {
|
||||
final String[] mimetypes = getCrawlerDocumentCacheSupportedMimetypes().split(",");
|
||||
if (mimetypes.length == 1 && StringUtil.isBlank(mimetypes[0])) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -60,18 +60,18 @@ public class QueryStringBuilder {
|
|||
return queryBuf.toString();
|
||||
}
|
||||
|
||||
public static QueryStringBuilder query(String query) {
|
||||
QueryStringBuilder builder = new QueryStringBuilder();
|
||||
public static QueryStringBuilder query(final String query) {
|
||||
final QueryStringBuilder builder = new QueryStringBuilder();
|
||||
builder.query = query;
|
||||
return builder;
|
||||
}
|
||||
|
||||
public QueryStringBuilder extraQueries(String[] extraQueries) {
|
||||
public QueryStringBuilder extraQueries(final String[] extraQueries) {
|
||||
this.extraQueries = extraQueries;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryStringBuilder fields(Map<String, String[]> fieldMap) {
|
||||
public QueryStringBuilder fields(final Map<String, String[]> fieldMap) {
|
||||
this.fieldMap = fieldMap;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.lastaflute.web.response.render.RenderData;
|
|||
|
||||
public class RenderDataUtil {
|
||||
|
||||
public static void register(RenderData data, String key, Object value) {
|
||||
public static void register(final RenderData data, final String key, final Object value) {
|
||||
if (value instanceof Entity) {
|
||||
data.register(key, BeanUtil.copyBeanToNewMap(value));
|
||||
} else if (value instanceof Collection<?>) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ResourceUtil {
|
|||
if (url != null) {
|
||||
return url;
|
||||
}
|
||||
FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
return fessConfig.getElasticsearchHttpUrl();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,15 +23,15 @@ import org.codelibs.core.lang.StringUtil;
|
|||
public class CronExpressionValidator implements ConstraintValidator<CronExpression, String> {
|
||||
|
||||
@Override
|
||||
public void initialize(CronExpression constraintAnnotation) {
|
||||
public void initialize(final CronExpression constraintAnnotation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
public boolean isValid(final String value, final ConstraintValidatorContext context) {
|
||||
return determineValid(value);
|
||||
}
|
||||
|
||||
protected boolean determineValid(String value) {
|
||||
protected boolean determineValid(final String value) {
|
||||
if (StringUtil.isNotBlank(value) && !org.quartz.CronExpression.isValidExpression(value)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class UriTypeValidator implements ConstraintValidator<UriType, String> {
|
|||
private String[] protocols;
|
||||
|
||||
@Override
|
||||
public void initialize(UriType uriType) {
|
||||
public void initialize(final UriType uriType) {
|
||||
protocols = uriType.protocols();
|
||||
if (protocols == null || protocols.length == 0) {
|
||||
throw new ConstraintDefinitionException("protocols is emtpy.");
|
||||
|
@ -33,7 +33,7 @@ public class UriTypeValidator implements ConstraintValidator<UriType, String> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
public boolean isValid(final String value, final ConstraintValidatorContext context) {
|
||||
if (StringUtil.isNotBlank(value)) {
|
||||
return check(protocols, value);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue