danwatford edited a comment on pull request #217:
URL: https://github.com/apache/ofbiz-framework/pull/217#issuecomment-665611006


   I'm don't know how to resolve this @JacquesLeRoux . 
   Before the most recent merge commit a few moments ago I attempted to apply 
the patch you linked to against trunk and saw the failures you mentioned. As 
far as I can tell they are due to a difference in whitespace in the trunk 
compared to the lines expected to be replaced by the patch.
   
   I then tried generated another patch using 'git format-patch trunk --stdout 
> OFBIZ-11907.patch', but saw the exact same problem with then applying the new 
patch to trunk.
   
   The issue appears to be with the whitespace is this part of the patch:
   ```
   -        String tokenValue = CsrfUtil.generateTokenForNonAjax(request, 
target);
   -        if (UtilValidate.isNotEmpty(tokenValue)) {
   -            String currentString = externalWriter.toString();
   -            if (currentString.startsWith("<form")) {
   -                currentString = 
currentString.substring(currentString.lastIndexOf("\"")+1);
   -            }
   -            if (currentString.indexOf('?') == -1) {
   -                externalWriter.append("?" + CsrfUtil.getTokenNameNonAjax() 
+ "=" + tokenValue);
   -            } else {
   -                externalWriter.append("&amp;" + 
CsrfUtil.getTokenNameNonAjax() + "=" + tokenValue);
   -            }
   +        additionalParameters.forEach(uriBuilder::addParameter);
   +
   +        try {
   +            return uriBuilder.build();
   +        } catch (URISyntaxException e) {
   +            final String msg = "Syntax error when building URI: " + 
uriBuilder.toString();
   +            Debug.logError(e, msg, MODULE);
   +            throw new RuntimeException(msg, e);
   ```
   
   
   If a way to resolve this can be found then I think the patch will apply 
cleanly.
   
   Perhaps this is a reason to coordinate large formatting changes across the 
code base as this is the third time I've tried to fix the merge and we are now 
getting hit by some subtle diff/patch issue that I'm unable to definitively 
diagnose.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to