From 3b7d0b239c7dd366a6980b0289278d22bf0dfc87 Mon Sep 17 00:00:00 2001 From: hollingsworthd Date: Wed, 2 Dec 2015 00:08:18 -0500 Subject: [PATCH] Handle EOF on SSL --- src/com/machinepublishers/jbrowserdriver/Util.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/machinepublishers/jbrowserdriver/Util.java b/src/com/machinepublishers/jbrowserdriver/Util.java index e7932a92..104f7251 100644 --- a/src/com/machinepublishers/jbrowserdriver/Util.java +++ b/src/com/machinepublishers/jbrowserdriver/Util.java @@ -38,6 +38,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.net.ssl.SSLProtocolException; + import com.machinepublishers.browser.Browser; class Util { @@ -176,7 +178,7 @@ static String toString(InputStream inputStream, String charset) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, charset), chars.length); try { for (int len; -1 != (len = reader.read(chars, 0, chars.length)); builder.append(chars, 0, len)); - } catch (EOFException e) {} + } catch (EOFException | SSLProtocolException e) {} return builder.toString(); } catch (Throwable t) { return null; @@ -191,7 +193,7 @@ static byte[] toBytes(InputStream inputStream) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(bytes.length); try { for (int len = 0; -1 != (len = inputStream.read(bytes, 0, bytes.length)); out.write(bytes, 0, len)); - } catch (EOFException e) {} + } catch (EOFException | SSLProtocolException e) {} return out.toByteArray(); } finally { close(inputStream);