@@ -24,15 +24,9 @@ of this software and associated documentation files (the "Software"), to deal
2424
2525package 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 ;
3227import java .io .File ;
3328import java .io .FileInputStream ;
3429import java .io .IOException ;
35- import java .io .StringWriter ;
3630import java .net .InetAddress ;
3731import java .net .UnknownHostException ;
3832import java .util .Arrays ;
@@ -47,13 +41,16 @@ of this software and associated documentation files (the "Software"), to deal
4741import java .util .concurrent .Future ;
4842import java .util .concurrent .TimeUnit ;
4943import 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 ;
5050import lombok .extern .slf4j .Slf4j ;
51- import org .apache .commons .io .IOUtils ;
5251import org .apache .commons .net .ftp .FTP ;
5352import org .apache .commons .net .ftp .FTPClient ;
5453import 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
6461public 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 }
0 commit comments