Changeset 33774


Ignore:
Timestamp:
2019-12-09T11:37:07+13:00 (4 years ago)
Author:
kjdon
Message:

getTextString code moved to Dictionary.getTextSTring, as its no longer only used by ServiceRacks - actions, and LIbraryServlet now use this method too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ServiceRack.java

    r32455 r33774  
    579579    {
    580580
    581         // we want to use the collection class loader in case there are coll specific files
    582         if (dictionary != null)
    583         {
    584             // just try the one specified dictionary
    585             Dictionary dict = new Dictionary(dictionary, lang, this.class_loader);
    586             String result = dict.get(key, args);
    587             if (result == null)
    588             { // not found
    589               //return "_" + key + "_";
    590               return null;
    591             }
    592             return result;
    593         }
    594 
    595         // now we try class names for dictionary names
    596         String original_class_name = this.getClass().getName();
    597         original_class_name = original_class_name.substring(original_class_name.lastIndexOf('.') + 1);
    598         Dictionary dict = new Dictionary(original_class_name, lang, this.class_loader);
    599         String result = dict.get(key, args);
    600         if (result != null)
    601         {
    602             return result;
    603         }
    604 
    605         // we have to try super classes
    606         String class_name;
    607         Class c = this.getClass().getSuperclass();
    608         while (result == null && c != null)
    609         {
    610             class_name = c.getName();
    611             class_name = class_name.substring(class_name.lastIndexOf('.') + 1);
    612             if (class_name.equals("ServiceRack"))
    613             {
    614                 // this is as far as we go
    615                 break;
    616             }
    617             dict = new Dictionary(class_name, lang, this.class_loader);
    618             result = dict.get(key, args);
    619             c = c.getSuperclass();
    620         }
    621         if (result == null)
    622         {
    623           // try the ServiceRack properties
    624           // at the moment we look for original_class_name.key, then just key
    625           // if there is lots of inheritance, may want to try down the list of superclasses too...?
    626           class_name = "ServiceRack";
    627           dict = new Dictionary(class_name, lang, this.class_loader);
    628           String full_key = original_class_name+"."+key;
    629           result = dict.get(full_key, args);
    630           if(result == null) {
    631             result = dict.get(key, args);
    632           }
    633           if(result == null) {
    634             //return "_" + key + "_";
    635             return null;
    636           }
    637         }
    638         return result;
    639    
     581        return Dictionary.getTextString(key, lang, args, dictionary, this.getClass(), "ServiceRack", this.class_loader);
    640582    }
    641583
Note: See TracChangeset for help on using the changeset viewer.