This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit cf35a9f4a47839ced10d18d9d1c4614b2545d8f2
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Tue Jan 30 16:36:05 2024 +0100

    Improved: Don't need to show files names in UI messages (OFBIZ-12884)
    
    We don't need to show files names in UI messages. It does not help users, 
rather
    confuse them. It's already in log where we also give enough but not too much
    information, ie the file and method used.
    
    Also removes all useless "this."
---
 .../org/apache/ofbiz/minilang/SimpleMethod.java    | 59 ++++++++++++----------
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git 
a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java 
b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java
index 8d4e0ddefc..11a8be6f77 100644
--- 
a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java
+++ 
b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java
@@ -469,8 +469,8 @@ public final class SimpleMethod extends MiniLangElement {
             methodContext.putEnv(eventResponseName, 
methodContext.getResponse());
         }
         methodContext.putEnv("simpleMethod", this);
-        methodContext.putEnv("methodName", this.getMethodName());
-        methodContext.putEnv("methodShortDescription", 
this.getShortDescription());
+        methodContext.putEnv("methodName", getMethodName());
+        methodContext.putEnv("methodShortDescription", getShortDescription());
         // if using transaction, try to start here
         boolean beganTransaction = false;
         if (useTransaction) {
@@ -631,7 +631,7 @@ public final class SimpleMethod extends MiniLangElement {
             }
             // rollback here passing beganTransaction to either rollback, or 
set rollback only
             try {
-                TransactionUtil.rollback(beganTransaction, "Error in 
simple-method [" + this.getShortDescription() + "]: "
+                TransactionUtil.rollback(beganTransaction, "Error in 
simple-method [" + getShortDescription() + "]: "
                         + summaryErrorStringBuffer, null);
             } catch (GenericTransactionException e) {
                 String errMsg = "Error trying to rollback transaction, could 
not process method: " + e.getMessage();
@@ -649,7 +649,7 @@ public final class SimpleMethod extends MiniLangElement {
 
     @Override
     public void gatherArtifactInfo(ArtifactInfoContext aic) {
-        for (MethodOperation methodOp : this.methodOperations) {
+        for (MethodOperation methodOp : methodOperations) {
             methodOp.gatherArtifactInfo(aic);
         }
     }
@@ -669,101 +669,106 @@ public final class SimpleMethod extends MiniLangElement 
{
     }
 
     public String getDefaultErrorCode() {
-        return this.defaultErrorCode;
+        return defaultErrorCode;
     }
 
     public String getDefaultSuccessCode() {
-        return this.defaultSuccessCode;
+        return defaultSuccessCode;
     }
 
     public String getEventErrorMessageListName() {
-        return this.eventErrorMessageListName;
+        return eventErrorMessageListName;
     }
 
     public String getEventErrorMessageName() {
-        return this.eventErrorMessageName;
+        return eventErrorMessageName;
     }
 
     public String getEventEventMessageListName() {
-        return this.eventEventMessageListName;
+        return eventEventMessageListName;
     }
 
     public String getEventEventMessageName() {
-        return this.eventEventMessageName;
+        return eventEventMessageName;
     }
 
     // event fields
     public String getEventRequestName() {
-        return this.eventRequestName;
+        return eventRequestName;
     }
 
     public String getEventResponseCodeName() {
-        return this.eventResponseCodeName;
+        return eventResponseCodeName;
     }
 
     public String getEventSessionName() {
-        return this.eventSessionName;
+        return eventSessionName;
     }
 
     public String getFileName() {
-        return this.fromLocation.substring(this.fromLocation.lastIndexOf("/") 
+ 1);
+        return fromLocation.substring(fromLocation.lastIndexOf("/") + 1);
     }
 
     public String getFromLocation() {
-        return this.fromLocation;
+        return fromLocation;
     }
 
     public String getLocationAndName() {
-        return this.fromLocation + "#" + this.methodName;
+        return fromLocation + "#" + methodName;
     }
 
     public boolean getLoginRequired() {
-        return this.loginRequired;
+        return loginRequired;
     }
 
     public String getMethodName() {
-        return this.methodName;
+        return methodName;
     }
 
     public List<MethodOperation> getMethodOperations() {
-        return this.methodOperations;
+        return methodOperations;
     }
 
     public String getServiceErrorMessageListName() {
-        return this.serviceErrorMessageListName;
+        return serviceErrorMessageListName;
     }
 
     public String getServiceErrorMessageMapName() {
-        return this.serviceErrorMessageMapName;
+        return serviceErrorMessageMapName;
     }
 
     public String getServiceErrorMessageName() {
-        return this.serviceErrorMessageName;
+        return serviceErrorMessageName;
     }
 
     public String getServiceResponseMessageName() {
-        return this.serviceResponseMessageName;
+        return serviceResponseMessageName;
     }
 
     public String getServiceSuccessMessageListName() {
-        return this.serviceSuccessMessageListName;
+        return serviceSuccessMessageListName;
     }
 
     public String getServiceSuccessMessageName() {
-        return this.serviceSuccessMessageName;
+        return serviceSuccessMessageName;
     }
 
     public String getShortDescription() {
-        return this.shortDescription + " [" + this.fromLocation + "#" + 
this.methodName + "]";
+        if (fromLocation.contains("file:") && 
fromLocation.contains("Events.xml")) {
+            return  getFileName() + "#" + getMethodName();
+        } else {
+            return shortDescription + " [" + fromLocation + "#" + methodName + 
"]";
+        }
     }
 
+
     @Override
     public SimpleMethod getSimpleMethod() {
         return this;
     }
 
     public boolean getUseTransaction() {
-        return this.useTransaction;
+        return useTransaction;
     }
 
     private String returnError(MethodContext methodContext, String errorMsg) {

Reply via email to