Changeset 8827


Ignore:
Timestamp:
2004-12-16T15:25:39+13:00 (19 years ago)
Author:
kjdon
Message:

small change, testing for null things

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GS2MacroResolver.java

    r8643 r8827  
    9292        break;
    9393        case TYPE_META:
    94         // for some reason, this matches() never matches
    95         //if (text.matches(".*"+m.macro+".*")) {
    96         if (info == null) {
    97             info = gdbm_src.getInfo(doc_oid);
     94        if (text.indexOf(m.macro) != -1) {
    9895            if (info == null) {
    99             break;
     96            info = gdbm_src.getInfo(doc_oid);
     97            if (info == null) {
     98                break;
     99            }
     100            }
     101            String value = info.getInfo(m.text);
     102            if (value != null) {
     103            text = text.replaceAll(m.macro, value);
     104            } else {
     105            // try the root node
     106            if (root_info == null && !OID.isTop(doc_oid)) {
     107                System.err.println("top="+OID.getTop(doc_oid));
     108                root_info = gdbm_src.getInfo(OID.getTop(doc_oid));
     109            }
     110            if (root_info == null) break;
     111            value = root_info.getInfo(m.text);
     112            if (value != null) {
     113                text = text.replaceAll(m.macro, value);
     114            }
    100115            }
    101116        }
    102         String value = info.getInfo(m.text);
    103         if (value != null) {
    104             text = text.replaceAll(m.macro, value);
    105         } else {
    106             // try the root node
    107             if (root_info == null && !OID.isTop(doc_oid)) {
    108             System.err.println("top="+OID.getTop(doc_oid));
    109             root_info = gdbm_src.getInfo(OID.getTop(doc_oid));
    110             }
    111             if (root_info == null) break;
    112             value = root_info.getInfo(m.text);
    113             if (value != null) {
    114             text = text.replaceAll(m.macro, value);
    115             }
    116         }
    117         //} // if
     117       
    118118        break;
    119119        } // switch
Note: See TracChangeset for help on using the changeset viewer.