Polishing for Java 17 baseline
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ class ResponseMapGraphQlResponse extends AbstractGraphQlResponse {
|
||||
private static List<ResponseError> wrapErrors(Map<String, Object> map) {
|
||||
List<Map<String, Object>> errors = (List<Map<String, Object>>) map.get("errors");
|
||||
errors = (errors != null ? errors : Collections.emptyList());
|
||||
return errors.stream().map(Error::new).collect(Collectors.toList());
|
||||
return errors.stream().map(MapResponseError::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class ResponseMapGraphQlResponse extends AbstractGraphQlResponse {
|
||||
/**
|
||||
* {@link GraphQLError} that wraps a deserialized the GraphQL response map.
|
||||
*/
|
||||
private static final class Error implements ResponseError {
|
||||
private static final class MapResponseError implements ResponseError {
|
||||
|
||||
private final Map<String, Object> errorMap;
|
||||
|
||||
@@ -120,7 +120,7 @@ class ResponseMapGraphQlResponse extends AbstractGraphQlResponse {
|
||||
|
||||
private final String path;
|
||||
|
||||
Error(Map<String, Object> errorMap) {
|
||||
MapResponseError(Map<String, Object> errorMap) {
|
||||
Assert.notNull(errorMap, "'errorMap' is required");
|
||||
this.errorMap = errorMap;
|
||||
this.locations = initLocations(errorMap);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -107,8 +107,7 @@ class PropertySelection {
|
||||
* @return the property paths as list.
|
||||
*/
|
||||
public List<String> toList() {
|
||||
return this.propertyPaths.stream().map(PropertyPath::toDotPath)
|
||||
.collect(Collectors.toList());
|
||||
return this.propertyPaths.stream().map(PropertyPath::toDotPath).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,7 +89,7 @@ public class DefaultExecutionGraphQlResponse extends AbstractGraphQlResponse imp
|
||||
|
||||
@Override
|
||||
public List<ResponseError> getErrors() {
|
||||
return this.result.getErrors().stream().map(Error::new).collect(Collectors.toList());
|
||||
return this.result.getErrors().stream().map(GraphQLErrorResponseError::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,13 +111,7 @@ public class DefaultExecutionGraphQlResponse extends AbstractGraphQlResponse imp
|
||||
/**
|
||||
* {@link GraphQLError} that wraps a {@link GraphQLError}.
|
||||
*/
|
||||
private static class Error implements ResponseError {
|
||||
|
||||
private final GraphQLError delegate;
|
||||
|
||||
Error(GraphQLError delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
private record GraphQLErrorResponseError(GraphQLError delegate) implements ResponseError {
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -97,7 +97,7 @@ public class ResourceDocumentSource implements DocumentSource {
|
||||
.switchIfEmpty(Mono.fromRunnable(() -> {
|
||||
throw new IllegalStateException(
|
||||
"Failed to find document, name='" + name + "', under location(s)=" +
|
||||
this.locations.stream().map(Resource::toString).collect(Collectors.toList()));
|
||||
this.locations.stream().map(Resource::toString).toList());
|
||||
}))
|
||||
.subscribeOn(Schedulers.boundedElastic());
|
||||
}
|
||||
@@ -117,9 +117,9 @@ public class ResourceDocumentSource implements DocumentSource {
|
||||
|
||||
private String resourceToString(Resource resource) {
|
||||
try {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
FileCopyUtils.copy(resource.getInputStream(), out);
|
||||
return new String(out.toByteArray(), StandardCharsets.UTF_8);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
FileCopyUtils.copy(resource.getInputStream(), outputStream);
|
||||
return outputStream.toString(StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalArgumentException(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -151,7 +151,7 @@ public class DefaultGraphQlClientResponseTests {
|
||||
}
|
||||
|
||||
private ClientResponseField getFieldOnErrorResponse(String path, GraphQLError... errors) {
|
||||
List<?> list = Arrays.stream(errors).map(GraphQLError::toSpecification).collect(Collectors.toList());
|
||||
List<?> list = Arrays.stream(errors).map(GraphQLError::toSpecification).toList();
|
||||
ClientGraphQlResponse response = creatResponse(Collections.singletonMap("errors", list));
|
||||
return response.field(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user