Skip to content

Commit 281056e

Browse files
committed
handle null crl comparison (CRL.new == ...)
1 parent 0566063 commit 281056e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/jruby/ext/openssl/X509CRL.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ public X509CRL(Ruby runtime, RubyClass type) {
128128
super(runtime, type);
129129
}
130130

131-
private X509CRL(Ruby runtime) {
132-
super(runtime, _CRL(runtime));
131+
java.security.cert.X509CRL getCRL() {
132+
return getCRL(false);
133133
}
134134

135-
java.security.cert.X509CRL getCRL() {
135+
private java.security.cert.X509CRL getCRL(boolean allowNull) {
136136
if ( crl != null ) return crl;
137137
try {
138138
if ( crlHolder == null ) {
139+
if ( allowNull ) return null;
139140
throw new IllegalStateException("no crl holder");
140141
}
141142
final byte[] encoded = crlHolder.getEncoded();
@@ -168,7 +169,8 @@ private X509CRLHolder getCRLHolder(boolean allowNull) {
168169

169170
final byte[] getEncoded() throws IOException, CRLException {
170171
if ( crlHolder != null ) return crlHolder.getEncoded();
171-
return getCRL().getEncoded();
172+
java.security.cert.X509CRL crl = getCRL(true);
173+
return crl == null ? new byte[0] : crl.getEncoded(); // TODO CRL.new isn't like MRI
172174
}
173175

174176
private byte[] getSignature() {

0 commit comments

Comments
 (0)