/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.struts2.convention.annotation.ParentPackage
 *  org.apache.struts2.convention.annotation.Result
 *  org.springframework.dao.DataAccessException
 */
package com.hst.common.action;

import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.service.BaseBusinessService;
import com.hst.framework.action.BaseAction;
import com.hst.framework.constants.AppServiceConstants;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.domain.BaseBusinessDomain;
import com.hst.framework.util.HstEncodeUtil;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.dao.DataAccessException;

@ParentPackage(value="basebusiness-json")
@Result(name="json", type="json", params={"root", "result"})
public class ExtendAction
extends BaseAction {
    private BaseBusinessService service;
    protected BaseBusinessDomain domain;

    public TaxCommonReturnDomain handleException(Exception e) {
        TaxCommonReturnDomain messageDomain = new TaxCommonReturnDomain();
        if (e instanceof DataAccessException) {
            int secondOraIndex;
            DataAccessException dae = (DataAccessException)e;
            String message = dae.getMessage();
            int oraIndex = (message = HstEncodeUtil.ISO2GBK(message)).indexOf("ORA-");
            if (oraIndex > 0 && (message = message.substring(oraIndex)).length() >= 4 && (secondOraIndex = message.substring(4, message.length()).indexOf("ORA")) > 0) {
                message = message.substring(0, secondOraIndex + 4);
            }
            messageDomain.setCode(AppServiceConstants.TAX_DB_ERROR);
            messageDomain.setMess(message);
            if (WebConstants.LOG_KZ_ERRORS.equals("Y")) {
                _logger.error((Object)message);
            }
            return messageDomain;
        }
        messageDomain.setCode(AppServiceConstants.TAX_APP_ERROR);
        if (e.toString().length() > 1000) {
            messageDomain.setMess(e.toString().substring(0, 999));
        } else {
            messageDomain.setMess(e.toString());
        }
        if (WebConstants.LOG_KZ_ERRORS.equals("Y")) {
            _logger.error((Object)e.toString());
        }
        return messageDomain;
    }

    public BaseBusinessDomain getDomain() {
        return this.domain;
    }

    public void setDomain(BaseBusinessDomain domain) {
        this.domain = domain;
    }

    public BaseBusinessService getService() {
        return this.service;
    }

    public void setService(BaseBusinessService service) {
        this.service = service;
    }
}
