Merge "NativeCrypto: catch null input streams in cert factory"
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509CertificateFactory.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509CertificateFactory.java
index c56f0b6..09e2507 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509CertificateFactory.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLX509CertificateFactory.java
@@ -61,6 +61,10 @@
      */
     private static abstract class Parser<T> {
         public T generateItem(InputStream inStream) throws ParsingException {
+            if (inStream == null) {
+                throw new ParsingException("inStream == null");
+            }
+
             final boolean markable = inStream.markSupported();
             if (markable) {
                 inStream.mark(PKCS7_MARKER.length);