if (filename_id != null) {
          
            id       = filename_id;              
            version    = filename_version;
                      
            PluginInterface pi = installer.getPluginManager().getPluginInterfaceByID( id );
            ok =    pi != null &&
                (  pi.getPluginDirectoryName() == null || 
                    pi.getPluginDirectoryName().length() == 0 ); 
          }
          
          if ( !ok ){
          
            throw( new PluginException( "Mandatory file 'plugin.properties' not found in plugin file" ));
          }
        }else{ // properties != null
        
          // unfortunately plugin.id isn't mandatory for the properties, and neither is plugin.version
        
          PluginInitializer.checkJDKVersion( "", properties, false );
          PluginInitializer.checkAzureusVersion("", properties, false);
          
          id    = properties.getProperty( "plugin.id" );
          version  = properties.getProperty( "plugin.version" );
          
          // Force both versions to be the same if they are both defined.
          String prop_version = version;
          if (prop_version != null && filename_version != null && !filename_version.equals(prop_version)) {
              throw new PluginException("inconsistent versions [file=" + filename_version + ", prop=" + prop_version + "]");
          }
        }
        
        if ( id == null ){
          
          // see if plugin is already loaded, if so we can get the id from it
          
          String  plugin_class = properties.getProperty("plugin.class");
          
          if ( plugin_class == null ){
            
            String  plugin_classes = properties.getProperty( "plugin.classes" );
            
            if ( plugin_classes != null ){
              
              int  semi_pos = plugin_classes.indexOf(";");
              
              if ( semi_pos == -1 ){
                
                plugin_class  = plugin_classes;
                
              }else{
                
                plugin_class = plugin_classes.substring( 0, semi_pos );
              }
            }
          }
          
          if ( plugin_class != null ){
            
            try{
              PluginInterface pi = installer.getPluginManager().getPluginInterfaceByClass( plugin_class );
              
              if ( pi != null ){
                
                id  = pi.getPluginID();
              }
            }catch( Throwable ignore ){
              
            }
          }