diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/RawResponsesDialog.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/RawResponsesDialog.java index 289d369013..436a265b02 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/RawResponsesDialog.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/RawResponsesDialog.java @@ -24,7 +24,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.jsoup.Jsoup; -import org.jsoup.safety.Whitelist; +import org.jsoup.safety.Safelist; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -130,7 +130,7 @@ protected void createButtonsForButtonBar(Composite parent) if (rawText.isDisposed()) return; - rawText.setText(Jsoup.clean(rawText.getText(), Whitelist.relaxed())); + rawText.setText(Jsoup.clean(rawText.getText(), Safelist.relaxed())); })); } diff --git a/name.abuchen.portfolio/META-INF/MANIFEST.MF b/name.abuchen.portfolio/META-INF/MANIFEST.MF index c0a330c513..fff4080a85 100644 --- a/name.abuchen.portfolio/META-INF/MANIFEST.MF +++ b/name.abuchen.portfolio/META-INF/MANIFEST.MF @@ -63,10 +63,10 @@ Import-Package: com.google.common.base, Bundle-ClassPath: . Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, - org.apache.httpcomponents.httpclient, - org.apache.httpcomponents.httpcore, + org.apache.httpcomponents.client5.httpclient5, + org.apache.httpcomponents.core5.httpcore5, org.apache.pdfbox, - com.jayway.jsonpath.json-path, + json-path, com.google.gson Automatic-Module-Name: name.abuchen.portfolio Eclipse-ExtensibleAPI: true diff --git a/name.abuchen.portfolio/src/name/abuchen/portfolio/online/impl/HTMLTableQuoteFeed.java b/name.abuchen.portfolio/src/name/abuchen/portfolio/online/impl/HTMLTableQuoteFeed.java index 1cc758975e..ca5867f2ca 100644 --- a/name.abuchen.portfolio/src/name/abuchen/portfolio/online/impl/HTMLTableQuoteFeed.java +++ b/name.abuchen.portfolio/src/name/abuchen/portfolio/online/impl/HTMLTableQuoteFeed.java @@ -33,7 +33,7 @@ import org.jsoup.UncheckedIOException; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; -import org.jsoup.safety.Whitelist; +import org.jsoup.safety.Safelist; import org.jsoup.select.Elements; import name.abuchen.portfolio.Messages; @@ -549,7 +549,7 @@ private List parse(String url, Document document, QuoteFeed if (prices.isEmpty()) { data.addError(new IOException(MessageFormat.format(Messages.MsgNoQuotesFoundInHTML, url, - Jsoup.clean(document.html(), Whitelist.relaxed())))); + Jsoup.clean(document.html(), Safelist.relaxed())))); return Collections.emptyList(); } diff --git a/name.abuchen.portfolio/src/name/abuchen/portfolio/online/portfolioreport/PRApiClient.java b/name.abuchen.portfolio/src/name/abuchen/portfolio/online/portfolioreport/PRApiClient.java index 8dc18d7707..17992e688c 100644 --- a/name.abuchen.portfolio/src/name/abuchen/portfolio/online/portfolioreport/PRApiClient.java +++ b/name.abuchen.portfolio/src/name/abuchen/portfolio/online/portfolioreport/PRApiClient.java @@ -7,21 +7,23 @@ import java.util.ArrayList; import java.util.List; -import org.apache.http.Header; -import org.apache.http.HttpHeaders; -import org.apache.http.HttpStatus; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.message.BasicHeader; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.classic.methods.HttpDelete; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.classic.methods.HttpPut; +import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpHeaders; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.core5.http.message.BasicHeader; import org.osgi.framework.FrameworkUtil; import com.google.gson.Gson; @@ -33,10 +35,11 @@ import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; + import name.abuchen.portfolio.online.impl.PortfolioReportNet; import name.abuchen.portfolio.util.WebAccess; -@SuppressWarnings("nls") +@SuppressWarnings({ "nls", "restriction" }) public class PRApiClient { private String endpoint; @@ -148,10 +151,10 @@ private List list(Class type, String path) throws IOException HttpGet request = new HttpGet(endpoint + path); CloseableHttpResponse response = client.execute(request); - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) + if (response.getCode() != HttpStatus.SC_OK) throw asError(request, response, null); - return this.gson.fromJson(EntityUtils.toString(response.getEntity()), + return this.gson.fromJson(toString(response.getEntity()), TypeToken.getParameterized(List.class, type).getType()); } @@ -161,10 +164,10 @@ private T create(Class type, String path, T input) throws IOException request.setEntity(new StringEntity(this.gson.toJson(input), StandardCharsets.UTF_8)); CloseableHttpResponse response = client.execute(request); - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) - throw asError(request, response, EntityUtils.toString(request.getEntity())); + if (response.getCode() != HttpStatus.SC_CREATED) + throw asError(request, response, toString(request.getEntity())); - return this.gson.fromJson(EntityUtils.toString(response.getEntity()), type); + return this.gson.fromJson(toString(response.getEntity()), type); } private T update(Class type, String path, T input) throws IOException @@ -174,10 +177,10 @@ private T update(Class type, String path, T input) throws IOException CloseableHttpResponse response = client.execute(request); - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) - throw asError(request, response, EntityUtils.toString(request.getEntity())); + if (response.getCode() != HttpStatus.SC_OK) + throw asError(request, response, toString(request.getEntity())); - return this.gson.fromJson(EntityUtils.toString(response.getEntity()), type); + return this.gson.fromJson(toString(response.getEntity()), type); } private T deleteEntity(Class type, String path) throws IOException @@ -185,17 +188,28 @@ private T deleteEntity(Class type, String path) throws IOException HttpDelete request = new HttpDelete(endpoint + path); CloseableHttpResponse response = client.execute(request); - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) + if (response.getCode() != HttpStatus.SC_OK) throw asError(request, response, null); - return this.gson.fromJson(EntityUtils.toString(response.getEntity()), type); + return this.gson.fromJson(toString(response.getEntity()), type); } - private IOException asError(HttpRequestBase request, CloseableHttpResponse response, String requestBody) + private IOException asError(HttpUriRequestBase request, CloseableHttpResponse response, String requestBody) throws IOException { - return new IOException(request.toString() + " --> " + response.getStatusLine().getStatusCode() + "\n\n" - + (requestBody != null ? requestBody + "\n\n" : "") - + EntityUtils.toString(response.getEntity())); + return new IOException(request.toString() + " --> " + response.getCode() + "\n\n" + + (requestBody != null ? requestBody + "\n\n" : "") + toString(response.getEntity())); + } + + private String toString(HttpEntity httpEntity) throws IOException + { + try + { + return EntityUtils.toString(httpEntity); + } + catch (ParseException e) + { + throw new IOException(e); + } } } diff --git a/name.abuchen.portfolio/src/name/abuchen/portfolio/util/WebAccess.java b/name.abuchen.portfolio/src/name/abuchen/portfolio/util/WebAccess.java index 4d283004ec..49fc61fecb 100644 --- a/name.abuchen.portfolio/src/name/abuchen/portfolio/util/WebAccess.java +++ b/name.abuchen.portfolio/src/name/abuchen/portfolio/util/WebAccess.java @@ -8,21 +8,23 @@ import java.util.Locale; import java.util.Objects; -import org.apache.http.Header; -import org.apache.http.HttpStatus; -import org.apache.http.client.config.CookieSpecs; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.EnglishReasonPhraseCatalog; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.message.BasicHeader; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.client5.http.cookie.StandardCookieSpec; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.impl.EnglishReasonPhraseCatalog; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.core5.http.message.BasicHeader; +import org.apache.hc.core5.net.URIBuilder; +import org.apache.hc.core5.util.Timeout; //@formatter:off /** @@ -94,7 +96,7 @@ public class WebAccess @FunctionalInterface private interface Request { - HttpRequestBase create(URI uri) throws IOException; + HttpUriRequestBase create(URI uri) throws IOException; } public static class WebAccessException extends IOException @@ -114,8 +116,10 @@ public int getHttpErrorCode() } } - public static final RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(20000) - .setConnectTimeout(2000).setConnectionRequestTimeout(20000).setCookieSpec(CookieSpecs.STANDARD) + public static final RequestConfig defaultRequestConfig = RequestConfig.custom() + .setConnectTimeout(Timeout.ofSeconds(2)) // + .setResponseTimeout(Timeout.ofSeconds(2)) // + .setCookieSpec(StandardCookieSpec.STRICT) // .build(); private final URIBuilder builder; @@ -173,8 +177,15 @@ public WebAccess addUserAgent(String userAgent) public String get() throws IOException { - CloseableHttpResponse response = executeWith(HttpGet::new); - return EntityUtils.toString(response.getEntity()); + try + { + CloseableHttpResponse response = executeWith(HttpGet::new); + return EntityUtils.toString(response.getEntity()); + } + catch (ParseException e) + { + throw new IOException(e); + } } public void post(String body) throws IOException @@ -201,12 +212,11 @@ private CloseableHttpResponse executeWith(Request function) throws IOException .build(); URI uri = builder.build(); - HttpRequestBase request = function.create(uri); + HttpUriRequestBase request = function.create(uri); response = client.execute(request); - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) - throw new WebAccessException(buildMessage(uri, response.getStatusLine().getStatusCode()), - response.getStatusLine().getStatusCode()); + if (response.getCode() != HttpStatus.SC_OK) + throw new WebAccessException(buildMessage(uri, response.getCode()), response.getCode()); return response; } diff --git a/portfolio-app/eclipse/launches.lc b/portfolio-app/eclipse/launches.lc index 066f0ccc46..daed939138 100644 --- a/portfolio-app/eclipse/launches.lc +++ b/portfolio-app/eclipse/launches.lc @@ -8,7 +8,7 @@ eclipse configuration PortfolioPerformance { feature org.eclipse.emf.ecore; feature org.eclipse.emf.common; feature org.eclipse.equinox.p2.core.feature; - feature org.eclipse.ecf.filetransfer.httpclient45.feature; + feature org.eclipse.ecf.filetransfer.httpclient5.feature; feature org.eclipse.ecf.core.ssl.feature; feature org.eclipse.ecf.filetransfer.ssl.feature; feature org.eclipse.ecf.core.feature; @@ -50,7 +50,7 @@ abstract junit-plugin configuration TestBase { feature org.eclipse.emf.ecore; feature org.eclipse.emf.common; feature org.eclipse.equinox.p2.core.feature; - feature org.eclipse.ecf.filetransfer.httpclient45.feature; + feature org.eclipse.ecf.filetransfer.httpclient5.feature; feature org.eclipse.ecf.core.ssl.feature; feature org.eclipse.ecf.filetransfer.ssl.feature; feature org.eclipse.ecf.core.feature; diff --git a/portfolio-app/pom.xml b/portfolio-app/pom.xml index f918bf2b62..a2ee9361aa 100644 --- a/portfolio-app/pom.xml +++ b/portfolio-app/pom.xml @@ -11,7 +11,7 @@ Portfolio Performance - 2.7.1 + 2.6.0 true true true @@ -130,52 +130,52 @@ eclipse-plugin - org.eclipse.pde.ds.lib.nl_de + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_it eclipse-plugin - org.eclipse.pde.ds.lib.nl_es + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_de eclipse-plugin - org.eclipse.pde.ds.lib.nl_nl + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_nl eclipse-plugin - org.eclipse.pde.ds.lib.nl_pt + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_pt eclipse-plugin - org.eclipse.pde.ds.lib.nl_fr + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_cs eclipse-plugin - org.eclipse.pde.ds.lib.nl_it + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_fr eclipse-plugin - org.eclipse.pde.ds.lib.nl_cs + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_es eclipse-plugin - org.eclipse.pde.ds.lib.nl_ru + org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_ru eclipse-plugin - org.eclipse.e4.ui.swt.gtk.nl_de + org.eclipse.e4.ui.swt.gtk.nl_it eclipse-plugin - org.eclipse.e4.ui.swt.gtk.nl_es + org.eclipse.e4.ui.swt.gtk.nl_de @@ -188,16 +188,6 @@ org.eclipse.e4.ui.swt.gtk.nl_pt - - eclipse-plugin - org.eclipse.e4.ui.swt.gtk.nl_fr - - - - eclipse-plugin - org.eclipse.e4.ui.swt.gtk.nl_it - - eclipse-plugin org.eclipse.e4.ui.swt.gtk.nl_cs @@ -205,87 +195,17 @@ eclipse-plugin - org.eclipse.e4.ui.swt.gtk.nl_ru - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_de - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_es - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_nl - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_pt - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_fr - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_it - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_cs - - - - eclipse-plugin - org.eclipse.pde.ds1_2.lib.nl_ru - - - - eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_de - - - - eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_es - - - - eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_nl - - - - eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_pt - - - - eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_fr - - - - eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_it + org.eclipse.e4.ui.swt.gtk.nl_fr eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_cs + org.eclipse.e4.ui.swt.gtk.nl_es eclipse-plugin - org.eclipse.equinox.launcher.cocoa.macosx.aarch64.nl_ru + org.eclipse.e4.ui.swt.gtk.nl_ru diff --git a/portfolio-product/name.abuchen.portfolio.distro.product b/portfolio-product/name.abuchen.portfolio.distro.product index 1f84146f27..619268a6a2 100644 --- a/portfolio-product/name.abuchen.portfolio.distro.product +++ b/portfolio-product/name.abuchen.portfolio.distro.product @@ -48,7 +48,7 @@ - + diff --git a/portfolio-product/name.abuchen.portfolio.product b/portfolio-product/name.abuchen.portfolio.product index 311225f8f5..50c42c7691 100644 --- a/portfolio-product/name.abuchen.portfolio.product +++ b/portfolio-product/name.abuchen.portfolio.product @@ -47,7 +47,7 @@ - + diff --git a/portfolio-target-definition/portfolio-target-definition.target b/portfolio-target-definition/portfolio-target-definition.target index d9c6621e78..1da941627a 100644 --- a/portfolio-target-definition/portfolio-target-definition.target +++ b/portfolio-target-definition/portfolio-target-definition.target @@ -3,57 +3,48 @@ - - - - - - - + + + + + + - - - - - - - - - - - - - - - + - - - + + + + + + + + + + - - - + + - - - - - - - - - + + + + + + + + +