code clean up

This commit is contained in:
Shinsuke Sugaya 2017-07-29 15:02:23 +09:00
parent 18cc6e6518
commit 9caf5e7b4d
15 changed files with 27 additions and 32 deletions

View file

@ -81,7 +81,7 @@ public class AdminDesignAction extends FessAdminAction {
}
private List<Pair<String, String>> loadJspFileNameItems() {
List<Pair<String, String>> jspItems = new ArrayList<>();
final List<Pair<String, String>> jspItems = new ArrayList<>();
for (final Pair<String, String> p : systemHelper.getDesignJspFileNames()) {
jspItems.add(new Pair<>(":" + p.getFirst(), "/" + p.getSecond()));
}
@ -324,7 +324,7 @@ public class AdminDesignAction extends FessAdminAction {
throwValidationError(messages -> messages.addErrorsDesignJspFileDoesNotExist(GLOBAL), () -> asListHtml());
}
return jspFile;
} catch (UnsupportedEncodingException e) {
} catch (final UnsupportedEncodingException e) {
throw new FessSystemException("Failed to decode " + fileName, e);
}
}

View file

@ -240,7 +240,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
if ("http".equalsIgnoreCase(host) || "https".equalsIgnoreCase(host)) {
return false;
}
} catch (MalformedURLException e) {
} catch (final MalformedURLException e) {
return false;
}
return true;
@ -784,7 +784,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
if (thumbnailUrl != null) {
return thumbnailUrl.toExternalForm();
}
} catch (Exception e) {
} catch (final Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to parse thumbnail url for " + url + " : " + attributes, e);
}

View file

@ -308,13 +308,7 @@ public class FessEsClient implements Client {
final String configIndex = values[0];
final String configType = values[1];
final String indexName;
final boolean isFessIndex = configIndex.equals("fess");
if (isFessIndex) {
indexName = fessConfig.getIndexDocumentUpdateIndex();
} else {
indexName = configIndex;
}
final String createdIndexName;
if (isFessIndex) {
createdIndexName = generateNewIndexName(configIndex);

View file

@ -102,7 +102,7 @@ public class ImplementedInvokerAssistant implements InvokerAssistant {
}
@Override
public OutsideSqlOption assistFirstOutsideSqlOption(String tableDbName) {
public OutsideSqlOption assistFirstOutsideSqlOption(final String tableDbName) {
// TODO Auto-generated method stub
return null;
}
@ -171,7 +171,7 @@ public class ImplementedInvokerAssistant implements InvokerAssistant {
}
@Override
public void toBeDisposable(DisposableProcess callerProcess) {
public void toBeDisposable(final DisposableProcess callerProcess) {
// TODO Auto-generated method stub
}

View file

@ -57,7 +57,7 @@ public class SearchLogBhv extends BsSearchLogBhv {
}
@Override
protected <RESULT extends SearchLog> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
protected <RESULT extends SearchLog> RESULT createEntity(final Map<String, Object> source, final Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
final Object searchFieldObj = source.get("searchField");

View file

@ -40,7 +40,7 @@ public class SearchLog extends BsSearchLog {
private static final long serialVersionUID = 1L;
private List<Pair<String, String>> searchFieldLogList = new ArrayList<>();
private final List<Pair<String, String>> searchFieldLogList = new ArrayList<>();
private OptionalEntity<UserInfo> userInfo;
@ -64,7 +64,7 @@ public class SearchLog extends BsSearchLog {
public void addSearchFieldLogValue(final String name, final String value) {
if (StringUtil.isNotBlank(name) && StringUtil.isNotBlank(value)) {
searchFieldLogList.add(new Pair<String, String>(name, value));
searchFieldLogList.add(new Pair<>(name, value));
}
}
@ -100,8 +100,9 @@ public class SearchLog extends BsSearchLog {
if (fields != null) {
sourceMap.putAll(fields);
}
final Map<String, List<Object>> searchFieldMap = searchFieldLogList.stream()
.collect(Collectors.groupingBy(Pair::getFirst, Collectors.mapping(Pair::getSecond, Collectors.toList())));
final Map<String, List<Object>> searchFieldMap =
searchFieldLogList.stream().collect(
Collectors.groupingBy(Pair::getFirst, Collectors.mapping(Pair::getSecond, Collectors.toList())));
sourceMap.put("searchField", searchFieldMap);
return sourceMap;
}

View file

@ -19,11 +19,11 @@ public class ThumbnailGenerationException extends FessSystemException {
private static final long serialVersionUID = 1L;
public ThumbnailGenerationException(String message, Exception cause) {
public ThumbnailGenerationException(final String message, final Exception cause) {
super(message, cause);
}
public ThumbnailGenerationException(String message) {
public ThumbnailGenerationException(final String message) {
super(message, false, false);
}
}

View file

@ -96,7 +96,7 @@ public class CrawlingConfigHelper {
return null;
}
});
} catch (ExecutionException e) {
} catch (final ExecutionException e) {
logger.warn("Failed to access a crawling config cache: " + configId, e);
return null;
}

View file

@ -65,7 +65,7 @@ public class RelatedContentHelper {
this.relatedContentMap = relatedContentMap;
}
protected String getHostKey(RelatedContent entity) {
protected String getHostKey(final RelatedContent entity) {
final String key = entity.getVirtualHost();
return StringUtil.isBlank(key) ? StringUtil.EMPTY : key;
}
@ -73,7 +73,7 @@ public class RelatedContentHelper {
public String getRelatedContent(final String query) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String key = fessConfig.getVirtualHostKey();
Map<String, String> map = relatedContentMap.get(key);
final Map<String, String> map = relatedContentMap.get(key);
if (map != null) {
final String content = map.get(toLowerCase(query));
if (StringUtil.isNotBlank(content)) {

View file

@ -65,7 +65,7 @@ public class RelatedQueryHelper {
this.relatedQueryMap = relatedQueryMap;
}
protected String getHostKey(RelatedQuery entity) {
protected String getHostKey(final RelatedQuery entity) {
final String key = entity.getVirtualHost();
return StringUtil.isBlank(key) ? StringUtil.EMPTY : key;
}
@ -73,7 +73,7 @@ public class RelatedQueryHelper {
public String[] getRelatedQueries(final String query) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String key = fessConfig.getVirtualHostKey();
Map<String, String[]> map = relatedQueryMap.get(key);
final Map<String, String[]> map = relatedQueryMap.get(key);
if (map != null) {
final String[] queries = map.get(toLowerCase(query));
if (queries != null) {

View file

@ -237,7 +237,7 @@ public class SystemHelper {
new File(servletContext.getRealPath("/WEB-INF/view/" + e.getValue()));
try {
Files.copy(baseJspFile.toPath(), jspFile.toPath());
} catch (IOException ex) {
} catch (final IOException ex) {
logger.warn("Could not copy from " + baseJspFile.getAbsolutePath() + " to "
+ jspFile.getAbsolutePath(), ex);
}

View file

@ -139,7 +139,7 @@ public class ViewHelper {
protected ActionHook actionHook = new ActionHook();
private Set<String> inlineMimeTypeSet = new HashSet<>();
private final Set<String> inlineMimeTypeSet = new HashSet<>();
@PostConstruct
public void init() {

View file

@ -379,7 +379,7 @@ public class ThumbnailManager {
if (logger.isDebugEnabled()) {
logger.debug("Delete " + path);
}
} catch (IOException e) {
} catch (final IOException e) {
logger.warn("Failed to delete " + path, e);
}
}

View file

@ -183,7 +183,7 @@ public abstract class BaseThumbnailGenerator implements ThumbnailGenerator {
return process(id,
(configId, url) -> {
final CrawlingConfigHelper crawlingConfigHelper = ComponentUtil.getCrawlingConfigHelper();
CrawlingConfig config = crawlingConfigHelper.getCrawlingConfig(configId);
final CrawlingConfig config = crawlingConfigHelper.getCrawlingConfig(configId);
if (config == null) {
throw new ThumbnailGenerationException("No CrawlingConfig: " + configId);
}
@ -232,7 +232,7 @@ public abstract class BaseThumbnailGenerator implements ThumbnailGenerator {
this.name = name;
}
public void setMaxRedirectCount(int maxRedirectCount) {
public void setMaxRedirectCount(final int maxRedirectCount) {
this.maxRedirectCount = maxRedirectCount;
}

View file

@ -192,15 +192,15 @@ public class CommandGenerator extends BaseThumbnailGenerator {
}
}
public void setCommandList(List<String> commandList) {
public void setCommandList(final List<String> commandList) {
this.commandList = commandList;
}
public void setCommandTimeout(long commandTimeout) {
public void setCommandTimeout(final long commandTimeout) {
this.commandTimeout = commandTimeout;
}
public void setBaseDir(File baseDir) {
public void setBaseDir(final File baseDir) {
this.baseDir = baseDir;
}