Page 1 of 1

<img src="https..."> gives WARNING:: IO problem for ...

PostPosted: Fri Dec 14, 2018 3:28 am
by pslingerland
When importing XHTML containing an image tag referring an external https image resource an error "org.docx4j.org.xhtmlrenderer.exception WARNING:: IO problem for https://www.... When referring to an http image resource no problem occurs. I suspect sll security settings being more strict in recent java 1.8 updates (1.8.0_151-b12 is currently in use). I also get an error when loading the https resource using

URLConnection connection = url.openConnection();
InputStream is = connection.getInputStream();

but when setting the

HttpsURLConnection.setDefaultHostnameVerifier(
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

parameter, the resource is loaded using.

The xhtml import, however, does not react to this setting and still keeps reporting the IO problem.

Is there a solution to this problem?

Re: <img src="https..."> gives WARNING:: IO problem for ...

PostPosted: Sat Dec 15, 2018 10:50 am
by jason
Works for me out of the box using

Code: Select all
$ /usr/lib/jvm/java-8-openjdk/bin/java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (build 1.8.0_192-b26)
OpenJDK 64-Bit Server VM (build 25.192-b26, mixed mode)


with image at https://www.docx4java.org/logo-75.png

Here is how its typically loaded (by XHTMLImageHandlerDefault):
https://github.com/plutext/flyingsaucer ... .java#L123

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
    protected InputStream resolveAndOpenStream(String uri) {
        java.io.InputStream is = null;
        uri = resolveURI(uri);
        try {
            is = new URL(uri).openStream();
        } catch (java.net.MalformedURLException e) {
            XRLog.exception("bad URL given: " + uri, e);
        } catch (java.io.FileNotFoundException e) {
            XRLog.exception("item at URI " + uri + " not found");
        } catch (java.io.IOException e) {
            XRLog.exception("IO problem for " + uri, e);
        }
        return is;
    }
 
Parsed in 0.016 seconds, using GeSHi 1.0.8.4


Is XRLog.exception("IO problem for " + uri, e); printing out the IOException?