Revision: 6246 http://sourceforge.net/p/jump-pilot/code/6246 Author: michaudm Date: 2020-04-12 22:59:57 +0000 (Sun, 12 Apr 2020) Log Message: ----------- Fix #492 GetFeatureInfo without certificate + encoding
Modified Paths: -------------- core/trunk/ChangeLog core/trunk/src/com/vividsolutions/wms/AbstractWMSRequest.java core/trunk/src/org/openjump/util/URLConnectionProvider.java Modified: core/trunk/ChangeLog =================================================================== --- core/trunk/ChangeLog 2020-04-12 14:53:52 UTC (rev 6245) +++ core/trunk/ChangeLog 2020-04-12 22:59:57 UTC (rev 6246) @@ -4,6 +4,9 @@ # 3. be concise but convey the change in a way that ordinary users understand #<-------------------------------- 80 chars ----------------------------------># +2020-04-13 mmichaud <m.michael.mich...@orange.fr> + * Fix #492 GetFeatureInfo without certificate + encoding + 2020-04-12 mmichaud <m.michael.mich...@orange.fr> * Now tolerate an empty cpg file along with shapefile Modified: core/trunk/src/com/vividsolutions/wms/AbstractWMSRequest.java =================================================================== --- core/trunk/src/com/vividsolutions/wms/AbstractWMSRequest.java 2020-04-12 14:53:52 UTC (rev 6245) +++ core/trunk/src/com/vividsolutions/wms/AbstractWMSRequest.java 2020-04-12 22:59:57 UTC (rev 6246) @@ -11,6 +11,7 @@ import javax.imageio.ImageIO; +import org.apache.commons.codec.Charsets; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.BoundedInputStream; import org.openjump.util.URLConnectionProvider; @@ -159,13 +160,14 @@ protected String readConnection(HttpURLConnection con, long limit) throws IOException { boolean httpOk = con.getResponseCode() == HttpURLConnection.HTTP_OK; // get correct stream - InputStream in = httpOk ? con.getInputStream() : con.getErrorStream(); + InputStream in = httpOk ? con..getInputStream() : con.getErrorStream(); String result = ""; if (in!=null) { // limit max chars BoundedInputStream bin = new BoundedInputStream(in, limit > 0 ? limit : -1); - result = IOUtils.toString(bin); + result = new String(bin.readAllBytes(), Charsets.UTF_8); + //result = IOUtils.toString(bin); FileUtil.close(bin); } Modified: core/trunk/src/org/openjump/util/URLConnectionProvider.java =================================================================== --- core/trunk/src/org/openjump/util/URLConnectionProvider.java 2020-04-12 14:53:52 UTC (rev 6245) +++ core/trunk/src/org/openjump/util/URLConnectionProvider.java 2020-04-12 22:59:57 UTC (rev 6246) @@ -13,10 +13,7 @@ import java.util.HashSet; import java.util.Set; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; +import javax.net.ssl.*; import javax.swing.JOptionPane; import com.vividsolutions.jump.I18N; @@ -130,7 +127,7 @@ setTrustOption(false, url); connection.connect(); // try to connect return connection; // can connect - } catch(GeneralSecurityException e) { + } catch(GeneralSecurityException|SSLHandshakeException e) { String baseURL = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getPath()).toString(); if (authorizedURL.contains(baseURL) || acceptConnection(url)) { try { _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel