package com.lerx.v6.util;

import org.springframework.context.support.ResourceBundleMessageSource;

import com.lerx.analyze.util.AnalyzeUtil;
import com.lerx.portal.obj.EnvirSet;
import com.lerx.sys.util.FileUtil;

public class ErrorUtil {
	
	public static String occur(ResourceBundleMessageSource messageSource,EnvirSet es,String key,String defValue) {
		String html;
		html = FileUtil.readRes(messageSource, "template_error");
		html = TempletUtil.tagToEnvir(html, es);
		html = AnalyzeUtil.replace(html, "tag", "resFolder",messageSource.getMessage("res.folder.default", null, "resFolder", null));
		String msg=messageSource.getMessage(key, null, defValue, null);
		html = AnalyzeUtil.replace(html, "tag", "msg", msg);
		html = AnalyzeUtil.replace(html, "tag", "portalName", es.getPortalDaoImpl().query_update().getName());
		return html;
	}

}
