code cleanup
This commit is contained in:
parent
3bbed94797
commit
62664ac1e1
11 changed files with 18 additions and 18 deletions
|
@ -36,7 +36,7 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
|
||||
public interface FessTransformer {
|
||||
|
||||
Map<String, String> parentEncodingMap = Collections.synchronizedMap(new LruHashMap<String, String>(1000));
|
||||
Map<String, String> parentEncodingMap = Collections.synchronizedMap(new LruHashMap<>(1000));
|
||||
|
||||
FessConfig getFessConfig();
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Executor Thread Pool: {}", nThreads);
|
||||
}
|
||||
return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(nThreads),
|
||||
return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(nThreads),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback {
|
|||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof ChildUrlsException) {
|
||||
((ChildUrlsException) cause).getChildUrlList().stream().map(RequestData::getUrl).forEach(s -> {
|
||||
if (!processedUrls.contains(s)&&!urlQueue.contains(s)) {
|
||||
if (!processedUrls.contains(s) && !urlQueue.contains(s)) {
|
||||
urlQueue.offer(s);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -51,7 +51,6 @@ import org.codelibs.fess.crawler.client.smb.SmbAuthentication;
|
|||
import org.codelibs.fess.crawler.client.smb.SmbClient;
|
||||
import org.codelibs.fess.crawler.exception.CrawlerSystemException;
|
||||
import org.codelibs.fess.es.config.bsentity.BsDataConfig;
|
||||
import org.codelibs.fess.es.config.exentity.CrawlingConfig.ConfigName;
|
||||
import org.codelibs.fess.util.ParameterUtil;
|
||||
|
||||
/**
|
||||
|
|
|
@ -98,7 +98,7 @@ public class CrawlingInfoHelper {
|
|||
|
||||
public synchronized void putToInfoMap(final String key, final String value) {
|
||||
if (infoMap == null) {
|
||||
infoMap = Collections.synchronizedMap(new LinkedHashMap<String, String>());
|
||||
infoMap = Collections.synchronizedMap(new LinkedHashMap<>());
|
||||
}
|
||||
logger.debug("infoMap: {}={} => {}", key, value, infoMap);
|
||||
infoMap.put(key, value);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class DataIndexHelper {
|
|||
|
||||
protected int crawlerPriority = Thread.NORM_PRIORITY;
|
||||
|
||||
protected final List<DataCrawlingThread> dataCrawlingThreadList = Collections.synchronizedList(new ArrayList<DataCrawlingThread>());
|
||||
protected final List<DataCrawlingThread> dataCrawlingThreadList = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
public void crawl(final String sessionId) {
|
||||
final List<DataConfig> configList = ComponentUtil.getCrawlingConfigHelper().getAllDataConfigList();
|
||||
|
|
|
@ -55,8 +55,8 @@ public class IndexingHelper {
|
|||
docList.stream().forEach(doc -> {
|
||||
if (!thumbnailManager.offer(doc)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Removing {} from {}", doc.get(fessConfig.getIndexFieldThumbnail()),
|
||||
doc.get(fessConfig.getIndexFieldUrl()));
|
||||
logger.debug("Removing {}={} from doc[{}]", fessConfig.getIndexFieldThumbnail(),
|
||||
doc.get(fessConfig.getIndexFieldThumbnail()), doc.get(fessConfig.getIndexFieldUrl()));
|
||||
}
|
||||
doc.remove(fessConfig.getIndexFieldThumbnail());
|
||||
}
|
||||
|
|
|
@ -210,19 +210,19 @@ public class PermissionHelper {
|
|||
final Map<String, Object> metaDataMap = responseData.getMetaDataMap();
|
||||
final Object fileAttributeView = metaDataMap.get(FileSystemClient.FILE_ATTRIBUTE_VIEW);
|
||||
try {
|
||||
if (fileAttributeView instanceof AclFileAttributeView aclFileAttributeView) {
|
||||
if (fileAttributeView instanceof final AclFileAttributeView aclFileAttributeView) {
|
||||
aclFileAttributeView.getAcl().stream().forEach(acl -> {
|
||||
final UserPrincipal principal = acl.principal();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Principal: [{}] {}", principal.getClass().getName(), principal);
|
||||
}
|
||||
if (principal instanceof GroupPrincipal groupPrincipal) {
|
||||
if (principal instanceof final GroupPrincipal groupPrincipal) {
|
||||
roleTypeList.add(systemHelper.getSearchRoleByGroup(groupPrincipal.getName()));
|
||||
} else if (principal != null) {
|
||||
roleTypeList.add(systemHelper.getSearchRoleByUser(principal.getName()));
|
||||
}
|
||||
});
|
||||
} else if (fileAttributeView instanceof PosixFileAttributeView posixFileAttributeView) {
|
||||
} else if (fileAttributeView instanceof final PosixFileAttributeView posixFileAttributeView) {
|
||||
final PosixFileAttributes attributes = posixFileAttributeView.readAttributes();
|
||||
final UserPrincipal userPrincipal = attributes.owner();
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -239,7 +239,7 @@ public class PermissionHelper {
|
|||
roleTypeList.add(systemHelper.getSearchRoleByGroup(groupPrincipal.getName()));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
throw new CrawlingAccessException("Failed to access permission info", e);
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
|
|
@ -535,7 +535,7 @@ public class SystemHelper {
|
|||
buf.append(e.getKey()).append(": ");
|
||||
try {
|
||||
buf.append(e.getValue().get());
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logger.warn("Failed to process {} task.", e.getKey(), ex);
|
||||
buf.append(ex.getMessage());
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class WebFsIndexHelper {
|
|||
|
||||
protected int crawlerPriority = Thread.NORM_PRIORITY;
|
||||
|
||||
protected final List<Crawler> crawlerList = Collections.synchronizedList(new ArrayList<Crawler>());
|
||||
protected final List<Crawler> crawlerList = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
public void crawl(final String sessionId, final List<String> webConfigIdList, final List<String> fileConfigIdList) {
|
||||
final boolean runAll = webConfigIdList == null && fileConfigIdList == null;
|
||||
|
|
|
@ -70,6 +70,7 @@ public class RankFusionProcessor implements AutoCloseable {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@PreDestroy
|
||||
public void close() throws Exception {
|
||||
if (executorService != null) {
|
||||
|
@ -163,8 +164,8 @@ public class RankFusionProcessor implements AutoCloseable {
|
|||
if (doc.get(idField) instanceof final String id) {
|
||||
final float score = 1.0f / (rankConstant + j);
|
||||
if (scoreDocMap.containsKey(id)) {
|
||||
Map<String, Object> baseDoc = scoreDocMap.get(id);
|
||||
float oldScore = toFloat(baseDoc.get(scoreField));
|
||||
final Map<String, Object> baseDoc = scoreDocMap.get(id);
|
||||
final float oldScore = toFloat(baseDoc.get(scoreField));
|
||||
baseDoc.put(scoreField, oldScore + score);
|
||||
} else {
|
||||
doc.put(scoreField, Float.valueOf(score));
|
||||
|
|
|
@ -435,10 +435,10 @@ public class AzureAdAuthenticator implements SsoAuthenticator {
|
|||
}
|
||||
}
|
||||
|
||||
protected void addGroupOrRoleName(List<String> list, String value, boolean useDomainServices) {
|
||||
protected void addGroupOrRoleName(final List<String> list, final String value, final boolean useDomainServices) {
|
||||
list.add(value);
|
||||
if (useDomainServices && value.indexOf('@') >= 0) {
|
||||
String[] values = value.split("@");
|
||||
final String[] values = value.split("@");
|
||||
if (values.length > 1) {
|
||||
list.add(values[0]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue