src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsDefender.java
branchJDK-8200758-branch
changeset 57151 38d0b67617e3
parent 57106 ea870b9ce89a
equal deleted inserted replaced
57150:fa68c2ab636d 57151:38d0b67617e3
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.jpackage.internal;
    26 package jdk.jpackage.internal;
    27 
    27 
    28 import jdk.jpackage.internal.Platform;
       
    29 import java.util.List;
    28 import java.util.List;
    30 
    29 
    31 final class WindowsDefender {
    30 final class WindowsDefender {
    32 
    31 
    33     private WindowsDefender() {}
    32     private WindowsDefender() {}
    34 
    33 
    35     static final boolean isThereAPotentialWindowsDefenderIssue() {
    34     static final boolean isThereAPotentialWindowsDefenderIssue(String dir) {
    36         boolean result = false;
    35         boolean result = false;
    37 
    36 
    38         if (Platform.getPlatform() == Platform.WINDOWS &&
    37         if (Platform.getPlatform() == Platform.WINDOWS &&
    39             Platform.getMajorVersion() == 10) {
    38             Platform.getMajorVersion() == 10) {
    40 
    39 
    41             // If DisableRealtimeMonitoring is not enabled then there
    40             // If DisableRealtimeMonitoring is not enabled then there
    42             // may be a problem.
    41             // may be a problem.
    43             if (!WindowsRegistry.readDisableRealtimeMonitoring() &&
    42             if (!WindowsRegistry.readDisableRealtimeMonitoring() &&
    44                 !isTempDirectoryInExclusionPath()) {
    43                 !isDirectoryInExclusionPath(dir)) {
    45                 result = true;
    44                 result = true;
    46             }
    45             }
    47         }
    46         }
    48 
    47 
    49         return result;
    48         return result;
    50     }
    49     }
    51 
    50 
    52     private static boolean isTempDirectoryInExclusionPath() {
    51     private static boolean isDirectoryInExclusionPath(String dir) {
    53         boolean result = false;
    52         boolean result = false;
    54         // If the user temp directory is not found in the exclusion
    53         // If the user temp directory is not found in the exclusion
    55         // list then there may be a problem.
    54         // list then there may be a problem.
    56         List<String> paths = WindowsRegistry.readExclusionsPaths();
    55         List<String> paths = WindowsRegistry.readExclusionsPaths();
    57         String tempDirectory = getUserTempDirectory();
       
    58 
       
    59         for (String s : paths) {
    56         for (String s : paths) {
    60             if (s.equals(tempDirectory)) {
    57             if (WindowsRegistry.comparePaths(s, dir)) {
    61                 result = true;
    58                 result = true;
    62                 break;
    59                 break;
    63             }
    60             }
    64         }
    61         }
    65 
    62