Skip to content

Commit

Permalink
Handle EOF on SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
hollingsworthd committed Dec 2, 2015
1 parent 2e6dcfc commit 3b7d0b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/com/machinepublishers/jbrowserdriver/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 3b7d0b2

Please sign in to comment.