Ver Fonte

fixes from sonarcube

Shinsuke Sugaya há 5 anos atrás
pai
commit
88952e3f8e

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

@@ -779,7 +779,7 @@ public class FessEsClient implements Client {
 
             try {
                 if (logger.isDebugEnabled()) {
-                    logger.debug("Query DSL:\n{}", searchRequestBuilder.toString());
+                    logger.debug("Query DSL:\n{}", searchRequestBuilder);
                 }
                 searchResponse = searchRequestBuilder.execute().actionGet(ComponentUtil.getFessConfig().getIndexSearchTimeout());
             } catch (final SearchPhaseExecutionException e) {
@@ -803,7 +803,7 @@ public class FessEsClient implements Client {
             String scrollId = null;
             try {
                 if (logger.isDebugEnabled()) {
-                    logger.debug("Query DSL:\n{}", searchRequestBuilder.toString());
+                    logger.debug("Query DSL:\n{}", searchRequestBuilder);
                 }
                 SearchResponse response = searchRequestBuilder.execute().actionGet(ComponentUtil.getFessConfig().getIndexSearchTimeout());
 

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

@@ -124,7 +124,7 @@ public class IndexingHelper {
                 }
             }
             if (logger.isDebugEnabled()) {
-                logger.debug("{} => {}", queryBuilder.toString(), docs);
+                logger.debug("{} => {}", queryBuilder, docs);
             }
         }
         if (!docIdList.isEmpty()) {

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

@@ -258,20 +258,20 @@ public class LabelTypeHelper {
                 if (includedPaths.matcher(path).matches()) {
                     if (excludedPaths != null && excludedPaths.matcher(path).matches()) {
                         if (logger.isDebugEnabled()) {
-                            logger.debug("Path {} matched against the excludes paths expression {}", path, excludedPaths.toString());
+                            logger.debug("Path {} matched against the excludes paths expression {}", path, excludedPaths);
                         }
                         return false;
                     }
                     return true;
                 }
                 if (logger.isDebugEnabled()) {
-                    logger.debug("Path {} wasn't matched against the include paths expression {}", path, includedPaths.toString());
+                    logger.debug("Path {} wasn't matched against the include paths expression {}", path, includedPaths);
                 }
                 return false;
             } else {
                 if (excludedPaths != null && excludedPaths.matcher(path).matches()) {
                     if (logger.isDebugEnabled()) {
-                        logger.debug("Path {} matched against the excludes paths expression {}", path, excludedPaths.toString());
+                        logger.debug("Path {} matched against the excludes paths expression {}", path, excludedPaths);
                     }
                     return false;
                 }

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

@@ -167,7 +167,7 @@ public class PermissionHelper {
                     }
                 }
                 if (logger.isDebugEnabled()) {
-                    logger.debug("smbUrl:{} roleType:{}", responseData.getUrl(), roleTypeList.toString());
+                    logger.debug("smbUrl:{} roleType:{}", responseData.getUrl(), roleTypeList);
                 }
             } else if (responseData.getUrl().startsWith("smb1:")) {
                 final jcifs.smb1.smb1.SID[] allowedSids =
@@ -191,7 +191,7 @@ public class PermissionHelper {
                     }
                 }
                 if (logger.isDebugEnabled()) {
-                    logger.debug("smb1Url:{} roleType:{}", responseData.getUrl(), roleTypeList.toString());
+                    logger.debug("smb1Url:{} roleType:{}", responseData.getUrl(), roleTypeList);
                 }
             }
         }
@@ -202,7 +202,6 @@ public class PermissionHelper {
         final List<String> roleTypeList = new ArrayList<>();
         final FessConfig fessConfig = ComponentUtil.getFessConfig();
         if (fessConfig.isFileRoleFromFile() && responseData.getUrl().startsWith("file:")) {
-            final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
             final String owner = (String) responseData.getMetaDataMap().get(FileSystemClient.FS_FILE_USER);
             if (owner != null) {
                 roleTypeList.add(systemHelper.getSearchRoleByUser(owner));
@@ -210,7 +209,7 @@ public class PermissionHelper {
             final String[] groups = (String[]) responseData.getMetaDataMap().get(FileSystemClient.FS_FILE_GROUPS);
             roleTypeList.addAll(stream(groups).get(stream -> stream.map(systemHelper::getSearchRoleByGroup).collect(Collectors.toList())));
             if (logger.isDebugEnabled()) {
-                logger.debug("fileUrl:{} roleType:{}", responseData.getUrl(), roleTypeList.toString());
+                logger.debug("fileUrl:{} roleType:{}", responseData.getUrl(), roleTypeList);
             }
         }
         return roleTypeList;
@@ -220,7 +219,6 @@ public class PermissionHelper {
         final List<String> roleTypeList = new ArrayList<>();
         final FessConfig fessConfig = ComponentUtil.getFessConfig();
         if (fessConfig.isFtpRoleFromFile() && responseData.getUrl().startsWith("ftp:")) {
-            final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
             final String owner = (String) responseData.getMetaDataMap().get(FtpClient.FTP_FILE_USER);
             if (owner != null) {
                 roleTypeList.add(systemHelper.getSearchRoleByUser(owner));
@@ -230,7 +228,7 @@ public class PermissionHelper {
                 roleTypeList.add(systemHelper.getSearchRoleByGroup(group));
             }
             if (logger.isDebugEnabled()) {
-                logger.debug("ftpUrl:{} roleType:{}", responseData.getUrl(), roleTypeList.toString());
+                logger.debug("ftpUrl:{} roleType:{}", responseData.getUrl(), roleTypeList);
             }
         }
         return roleTypeList;

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

@@ -152,7 +152,7 @@ public class ViewHelper {
 
     protected Cache<String, FacetResponse> facetCache;
 
-    protected long facetCacheDuration = 60 * 10; // 10min
+    protected long facetCacheDuration = 60 * 10L; // 10min
 
     @PostConstruct
     public void init() {