Updates to instanceof with variable
This commit is contained in:
@@ -89,8 +89,8 @@ public class CacheRequestBodyGatewayFilterFactory
|
||||
//
|
||||
Object backupCachedBody = exchange.getAttributes()
|
||||
.get(CACHED_ORIGINAL_REQUEST_BODY_BACKUP_ATTR);
|
||||
if (backupCachedBody instanceof DataBuffer) {
|
||||
DataBufferUtils.release((DataBuffer) backupCachedBody);
|
||||
if (backupCachedBody instanceof DataBuffer dataBuffer) {
|
||||
DataBufferUtils.release(dataBuffer);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -175,8 +175,7 @@ public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTest
|
||||
return chain.filter(exchange).doAfterTerminate(() -> {
|
||||
Object o = exchange.getAttributes()
|
||||
.get(CacheRequestBodyGatewayFilterFactory.CACHED_ORIGINAL_REQUEST_BODY_BACKUP_ATTR);
|
||||
if (o instanceof PooledDataBuffer) {
|
||||
PooledDataBuffer dataBuffer = (PooledDataBuffer) o;
|
||||
if (o instanceof PooledDataBuffer dataBuffer) {
|
||||
if (dataBuffer.isAllocated()) {
|
||||
exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
fail("DataBuffer is not released");
|
||||
|
||||
Reference in New Issue
Block a user