Skip to content

Commit b9b6513

Browse files
committed
Update deps
1 parent a052ca8 commit b9b6513

File tree

4 files changed

+147
-106
lines changed

4 files changed

+147
-106
lines changed

MassBank-Project/MassBank-lib/pom.xml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212
<name>MassBank lib</name>
1313

1414
<dependencies>
15+
<dependency>
16+
<groupId>org.apache.logging.log4j</groupId>
17+
<artifactId>log4j-api</artifactId>
18+
</dependency>
1519
<dependency>
1620
<groupId>org.apache.logging.log4j</groupId>
1721
<artifactId>log4j-core</artifactId>
22+
<scope>runtime</scope>
1823
</dependency>
1924
<dependency>
2025
<groupId>org.apache.logging.log4j</groupId>
@@ -30,10 +35,6 @@
3035
<groupId>commons-io</groupId>
3136
<artifactId>commons-io</artifactId>
3237
</dependency>
33-
<dependency>
34-
<groupId>commons-fileupload</groupId>
35-
<artifactId>commons-fileupload</artifactId>
36-
</dependency>
3738
<dependency>
3839
<groupId>org.apache.commons</groupId>
3940
<artifactId>commons-lang3</artifactId>
@@ -42,14 +43,14 @@
4243
<groupId>org.apache.commons</groupId>
4344
<artifactId>commons-configuration2</artifactId>
4445
</dependency>
45-
<dependency>
46-
<groupId>commons-cli</groupId>
47-
<artifactId>commons-cli</artifactId>
48-
</dependency>
4946
<dependency>
5047
<groupId>commons-beanutils</groupId>
5148
<artifactId>commons-beanutils</artifactId>
5249
</dependency>
50+
<dependency>
51+
<groupId>commons-cli</groupId>
52+
<artifactId>commons-cli</artifactId>
53+
</dependency>
5354
<dependency>
5455
<groupId>org.openscience.cdk</groupId>
5556
<artifactId>cdk-data</artifactId>
@@ -67,8 +68,16 @@
6768
<artifactId>cdk-formula</artifactId>
6869
</dependency>
6970
<dependency>
70-
<groupId>org.mariadb.jdbc</groupId>
71-
<artifactId>mariadb-java-client</artifactId>
71+
<groupId>org.openscience.cdk</groupId>
72+
<artifactId>cdk-interfaces</artifactId>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.openscience.cdk</groupId>
76+
<artifactId>cdk-smiles</artifactId>
77+
</dependency>
78+
<dependency>
79+
<groupId>org.openscience.cdk</groupId>
80+
<artifactId>cdk-silent</artifactId>
7281
</dependency>
7382
<dependency>
7483
<groupId>com.github.petitparser</groupId>
@@ -82,28 +91,35 @@
8291
<groupId>de.undercouch</groupId>
8392
<artifactId>citeproc-java</artifactId>
8493
</dependency>
94+
<dependency>
95+
<groupId>org.jbibtex</groupId>
96+
<artifactId>jbibtex</artifactId>
97+
</dependency>
8598
<dependency>
8699
<groupId>com.google.code.gson</groupId>
87100
<artifactId>gson</artifactId>
88101
</dependency>
89102
<dependency>
90-
<groupId>org.apache.httpcomponents</groupId>
91-
<artifactId>httpclient</artifactId>
103+
<groupId>org.apache.httpcomponents.client5</groupId>
104+
<artifactId>httpclient5</artifactId>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.apache.httpcomponents.core5</groupId>
108+
<artifactId>httpcore5</artifactId>
92109
</dependency>
93110
<dependency>
94111
<groupId>io.github.dan2097</groupId>
95-
<artifactId>jna-inchi-all</artifactId>
112+
<artifactId>jna-inchi-api</artifactId>
96113
</dependency>
97-
<!-- <dependency>-->
98-
<!-- <groupId>net.sourceforge.owlapi</groupId>-->
99-
<!-- <artifactId>owlapi-distribution</artifactId>-->
100-
<!-- <version>5.5.0</version>-->
101-
<!-- </dependency>-->
102114
<dependency>
103115
<groupId>org.junit.jupiter</groupId>
104-
<artifactId>junit-jupiter-engine</artifactId>
116+
<artifactId>junit-jupiter-api</artifactId>
105117
<scope>test</scope>
106118
</dependency>
119+
<dependency>
120+
<groupId>org.mariadb.jdbc</groupId>
121+
<artifactId>mariadb-java-client</artifactId>
122+
</dependency>
107123
<dependency>
108124
<groupId>com.zaxxer</groupId>
109125
<artifactId>HikariCP</artifactId>

MassBank-Project/MassBank-lib/src/main/java/massbank/PubchemResolver.java

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,14 @@
3434
import java.util.concurrent.ConcurrentHashMap;
3535
import java.util.stream.Collectors;
3636

37-
import org.apache.http.HttpResponse;
38-
import org.apache.http.client.ClientProtocolException;
39-
import org.apache.http.client.ResponseHandler;
40-
import org.apache.http.client.config.CookieSpecs;
41-
import org.apache.http.client.config.RequestConfig;
42-
import org.apache.http.client.methods.HttpGet;
43-
import org.apache.http.impl.client.CloseableHttpClient;
44-
import org.apache.http.impl.client.DefaultServiceUnavailableRetryStrategy;
45-
import org.apache.http.impl.client.HttpClients;
46-
import org.apache.http.util.EntityUtils;
37+
import org.apache.hc.client5.http.classic.methods.HttpGet;
38+
import org.apache.hc.client5.http.config.RequestConfig;
39+
import org.apache.hc.client5.http.cookie.StandardCookieSpec;
40+
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
41+
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
42+
import org.apache.hc.client5.http.impl.classic.HttpClients;
43+
import org.apache.hc.core5.http.io.entity.EntityUtils;
44+
import org.apache.hc.core5.util.Timeout;
4745
import org.apache.logging.log4j.LogManager;
4846
import org.apache.logging.log4j.Logger;
4947

@@ -148,53 +146,46 @@ public boolean isCid(Integer cid) {
148146
}
149147

150148
public String getJSONFromUrl(String url) {
151-
// Making HTTP request
152-
CloseableHttpClient httpclient = HttpClients.custom()
153-
.setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD)
154-
.setConnectTimeout(5 * 1000).setSocketTimeout(60 * 1000).build())
155-
.setServiceUnavailableRetryStrategy(new DefaultServiceUnavailableRetryStrategy(5, 5000)).build();
156-
try {
157-
HttpGet httpget = new HttpGet(url);
158-
// Create a custom response handler
159-
160-
// a response handler that throws an exception if status is not 200
161-
ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
162-
@Override
163-
public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
164-
int status = response.getStatusLine().getStatusCode();
165-
166-
if (status == 404) {
167-
logger.warn("PUGREST.NotFound");
149+
try (CloseableHttpClient httpClient = HttpClients.custom()
150+
.setDefaultRequestConfig(RequestConfig.custom()
151+
.setConnectTimeout(Timeout.ofSeconds(5))
152+
.setResponseTimeout(Timeout.ofSeconds(60))
153+
.setCookieSpec(StandardCookieSpec.STRICT)
154+
.build())
155+
.build()) {
156+
HttpGet httpGet = new HttpGet(url);
157+
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
158+
int status = response.getCode();
159+
if (status == 404) {
160+
logger.warn("PUGREST.NotFound");
161+
try {
168162
return EntityUtils.toString(response.getEntity());
163+
} catch (org.apache.hc.core5.http.ParseException e) {
164+
logger.error("Error parsing HTTP response entity", e);
165+
return "";
169166
}
170-
171-
if (status != 200) {
172-
logger.error("HTTP respomse:" + status);
167+
}
168+
if (status != 200) {
169+
logger.error("HTTP response: " + status);
170+
try {
173171
logger.error(EntityUtils.toString(response.getEntity()));
174-
throw new ClientProtocolException("Pubchem no success.");
172+
} catch (org.apache.hc.core5.http.ParseException e) {
173+
logger.error("Error parsing HTTP response entity", e);
174+
return "";
175175
}
176+
throw new IOException("Pubchem no success.");
177+
}
178+
try {
176179
return EntityUtils.toString(response.getEntity());
180+
} catch (org.apache.hc.core5.http.ParseException e) {
181+
logger.error("Error parsing HTTP response entity", e);
182+
return "";
177183
}
178-
179-
};
180-
181-
String responseBody = httpclient.execute(httpget, responseHandler);
182-
return responseBody;
183-
} catch (ClientProtocolException e) {
184-
// TODO Auto-generated catch block
185-
e.printStackTrace();
186-
} catch (IOException e) {
187-
// TODO Auto-generated catch block
188-
e.printStackTrace();
189-
} finally {
190-
try {
191-
httpclient.close();
192-
} catch (IOException e) {
193-
// TODO Auto-generated catch block
194-
e.printStackTrace();
195184
}
185+
} catch (IOException e) {
186+
logger.error("Error fetching JSON from URL: " + url, e);
187+
return "";
196188
}
197-
return "";
198189
}
199190

200191
// Respons classes for json structure

MassBank-Project/MassBank-web/pom.xml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515
<groupId>de.ipb-halle.msbi</groupId>
1616
<artifactId>MassBank-lib</artifactId>
1717
</dependency>
18+
<dependency>
19+
<groupId>org.apache.logging.log4j</groupId>
20+
<artifactId>log4j-api</artifactId>
21+
</dependency>
1822
<dependency>
1923
<groupId>jakarta.platform</groupId>
2024
<artifactId>jakarta.jakartaee-web-api</artifactId>
2125
<scope>provided</scope>
2226
</dependency>
2327
<dependency>
24-
<groupId>org.glassfish.web</groupId>
25-
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
26-
<version>2.0.0</version>
27-
<scope>provided</scope>
28+
<groupId>com.google.code.gson</groupId>
29+
<artifactId>gson</artifactId>
2830
</dependency>
2931
<dependency>
3032
<groupId>org.jfree</groupId>
@@ -35,9 +37,16 @@
3537
<artifactId>jfreesvg</artifactId>
3638
</dependency>
3739
<dependency>
38-
<groupId>jakarta.servlet.jsp.jstl</groupId>
39-
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
40-
<scope>provided</scope>
40+
<groupId>org.openscience.cdk</groupId>
41+
<artifactId>cdk-interfaces</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.openscience.cdk</groupId>
45+
<artifactId>cdk-depict</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.apache.commons</groupId>
49+
<artifactId>commons-configuration2</artifactId>
4150
</dependency>
4251
<dependency>
4352
<groupId>com.github.dfabulich</groupId>

0 commit comments

Comments
 (0)