Skip to content

Commit 0e3e61d

Browse files
Fix: SSL error in multithreading mode by using custom protocol and relative URI
1 parent 7e384db commit 0e3e61d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/br/com/swconsultoria/nfe/ConsultaTributacao.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,18 @@ private static HttpClient createHttpClient(ConfiguracoesNfe config, Certificado
507507
}
508508

509509
private static String executeRequestWithHttpClient(HttpClient httpClient, String url) throws IOException {
510-
GetMethod getMethod = new GetMethod(url);
510+
String uri = url;
511+
if (httpClient.getHostConfiguration().getProtocol() != null) {
512+
try {
513+
URL u = new URL(url);
514+
httpClient.getHostConfiguration().setHost(u.getHost(), u.getPort(), httpClient.getHostConfiguration().getProtocol());
515+
uri = u.getFile();
516+
} catch (Exception e) {
517+
log.warning("[ConsultaTributacao] Erro ao processar URL para modo multithreading: " + e.getMessage());
518+
}
519+
}
520+
521+
GetMethod getMethod = new GetMethod(uri);
511522

512523
try {
513524
getMethod.setRequestHeader("Accept", "application/json");

0 commit comments

Comments
 (0)