Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2013-05-27 11:43:42 +0400
committerDavid Hook <dgh@cryptoworkshop.com>2013-05-27 11:43:42 +0400
commitc33babfa726d9d348521f534ba07d731238da618 (patch)
treec73e78066f14c5cffccfd8ae98286f1aea4d131d
parent739ad9b96f8df54351e4020ddc20036921b9a7f1 (diff)
added null check
-rw-r--r--src/main/java/org/bouncycastle/asn1/StreamUtil.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/bouncycastle/asn1/StreamUtil.java b/src/main/java/org/bouncycastle/asn1/StreamUtil.java
index 0a3c4aa4..b6cb0706 100644
--- a/src/main/java/org/bouncycastle/asn1/StreamUtil.java
+++ b/src/main/java/org/bouncycastle/asn1/StreamUtil.java
@@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.channels.FileChannel;
class StreamUtil
{
@@ -33,7 +34,8 @@ class StreamUtil
{
try
{
- long size = ((FileInputStream)in).getChannel().size();
+ FileChannel channel = ((FileInputStream)in).getChannel();
+ long size = (channel != null) ? channel.size() : Integer.MAX_VALUE;
if (size < Integer.MAX_VALUE)
{