Changeset 33750 for main


Ignore:
Timestamp:
2019-12-04T16:47:25+13:00 (4 years ago)
Author:
ak19
Message:

Fixed a NullPointerException without stacktrace, noticed with dlheritage resulting in Untitled docs under author Young, Amanda. The only further log information was that there had been an InvocationTargetException when processDocumentMetadataRetrieve (a processService) was called on a subclass (GS2SolrRetrieve). The log also mentioned an ERROR:t ServiceRack.process() adding in an error element. The SO page at https://stackoverflow.com/questions/2411487/nullpointerexception-in-java-with-no-stacktrace had one answer that was relevant, which was that when the same Null ptr exception occurs multiple times, logger no longer prints out the full stack trace and to look in earlier parts of the log. Looking in an earlier log file, allowed me to find out that the Null ptr exception happened in AbstractGS2DocumentRetrieve.java where metas was null and therefore metas.length resulted in the exception. Fixing this appears to have fixed everything to do with this in dlheritage.

File:
1 edited

Legend:

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

    r33346 r33750  
    367367      // look for metadata refs
    368368      String [] metas = StringUtils.substringsBetween(val, "[", "]");
    369       for (int i=0; i<metas.length; i++) {
    370         String meta = metas[i];
    371         String meta_val;
    372         // hack for parent(Top). gs2 had lots of other modifiers, but is this the only one that was used in
    373         // metadata values??
    374         if (meta.startsWith("parent(Top):")) {
    375           String nmeta = meta.substring(12); // or 13?
    376           String root_id = OID.getTop(oid);
    377           DBInfo root_info = this.coll_db.getInfo(root_id);
    378           meta_val = root_info.getInfo(nmeta);
    379         } else {
    380           meta_val = this_info.getInfo(meta);
    381         }
    382         if (!meta_val.equals("")) {
    383           val = StringUtils.replace(val,"["+meta+"]",meta_val);
    384         }
     369      if(metas != null) {
     370          for (int i=0; i<metas.length; i++) {
     371          String meta = metas[i];
     372          String meta_val;
     373          // hack for parent(Top). gs2 had lots of other modifiers, but is this the only one that was used in
     374          // metadata values??
     375          if (meta.startsWith("parent(Top):")) {
     376              String nmeta = meta.substring(12); // or 13?
     377              String root_id = OID.getTop(oid);
     378              DBInfo root_info = this.coll_db.getInfo(root_id);
     379              meta_val = root_info.getInfo(nmeta);
     380          } else {
     381              meta_val = this_info.getInfo(meta);
     382          }
     383          if (!meta_val.equals("")) {
     384              val = StringUtils.replace(val,"["+meta+"]",meta_val);
     385          }
     386          }
     387      } else {
     388          logger.info("@@@@ metas was null. Using val: " + val);
    385389      }
    386390      values.set(j,val);
Note: See TracChangeset for help on using the changeset viewer.