Classes from the packages "com.sun. *" And "sun. *" Should not be used. Sonar Problem for a Jersey Client

I use jersey clientfor leisure calls. Import for my code:

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;

Everything is working fine. I use Sonarto check the quality of my code.

Sonar shows a serious problem for:

Classes from "com.sun." and the sun. packages should not be used

Is it really bad practice to use classes from the sun?

If so, what are the alternatives?

+4
source share
2 answers

JAX-RS 2.0. . . . , :

Client client = Client.create();
WebResource webResource = client.resource(restURL).path("myresource/{param}");
String result = webResource.pathParam("param", "value").get(String.class);

:

Client client = ClientFactory.newClient();
WebTarget target = client.target(restURL).path("myresource/{param}");
String result = target.pathParam("param", "value").get(String.class);
+5

API-: , JRE/JDK (Sun ), .

API-, .

Reference- Java- Sun?

0

Source: https://habr.com/ru/post/1608462/


All Articles