Ignore:
Timestamp:
2011-03-15T17:07:58+13:00 (13 years ago)
Author:
davidb
Message:

Changes to take advantage of the more efficient Apache Commons string manipulation classes.

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service
Files:
2 edited

Legend:

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

    r22974 r23792  
    4444import org.apache.log4j.*;
    4545
     46// Apache Commons
     47import org.apache.commons.lang3.*;
     48
    4649/** Implements the generic retrieval and classifier services for GS2
    4750 * collections.
     
    150153    StringTokenizer st = new StringTokenizer(contains, ";");
    151154    while (st.hasMoreTokens()) {
    152         String child_id = st.nextToken().replaceAll("\"", node_id);
     155        String child_id = StringUtils.replace(st.nextToken(), "\"", node_id);
    153156        children.add(child_id);
    154157    }
     
    235238       
    236239        String contains = info.getInfo("contains");
    237         contains = contains.replaceAll("\"", parent_id);
     240        contains = StringUtils.replace(contains, "\"", parent_id);
    238241        String [] children = contains.split(";");
    239242        for (int i=0;i<children.length;i++) {
     
    475478        } else {
    476479            String contains = info.getInfo("contains");
    477             contains = contains.replaceAll("\"", parent_id);
     480            contains = StringUtils.replace(contains, "\"", parent_id);
    478481            String [] children = contains.split(";");
    479482            for (int i=0;i<children.length;i++) {
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java

    r15326 r23792  
    3333
    3434import org.apache.log4j.*;
     35
     36// Apache Commons
     37import org.apache.commons.lang3.*;
    3538
    3639public class GS2MGRetrieve
     
    134137        if (doc_content!=null) {
    135138            // remove any ctrl-c or ctrl-b
    136             doc_content = doc_content.replaceAll ("\u0002|\u0003", "");
     139            doc_content = StringUtils.replace(doc_content, "\u0002|\u0003", "");
    137140            // replace _httpimg_ with the correct address
    138141            doc_content = resolveTextMacros (doc_content, doc_id, lang);
Note: See TracChangeset for help on using the changeset viewer.