Changeset 32115


Ignore:
Timestamp:
02/06/18 04:30:59 (3 years ago)
Author:
Georgiy Litvinov
Message:

Fixed NPE in case empty group title

File:
1 edited

Legend:

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

    r31869 r32115  
    66import org.greenstone.gsdl3.util.GSFile;
    77import org.greenstone.gsdl3.util.GSXML;
     8import org.greenstone.gsdl3.util.Request;
    89import org.greenstone.gsdl3.util.UserContext;
    910import org.greenstone.gsdl3.util.XMLConverter;
     
    277278            Element groupDescription = getGroupDescription(name);
    278279            Element titleEl = (Element) GSXML.getChildByTagName(groupDescription, GSXML.TITLE_ELEM);
    279             String title = titleEl.getTextContent();
     280            String title;
     281            if (titleEl != null) {
     282                 title = titleEl.getTextContent(); 
     283            } else {
     284                title = name;
     285            }
    280286            group.setAttribute(GSXML.TITLE_ELEM, title  );
    281287            addGroupInfo(group, newPath);
     
    482488        Document doc = XMLConverter.newDOM();
    483489        // Get the message router info
    484         Element mr_info_message = doc.createElement(GSXML.MESSAGE_ELEM);
    485         Element mr_request = GSXML.createBasicRequest(doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext);
    486         mr_info_message.appendChild(mr_request);
    487         Element mr_info_response_message = (Element) this.router.process(mr_info_message);
    488         if (mr_info_response_message == null) {
     490        Element inforesponseMessage = new Request(doc, userContext, router, GSXML.REQUEST_TYPE_DESCRIBE).send();
     491        if (inforesponseMessage == null) {
    489492            logger.error(" couldn't query the message router!");
    490493            return null;
    491494        }
    492         Element mr_info_response = (Element) GSXML.getChildByTagName(mr_info_response_message, GSXML.RESPONSE_ELEM);
     495        Element mr_info_response = (Element) GSXML.getChildByTagName(inforesponseMessage, GSXML.RESPONSE_ELEM);
    493496        if (mr_info_response == null) {
    494497            logger.error("Message router response is null!");
Note: See TracChangeset for help on using the changeset viewer.