Browse Source

code clean up

Shinsuke Sugaya 8 years ago
parent
commit
9caf5e7b4d

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java

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

+ 2 - 2
src/main/java/org/codelibs/fess/crawler/transformer/FessXpathTransformer.java

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

+ 0 - 6
src/main/java/org/codelibs/fess/es/client/FessEsClient.java

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

+ 2 - 2
src/main/java/org/codelibs/fess/es/common/ImplementedInvokerAssistant.java

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

+ 1 - 1
src/main/java/org/codelibs/fess/es/log/exbhv/SearchLogBhv.java

@@ -57,7 +57,7 @@ public class SearchLogBhv extends BsSearchLogBhv {
     }
     }
 
 
     @Override
     @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 {
         try {
             final RESULT result = entityType.newInstance();
             final RESULT result = entityType.newInstance();
             final Object searchFieldObj = source.get("searchField");
             final Object searchFieldObj = source.get("searchField");

+ 5 - 4
src/main/java/org/codelibs/fess/es/log/exentity/SearchLog.java

@@ -40,7 +40,7 @@ public class SearchLog extends BsSearchLog {
 
 
     private static final long serialVersionUID = 1L;
     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;
     private OptionalEntity<UserInfo> userInfo;
 
 
@@ -64,7 +64,7 @@ public class SearchLog extends BsSearchLog {
 
 
     public void addSearchFieldLogValue(final String name, final String value) {
     public void addSearchFieldLogValue(final String name, final String value) {
         if (StringUtil.isNotBlank(name) && StringUtil.isNotBlank(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) {
         if (fields != null) {
             sourceMap.putAll(fields);
             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);
         sourceMap.put("searchField", searchFieldMap);
         return sourceMap;
         return sourceMap;
     }
     }

+ 2 - 2
src/main/java/org/codelibs/fess/exception/ThumbnailGenerationException.java

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

+ 1 - 1
src/main/java/org/codelibs/fess/helper/CrawlingConfigHelper.java

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

+ 2 - 2
src/main/java/org/codelibs/fess/helper/RelatedContentHelper.java

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

+ 2 - 2
src/main/java/org/codelibs/fess/helper/RelatedQueryHelper.java

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

+ 1 - 1
src/main/java/org/codelibs/fess/helper/SystemHelper.java

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

+ 1 - 1
src/main/java/org/codelibs/fess/helper/ViewHelper.java

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

+ 1 - 1
src/main/java/org/codelibs/fess/thumbnail/ThumbnailManager.java

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

+ 2 - 2
src/main/java/org/codelibs/fess/thumbnail/impl/BaseThumbnailGenerator.java

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

+ 3 - 3
src/main/java/org/codelibs/fess/thumbnail/impl/CommandGenerator.java

@@ -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;
         this.commandList = commandList;
     }
     }
 
 
-    public void setCommandTimeout(long commandTimeout) {
+    public void setCommandTimeout(final long commandTimeout) {
         this.commandTimeout = commandTimeout;
         this.commandTimeout = commandTimeout;
     }
     }
 
 
-    public void setBaseDir(File baseDir) {
+    public void setBaseDir(final File baseDir) {
         this.baseDir = baseDir;
         this.baseDir = baseDir;
     }
     }