Skip to content

Commit

Permalink
Improved: Don't need to show files names in UI messages (OFBIZ-12884)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JacquesLeRoux committed Feb 1, 2024
1 parent b1cf4ef commit 93f8a58
Showing 1 changed file with 33 additions and 27 deletions.
Expand Up @@ -429,8 +429,8 @@ public String exec(MethodContext methodContext) throws MiniLangException {
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) {
Expand Down Expand Up @@ -584,7 +584,8 @@ public String exec(MethodContext methodContext) throws MiniLangException {
}
// 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()) {
Expand All @@ -601,7 +602,7 @@ public String exec(MethodContext methodContext) throws MiniLangException {

@Override
public void gatherArtifactInfo(ArtifactInfoContext aic) {
for (MethodOperation methodOp : this.methodOperations) {
for (MethodOperation methodOp : methodOperations) {
methodOp.gatherArtifactInfo(aic);
}
}
Expand All @@ -621,11 +622,11 @@ public Set<String> getAllServiceNamesCalled() throws MiniLangException {
}

public String getDefaultErrorCode() {
return this.defaultErrorCode;
return defaultErrorCode;
}

public String getDefaultSuccessCode() {
return this.defaultSuccessCode;
return defaultSuccessCode;
}

public String getDelegatorEnvName() {
Expand All @@ -637,56 +638,56 @@ public String getDispatcherEnvName() {
}

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() {
Expand All @@ -698,33 +699,38 @@ public String getSecurityEnvName() {
}

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;
Expand All @@ -735,7 +741,7 @@ public String getUserLoginEnvName() {
}

public boolean getUseTransaction() {
return this.useTransaction;
return useTransaction;
}

private String returnError(MethodContext methodContext, String errorMsg) {
Expand Down

0 comments on commit 93f8a58

Please sign in to comment.