Skip to content

Commit

Permalink
Revert: Add TLS 1.2 support for java 6 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
bstewart00 authored Nov 9, 2020
1 parent f2f48bf commit c963cad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
16 changes: 1 addition & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.github.wovnio</groupId>
<artifactId>wovnjava</artifactId>
<name>wovnjava</name>
<version>1.0.3-jdk6</version>
<version>1.0.4-jdk6</version>
<url>https://github.com/WOVNio/wovnjava</url>

<licenses>
Expand Down Expand Up @@ -74,20 +74,6 @@
<version>3.4</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.66</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.bouncycastle/bctls-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctls-jdk15on</artifactId>
<version>1.66</version>
</dependency>
</dependencies>

<build>
Expand Down
34 changes: 10 additions & 24 deletions src/main/java/com/github/wovnio/wovnjava/Api.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
package com.github.wovnio.wovnjava;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.LinkedHashMap;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.LinkedHashMap;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import javax.net.ssl.HttpsURLConnection;
import javax.xml.bind.DatatypeConverter;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jsse.provider.SSLSocketFactoryImpl;

import net.arnx.jsonic.JSON;

class Api {
static {
if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
Security.addProvider(new BouncyCastleProvider());
}
}

private final int READ_BUFFER_SIZE = 8196;
private final Settings settings;
private final Headers headers;
Expand All @@ -48,13 +37,11 @@ class Api {

String translate(String lang, String html) throws ApiException {
this.responseHeaders.setApiStatus("Requested");

HttpsURLConnection con = null;
HttpURLConnection con = null;
try {
URL url = getApiUrl(lang, html);
con = (HttpsURLConnection) url.openConnection();
con = (HttpURLConnection) url.openConnection();
con.setConnectTimeout(settings.connectTimeout);
con.setSSLSocketFactory(new SSLSocketFactoryImpl());
con.setReadTimeout(settings.readTimeout);
return translate(lang, html, con);
} catch (UnsupportedEncodingException e) {
Expand All @@ -67,8 +54,7 @@ String translate(String lang, String html) throws ApiException {
throw new ApiException("NoSuchAlgorithmException", e.getMessage());
} catch(Exception e) {
throw new ApiException("Exception", e.getMessage());
}
finally {
} finally {
if (con != null) {
con.disconnect();
}
Expand Down

0 comments on commit c963cad

Please sign in to comment.