code clean-up

This commit is contained in:
Shinsuke Sugaya 2020-06-04 17:43:11 +09:00
parent a569803668
commit 4e0d5ffd54
5 changed files with 8 additions and 11 deletions

View file

@ -98,8 +98,8 @@ public class AllJobScheduler implements LaJobScheduler {
@Override
public LaJobRunner createRunner() {
return new LaJobRunner().useAccessContext(resource -> accessContextLogic.create(resource, () -> OptionalThing.empty(),
() -> OptionalThing.empty(), () -> APP_TYPE));
return new LaJobRunner().useAccessContext(resource -> accessContextLogic.create(resource, OptionalThing::empty,
OptionalThing::empty, () -> APP_TYPE));
}
public void setJobClass(final Class<? extends LaJob> jobClass) {

View file

@ -162,7 +162,7 @@ public class AdminStorageAction extends FessAdminAction {
try (final InputStream in = uploadFile.getInputStream()) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final MinioClient minioClient = createClient(fessConfig);
minioClient.putObject(fessConfig.getStorageBucket(), objectName, in, new PutObjectOptions((long) uploadFile.getFileSize(), -1));
minioClient.putObject(fessConfig.getStorageBucket(), objectName, in, new PutObjectOptions(uploadFile.getFileSize(), -1));
} catch (final Exception e) {
throw new StorageException("Failed to upload " + objectName, e);
}

View file

@ -19,13 +19,10 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.codelibs.core.lang.ThreadUtil;
import org.codelibs.fess.exception.FessSystemException;
public class IntervalControlHelper {
private static final Logger logger = LogManager.getLogger(IntervalControlHelper.class);
protected volatile boolean crawlerRunning = true;

View file

@ -39,7 +39,7 @@ public class NotificationHelper {
sendToGoogleChat(cardView, discloser);
}
protected void sendToSlack(CardView cardView, SMailPostingDiscloser discloser) {
protected void sendToSlack(final CardView cardView, final SMailPostingDiscloser discloser) {
// https://api.slack.com/messaging/webhooks#posting_with_webhooks
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String slackWebhookUrls = fessConfig.getSlackWebhookUrls();
@ -76,7 +76,7 @@ public class NotificationHelper {
return buf.toString();
}
protected void sendToGoogleChat(CardView cardView, SMailPostingDiscloser discloser) {
protected void sendToGoogleChat(final CardView cardView, final SMailPostingDiscloser discloser) {
// https://developers.google.com/hangouts/chat/how-tos/webhooks
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String googleChatWebhookUrls = fessConfig.getGoogleChatWebhookUrls();

View file

@ -194,7 +194,7 @@ public class SystemHelper {
public String getUsername() {
final RequestManager requestManager = ComponentUtil.getRequestManager();
return requestManager.findUserBean(FessUserBean.class).map(user -> user.getUserId()).orElse(Constants.GUEST_USER);
return requestManager.findUserBean(FessUserBean.class).map(FessUserBean::getUserId).orElse(Constants.GUEST_USER);
}
public Date getCurrentTime() {
@ -571,7 +571,7 @@ public class SystemHelper {
if (logger.isDebugEnabled()) {
logger.debug("Updated System Cpu {}%", systemCpuPercent);
}
} catch (Exception e) {
} catch (final Exception e) {
logger.warn("Failed to get SystemCpuPercent.", e);
return 0;
}
@ -598,7 +598,7 @@ public class SystemHelper {
return productVersion;
}
public void setSystemCpuCheckInterval(long systemCpuCheckInterval) {
public void setSystemCpuCheckInterval(final long systemCpuCheckInterval) {
this.systemCpuCheckInterval = systemCpuCheckInterval;
}
}