Skip to content

Commit 895fd14

Browse files
committed
Bump unirest version
1 parent dd6bc45 commit 895fd14

4 files changed

Lines changed: 13 additions & 25 deletions

File tree

build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ java {
3030

3131

3232
dependencies {
33-
/* ChronosJob.ChronosJob(org.json.JSONObject) is exposed to overwriting classes */
34-
api group: 'org.json', name: 'json', version: '20220320' /* version '20160212' is used by com.mashape.unirest:unirest-java:1.4.9 */
35-
36-
implementation group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
33+
api group: 'com.konghq', name: 'unirest-java', version: '3.13.10'
3734
implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre'
3835

3936
implementation group: 'commons-validator', name: 'commons-validator', version: '1.7'

src/main/java/ch/unibas/dmi/dbis/chronos/agent/AbstractChronosAgent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ of this software and associated documentation files (the "Software"), to deal
4545
import java.util.TimerTask;
4646
import java.util.concurrent.ConcurrentHashMap;
4747
import java.util.concurrent.TimeUnit;
48+
import kong.unirest.json.JSONObject;
4849
import lombok.extern.slf4j.Slf4j;
4950
import net.lingala.zip4j.ZipFile;
5051
import net.lingala.zip4j.model.ZipParameters;
5152
import net.lingala.zip4j.model.enums.CompressionLevel;
5253
import net.lingala.zip4j.model.enums.CompressionMethod;
5354
import org.apache.commons.io.FileUtils;
54-
import org.json.JSONObject;
5555

5656

5757
/**

src/main/java/ch/unibas/dmi/dbis/chronos/agent/ChronosHttpClient.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@ of this software and associated documentation files (the "Software"), to deal
2424

2525
package ch.unibas.dmi.dbis.chronos.agent;
2626

27-
28-
import com.mashape.unirest.http.HttpResponse;
29-
import com.mashape.unirest.http.JsonNode;
30-
import com.mashape.unirest.http.Unirest;
31-
import com.mashape.unirest.http.exceptions.UnirestException;
3227
import java.io.File;
3328
import java.io.FileInputStream;
3429
import java.io.IOException;
35-
import java.io.StringWriter;
3630
import java.net.InetAddress;
3731
import java.net.UnknownHostException;
3832
import java.util.Arrays;
@@ -47,13 +41,16 @@ of this software and associated documentation files (the "Software"), to deal
4741
import java.util.concurrent.Future;
4842
import java.util.concurrent.TimeUnit;
4943
import java.util.concurrent.atomic.AtomicInteger;
44+
import kong.unirest.ContentType;
45+
import kong.unirest.HttpResponse;
46+
import kong.unirest.JsonNode;
47+
import kong.unirest.Unirest;
48+
import kong.unirest.UnirestException;
49+
import kong.unirest.json.JSONObject;
5050
import lombok.extern.slf4j.Slf4j;
51-
import org.apache.commons.io.IOUtils;
5251
import org.apache.commons.net.ftp.FTP;
5352
import org.apache.commons.net.ftp.FTPClient;
5453
import org.apache.commons.validator.routines.InetAddressValidator;
55-
import org.apache.http.entity.ContentType;
56-
import org.json.JSONObject;
5754

5855

5956
/**
@@ -64,13 +61,9 @@ of this software and associated documentation files (the "Software"), to deal
6461
public class ChronosHttpClient {
6562

6663
static {
67-
Runtime.getRuntime().addShutdownHook( new Thread( () -> {
68-
try {
69-
Unirest.shutdown();
70-
} catch ( IOException ex ) {
71-
log.warn( "Exception while shutting down Unirest.", ex );
72-
}
73-
}, ChronosHttpClient.class.getSimpleName() + "-ShutdownHook" ) );
64+
Runtime.getRuntime().addShutdownHook(
65+
new Thread( Unirest::shutDown, ChronosHttpClient.class.getSimpleName() + "-ShutdownHook" )
66+
);
7467
}
7568

7669

@@ -562,9 +555,7 @@ private void httpUpload( final ChronosJob job, final File file, final Properties
562555
.field( "result", fis, ContentType.APPLICATION_OCTET_STREAM, "results.zip" )
563556
.asJson();
564557
// Get result
565-
StringWriter writer = new StringWriter();
566-
IOUtils.copy( jsonResponse.getRawBody(), writer );
567-
String resultString = writer.toString();
558+
String resultString = jsonResponse.getBody().toString();
568559
if ( jsonResponse.getStatus() != ChronosRestApi.STATUS_CODE__SUCCESS ) {
569560
log.warn( resultString );
570561
}

src/main/java/ch/unibas/dmi/dbis/chronos/agent/ChronosJob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ of this software and associated documentation files (the "Software"), to deal
3939
import javax.xml.xpath.XPathExpression;
4040
import javax.xml.xpath.XPathExpressionException;
4141
import javax.xml.xpath.XPathFactory;
42-
import org.json.JSONObject;
42+
import kong.unirest.json.JSONObject;
4343
import org.w3c.dom.Document;
4444
import org.w3c.dom.Node;
4545
import org.w3c.dom.NodeList;

0 commit comments

Comments
 (0)