Shinsuke Sugaya 5 vuotta sitten
vanhempi
commit
f124be3298
22 muutettua tiedostoa jossa 55 lisäystä ja 55 poistoa
  1. 5 5
      src/main/java/org/codelibs/fess/app/web/admin/backup/AdminBackupAction.java
  2. 1 1
      src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java
  3. 1 1
      src/main/java/org/codelibs/fess/app/web/base/login/LocalUserCredential.java
  4. 2 2
      src/main/java/org/codelibs/fess/crawler/transformer/AbstractFessFileTransformer.java
  5. 1 1
      src/main/java/org/codelibs/fess/es/config/exentity/CrawlingConfig.java
  6. 2 2
      src/main/java/org/codelibs/fess/exception/PluginException.java
  7. 2 2
      src/main/java/org/codelibs/fess/exception/ThemeException.java
  8. 1 1
      src/main/java/org/codelibs/fess/exec/ThumbnailGenerator.java
  9. 3 3
      src/main/java/org/codelibs/fess/helper/DocumentHelper.java
  10. 2 2
      src/main/java/org/codelibs/fess/helper/PermissionHelper.java
  11. 1 1
      src/main/java/org/codelibs/fess/helper/SambaHelper.java
  12. 2 2
      src/main/java/org/codelibs/fess/helper/SystemHelper.java
  13. 22 22
      src/main/java/org/codelibs/fess/helper/ThemeHelper.java
  14. 1 1
      src/main/java/org/codelibs/fess/helper/UserInfoHelper.java
  15. 1 1
      src/main/java/org/codelibs/fess/job/CrawlJob.java
  16. 1 1
      src/main/java/org/codelibs/fess/job/GenerateThumbnailJob.java
  17. 1 1
      src/main/java/org/codelibs/fess/job/SuggestJob.java
  18. 1 1
      src/main/java/org/codelibs/fess/job/UpdateLabelJob.java
  19. 2 2
      src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java
  20. 1 1
      src/main/java/org/codelibs/fess/sso/aad/AzureAdAuthenticator.java
  21. 1 1
      src/main/java/org/codelibs/fess/taglib/FessFunctions.java
  22. 1 1
      src/main/java/org/codelibs/fess/thumbnail/impl/CommandGenerator.java

+ 5 - 5
src/main/java/org/codelibs/fess/app/web/admin/backup/AdminBackupAction.java

@@ -117,7 +117,7 @@ public class AdminBackupAction extends FessAdminAction {
         validate(form, messages -> {}, () -> asListHtml());
         verifyToken(() -> asListHtml());
         final String fileName = form.bulkFile.getFileName();
-        File tempFile = ComponentUtil.getSystemHelper().createTempFile("fess_restore_", ".tmp");
+        final File tempFile = ComponentUtil.getSystemHelper().createTempFile("fess_restore_", ".tmp");
         try (final InputStream in = form.bulkFile.getInputStream(); final OutputStream out = new FileOutputStream(tempFile)) {
             CopyUtil.copy(in, out);
             asyncImport(fileName, tempFile);
@@ -272,11 +272,11 @@ public class AdminBackupAction extends FessAdminAction {
         }
     }
 
-    private Map<String, Map<String, String>> parseObject(final ObjectMapper mapper, String line) {
+    private Map<String, Map<String, String>> parseObject(final ObjectMapper mapper, final String line) {
         try {
             return mapper.readValue(line, new TypeReference<Map<String, Map<String, String>>>() {
             });
-        } catch (Exception e) {
+        } catch (final Exception e) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Failed to parse " + line, e);
             }
@@ -309,14 +309,14 @@ public class AdminBackupAction extends FessAdminAction {
                 }
             } else if (id.equals("fess.json")) {
                 return asStream(id).contentTypeOctetStream().stream(out -> {
-                    Path fessJsonPath = getFessJsonPath();
+                    final Path fessJsonPath = getFessJsonPath();
                     try (final InputStream in = Files.newInputStream(fessJsonPath)) {
                         out.write(in);
                     }
                 });
             } else if (id.equals("doc.json")) {
                 return asStream(id).contentTypeOctetStream().stream(out -> {
-                    Path fessJsonPath = getDocJsonPath();
+                    final Path fessJsonPath = getDocJsonPath();
                     try (final InputStream in = Files.newInputStream(fessJsonPath)) {
                         out.write(in);
                     }

+ 1 - 1
src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java

@@ -110,7 +110,7 @@ public abstract class FessBaseAction extends TypicalAction // has several interf
     @Override
     public ActionResponse godHandPrologue(final ActionRuntime runtime) {
         fessLoginAssist.getSavedUserBean().ifPresent(u -> {
-            boolean result = u.getFessUser().refresh();
+            final boolean result = u.getFessUser().refresh();
             if (logger.isDebugEnabled()) {
                 logger.debug("refresh user info: {}", result);
             }

+ 1 - 1
src/main/java/org/codelibs/fess/app/web/base/login/LocalUserCredential.java

@@ -18,7 +18,7 @@ package org.codelibs.fess.app.web.base.login;
 import org.lastaflute.web.login.credential.UserPasswordCredential;
 
 public class LocalUserCredential extends UserPasswordCredential implements FessCredential {
-    public LocalUserCredential(String user, String password) {
+    public LocalUserCredential(final String user, final String password) {
         super(user, password);
     }
 

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

@@ -384,9 +384,9 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
         params.put(HttpHeaders.CONTENT_TYPE, responseData.getMimeType());
         params.put(HttpHeaders.CONTENT_ENCODING, responseData.getCharSet());
         params.put(ExtractData.URL, responseData.getUrl());
-        Map<String, String> configParam = crawlingConfig.getConfigParameterMap(ConfigName.CONFIG);
+        final Map<String, String> configParam = crawlingConfig.getConfigParameterMap(ConfigName.CONFIG);
         if (configParam != null) {
-            String keepOriginalBody = configParam.get(Config.KEEP_ORIGINAL_BODY);
+            final String keepOriginalBody = configParam.get(Config.KEEP_ORIGINAL_BODY);
             if (StringUtil.isNotBlank(keepOriginalBody)) {
                 params.put(TikaExtractor.NORMALIZE_TEXT, Constants.TRUE.equalsIgnoreCase(keepOriginalBody) ? Constants.FALSE
                         : Constants.TRUE);

+ 1 - 1
src/main/java/org/codelibs/fess/es/config/exentity/CrawlingConfig.java

@@ -67,7 +67,7 @@ public interface CrawlingConfig {
     public enum ConfigType {
         WEB("W"), FILE("F"), DATA("D");
 
-        private final String typePrefix;
+        private String typePrefix;
 
         ConfigType(final String typePrefix) {
             this.typePrefix = typePrefix;

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

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

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

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

+ 1 - 1
src/main/java/org/codelibs/fess/exec/ThumbnailGenerator.java

@@ -200,7 +200,7 @@ public class ThumbnailGenerator {
             }
             executorService.shutdown();
             executorService.awaitTermination(60, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Interrupted.", e);
             }

+ 3 - 3
src/main/java/org/codelibs/fess/helper/DocumentHelper.java

@@ -78,11 +78,11 @@ public class DocumentHelper {
                 tikaExtractor.setReplaceDuplication(isDuplicateTermRemoved());
                 tikaExtractor.setSpaceChars(getSpaceChars());
             }
-        } catch (ComponentNotFoundException e) {
+        } catch (final ComponentNotFoundException e) {
             if (logger.isDebugEnabled()) {
                 logger.debug("tikaExtractor is not found: " + e.getMessage());
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             logger.warn("Failed to initiaize TikaExtractor.", e);
         }
     }
@@ -107,7 +107,7 @@ public class DocumentHelper {
         }
 
         if (crawlingConfig != null) {
-            Map<String, String> configParam = crawlingConfig.getConfigParameterMap(ConfigName.CONFIG);
+            final Map<String, String> configParam = crawlingConfig.getConfigParameterMap(ConfigName.CONFIG);
             if (configParam != null && Constants.TRUE.equalsIgnoreCase(configParam.get(Param.Config.KEEP_ORIGINAL_BODY))) {
                 return content;
             }

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

@@ -236,11 +236,11 @@ public class PermissionHelper {
         return roleTypeList;
     }
 
-    public void setAllowPrefix(String allowPrefix) {
+    public void setAllowPrefix(final String allowPrefix) {
         this.allowPrefix = allowPrefix;
     }
 
-    public void setDenyPrefix(String denyPrefix) {
+    public void setDenyPrefix(final String denyPrefix) {
         this.denyPrefix = denyPrefix;
     }
 }

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

@@ -76,7 +76,7 @@ public class SambaHelper {
         if (logger.isDebugEnabled()) {
             try {
                 logger.debug("Processing SID: {} {} {}", type, sid, sid.toDisplayString());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // ignore
             }
         }

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

@@ -470,14 +470,14 @@ public class SystemHelper {
         return System.getProperty(Constants.FESS_LOG_LEVEL, Level.WARN.toString());
     }
 
-    public File createTempFile(String prefix, String suffix) {
+    public File createTempFile(final String prefix, final String suffix) {
         try {
             final File file = File.createTempFile(prefix, suffix);
             if (logger.isDebugEnabled()) {
                 logger.debug("Create {} as a temp file.", file.getAbsolutePath());
             }
             return file;
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new IORuntimeException(e);
         }
     }

+ 22 - 22
src/main/java/org/codelibs/fess/helper/ThemeHelper.java

@@ -36,9 +36,9 @@ import org.slf4j.LoggerFactory;
 public class ThemeHelper {
     private static final Logger logger = LoggerFactory.getLogger(ThemeHelper.class);
 
-    public void install(Artifact artifact) {
-        Path jarPath = getJarFile(artifact);
-        String themeName = getThemeName(artifact);
+    public void install(final Artifact artifact) {
+        final Path jarPath = getJarFile(artifact);
+        final String themeName = getThemeName(artifact);
         if (logger.isDebugEnabled()) {
             logger.debug("Theme: {}", themeName);
         }
@@ -46,7 +46,7 @@ public class ThemeHelper {
             ZipEntry entry;
             while ((entry = zis.getNextEntry()) != null) {
                 if (!entry.isDirectory()) {
-                    String[] names = entry.getName().split("/");
+                    final String[] names = entry.getName().split("/");
                     if (names.length < 2) {
                         continue;
                     }
@@ -55,54 +55,54 @@ public class ThemeHelper {
                     }
                     if ("view".equals(names[0])) {
                         names[0] = themeName;
-                        Path path = ResourceUtil.getViewTemplatePath(names);
+                        final Path path = ResourceUtil.getViewTemplatePath(names);
                         Files.createDirectories(path.getParent());
                         Files.copy(zis, path, StandardCopyOption.REPLACE_EXISTING);
                     } else if ("css".equals(names[0])) {
                         names[0] = themeName;
-                        Path path = ResourceUtil.getCssPath(names);
+                        final Path path = ResourceUtil.getCssPath(names);
                         Files.createDirectories(path.getParent());
                         Files.copy(zis, path, StandardCopyOption.REPLACE_EXISTING);
                     } else if ("js".equals(names[0])) {
                         names[0] = themeName;
-                        Path path = ResourceUtil.getJavaScriptPath(names);
+                        final Path path = ResourceUtil.getJavaScriptPath(names);
                         Files.createDirectories(path.getParent());
                         Files.copy(zis, path, StandardCopyOption.REPLACE_EXISTING);
                     } else if ("images".equals(names[0])) {
                         names[0] = themeName;
-                        Path path = ResourceUtil.getImagePath(names);
+                        final Path path = ResourceUtil.getImagePath(names);
                         Files.createDirectories(path.getParent());
                         Files.copy(zis, path, StandardCopyOption.REPLACE_EXISTING);
                     }
                 }
             }
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new ThemeException("Failed to install " + artifact, e);
         }
     }
 
-    public void uninstall(Artifact artifact) {
-        String themeName = getThemeName(artifact);
+    public void uninstall(final Artifact artifact) {
+        final String themeName = getThemeName(artifact);
 
-        Path viewPath = ResourceUtil.getViewTemplatePath(themeName);
+        final Path viewPath = ResourceUtil.getViewTemplatePath(themeName);
         closeQuietly(viewPath);
-        Path imagePath = ResourceUtil.getImagePath(themeName);
+        final Path imagePath = ResourceUtil.getImagePath(themeName);
         closeQuietly(imagePath);
-        Path cssPath = ResourceUtil.getCssPath(themeName);
+        final Path cssPath = ResourceUtil.getCssPath(themeName);
         closeQuietly(cssPath);
-        Path jsPath = ResourceUtil.getJavaScriptPath(themeName);
+        final Path jsPath = ResourceUtil.getJavaScriptPath(themeName);
         closeQuietly(jsPath);
     }
 
-    protected String getThemeName(Artifact artifact) {
-        String themeName = artifact.getName().substring(ArtifactType.THEME.getId().length() + 1);
+    protected String getThemeName(final Artifact artifact) {
+        final String themeName = artifact.getName().substring(ArtifactType.THEME.getId().length() + 1);
         if (StringUtil.isBlank(themeName)) {
             throw new ThemeException("Theme name is empty: " + artifact);
         }
         return themeName;
     }
 
-    protected void closeQuietly(Path dir) {
+    protected void closeQuietly(final Path dir) {
         try (Stream<Path> walk = Files.walk(dir, FileVisitOption.FOLLOW_LINKS)) {
             walk.sorted(Comparator.reverseOrder()).forEach(f -> {
                 if (logger.isDebugEnabled()) {
@@ -110,18 +110,18 @@ public class ThemeHelper {
                 }
                 try {
                     Files.delete(f);
-                } catch (IOException e) {
+                } catch (final IOException e) {
                     logger.warn("Failed to delete " + f, e);
                 }
             });
             Files.deleteIfExists(dir);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             logger.warn("Failed to delete " + dir, e);
         }
     }
 
-    protected Path getJarFile(Artifact artifact) {
-        Path jarPath = ResourceUtil.getPluginPath(artifact.getFileName());
+    protected Path getJarFile(final Artifact artifact) {
+        final Path jarPath = ResourceUtil.getPluginPath(artifact.getFileName());
         if (!Files.exists(jarPath)) {
             throw new ThemeException(artifact.getFileName() + " does not exist.");
         }

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

@@ -233,7 +233,7 @@ public class UserInfoHelper {
         this.cookieSecure = cookieSecure;
     }
 
-    public void setCookieHttpOnly(boolean httpOnly) {
+    public void setCookieHttpOnly(final boolean httpOnly) {
         this.httpOnly = httpOnly;
     }
 }

+ 1 - 1
src/main/java/org/codelibs/fess/job/CrawlJob.java

@@ -321,7 +321,7 @@ public class CrawlJob extends ExecJob {
             cmdList.add(Integer.toString(documentExpires));
         }
 
-        File propFile = ComponentUtil.getSystemHelper().createTempFile(getExecuteType() + "_", ".properties");
+        final File propFile = ComponentUtil.getSystemHelper().createTempFile(getExecuteType() + "_", ".properties");
         try {
             cmdList.add("-p");
             cmdList.add(propFile.getAbsolutePath());

+ 1 - 1
src/main/java/org/codelibs/fess/job/GenerateThumbnailJob.java

@@ -202,7 +202,7 @@ public class GenerateThumbnailJob extends ExecJob {
             cmdList.add("--cleanup");
         }
 
-        File propFile = ComponentUtil.getSystemHelper().createTempFile(getExecuteType() + "_", ".properties");
+        final File propFile = ComponentUtil.getSystemHelper().createTempFile(getExecuteType() + "_", ".properties");
         try {
             cmdList.add("-p");
             cmdList.add(propFile.getAbsolutePath());

+ 1 - 1
src/main/java/org/codelibs/fess/job/SuggestJob.java

@@ -184,7 +184,7 @@ public class SuggestJob extends ExecJob {
         cmdList.add("--sessionId");
         cmdList.add(sessionId);
 
-        File propFile = ComponentUtil.getSystemHelper().createTempFile(getExecuteType() + "_", ".properties");
+        final File propFile = ComponentUtil.getSystemHelper().createTempFile(getExecuteType() + "_", ".properties");
         try {
             cmdList.add("-p");
             cmdList.add(propFile.getAbsolutePath());

+ 1 - 1
src/main/java/org/codelibs/fess/job/UpdateLabelJob.java

@@ -62,7 +62,7 @@ public class UpdateLabelJob {
                                         return builder.setDoc(XContentFactory.jsonBuilder().startObject()
                                                 .field(fessConfig.getIndexFieldLabel(), labelSet.toArray(n -> new String[n])).endObject());
                                     }
-                                } catch (IOException e) {
+                                } catch (final IOException e) {
                                     logger.warn("Failed to process " + hit, e);
                                 }
                                 return null;

+ 2 - 2
src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java

@@ -1984,7 +1984,7 @@ public interface FessProp {
     default Object getQueryTrackTotalHitsValue() {
         Object value = propMap.get(QUERY_TRACK_TOTAL_HITS_VALUE);
         if (value == null) {
-            String v = getQueryTrackTotalHits();
+            final String v = getQueryTrackTotalHits();
             if (Constants.TRUE.equalsIgnoreCase(v)) {
                 value = Boolean.TRUE;
             } else if (Constants.FALSE.equalsIgnoreCase(v)) {
@@ -1992,7 +1992,7 @@ public interface FessProp {
             } else {
                 try {
                     value = Integer.valueOf(Integer.parseInt(v));
-                } catch (NumberFormatException e) {
+                } catch (final NumberFormatException e) {
                     value = StringUtil.EMPTY;
                 }
             }

+ 1 - 1
src/main/java/org/codelibs/fess/sso/aad/AzureAdAuthenticator.java

@@ -576,7 +576,7 @@ public class AzureAdAuthenticator implements SsoAuthenticator {
         this.acquisitionTimeout = acquisitionTimeout;
     }
 
-    public void setGroupCacheExpiry(long groupCacheExpiry) {
+    public void setGroupCacheExpiry(final long groupCacheExpiry) {
         this.groupCacheExpiry = groupCacheExpiry;
     }
 }

+ 1 - 1
src/main/java/org/codelibs/fess/taglib/FessFunctions.java

@@ -170,7 +170,7 @@ public class FessFunctions {
     }
 
     public static String formatFileSize(final long value) {
-        double target = (double) value;
+        double target = value;
         String unit = ""; // TODO l10n?
         String format = "0.#";
         if (value < 1024) {

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

@@ -84,7 +84,7 @@ public class CommandGenerator extends BaseThumbnailGenerator {
         }
 
         return process(thumbnailId, responseData -> {
-            File tempFile = ComponentUtil.getSystemHelper().createTempFile("thumbnail_", "");
+            final File tempFile = ComponentUtil.getSystemHelper().createTempFile("thumbnail_", "");
             try {
                 CopyUtil.copy(responseData.getResponseBody(), tempFile);