Skip to content

Commit

Permalink
Merge pull request #78 from CodeWizArt/feature/update-dependencys
Browse files Browse the repository at this point in the history
Feature/update dependencys
  • Loading branch information
oboehm authored Feb 23, 2022
2 parents 0b7ee33 + db8dee7 commit 3178b1f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 28 deletions.
8 changes: 6 additions & 2 deletions lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@
<artifactId>commons-cli</artifactId>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5-fluent</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
16 changes: 6 additions & 10 deletions lib/src/main/java/gdv/xport/util/URLReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package gdv.xport.util;

import gdv.xport.config.Config;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.io.FileUtils;
import org.apache.hc.client5.http.fluent.Content;
import org.apache.hc.client5.http.fluent.Request;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -64,14 +64,10 @@ public String read() throws IOException {
return readFile();
}
try {
HttpClient httpClient = new HttpClient();
GetMethod get = new GetMethod(url.toString());
httpClient.executeMethod(get);
String content = get.getResponseBodyAsString();
get.releaseConnection();
return content;
} catch(IllegalStateException ise) {
LOG.info(ise + " - fallback to URLConnection");
Content content = Request.get(url).execute().returnContent();
return content.asString();
} catch(IOException ioe) {
LOG.info(ioe + " - fallback to URLConnection");
URLConnection connection = url.toURL().openConnection();
return read(connection);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/src/test/java/gdv/xport/demo/ImportExportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import gdv.xport.Datenpaket;
import gdv.xport.feld.Bezeichner;
import gdv.xport.satz.Satz;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
import patterntesting.runtime.annotation.IntegrationTest;
import patterntesting.runtime.annotation.SkipTestOn;
Expand All @@ -43,7 +43,7 @@
*/
public class ImportExportTest {

private static final Log log = LogFactory.getLog(ImportExportTest.class);
private static final Logger LOG = LogManager.getLogger(ImportExportTest.class);

/**
* Test-Methode fuer {@link ImportExport#importSatz100(File)}.
Expand All @@ -53,7 +53,7 @@ public class ImportExportTest {
@Test
public void testImportSatz100() throws IOException {
File tmpFile = File.createTempFile("datensatz", ".gdv");
log.info("file \"" + tmpFile + "\" created.");
LOG.info("file \"" + tmpFile + "\" created.");
checkImportSatz100(tmpFile);
}

Expand All @@ -67,7 +67,7 @@ private void checkImportSatz100(File tmpFile) throws IOException {
assertEquals("1", satz100.getFeld(Bezeichner.GESCHLECHT).getInhalt());
} finally {
tmpFile.delete();
log.info("file \"" + tmpFile + "\" deleted.");
LOG.info("file \"" + tmpFile + "\" deleted.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@

package gdv.xport.io;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.CharBuffer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
* Unit-Test fuer {@link RecyclingInputStreamReader}.
Expand All @@ -38,7 +38,7 @@
*/
public class RecyclingInputStreamReaderTest {

private static Log log = LogFactory.getLog(RecyclingInputStreamReaderTest.class);
private static final Logger LOG = LogManager.getLogger(RecyclingInputStreamReaderTest.class);
private static String HELLO = "hello world";
private final InputStream istream = new ByteArrayInputStream(HELLO.getBytes());

Expand All @@ -58,7 +58,7 @@ public void testRead() throws IOException {
assertEquals(HELLO, new String(cbuf));
} finally {
reader.close();
log.info(reader + " was closed.");
LOG.info(reader + " was closed.");
}
}

Expand Down
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,14 @@
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5-fluent</artifactId>
<version>5.1.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down Expand Up @@ -519,7 +524,7 @@
<dependency>
<groupId>net.sf.oval</groupId>
<artifactId>oval</artifactId>
<version>1.90</version>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>de.jfachwert</groupId>
Expand Down

0 comments on commit 3178b1f

Please sign in to comment.