Added guard to prevent user message from being displayed while autoDetect is running
authorLou Dasaro <mr_lou_d@netbeans.org>
Tue, 10 Nov 2015 13:14:34 -0600
changeset 183478fec7305fe04
parent 18346 c3249b3bfed8
child 18348 b025a5cfb69c
Added guard to prevent user message from being displayed while autoDetect is running
Improved logged warning. Changed some platform messages to be logged if log.Level=CONFIG
Task #152377 - adding an invalid python platform throws PythonException (to log)
python.core/src/org/netbeans/modules/python/api/PythonAutoDetector.java
python.core/src/org/netbeans/modules/python/api/PythonPlatformManager.java
     1.1 --- a/python.core/src/org/netbeans/modules/python/api/PythonAutoDetector.java	Sun Nov 08 18:11:23 2015 -0600
     1.2 +++ b/python.core/src/org/netbeans/modules/python/api/PythonAutoDetector.java	Tue Nov 10 13:14:34 2015 -0600
     1.3 @@ -82,16 +82,16 @@
     1.4                  if (Utilities.isWindows()){
     1.5                      if (ext.equalsIgnoreCase("exe") || ext.equalsIgnoreCase("bat")) {
     1.6                          if( addMatch(dir.getAbsolutePath())) { //don't report duplicates
     1.7 -                            if (LOGGER.isLoggable(Level.FINE)) {
     1.8 -                                LOGGER.log(Level.FINE, "Match (Windows): {0}", dir.getAbsolutePath());                           
     1.9 +                            if (LOGGER.isLoggable(Level.CONFIG)) {
    1.10 +                                LOGGER.log(Level.CONFIG, "Match (Windows): {0}", dir.getAbsolutePath());                           
    1.11                              }
    1.12                          }
    1.13                      }
    1.14                  } else if(Utilities.isMac()) {
    1.15                      if (ext.equalsIgnoreCase("")) {
    1.16                          if( addMatch(dir.getAbsolutePath())) {
    1.17 -                            if (LOGGER.isLoggable(Level.FINE)) {
    1.18 -                                LOGGER.log(Level.FINE, "Match (Mac): {0}", dir.getAbsolutePath());                           
    1.19 +                            if (LOGGER.isLoggable(Level.CONFIG)) {
    1.20 +                                LOGGER.log(Level.CONFIG, "Match (Mac): {0}", dir.getAbsolutePath());                           
    1.21                              }
    1.22                          }
    1.23                      }
    1.24 @@ -173,8 +173,8 @@
    1.25              }
    1.26          }
    1.27          // no python found!!!
    1.28 -        if (LOGGER.isLoggable(Level.FINE)) {
    1.29 -            LOGGER.log(Level.FINE, "Python/Jython not found in environment path {0}", sEnvPath);            
    1.30 +        if (LOGGER.isLoggable(Level.CONFIG)) {
    1.31 +            LOGGER.log(Level.CONFIG, "Python/Jython not found in environment path {0}", sEnvPath);            
    1.32          }
    1.33      }
    1.34  
     2.1 --- a/python.core/src/org/netbeans/modules/python/api/PythonPlatformManager.java	Sun Nov 08 18:11:23 2015 -0600
     2.2 +++ b/python.core/src/org/netbeans/modules/python/api/PythonPlatformManager.java	Tue Nov 10 13:14:34 2015 -0600
     2.3 @@ -420,11 +420,12 @@
     2.4                  platforms.put(platform.getId(), platform);
     2.5              }else{
     2.6                  // throw new PythonException("Could not discover Python properties");
     2.7 -                LOGGER.log(Level.SEVERE, "Could not discover Python properties in ", cmd);
     2.8 -                showPlatformError( "Unable to discover Python properties in platform : " + // NOI18N
     2.9 -                                  cmd +
    2.10 -                                  "\nPlease check the installation path and entry in Python Platforms. " // NOI18N
    2.11 -                                );                
    2.12 +                String sMessage = "Unable to discover Python properties in platform: " + cmd +
    2.13 +                     "\nCheck the installation path or entry in Python Platforms";
    2.14 +                LOGGER.log(Level.SEVERE, sMessage);
    2.15 +                if(!autoDetecting) { // guard - because it can be problematic to display a user message while autoDetecting
    2.16 +                    showPlatformError( sMessage );// NOI18N
    2.17 +                }          
    2.18                  return (PythonPlatform) null;
    2.19              }
    2.20  //        }catch(PythonException ex){