code cleanup
This commit is contained in:
parent
a86882e02a
commit
c4917d9d9e
33 changed files with 134 additions and 155 deletions
|
@ -174,27 +174,8 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final String DEFAULT_SUGGEST_PURGE_DAY = "30";
|
||||
|
||||
public static final String DEFAULT_PURGE_BY_BOTS = "Crawler"//
|
||||
+ ",crawler"//
|
||||
+ ",Bot"//
|
||||
+ ",bot"//
|
||||
+ ",Slurp"//
|
||||
+ ",Yeti"//
|
||||
+ ",Baidu"//
|
||||
+ ",Steeler"//
|
||||
+ ",ichiro"//
|
||||
+ ",hotpage"//
|
||||
+ ",Feedfetcher"//
|
||||
+ ",ia_archiver"//
|
||||
+ ",Y!J-BRI"//
|
||||
+ ",Google Desktop"//
|
||||
+ ",Seznam"//
|
||||
+ ",Tumblr"//
|
||||
+ ",YandexBot"//
|
||||
+ ",Chilkat"//
|
||||
+ ",CloudFront"//
|
||||
+ ",Mediapartners"//
|
||||
+ ",MSIE 6";
|
||||
public static final String DEFAULT_PURGE_BY_BOTS =
|
||||
"Crawler,crawler,Bot,bot,Slurp,Yeti,Baidu,Steeler,ichiro,hotpage,Feedfetcher,ia_archiver,Y!J-BRI,Google Desktop,Seznam,Tumblr,YandexBot,Chilkat,CloudFront,Mediapartners,MSIE 6";
|
||||
|
||||
public static final String DEFAULT_FROM_EMAIL = "Administrator <root@localhost>";
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class FessBoot extends TomcatBoot {
|
|||
op.replace("fess.log.path", fessLogPath.replace("\\", "/"));
|
||||
}).asYouLikeIt(resource -> {
|
||||
final Host host = resource.getHost();
|
||||
if (host instanceof StandardHost standardHost) {
|
||||
if (host instanceof final StandardHost standardHost) {
|
||||
standardHost.setErrorReportValveClass(SuppressErrorReportValve.class.getName());
|
||||
}
|
||||
}).useTldDetect(jarName -> (jarName.contains("jstl") || jarName.contains("lasta-taglib"))).asDevelopment(isNoneEnv()).bootAwait();
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract class BaseJsonApiManager extends BaseApiManager {
|
|||
return;
|
||||
}
|
||||
|
||||
if (t instanceof InvalidAccessTokenException e) {
|
||||
if (t instanceof final InvalidAccessTokenException e) {
|
||||
final HttpServletResponse response = LaResponseUtil.getResponse();
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
response.setHeader("WWW-Authenticate", "Bearer error=\"" + e.getType() + "\"");
|
||||
|
|
|
@ -321,7 +321,7 @@ public class GsaApiManager extends BaseApiManager {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to process a search request.", e);
|
||||
}
|
||||
if (e instanceof InvalidAccessTokenException iate) {
|
||||
if (e instanceof final InvalidAccessTokenException iate) {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
response.setHeader("WWW-Authenticate", "Bearer error=\"" + iate.getType() + "\"");
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public class SuggestApiManager extends BaseJsonApiManager {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to process a suggest request.", e);
|
||||
}
|
||||
if (e instanceof InvalidAccessTokenException iate) {
|
||||
if (e instanceof final InvalidAccessTokenException iate) {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
response.setHeader("WWW-Authenticate", "Bearer error=\"" + iate.getType() + "\"");
|
||||
}
|
||||
|
|
|
@ -316,15 +316,20 @@ public class AdminAction extends FessAdminAction {
|
|||
}
|
||||
if (user.hasRoles(getActionRoles(AdminSchedulerAction.ROLE))) {
|
||||
return AdminSchedulerAction.class;
|
||||
} else if (user.hasRoles(getActionRoles(AdminDesignAction.ROLE))) {
|
||||
}
|
||||
if (user.hasRoles(getActionRoles(AdminDesignAction.ROLE))) {
|
||||
return AdminDesignAction.class;
|
||||
} else if (user.hasRoles(getActionRoles(AdminDictAction.ROLE))) {
|
||||
}
|
||||
if (user.hasRoles(getActionRoles(AdminDictAction.ROLE))) {
|
||||
return AdminDictAction.class;
|
||||
} else if (user.hasRoles(getActionRoles(AdminAccesstokenAction.ROLE))) {
|
||||
}
|
||||
if (user.hasRoles(getActionRoles(AdminAccesstokenAction.ROLE))) {
|
||||
return AdminAccesstokenAction.class;
|
||||
} else if (user.hasRoles(getActionRoles(AdminPluginAction.ROLE))) {
|
||||
}
|
||||
if (user.hasRoles(getActionRoles(AdminPluginAction.ROLE))) {
|
||||
return AdminPluginAction.class;
|
||||
} else if (user.hasRoles(getActionRoles(AdminStorageAction.ROLE))) {
|
||||
}
|
||||
if (user.hasRoles(getActionRoles(AdminStorageAction.ROLE))) {
|
||||
return AdminStorageAction.class;
|
||||
} else if (user.hasRoles(getActionRoles(AdminWebconfigAction.ROLE))) {
|
||||
return AdminWebconfigAction.class;
|
||||
|
|
|
@ -314,7 +314,8 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
}
|
||||
if ("click_log".equals(name)) {
|
||||
return writeNdjsonResponse(id, getClickLogNdjsonWriteCall());
|
||||
} else if ("favorite_log".equals(name)) {
|
||||
}
|
||||
if ("favorite_log".equals(name)) {
|
||||
return writeNdjsonResponse(id, getFavoriteLogNdjsonWriteCall());
|
||||
}
|
||||
} else if ("fess.json".equals(id)) {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class AdminSysteminfoAction extends FessAdminAction {
|
|||
}
|
||||
itemList.add(createItem(k, value));
|
||||
});
|
||||
if (fessConfig instanceof ObjectiveConfig config) {
|
||||
if (fessConfig instanceof final ObjectiveConfig config) {
|
||||
config.keySet().stream().forEach(k -> {
|
||||
final String value;
|
||||
if (isMaskedValue(k)) {
|
||||
|
|
|
@ -107,9 +107,11 @@ public class ApiAdminBackupAction extends FessApiAdminAction {
|
|||
}
|
||||
if ("user_info".equals(name)) {
|
||||
return writeNdjsonResponse(id, getUserInfoNdjsonWriteCall());
|
||||
} else if ("click_log".equals(name)) {
|
||||
}
|
||||
if ("click_log".equals(name)) {
|
||||
return writeNdjsonResponse(id, getClickLogNdjsonWriteCall());
|
||||
} else if ("favorite_log".equals(name)) {
|
||||
}
|
||||
if ("favorite_log".equals(name)) {
|
||||
return writeNdjsonResponse(id, getFavoriteLogNdjsonWriteCall());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -344,12 +344,10 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
if (lastModified != null) {
|
||||
return lastModified;
|
||||
}
|
||||
} else if (lastModifiedObj instanceof String[] lastModifieds) {
|
||||
if (lastModifieds.length > 0) {
|
||||
final Date lastModified = FessFunctions.parseDate(lastModifieds[0]);
|
||||
if (lastModified != null) {
|
||||
return lastModified;
|
||||
}
|
||||
} else if ((lastModifiedObj instanceof final String[] lastModifieds) && (lastModifieds.length > 0)) {
|
||||
final Date lastModified = FessFunctions.parseDate(lastModifieds[0]);
|
||||
if (lastModified != null) {
|
||||
return lastModified;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,13 +85,10 @@ public interface FessTransformer {
|
|||
|
||||
if (encoding != null) {
|
||||
String enc;
|
||||
if (StringUtil.isNotBlank(getFessConfig().getCrawlerDocumentSiteEncoding())) {
|
||||
if (!getFessConfig().isCrawlerDocumentUseSiteEncodingOnEnglish()
|
||||
|| ("ISO-8859-1".equalsIgnoreCase(encoding) || "US-ASCII".equalsIgnoreCase(encoding))) {
|
||||
enc = getFessConfig().getCrawlerDocumentSiteEncoding();
|
||||
} else {
|
||||
enc = encoding;
|
||||
}
|
||||
if (StringUtil.isNotBlank(getFessConfig().getCrawlerDocumentSiteEncoding())
|
||||
&& (!getFessConfig().isCrawlerDocumentUseSiteEncodingOnEnglish()
|
||||
|| ("ISO-8859-1".equalsIgnoreCase(encoding) || "US-ASCII".equalsIgnoreCase(encoding)))) {
|
||||
enc = getFessConfig().getCrawlerDocumentSiteEncoding();
|
||||
} else {
|
||||
enc = encoding;
|
||||
}
|
||||
|
|
|
@ -122,16 +122,8 @@ public class KuromojiItem extends DictionaryItem {
|
|||
return false;
|
||||
}
|
||||
final KuromojiItem other = (KuromojiItem) obj;
|
||||
if (!Objects.equals(pos, other.pos)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(reading, other.reading)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(segmentation, other.segmentation)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(token, other.token)) {
|
||||
if (!Objects.equals(pos, other.pos) || !Objects.equals(reading, other.reading) || !Objects.equals(segmentation, other.segmentation)
|
||||
|| !Objects.equals(token, other.token)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -108,10 +108,7 @@ public class CharMappingItem extends DictionaryItem {
|
|||
final CharMappingItem other = (CharMappingItem) obj;
|
||||
sort();
|
||||
other.sort();
|
||||
if (!Arrays.equals(inputs, other.inputs)) {
|
||||
return false;
|
||||
}
|
||||
if (!output.equals(other.getOutput())) {
|
||||
if (!Arrays.equals(inputs, other.inputs) || !output.equals(other.getOutput())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ProtwordsItem extends DictionaryItem {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
final int result = 1;
|
||||
return prime * result + input.hashCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -87,10 +87,7 @@ public class StemmerOverrideItem extends DictionaryItem {
|
|||
return false;
|
||||
}
|
||||
final StemmerOverrideItem other = (StemmerOverrideItem) obj;
|
||||
if (!Objects.equals(input, other.input)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(output, other.output)) {
|
||||
if (!Objects.equals(input, other.input) || !Objects.equals(output, other.output)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class StopwordsItem extends DictionaryItem {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
final int result = 1;
|
||||
return prime * result + input.hashCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -104,10 +104,7 @@ public class SynonymItem extends DictionaryItem {
|
|||
return false;
|
||||
}
|
||||
final SynonymItem other = (SynonymItem) obj;
|
||||
if (!ArrayUtil.equalsIgnoreSequence(inputs, other.inputs)) {
|
||||
return false;
|
||||
}
|
||||
if (!ArrayUtil.equalsIgnoreSequence(outputs, other.outputs)) {
|
||||
if (!ArrayUtil.equalsIgnoreSequence(inputs, other.inputs) || !ArrayUtil.equalsIgnoreSequence(outputs, other.outputs)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -479,7 +479,7 @@ public class SearchEngineClient implements Client {
|
|||
final AcknowledgedResponse response =
|
||||
client.admin().indices().prepareDelete(indexName).execute().actionGet(fessConfig.getIndexIndicesTimeout());
|
||||
return response.isAcknowledged();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.debug("Failed to delete {}.", indexName, e);
|
||||
}
|
||||
return false;
|
||||
|
@ -488,7 +488,7 @@ public class SearchEngineClient implements Client {
|
|||
protected String readIndexSetting(final String fesenType, final String indexConfigFile, final String numberOfShards,
|
||||
final String autoExpandReplicas) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
String source = FileUtil.readUTF8(indexConfigFile);
|
||||
final String source = FileUtil.readUTF8(indexConfigFile);
|
||||
String dictionaryPath = System.getProperty("fess.dictionary.path", StringUtil.EMPTY);
|
||||
if (StringUtil.isNotBlank(dictionaryPath) && !dictionaryPath.endsWith("/")) {
|
||||
dictionaryPath = dictionaryPath + "/";
|
||||
|
@ -1419,7 +1419,7 @@ public class SearchEngineClient implements Client {
|
|||
}
|
||||
|
||||
public EngineInfo getEngineInfo() {
|
||||
if (client instanceof HttpClient httpClient) {
|
||||
if (client instanceof final HttpClient httpClient) {
|
||||
return httpClient.getEngineInfo();
|
||||
}
|
||||
throw new SearchEngineClientException("client is not HttpClient.");
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ClickLog extends BsClickLog implements SearchLogEvent {
|
|||
|
||||
@Override
|
||||
protected void addFieldToSource(final Map<String, Object> sourceMap, final String field, final Object value) {
|
||||
if (value instanceof LocalDateTime ldt) {
|
||||
if (value instanceof final LocalDateTime ldt) {
|
||||
final ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
|
||||
super.addFieldToSource(sourceMap, field, DateTimeFormatter.ISO_INSTANT.format(zdt));
|
||||
} else {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class FavoriteLog extends BsFavoriteLog implements SearchLogEvent {
|
|||
|
||||
@Override
|
||||
protected void addFieldToSource(final Map<String, Object> sourceMap, final String field, final Object value) {
|
||||
if (value instanceof LocalDateTime ldt) {
|
||||
if (value instanceof final LocalDateTime ldt) {
|
||||
final ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
|
||||
super.addFieldToSource(sourceMap, field, DateTimeFormatter.ISO_INSTANT.format(zdt));
|
||||
} else {
|
||||
|
|
|
@ -141,7 +141,7 @@ public class SearchLog extends BsSearchLog implements SearchLogEvent {
|
|||
|
||||
@Override
|
||||
protected void addFieldToSource(final Map<String, Object> sourceMap, final String field, final Object value) {
|
||||
if (value instanceof LocalDateTime ldt) {
|
||||
if (value instanceof final LocalDateTime ldt) {
|
||||
final ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
|
||||
super.addFieldToSource(sourceMap, field, DateTimeFormatter.ISO_INSTANT.format(zdt));
|
||||
} else {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class UserInfo extends BsUserInfo implements SearchLogEvent {
|
|||
|
||||
@Override
|
||||
protected void addFieldToSource(final Map<String, Object> sourceMap, final String field, final Object value) {
|
||||
if (value instanceof LocalDateTime ldt) {
|
||||
if (value instanceof final LocalDateTime ldt) {
|
||||
final ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
|
||||
super.addFieldToSource(sourceMap, field, DateTimeFormatter.ISO_INSTANT.format(zdt));
|
||||
} else {
|
||||
|
|
|
@ -425,26 +425,31 @@ public class QueryHelper {
|
|||
}
|
||||
|
||||
protected QueryBuilder convertQuery(final QueryContext context, final Query query, final float boost) {
|
||||
if (query instanceof TermQuery) {
|
||||
return convertTermQuery(context, (TermQuery) query, boost);
|
||||
if (query instanceof final TermQuery termQuery) {
|
||||
return convertTermQuery(context, termQuery, boost);
|
||||
}
|
||||
if (query instanceof TermRangeQuery) {
|
||||
return convertTermRangeQuery(context, (TermRangeQuery) query, boost);
|
||||
if (query instanceof final TermRangeQuery termRangeQuery) {
|
||||
return convertTermRangeQuery(context, termRangeQuery, boost);
|
||||
}
|
||||
if (query instanceof PhraseQuery) {
|
||||
return convertPhraseQuery(context, (PhraseQuery) query, boost);
|
||||
if (query instanceof final PhraseQuery phraseQuery) {
|
||||
return convertPhraseQuery(context, phraseQuery, boost);
|
||||
}
|
||||
if (query instanceof FuzzyQuery) {
|
||||
return convertFuzzyQuery(context, (FuzzyQuery) query, boost);
|
||||
} else if (query instanceof PrefixQuery) {
|
||||
return convertPrefixQuery(context, (PrefixQuery) query, boost);
|
||||
} else if (query instanceof WildcardQuery) {
|
||||
return convertWildcardQuery(context, (WildcardQuery) query, boost);
|
||||
} else if (query instanceof BooleanQuery booleanQuery) {
|
||||
if (query instanceof final FuzzyQuery fuzzyQuery) {
|
||||
return convertFuzzyQuery(context, fuzzyQuery, boost);
|
||||
}
|
||||
if (query instanceof final PrefixQuery prefixQuery) {
|
||||
return convertPrefixQuery(context, prefixQuery, boost);
|
||||
}
|
||||
if (query instanceof final WildcardQuery wildcardQuery) {
|
||||
return convertWildcardQuery(context, wildcardQuery, boost);
|
||||
}
|
||||
if (query instanceof final BooleanQuery booleanQuery) {
|
||||
return convertBooleanQuery(context, booleanQuery, boost);
|
||||
} else if (query instanceof MatchAllDocsQuery) {
|
||||
}
|
||||
if (query instanceof MatchAllDocsQuery) {
|
||||
return QueryBuilders.matchAllQuery();
|
||||
} else if (query instanceof BoostQuery boostQuery) {
|
||||
}
|
||||
if (query instanceof final BoostQuery boostQuery) {
|
||||
return convertQuery(context, boostQuery.getQuery(), boostQuery.getBoost());
|
||||
}
|
||||
throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryUnknown(UserMessages.GLOBAL_PROPERTY_KEY),
|
||||
|
@ -655,22 +660,22 @@ public class QueryHelper {
|
|||
if (INURL_FIELD.equals(field) || (StringUtil.equals(field, context.getDefaultField())
|
||||
&& fessConfig.getIndexFieldUrl().equals(context.getDefaultField()))) {
|
||||
return QueryBuilders.wildcardQuery(fessConfig.getIndexFieldUrl(), "*" + text + "*").boost(boost);
|
||||
} else if (SITE_FIELD.equals(field)) {
|
||||
}
|
||||
if (SITE_FIELD.equals(field)) {
|
||||
return convertSiteQuery(context, text, boost);
|
||||
} else if (isSearchField(field)) {
|
||||
context.addFieldLog(field, text);
|
||||
context.addHighlightedQuery(text);
|
||||
if (notAnalyzedFieldSet.contains(field)) {
|
||||
return QueryBuilders.termQuery(field, text).boost(boost);
|
||||
} else {
|
||||
return buildMatchPhraseQuery(field, text).boost(boost);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (!isSearchField(field)) {
|
||||
final String origQuery = termQuery.toString();
|
||||
context.addFieldLog(Constants.DEFAULT_FIELD, origQuery);
|
||||
context.addHighlightedQuery(origQuery);
|
||||
return buildDefaultQueryBuilder((f, b) -> buildMatchPhraseQuery(f, origQuery).boost(b * boost));
|
||||
}
|
||||
context.addFieldLog(field, text);
|
||||
context.addHighlightedQuery(text);
|
||||
if (notAnalyzedFieldSet.contains(field)) {
|
||||
return QueryBuilders.termQuery(field, text).boost(boost);
|
||||
}
|
||||
return buildMatchPhraseQuery(field, text).boost(boost);
|
||||
}
|
||||
|
||||
protected QueryBuilder convertSiteQuery(final QueryContext context, final String text, final float boost) {
|
||||
|
|
|
@ -246,9 +246,8 @@ public class ViewHelper {
|
|||
}
|
||||
|
||||
protected OptionalThing<Set<String>> getQuerySet() {
|
||||
return LaRequestUtil.getOptionalRequest().map(req -> {
|
||||
return (Set<String>) req.getAttribute(Constants.HIGHLIGHT_QUERIES);
|
||||
}).filter(s -> s != null);
|
||||
return LaRequestUtil.getOptionalRequest().map(req -> ((Set<String>) req.getAttribute(Constants.HIGHLIGHT_QUERIES)))
|
||||
.filter(s -> s != null);
|
||||
}
|
||||
|
||||
public String getContentDescription(final Map<String, Object> document) {
|
||||
|
|
|
@ -70,7 +70,8 @@ public class DocBoostMatcher {
|
|||
}
|
||||
if (value instanceof Double) {
|
||||
return ((Double) value).floatValue();
|
||||
} else if (value != null) {
|
||||
}
|
||||
if (value != null) {
|
||||
return Float.parseFloat(value.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ public class FessMultipartRequestHandler implements MultipartRequestHandler {
|
|||
}
|
||||
haveValue = true;
|
||||
}
|
||||
if (request instanceof MultipartRequestWrapper wrapper) {
|
||||
if (request instanceof final MultipartRequestWrapper wrapper) {
|
||||
wrapper.setParameter(name, value);
|
||||
}
|
||||
final String[] oldArray = elementsText.get(name);
|
||||
|
|
|
@ -199,7 +199,7 @@ public class AzureAdAuthenticator implements SsoAuthenticator {
|
|||
}
|
||||
|
||||
final AuthenticationResponse authResponse = parseAuthenticationResponse(urlBuf.toString(), params);
|
||||
if (authResponse instanceof AuthenticationSuccessResponse oidcResponse) {
|
||||
if (authResponse instanceof final AuthenticationSuccessResponse oidcResponse) {
|
||||
validateAuthRespMatchesCodeFlow(oidcResponse);
|
||||
final AuthenticationResult authData = getAccessToken(oidcResponse.getAuthorizationCode(), getReplyUrl(request));
|
||||
validateNonce(stateData, authData);
|
||||
|
|
|
@ -183,13 +183,14 @@ public class SpnegoAuthenticator implements SsoAuthenticator {
|
|||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
return "5";
|
||||
} else if (logger.isWarnEnabled()) {
|
||||
return "6";
|
||||
} else if (logger.isErrorEnabled()) {
|
||||
return "7";
|
||||
} else {
|
||||
return "0";
|
||||
}
|
||||
if (logger.isWarnEnabled()) {
|
||||
return "6";
|
||||
}
|
||||
if (logger.isErrorEnabled()) {
|
||||
return "7";
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
if (SpnegoHttpFilter.Constants.LOGIN_CONF.equals(name)) {
|
||||
return getResourcePath(getProperty(SPNEGO_LOGIN_CONF, "auth_login.conf"));
|
||||
|
@ -199,15 +200,20 @@ public class SpnegoAuthenticator implements SsoAuthenticator {
|
|||
}
|
||||
if (SpnegoHttpFilter.Constants.CLIENT_MODULE.equals(name)) {
|
||||
return getProperty(SPNEGO_LOGIN_CLIENT_MODULE, "spnego-client");
|
||||
} else if (SpnegoHttpFilter.Constants.SERVER_MODULE.equals(name)) {
|
||||
}
|
||||
if (SpnegoHttpFilter.Constants.SERVER_MODULE.equals(name)) {
|
||||
return getProperty(SPNEGO_LOGIN_SERVER_MODULE, "spnego-server");
|
||||
} else if (SpnegoHttpFilter.Constants.PREAUTH_USERNAME.equals(name)) {
|
||||
}
|
||||
if (SpnegoHttpFilter.Constants.PREAUTH_USERNAME.equals(name)) {
|
||||
return getProperty(SPNEGO_PREAUTH_USERNAME, "username");
|
||||
} else if (SpnegoHttpFilter.Constants.PREAUTH_PASSWORD.equals(name)) {
|
||||
}
|
||||
if (SpnegoHttpFilter.Constants.PREAUTH_PASSWORD.equals(name)) {
|
||||
return getProperty(SPNEGO_PREAUTH_PASSWORD, "password");
|
||||
} else if (SpnegoHttpFilter.Constants.ALLOW_BASIC.equals(name)) {
|
||||
}
|
||||
if (SpnegoHttpFilter.Constants.ALLOW_BASIC.equals(name)) {
|
||||
return getProperty(SPNEGO_ALLOW_BASIC, "true");
|
||||
} else if (SpnegoHttpFilter.Constants.ALLOW_UNSEC_BASIC.equals(name)) {
|
||||
}
|
||||
if (SpnegoHttpFilter.Constants.ALLOW_UNSEC_BASIC.equals(name)) {
|
||||
return getProperty(SPNEGO_ALLOW_UNSECURE_BASIC, "true");
|
||||
} else if (SpnegoHttpFilter.Constants.PROMPT_NTLM.equals(name)) {
|
||||
return getProperty(SPNEGO_PROMPT_NTLM, "true");
|
||||
|
|
|
@ -130,7 +130,7 @@ public class CommandGenerator extends BaseThumbnailGenerator {
|
|||
protected void executeCommand(final String thumbnailId, final List<String> cmdList) {
|
||||
ProcessDestroyer task = null;
|
||||
try {
|
||||
ProcessBuilder pb = new ProcessBuilder(cmdList);
|
||||
final ProcessBuilder pb = new ProcessBuilder(cmdList);
|
||||
pb.directory(baseDir);
|
||||
pb.redirectErrorStream(true);
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class CommandGenerator extends BaseThumbnailGenerator {
|
|||
logger.debug("Thumbnail Command: {}", cmdList);
|
||||
}
|
||||
|
||||
Process p = pb.start();
|
||||
final Process p = pb.start();
|
||||
|
||||
final InputStreamThread ist = new InputStreamThread(p.getInputStream(), Charset.defaultCharset(), 0, s -> {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
|
|
@ -106,34 +106,32 @@ public final class DocumentUtil {
|
|||
if (clazz.isAssignableFrom(Long.class)) {
|
||||
if (value instanceof Long) {
|
||||
return (T) value;
|
||||
} else {
|
||||
return (T) Long.valueOf(value.toString());
|
||||
}
|
||||
return (T) Long.valueOf(value.toString());
|
||||
}
|
||||
if (clazz.isAssignableFrom(Integer.class)) {
|
||||
if (value instanceof Integer) {
|
||||
return (T) value;
|
||||
} else {
|
||||
return (T) Integer.valueOf(value.toString());
|
||||
}
|
||||
} else if (clazz.isAssignableFrom(Double.class)) {
|
||||
return (T) Integer.valueOf(value.toString());
|
||||
}
|
||||
if (clazz.isAssignableFrom(Double.class)) {
|
||||
if (value instanceof Double) {
|
||||
return (T) value;
|
||||
} else {
|
||||
return (T) Double.valueOf(value.toString());
|
||||
}
|
||||
} else if (clazz.isAssignableFrom(Float.class)) {
|
||||
return (T) Double.valueOf(value.toString());
|
||||
}
|
||||
if (clazz.isAssignableFrom(Float.class)) {
|
||||
if (value instanceof Float) {
|
||||
return (T) value;
|
||||
} else {
|
||||
return (T) Float.valueOf(value.toString());
|
||||
}
|
||||
} else if (clazz.isAssignableFrom(Boolean.class)) {
|
||||
return (T) Float.valueOf(value.toString());
|
||||
}
|
||||
if (clazz.isAssignableFrom(Boolean.class)) {
|
||||
if (value instanceof Boolean) {
|
||||
return (T) value;
|
||||
} else {
|
||||
return (T) Boolean.valueOf(value.toString());
|
||||
}
|
||||
return (T) Boolean.valueOf(value.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -267,17 +267,17 @@ public class GsaConfigParser extends DefaultHandler {
|
|||
final String v = s.substring(REGEXP_CASE.length());
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
return appendFileterPath(buf, unescape(v));
|
||||
} else if (s.startsWith(REGEXP)) {
|
||||
}
|
||||
if (s.startsWith(REGEXP)) {
|
||||
final String v = s.substring(REGEXP.length());
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
return appendFileterPath(buf, unescape(v));
|
||||
} else if (Arrays.stream(webProtocols).anyMatch(p -> s.startsWith(p))
|
||||
|| Arrays.stream(fileProtocols).anyMatch(p -> s.startsWith(p))) {
|
||||
return escape(s) + ".*";
|
||||
} else {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
return appendFileterPath(buf, escape(s));
|
||||
}
|
||||
if (Arrays.stream(webProtocols).anyMatch(p -> s.startsWith(p)) || Arrays.stream(fileProtocols).anyMatch(p -> s.startsWith(p))) {
|
||||
return escape(s) + ".*";
|
||||
}
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
return appendFileterPath(buf, escape(s));
|
||||
}
|
||||
|
||||
protected String escape(final String s) {
|
||||
|
|
|
@ -61,23 +61,28 @@ public final class MemoryUtil {
|
|||
}
|
||||
if (obj instanceof Date) {
|
||||
return 32L;
|
||||
} else if (obj instanceof LocalDateTime) {
|
||||
}
|
||||
if (obj instanceof LocalDateTime) {
|
||||
return 80L;
|
||||
} else if (obj instanceof ZonedDateTime) {
|
||||
}
|
||||
if (obj instanceof ZonedDateTime) {
|
||||
return 2128L;
|
||||
} else if (obj instanceof Object[]) {
|
||||
}
|
||||
if (obj instanceof Object[]) {
|
||||
long size = 0;
|
||||
for (final Object value : (Object[]) obj) {
|
||||
size += sizeOf(value);
|
||||
}
|
||||
return size;
|
||||
} else if (obj instanceof Collection<?>) {
|
||||
}
|
||||
if (obj instanceof Collection<?>) {
|
||||
long size = 0;
|
||||
for (final Object value : (Collection<?>) obj) {
|
||||
size += sizeOf(value);
|
||||
}
|
||||
return size;
|
||||
} else if (obj instanceof Map<?, ?>) {
|
||||
}
|
||||
if (obj instanceof Map<?, ?>) {
|
||||
long size = 0;
|
||||
for (final Map.Entry<?, ?> entry : ((Map<?, ?>) obj).entrySet()) {
|
||||
size += sizeOf(entry.getKey());
|
||||
|
|
|
@ -33,14 +33,12 @@ public class RenderDataUtil {
|
|||
if (value instanceof Entity) {
|
||||
data.register(key, BeanUtil.copyBeanToNewMap(value));
|
||||
} else {
|
||||
if (value instanceof Collection<?> coll) {
|
||||
if (!coll.isEmpty()) {
|
||||
// care performance for List that the most frequent pattern
|
||||
final Object first = coll instanceof List<?> ? ((List<?>) coll).get(0) : coll.iterator().next();
|
||||
if (first instanceof Entity) {
|
||||
data.register(key, coll.stream().map(BeanUtil::copyBeanToNewMap).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
if ((value instanceof final Collection<?> coll) && !coll.isEmpty()) {
|
||||
// care performance for List that the most frequent pattern
|
||||
final Object first = coll instanceof List<?> ? ((List<?>) coll).get(0) : coll.iterator().next();
|
||||
if (first instanceof Entity) {
|
||||
data.register(key, coll.stream().map(BeanUtil::copyBeanToNewMap).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
data.register(key, value);
|
||||
|
|
Loading…
Add table
Reference in a new issue