This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch release18.12 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 93f8a584193908e505b8c41692860a04cd5075de 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." # Conflicts handled by hand in SimpleMethod.java --- .../org/apache/ofbiz/minilang/SimpleMethod.java | 60 ++++++++++++---------- 1 file changed, 33 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 c5a9d53c24..c0cfd15202 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 @@ -429,8 +429,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) { @@ -584,7 +584,8 @@ 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() + "]: " + summaryErrorStringBuffer, null); + 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(); if (methodContext.isTraceOn()) { @@ -601,7 +602,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); } } @@ -621,11 +622,11 @@ public final class SimpleMethod extends MiniLangElement { } public String getDefaultErrorCode() { - return this.defaultErrorCode; + return defaultErrorCode; } public String getDefaultSuccessCode() { - return this.defaultSuccessCode; + return defaultSuccessCode; } public String getDelegatorEnvName() { @@ -637,56 +638,56 @@ public final class SimpleMethod extends MiniLangElement { } 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 getParameterMapName() { @@ -698,33 +699,38 @@ public final class SimpleMethod extends MiniLangElement { } 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; @@ -735,7 +741,7 @@ public final class SimpleMethod extends MiniLangElement { } public boolean getUseTransaction() { - return this.useTransaction; + return useTransaction; } private String returnError(MethodContext methodContext, String errorMsg) {