Mark ClientHttpResponse::getRawStatusCode for removal

This commit is contained in:
Arjen Poutsma 2023-05-30 11:11:09 +02:00
parent 033bebf8cd
commit 49d688f99c
9 changed files with 14 additions and 53 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -90,12 +90,6 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
return this.statusCode; return this.statusCode;
} }
@Override
@Deprecated
public int getRawStatusCode() {
return this.statusCode.value();
}
@Override @Override
public String getStatusText() { public String getStatusText() {
return (this.statusCode instanceof HttpStatus status ? status.getReasonPhrase() : ""); return (this.statusCode instanceof HttpStatus status ? status.getReasonPhrase() : "");

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,10 +27,11 @@ import org.springframework.http.HttpStatusCode;
* @since 3.1.1 * @since 3.1.1
* @deprecated as of 6.0, with no direct replacement * @deprecated as of 6.0, with no direct replacement
*/ */
@Deprecated(since = "6.0") @Deprecated(since = "6.0", forRemoval = true)
public abstract class AbstractClientHttpResponse implements ClientHttpResponse { public abstract class AbstractClientHttpResponse implements ClientHttpResponse {
@Override @Override
@SuppressWarnings("removal")
public HttpStatusCode getStatusCode() throws IOException { public HttpStatusCode getStatusCode() throws IOException {
return HttpStatusCode.valueOf(getRawStatusCode()); return HttpStatusCode.valueOf(getRawStatusCode());
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2023 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -50,12 +50,6 @@ final class BufferingClientHttpResponseWrapper implements ClientHttpResponse {
return this.response.getStatusCode(); return this.response.getStatusCode();
} }
@Override
@Deprecated
public int getRawStatusCode() throws IOException {
return this.response.getRawStatusCode();
}
@Override @Override
public String getStatusText() throws IOException { public String getStatusText() throws IOException {
return this.response.getStatusText(); return this.response.getStatusText();

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -50,8 +50,10 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
* @see #getStatusCode() * @see #getStatusCode()
* @deprecated as of 6.0, in favor of {@link #getStatusCode()} * @deprecated as of 6.0, in favor of {@link #getStatusCode()}
*/ */
@Deprecated(since = "6.0") @Deprecated(since = "6.0", forRemoval = true)
int getRawStatusCode() throws IOException; default int getRawStatusCode() throws IOException {
return getStatusCode().value();
}
/** /**
* Get the HTTP status text of the response. * Get the HTTP status text of the response.

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -57,12 +57,6 @@ final class HttpComponentsClientHttpResponse implements ClientHttpResponse {
return HttpStatusCode.valueOf(this.httpResponse.getCode()); return HttpStatusCode.valueOf(this.httpResponse.getCode());
} }
@Override
@Deprecated
public int getRawStatusCode() {
return this.httpResponse.getCode();
}
@Override @Override
public String getStatusText() { public String getStatusText() {
return this.httpResponse.getReasonPhrase(); return this.httpResponse.getReasonPhrase();

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -54,12 +54,6 @@ class OkHttp3ClientHttpResponse implements ClientHttpResponse {
return HttpStatusCode.valueOf(this.response.code()); return HttpStatusCode.valueOf(this.response.code());
} }
@Override
@Deprecated
public int getRawStatusCode() {
return this.response.code();
}
@Override @Override
public String getStatusText() { public String getStatusText() {
return this.response.message(); return this.response.message();

View File

@ -55,12 +55,6 @@ final class SimpleClientHttpResponse implements ClientHttpResponse {
return HttpStatusCode.valueOf(this.connection.getResponseCode()); return HttpStatusCode.valueOf(this.connection.getResponseCode());
} }
@Override
@Deprecated
public int getRawStatusCode() throws IOException {
return this.connection.getResponseCode();
}
@Override @Override
public String getStatusText() throws IOException { public String getStatusText() throws IOException {
String result = this.connection.getResponseMessage(); String result = this.connection.getResponseMessage();

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -55,12 +55,6 @@ class ClientHttpResponseDecorator implements ClientHttpResponse {
return this.delegate.getStatusCode(); return this.delegate.getStatusCode();
} }
@SuppressWarnings("deprecation")
@Override
public int getRawStatusCode() throws IOException {
return this.delegate.getRawStatusCode();
}
@Override @Override
public String getStatusText() throws IOException { public String getStatusText() throws IOException {
return this.delegate.getStatusText(); return this.delegate.getStatusText();

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -90,12 +90,6 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
return this.statusCode; return this.statusCode;
} }
@Override
@Deprecated
public int getRawStatusCode() {
return this.statusCode.value();
}
@Override @Override
public String getStatusText() { public String getStatusText() {
return (this.statusCode instanceof HttpStatus status ? status.getReasonPhrase() : ""); return (this.statusCode instanceof HttpStatus status ? status.getReasonPhrase() : "");