From fbeac15cf9dd657aea83e04a00afe1015ada3010 Mon Sep 17 00:00:00 2001 From: Gilles Dubois Date: Fri, 10 Nov 2017 11:35:25 +0100 Subject: [PATCH] Add check when no proxy adress is set but http proxy option is activated --- .../java/org/ocs/android/actions/OCSProtocol.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/ocs/android/actions/OCSProtocol.java b/app/src/main/java/org/ocs/android/actions/OCSProtocol.java index b37d04e..44415af 100644 --- a/app/src/main/java/org/ocs/android/actions/OCSProtocol.java +++ b/app/src/main/java/org/ocs/android/actions/OCSProtocol.java @@ -22,6 +22,7 @@ import android.content.Context; import android.os.AsyncTask; +import android.text.TextUtils; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; @@ -191,9 +192,13 @@ public String sendmethod(File pFile, String server, boolean gziped) throws OCSPr DefaultHttpClient httpClient = getNewHttpClient(OCSSettings.getInstance().isSSLStrict()); if (ocssettings.isProxy()) { - ocslog.debug("Use proxy : " + ocssettings.getProxyAdr()); - HttpHost proxy = new HttpHost(ocssettings.getProxyAdr(), ocssettings.getProxyPort()); - httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if(!TextUtils.isEmpty(ocssettings.getProxyAdr())){ + ocslog.debug("Use proxy : " + ocssettings.getProxyAdr()); + HttpHost proxy = new HttpHost(ocssettings.getProxyAdr(), ocssettings.getProxyPort()); + httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + }else{ + ocslog.debug("Invalid proxy settings"); + } } if (ocssettings.isAuth()) { ocslog.debug("Use AUTH : " + ocssettings.getLogin() + "/*****");