Changeset 14817

Show
Ignore:
Timestamp:
19.11.2007 11:22:33 (12 years ago)
Author:
anna
Message:

Improved error message when GLI had permission problems when opening and creating collections.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/collection/CollectionManager.java

    r14358 r14817  
    380380        if (!new File(collection_directory_path).exists()) { 
    381381        // If there is no collection directory then the creation was unsuccessful, or cancelled 
    382  
     382           
    383383        return; 
    384384        } 
     
    959959        System.err.println("Cannot write lock file!"); 
    960960        String args[] = new String[2]; 
    961         args[0] = location; 
    962         args[1] = Dictionary.get("FileActions.Write_Not_Permitted_Title"); 
     961        args[0] = location;      
     962        args[1] = Dictionary.get("FileActions.Write_Not_Permitted_Message", new String[]{lock_file.getAbsolutePath()});      
     963        if(Gatherer.client_operating_system.toUpperCase().indexOf("WINDOWS")!=-1){         
     964          //if(Gatherer.client_operating_system.toUpperCase().indexOf("VISTA")!=-1){             
     965            args[1] += Dictionary.get("FileActions.File_Permission_Detail", new String[]{Configuration.gsdl_path, System.getProperty("user.name")}); 
     966          //}  
     967        } 
    963968        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Cannot_Open_With_Reason", args), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 
    964969        args = null; 
     
    10191024        // There is obviously no existing collection present. 
    10201025        DebugStream.printStackTrace(error); 
     1026        error.printStackTrace(); 
    10211027        if(error.getMessage() != null) { 
    10221028        String[] args = new String[2]; 
    1023         args[0] = location; 
    1024         args[1] = error.getMessage(); 
     1029        args[0] = location;      
     1030        //args[1] = error.getMessage(); 
     1031        args[1] = "The Librarian Interface does not have permission to write to... Please check file permissions."; 
    10251032        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Cannot_Open_With_Reason", args), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 
    10261033        } 
     
    10721079     */ 
    10731080    public synchronized void message(GShellEvent event) { 
     1081       
    10741082    } 
    10751083 
     
    11591167        Gatherer.g_man.repaint(); 
    11601168    } 
    1161     else if (event.getStatus() == GShell.ERROR) { 
    1162         DebugStream.println("There was an error in the gshell:"+ event.getMessage()); 
    1163         if (event.getType() == GShell.NEW) { 
    1164         JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Cannot_Create_Collection"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 
    1165         } else { 
     1169    else if (event.getStatus() == GShell.ERROR) {        
     1170        if (event.getType() == GShell.NEW) {      
     1171          String name = event.getMessage(); 
     1172          String collectDir = getCollectionDirectoryPath(name); 
     1173          String errMsg = ""; 
     1174          if (!new File(getCollectionDirectoryPath(name)).exists() || !new File(getCollectionDirectoryPath(name)).canWrite()) {        
     1175        String reason = Dictionary.get("FileActions.Write_Not_Permitted_Message", new String[]{collectDir}); 
     1176        errMsg = Dictionary.get("CollectionManager.Cannot_Create_Collection_With_Reason", new String[]{reason}); 
     1177        if(Gatherer.client_operating_system.toUpperCase().indexOf("WINDOWS") != -1){           
     1178          //if(Gatherer.client_operating_system.toUpperCase().indexOf("VISTA")!=-1){             
     1179            errMsg += Dictionary.get("FileActions.File_Permission_Detail", new String[]{Configuration.gsdl_path, System.getProperty("user.name")}); 
     1180          //}  
     1181        } 
     1182          } else { 
     1183        errMsg = Dictionary.get("CollectionManager.Cannot_Create_Collection"); 
     1184          } 
     1185          JOptionPane.showMessageDialog(Gatherer.g_man, errMsg, Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 
     1186        }  
     1187        else { 
    11661188        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Preview_Ready_Failed"), Dictionary.get("CollectionManager.Preview_Ready_Title"), JOptionPane.ERROR_MESSAGE); 
    11671189        Gatherer.refresh(Gatherer.COLLECTION_REBUILT);