moresandeep commented on a change in pull request #135: KNOX-1995 - If a rule 
doesn't match, shouldn't ERROR and return null
URL: https://github.com/apache/knox/pull/135#discussion_r317719089
 
 

 ##########
 File path: 
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessor.java
 ##########
 @@ -165,7 +165,6 @@ public Template rewrite( Resolver resolver, Template 
inputUri, Direction directi
           }
         } else {
           LOG.failedToRewriteUrl( inputUri, direction, effectiveRuleName, 
stepStatus );
-          outputUri = null;
 
 Review comment:
   Not sure what the implications are if we return `outputUri = 
context.getCurrentUrl()` instead of `null`, it looks a bit risky to me to break 
the assumption that rewriter.rewrite() function on failure returns a non null 
value. 
   `JsonUrlRewriteFilterReader.filterValueString()` seems to ignore that 
contract causing NPE. it might be safe to just check `output != null` before 
calling `output.pattern()`. 

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to