diff --git a/src/main/java/jp/sf/fess/action/admin/ScheduledJobAction.java b/src/main/java/jp/sf/fess/action/admin/ScheduledJobAction.java
index 63a2e995d..0e2d1c760 100644
--- a/src/main/java/jp/sf/fess/action/admin/ScheduledJobAction.java
+++ b/src/main/java/jp/sf/fess/action/admin/ScheduledJobAction.java
@@ -167,7 +167,8 @@ public class ScheduledJobAction extends BsScheduledJobAction {
public String stop() {
final ScheduledJob scheduledJob = getScheduledJob();
try {
- JobExecutor jobExecutoer = jobHelper.getJobExecutoer(scheduledJob.getId());
+ final JobExecutor jobExecutoer = jobHelper
+ .getJobExecutoer(scheduledJob.getId());
jobExecutoer.shutdown();
SAStrutsUtil.addSessionMessage("success.job_stopped",
scheduledJob.getName());
diff --git a/src/main/java/jp/sf/fess/action/admin/dict/SynonymAction.java b/src/main/java/jp/sf/fess/action/admin/dict/SynonymAction.java
index 7ce2bde80..1d9291ed2 100644
--- a/src/main/java/jp/sf/fess/action/admin/dict/SynonymAction.java
+++ b/src/main/java/jp/sf/fess/action/admin/dict/SynonymAction.java
@@ -314,7 +314,7 @@ public class SynonymAction {
@Token(save = true, validate = false)
@Execute(validator = false, input = "downloadpage")
public String downloadpage() {
- SynonymFile synonymFile = synonymService
+ final SynonymFile synonymFile = synonymService
.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException(
@@ -327,7 +327,7 @@ public class SynonymAction {
@Token(save = true, validate = true)
@Execute(validator = false, input = "downloadpage")
public String download() {
- SynonymFile synonymFile = synonymService
+ final SynonymFile synonymFile = synonymService
.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException(
@@ -335,7 +335,7 @@ public class SynonymAction {
}
try (InputStream in = synonymFile.getInputStream()) {
ResponseUtil.download(synonymFile.getSimpleName(), in);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new SSCActionMessagesException(
"errors.failed_to_download_synonym_file");
}
@@ -346,7 +346,7 @@ public class SynonymAction {
@Token(save = true, validate = false)
@Execute(validator = false, input = "uploadpage")
public String uploadpage() {
- SynonymFile synonymFile = synonymService
+ final SynonymFile synonymFile = synonymService
.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException(
@@ -359,7 +359,7 @@ public class SynonymAction {
@Token(save = false, validate = true)
@Execute(validator = true, input = "uploadpage")
public String upload() {
- SynonymFile synonymFile = synonymService
+ final SynonymFile synonymFile = synonymService
.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException(
@@ -367,7 +367,7 @@ public class SynonymAction {
}
try (InputStream in = synonymForm.synonymFile.getInputStream()) {
synonymFile.update(in);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new SSCActionMessagesException(
"errors.failed_to_upload_synonym_file");
}
diff --git a/src/main/java/jp/sf/fess/action/admin/dict/UserDictAction.java b/src/main/java/jp/sf/fess/action/admin/dict/UserDictAction.java
index daca2b4d5..cde659737 100644
--- a/src/main/java/jp/sf/fess/action/admin/dict/UserDictAction.java
+++ b/src/main/java/jp/sf/fess/action/admin/dict/UserDictAction.java
@@ -312,7 +312,7 @@ public class UserDictAction {
@Token(save = true, validate = false)
@Execute(validator = false, input = "downloadpage")
public String downloadpage() {
- UserDictFile userdictFile = userDictService
+ final UserDictFile userdictFile = userDictService
.getUserDictFile(userDictForm.dictId);
if (userdictFile == null) {
throw new SSCActionMessagesException(
@@ -325,7 +325,7 @@ public class UserDictAction {
@Token(save = true, validate = true)
@Execute(validator = false, input = "downloadpage")
public String download() {
- UserDictFile userdictFile = userDictService
+ final UserDictFile userdictFile = userDictService
.getUserDictFile(userDictForm.dictId);
if (userdictFile == null) {
throw new SSCActionMessagesException(
@@ -333,7 +333,7 @@ public class UserDictAction {
}
try (InputStream in = userdictFile.getInputStream()) {
ResponseUtil.download(userdictFile.getSimpleName(), in);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new SSCActionMessagesException(
"errors.failed_to_download_userdict_file");
}
@@ -344,7 +344,7 @@ public class UserDictAction {
@Token(save = true, validate = false)
@Execute(validator = false, input = "uploadpage")
public String uploadpage() {
- UserDictFile userdictFile = userDictService
+ final UserDictFile userdictFile = userDictService
.getUserDictFile(userDictForm.dictId);
if (userdictFile == null) {
throw new SSCActionMessagesException(
@@ -357,7 +357,7 @@ public class UserDictAction {
@Token(save = false, validate = true)
@Execute(validator = true, input = "uploadpage")
public String upload() {
- UserDictFile userdictFile = userDictService
+ final UserDictFile userdictFile = userDictService
.getUserDictFile(userDictForm.dictId);
if (userdictFile == null) {
throw new SSCActionMessagesException(
@@ -365,7 +365,7 @@ public class UserDictAction {
}
try (InputStream in = userDictForm.userDictFile.getInputStream()) {
userdictFile.update(in);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new SSCActionMessagesException(
"errors.failed_to_upload_userdict_file");
}
diff --git a/src/main/java/jp/sf/fess/api/json/JsonApiManager.java b/src/main/java/jp/sf/fess/api/json/JsonApiManager.java
index bfc01b80b..0cb88aa3f 100644
--- a/src/main/java/jp/sf/fess/api/json/JsonApiManager.java
+++ b/src/main/java/jp/sf/fess/api/json/JsonApiManager.java
@@ -115,16 +115,16 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
protected void processPingRequest(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) {
- SearchService searchService = ComponentUtil.getSearchService();
+ final SearchService searchService = ComponentUtil.getSearchService();
int status;
final StringBuilder buf = new StringBuilder(1000);
String errMsg = null;
try {
- PingResponse pingResponse = searchService.ping();
+ final PingResponse pingResponse = searchService.ping();
status = pingResponse.getStatus();
buf.append("\"result\":[");
boolean appended = false;
- for (Target target : pingResponse.getTargets()) {
+ for (final Target target : pingResponse.getTargets()) {
if (appended) {
buf.append(',');
} else {
@@ -141,7 +141,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
buf.append("}");
}
buf.append(']');
- } catch (Exception e) {
+ } catch (final Exception e) {
status = 9;
errMsg = e.getMessage();
if (errMsg == null) {
diff --git a/src/main/java/jp/sf/fess/api/xml/XmlApiManager.java b/src/main/java/jp/sf/fess/api/xml/XmlApiManager.java
index 319bbd7a7..db006a374 100644
--- a/src/main/java/jp/sf/fess/api/xml/XmlApiManager.java
+++ b/src/main/java/jp/sf/fess/api/xml/XmlApiManager.java
@@ -104,15 +104,15 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
protected void processPingRequest(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) {
- SearchService searchService = ComponentUtil.getSearchService();
+ final SearchService searchService = ComponentUtil.getSearchService();
int status;
final StringBuilder buf = new StringBuilder(1000);
String errMsg = null;
try {
- PingResponse pingResponse = searchService.ping();
+ final PingResponse pingResponse = searchService.ping();
status = pingResponse.getStatus();
buf.append("");
- for (Target target : pingResponse.getTargets()) {
+ for (final Target target : pingResponse.getTargets()) {
buf.append("");
buf.append(target.getStatus());
buf.append("");
@@ -124,7 +124,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
buf.append("");
}
buf.append("");
- } catch (Exception e) {
+ } catch (final Exception e) {
status = 9;
errMsg = e.getMessage();
if (errMsg == null) {
diff --git a/src/main/java/jp/sf/fess/dict/synonym/SynonymFile.java b/src/main/java/jp/sf/fess/dict/synonym/SynonymFile.java
index 4f8d47ce8..dd007bc47 100644
--- a/src/main/java/jp/sf/fess/dict/synonym/SynonymFile.java
+++ b/src/main/java/jp/sf/fess/dict/synonym/SynonymFile.java
@@ -21,7 +21,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -39,7 +38,6 @@ import jp.sf.fess.dict.DictionaryFile;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.codelibs.core.util.StringUtil;
-import org.seasar.framework.util.FileUtil;
import org.seasar.robot.util.StreamUtil;
public class SynonymFile extends DictionaryFile {
diff --git a/src/main/java/jp/sf/fess/entity/PingResponse.java b/src/main/java/jp/sf/fess/entity/PingResponse.java
index a2bfa5421..ee9ced9ed 100644
--- a/src/main/java/jp/sf/fess/entity/PingResponse.java
+++ b/src/main/java/jp/sf/fess/entity/PingResponse.java
@@ -7,13 +7,13 @@ import java.util.List;
import org.apache.solr.client.solrj.response.SolrPingResponse;
public class PingResponse {
- private int status = 0;
+ private final int status = 0;
- private Target[] targets;
+ private final Target[] targets;
public PingResponse(Collection responses) {
- List targetList = new ArrayList<>();
- for (SolrPingResponse response : responses) {
+ final List targetList = new ArrayList<>();
+ for (final SolrPingResponse response : responses) {
int status = response.getStatus();
if (status != 0) {
status = 1;
@@ -26,19 +26,19 @@ public class PingResponse {
public static class Target {
- private int status;
+ private final int status;
- private String url;
+ private final String url;
- private long searchTime;
+ private final long searchTime;
- private int queryTime;
+ private final int queryTime;
public Target(int status, String url, long elapsedTime, int qTime) {
this.status = status;
this.url = url;
- this.searchTime = elapsedTime;
- this.queryTime = qTime;
+ searchTime = elapsedTime;
+ queryTime = qTime;
}
public int getStatus() {
diff --git a/src/main/java/jp/sf/fess/filter/FessEncodingFilter.java b/src/main/java/jp/sf/fess/filter/FessEncodingFilter.java
index 2566de47f..57b221c11 100644
--- a/src/main/java/jp/sf/fess/filter/FessEncodingFilter.java
+++ b/src/main/java/jp/sf/fess/filter/FessEncodingFilter.java
@@ -149,7 +149,7 @@ public class FessEncodingFilter extends EncodingFilter {
list.add(StringUtil.EMPTY);
}
}
- } catch (DecoderException e) {
+ } catch (final DecoderException e) {
throw new IOException(e);
}
diff --git a/src/main/java/jp/sf/fess/screenshot/ScreenShotManager.java b/src/main/java/jp/sf/fess/screenshot/ScreenShotManager.java
index 79ef38133..4785b1f76 100644
--- a/src/main/java/jp/sf/fess/screenshot/ScreenShotManager.java
+++ b/src/main/java/jp/sf/fess/screenshot/ScreenShotManager.java
@@ -62,7 +62,7 @@ public class ScreenShotManager {
public int splitSize = 5;
- private BlockingQueue screenShotTaskQueue = new LinkedBlockingQueue();
+ private final BlockingQueue screenShotTaskQueue = new LinkedBlockingQueue();
private boolean generating;
@@ -97,9 +97,9 @@ public class ScreenShotManager {
while (generating) {
try {
screenShotTaskQueue.take().generate();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
logger.debug("Interupted task.", e);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.warn("Failed to generage a screenshot.", e);
}
}
@@ -119,8 +119,8 @@ public class ScreenShotManager {
if (generator.isTarget(docMap)) {
final String url = (String) docMap.get("url");
final String path = getImageFilename(docMap);
- if (!screenShotTaskQueue.offer((new ScreenShotTask(url,
- new File(baseDir, path), generator)))) {
+ if (!screenShotTaskQueue.offer(new ScreenShotTask(url,
+ new File(baseDir, path), generator))) {
logger.warn("Failed to offer a screenshot task: " + url
+ " -> " + path);
}
@@ -130,7 +130,7 @@ public class ScreenShotManager {
}
protected String getImageFilename(final Map docMap) {
- StringBuilder buf = new StringBuilder(50);
+ final StringBuilder buf = new StringBuilder(50);
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
final String docid = (String) docMap.get(systemHelper.docIdField);
for (int i = 0; i < docid.length(); i++) {
@@ -219,30 +219,37 @@ public class ScreenShotManager {
final int prime = 31;
int result = 1;
result = prime * result
- + ((outputFile == null) ? 0 : outputFile.hashCode());
- result = prime * result + ((url == null) ? 0 : url.hashCode());
+ + (outputFile == null ? 0 : outputFile.hashCode());
+ result = prime * result + (url == null ? 0 : url.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- ScreenShotTask other = (ScreenShotTask) obj;
+ }
+ final ScreenShotTask other = (ScreenShotTask) obj;
if (outputFile == null) {
- if (other.outputFile != null)
+ if (other.outputFile != null) {
return false;
- } else if (!outputFile.equals(other.outputFile))
+ }
+ } else if (!outputFile.equals(other.outputFile)) {
return false;
+ }
if (url == null) {
- if (other.url != null)
+ if (other.url != null) {
return false;
- } else if (!url.equals(other.url))
+ }
+ } else if (!url.equals(other.url)) {
return false;
+ }
return true;
}
diff --git a/src/main/java/jp/sf/fess/screenshot/impl/WebDriverGenerator.java b/src/main/java/jp/sf/fess/screenshot/impl/WebDriverGenerator.java
index 09b773207..36422328b 100644
--- a/src/main/java/jp/sf/fess/screenshot/impl/WebDriverGenerator.java
+++ b/src/main/java/jp/sf/fess/screenshot/impl/WebDriverGenerator.java
@@ -72,7 +72,7 @@ public class WebDriverGenerator extends BaseScreenShotGenerator {
if (webDriver instanceof TakesScreenshot) {
webDriver.get(url);
- File screenshot = ((TakesScreenshot) webDriver)
+ final File screenshot = ((TakesScreenshot) webDriver)
.getScreenshotAs(OutputType.FILE);
convert(screenshot, outputFile);
} else {
@@ -83,18 +83,18 @@ public class WebDriverGenerator extends BaseScreenShotGenerator {
protected void convert(File inputFile, File outputFile) {
try {
- BufferedImage image = loadImage(inputFile);
- int screenShotHeight = screenShotWidth * image.getHeight()
+ final BufferedImage image = loadImage(inputFile);
+ final int screenShotHeight = screenShotWidth * image.getHeight()
/ windowWidth;
- BufferedImage screenShotImage = new BufferedImage(screenShotWidth,
- screenShotHeight, image.getType());
+ final BufferedImage screenShotImage = new BufferedImage(
+ screenShotWidth, screenShotHeight, image.getType());
screenShotImage.getGraphics().drawImage(
image.getScaledInstance(screenShotWidth, screenShotHeight,
Image.SCALE_AREA_AVERAGING), 0, 0, screenShotWidth,
screenShotHeight, null);
ImageIO.write(screenShotImage, imageFormatName, outputFile);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.warn("Failed to convert " + inputFile.getAbsolutePath(), e);
inputFile.renameTo(outputFile);
}
diff --git a/src/main/java/jp/sf/fess/service/SearchService.java b/src/main/java/jp/sf/fess/service/SearchService.java
index 99e256699..2a9f02171 100644
--- a/src/main/java/jp/sf/fess/service/SearchService.java
+++ b/src/main/java/jp/sf/fess/service/SearchService.java
@@ -79,7 +79,7 @@ public class SearchService implements Serializable {
@Resource
protected SpellChecker spellChecker;
- public PingResponse ping( ) {
+ public PingResponse ping() {
final SolrGroup solrGroup = solrGroupManager
.getSolrGroup(QueryType.QUERY);
return new PingResponse(solrGroup.ping());
diff --git a/src/main/java/jp/sf/fess/transformer/FessXpathTransformer.java b/src/main/java/jp/sf/fess/transformer/FessXpathTransformer.java
index 178ea014d..54e06e804 100644
--- a/src/main/java/jp/sf/fess/transformer/FessXpathTransformer.java
+++ b/src/main/java/jp/sf/fess/transformer/FessXpathTransformer.java
@@ -422,7 +422,7 @@ public class FessXpathTransformer extends AbstractFessXpathTransformer {
} else {
buf.append(' ');
}
- Node node = list.item(i);
+ final Node node = list.item(i);
if (pruned) {
final Node n = pruneNode(node.cloneNode(true));
buf.append(n.getTextContent());
@@ -509,7 +509,7 @@ public class FessXpathTransformer extends AbstractFessXpathTransformer {
: responseData.getUrl());
for (final Map.Entry entry : childUrlRuleMap
.entrySet()) {
- for (String u : getUrlFromTagAttribute(url, document,
+ for (final String u : getUrlFromTagAttribute(url, document,
entry.getKey(), entry.getValue(),
responseData.getCharSet())) {
anchorList.add(RequestDataBuilder.newRequestData().get()
@@ -523,8 +523,8 @@ public class FessXpathTransformer extends AbstractFessXpathTransformer {
// xpathAPI.remove();
}
- List urlList = new ArrayList<>(anchorList.size());
- for (RequestData requestData : anchorList) {
+ final List urlList = new ArrayList<>(anchorList.size());
+ for (final RequestData requestData : anchorList) {
urlList.add(requestData.getUrl());
}
return urlList;
@@ -534,7 +534,7 @@ public class FessXpathTransformer extends AbstractFessXpathTransformer {
protected List convertChildUrlList(
final List urlList) {
if (urlList != null) {
- for (RequestData requestData : urlList) {
+ for (final RequestData requestData : urlList) {
String url = requestData.getUrl();
for (final Map.Entry entry : convertUrlMap
.entrySet()) {