Fix null pointer exception in caching resources policy
MODIFY
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/CachingResourcesPolicy.java
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/CachingResourcesPolicy.java
@@ -167,6 +167,10 @@ public class CachingResourcesPolicy extends AbstractMappedDataPolicy<CachingReso
@Override
protected IReadWriteStream<ApiResponse> responseDataHandler(final ApiResponse response,
IPolicyContext context, CachingResourcesConfig policyConfiguration) {
+ if (response == null) {
+ // if the response is empty because of a policy failure before we end here and return null
+ return null;
+ }
List<CachingResourcesSettingsEntry> possibleMatchingCachingEntries = context.getAttribute(CACHE_POSSIBLE_MATCHING_ENTRIES, new ArrayList<CachingResourcesSettingsEntry>());
boolean isAMatch = false;
@@ -243,5 +247,4 @@ public class CachingResourcesPolicy extends AbstractMappedDataPolicy<CachingReso
return cacheId.toString();
}
-
}

Fix null pointer exception in caching resources policy (#756)