Changeset 37585 for main


Ignore:
Timestamp:
2023-03-28T16:09:16+13:00 (13 months ago)
Author:
davidb
Message:

moved setting the status error code to be earlier so it is guaranteed to be set where as before it was only set if there was an error; refactored some variable names

File:
1 edited

Legend:

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

    r37204 r37585  
    412412        statusString += " and monitored until done.";
    413413        // check for errors
    414         int status_code = Integer.parseInt(statusElem.getAttribute(GSXML.STATUS_ERROR_CODE_ATT));
    415         if (GSStatus.isError(status_code)) {
    416             logger.info("Got error status code: " + status_code);
    417             statusString += "But got error status code: " + status_code;
     414        int initial_response_status_code = Integer.parseInt(statusElem.getAttribute(GSXML.STATUS_ERROR_CODE_ATT));
     415        if (GSStatus.isError(initial_response_status_code)) {
     416            logger.info("Got error status code: " + initial_response_status_code);
     417            statusString += "But got error status code: " + initial_response_status_code;
    418418        } else { // check for Construction event errors
    419419            String id = statusElem.getAttribute("pid");
    420420            GS2PerlListener currentListener = this.listeners.get(id);
    421             status_code = currentListener.getStatus();
    422             if (GSStatus.isError(status_code))
    423             {
    424                 logger.info("xxxx Got construction event error. Error status code: " + status_code);
    425                 statusString += "But got construction event error, status code: " + status_code;
     421            int completed_status_code = currentListener.getStatus();
     422            // update statusElem so we return the status code on completion
     423            statusElem.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(completed_status_code));
     424            if (GSStatus.isError(completed_status_code))
     425            {
     426                logger.info("Got construction event error. Error status code: " + completed_status_code);
     427                statusString += "But got construction event error, status code: " + completed_status_code;
    426428                // add the rest of the messages to the statusElem node
    427429                statusString += "\n" + currentListener.getUpdate();
    428                 statusElem.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(currentListener.getStatus()));
    429430            }           
    430431        }       
Note: See TracChangeset for help on using the changeset viewer.