Ignore:
Timestamp:
2020-07-01T01:05:57+12:00 (4 years ago)
Author:
ak19
Message:

Bugfix. When using client-GLI noticed that creating or editing an existing metadataset (GEMS) caused an error. The problem was compounded by a deadlock situation in displaying the error message in a popup. That deadlock is not resolved here (see future commit for attempted fix of it). This commit resolves the root cause: which was that Configuration.site_name was suddenly set to null, thereby failing to upload the mds file to the remote GS3. The nulled site_name may however not be a problem that will only affect client-GLI, as the Preferences pane would not open and things froze in client-GLI because site_name was null, which I think can affect GLI too. Need to check this, albeit with the bug still intact, by using GEMS in GLI to create/edit an mds file, then going to Preferences (or for local GLI perhaps the active site_name should moreover be set to other than localsite first). The cause was that there was a single GEMS constructor, used both when GEMS is launched as a standalone app and when GEMS launched through GLI. However, in both cases, the GEMS constructor dangerously erased and replaced the static-looking Configuration object (and Dictionary) with a basic Configuration object, losing crucial information like site_name and who knows what else. The problem was duplicated in GEMS.java as this instantiated a MetadataSetManager object whose constructor did the same thing of erasing and replacing Configuration, where it may have been a copy-paste error from GEMS.java. Once the mysterious cause of this problem was finally tracked down, the solution was just to have additional constructors that assume Configuration and Dictionary exist (thus not overwriting them), to be called when GEMS is launched through GLI, and when MetadataSetManager is launched through GEMS as GEMS always ensures a Configuration object exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/MetadataSetDialog.java

    r18370 r34232  
    138138        String metadata_path = metadata_set.getMetadataSetFile().toString();
    139139        if (gems == null){
    140         gems = new GEMS(Configuration.gsdl_path,Configuration.gsdl3_path,"", false, false);
     140       
     141        //gems = new GEMS(Configuration.gsdl_path,Configuration.gsdl3_path,"", false, false, site_name); // dangerous: this version of GEMS constructor only for if GEMS not launched through GLI but standalone
     142        // refer to comments in GEMS.java for GEMS constructors
     143        gems = new GEMS("", false); // right way to create GEMS app when launched by GLI
    141144        gems.addGEMSListener(this);
    142145        }
     
    270273            public void actionPerformed(ActionEvent event) {
    271274            if (gems == null) {
    272                 gems = new GEMS(Configuration.gsdl_path, Configuration.gsdl3_path, "", false, false);
     275                //gems = new GEMS(Configuration.gsdl_path, Configuration.gsdl3_path, "", false, false, site_name); // dangerous: this version of GEMS constructor only for if GEMS not launched through GLI but standalone
     276                // refer to comments in GEMS.java for GEMS constructors
     277                gems = new GEMS("", false); // right way to create GEMS app when launched by GLI
    273278            }
    274279            gems.newMetadataSet();
Note: See TracChangeset for help on using the changeset viewer.