Github user Ethanlm commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2754#discussion_r208394271
  
    --- Diff: 
storm-webapp/src/main/java/org/apache/storm/daemon/logviewer/handler/LogviewerLogPageHandler.java
 ---
    @@ -193,24 +198,23 @@ public Response logPage(String fileName, Integer 
start, Integer length, String g
                         throw e.getCause();
                     }
     
    -                List<String> filesStrWithoutFileParam = 
logFiles.stream().map(WorkerLogs::getTopologyPortWorkerLog)
    -                        .filter(fileStr -> !StringUtils.equals(fileName, 
fileStr)).collect(toList());
    -
    -                List<String> reorderedFilesStr = new ArrayList<>();
    -                reorderedFilesStr.addAll(filesStrWithoutFileParam);
    +                List<String> reorderedFilesStr = 
logFiles.stream().map(WorkerLogs::getTopologyPortWorkerLog)
    +                    .filter(fileStr -> !StringUtils.equals(fileName, 
fileStr)).collect(toList());
                     reorderedFilesStr.add(fileName);
     
                     length = length != null ? Math.min(10485760, length) : 
LogviewerConstant.DEFAULT_BYTES_PER_PAGE;
    -
    -                String logString;
    -                if (isTxtFile(fileName)) {
    -                    logString = escapeHtml(start != null ? pageFile(path, 
start, length) : pageFile(path, length));
    -                } else {
    -                    logString = escapeHtml("This is a binary file and 
cannot display! You may download the full file.");
    +                //This is the same as what #pageFile(String path, Integer 
tail) does
    +                // boolean isZipFile = path.endsWith(".gz");
    +                // long fileLength = isZipFile ? 
ServerUtils.zipFileSize(new File(path)) : new File(path).length();
    +                // return pageFile(path, Long.valueOf(fileLength - 
tail).intValue(), tail);
    --- End diff --
    
    remove comments


---

Reply via email to