- Upgrade to upstream version 3.8.1

- Now require Java 1.8
This commit is contained in:
Ding-Yi Chen 2015-11-23 09:47:38 +10:00
commit 476eab306e
4 changed files with 13 additions and 99 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@
/client-3.6.0.zip
/client-3.7.3.zip
/client-3.7.4.zip
/client-3.8.1.zip

View file

@ -1,88 +0,0 @@
diff --git pom.xml pom.xml
index e605ef1..773e5ca 100644
--- pom.xml
+++ pom.xml
@@ -175,7 +175,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>4.3.3</version>
+ <version>4.2.5</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
diff --git zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java
index 9a59c61..7d1fb4b 100644
--- zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java
+++ zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java
@@ -9,6 +9,7 @@ import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -29,6 +30,7 @@ import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.jboss.resteasy.client.ClientExecutor;
@@ -137,28 +139,34 @@ public class ZanataProxyFactory implements ITranslationResourcesFactory {
sslContext.init(null, trustAllCerts, new SecureRandom());
- SSLSocketFactory factory = new SSLSocketFactory(sslContext) {
- @Override
- public Socket connectSocket(
- int connectTimeout,
- Socket socket,
- HttpHost host,
- InetSocketAddress remoteAddress,
- InetSocketAddress localAddress,
- HttpContext context) throws IOException,
- ConnectTimeoutException {
- if (socket instanceof SSLSocket) {
- try {
- PropertyUtils.setProperty(socket, "host",
- host.getHostName());
- } catch (Exception ex) {
- log.warn("Unable to enable SNI; you may have trouble connecting to some secure hosts. Please ensure that you are running Java 1.7 or later.");
+ SSLSocketFactory factory;
+ if (sslCertDisabled) {
+ // avoid triggering the problem described here:
+ // https://stackoverflow.com/questions/7615645/ssl-handshake-alert-unrecognized-name-error-since-upgrade-to-java-1-7-0
+ factory = new SSLSocketFactory(sslContext);
+ } else {
+ factory = new SSLSocketFactory(sslContext) {
+ // NB: This is only for httpcomponents-client 4.2, not 4.3
+ @Override
+ public Socket connectSocket(Socket socket,
+ InetSocketAddress remoteAddress,
+ InetSocketAddress localAddress,
+ HttpParams params)
+ throws IOException, UnknownHostException,
+ ConnectTimeoutException {
+ if (socket instanceof SSLSocket) {
+ try {
+ PropertyUtils.setProperty(socket, "host",
+ remoteAddress.getHostName());
+ } catch (Exception ex) {
+ log.warn("Unable to enable SNI; you may have trouble connecting to some secure hosts. Please ensure that you are running Java 1.7 or later.");
+ }
}
+ return super.connectSocket(socket, remoteAddress,
+ localAddress, params);
}
- return super.connectSocket(connectTimeout, socket, host, remoteAddress,
- localAddress, context);
- }
- };
+ };
+ }
HttpClient client = new DefaultHttpClient();

View file

@ -1 +1 @@
2da5014dbdc4fbeab137fcb39ed7f60c client-3.7.4.zip
82abe84704d6168d49431ec96316c819 client-3.8.1.zip

View file

@ -3,12 +3,12 @@
%global submodule_rest zanata-rest-%{shortname}
%global submodule_commands zanata-%{shortname}-commands
%global submodule_cli zanata-cli
%global java_version 1.7
%global java_ver_min 1.7
%global jersey_min_version 1.17
%global zanata_parent_version 24
%global zanata_api_version 3.7.3
%global zanata_common_version 3.7.2
%global zanata_parent_version 25
%global zanata_api_version 3.8.3
%global zanata_common_version 3.8.1
%if 0%{?fedora} >= 23
%global jersey_pkg_name jersey1
%else
@ -17,7 +17,7 @@
%global jersey_version %(rpm -q --qf "%%{version}" %{jersey_pkg_name})
Name: zanata-%{shortname}
Version: 3.7.4
Version: 3.8.1
Release: 1%{?dist}
Summary: Zanata client module
@ -29,7 +29,7 @@ Source0: https://github.com/zanata/%{name}/archive/%{shortname}-%{version
BuildArch: noarch
BuildRequires: maven-local
BuildRequires: java-devel >= 1:%{java_version}
BuildRequires: java-devel >= 1:%{java_ver_min}
BuildRequires: args4j >= 2.0.25
BuildRequires: exec-maven-plugin
BuildRequires: %{jersey_pkg_name} >= %{jersey_min_version}
@ -56,7 +56,7 @@ BuildRequires: zanata-parent >= %{zanata_parent_version}
BuildRequires: zanata-api >= %{zanata_api_version}
BuildRequires: zanata-common >= %{zanata_common_version}
Requires: java-headless >= 1:%{java_version}
Requires: java-headless >= 1:%{java_ver_min}
Requires: args4j >= 2.0.25
Requires: %{jersey_pkg_name} >= %{jersey_min_version}
Requires: %{jersey_pkg_name}-contribs >= %{jersey_min_version}
@ -100,7 +100,7 @@ This includes sub modules:
%pom_xpath_set "pom:properties/pom:jersey.version" %{jersey_version}
# Ensure it compile with supported java version
%pom_xpath_inject "pom:plugins" "<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>%{java_version}</source><target>%{java_version}</target><fork>true</fork><verbose>true</verbose></configuration></plugin>"
%pom_xpath_inject "pom:plugins" "<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>%{java_ver_min}</source><target>%{java_ver_min}</target><fork>true</fork><verbose>true</verbose></configuration></plugin>"
# simpleframework in fedora is too old
rm %{submodule_cli}/src/test/java/org/zanata/client/HTTPMockContainer.java
@ -186,8 +186,9 @@ chmod 755 %{buildroot}%{_bindir}/zanata-cli
%files javadoc -f .mfiles-javadoc
%changelog
* Mon Aug 10 2015 Ding-Yi Chen <dchen@redhat.com> 3.7.4-1
- Upgrade to upstream version 3.7.4
* Sun Nov 22 2015 Ding-Yi Chen <dchen@redhat.com> 3.8.1-1
- Upgrade to upstream version 3.8.1
- Now require Java 1.8
* Tue Jul 14 2015 Ding-Yi Chen <dchen@redhat.com> 3.7.3-1
- Upgrade to upstream version 3.7.3