(OFBIZ-7980) Applied slightly modified patch from jira issue
===================================== Add UI labels for success / error messages in common component ===================================== Thanks Tanmay for your contribution. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1759061 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -547,15 +547,16 @@ public class CommonServices {
|
||||
|
||||
public static Map<String, Object> resetMetric(DispatchContext dctx, Map<String, ?> context) {
|
||||
String originalName = (String) context.get("name");
|
||||
Locale locale = (Locale)context.get("locale");
|
||||
String name = UtilCodec.getDecoder("url").decode(originalName);
|
||||
if (name == null) {
|
||||
return ServiceUtil.returnError("Exception thrown while decoding metric name \"" + originalName + "\"");
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonExceptionThrownWhileDecodingMetric", UtilMisc.toMap("originalName", originalName), locale));
|
||||
}
|
||||
Metrics metric = MetricsFactory.getMetric(name);
|
||||
if (metric != null) {
|
||||
metric.reset();
|
||||
return ServiceUtil.returnSuccess();
|
||||
}
|
||||
return ServiceUtil.returnError("Metric \"" + name + "\" not found.");
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonMetricNotFound", UtilMisc.toMap("name", name), locale));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
import org.apache.ofbiz.base.util.FileUtil;
|
||||
import org.apache.ofbiz.base.util.UtilMisc;
|
||||
import org.apache.ofbiz.base.util.UtilProperties;
|
||||
import org.apache.ofbiz.base.util.template.FreeMarkerWorker;
|
||||
import org.apache.ofbiz.service.DispatchContext;
|
||||
import org.apache.ofbiz.service.ServiceUtil;
|
||||
@@ -197,7 +198,7 @@ public class JsLanguageFileMappingCreator {
|
||||
}
|
||||
catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError("The Outputfile could not be created: " + e.getMessage());
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage("CommonUiLabels", "CommonOutputFileCouldNotBeCreated", UtilMisc.toMap("errorString", e.getMessage()), (Locale)context.get("locale")));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user