From d2b06ee1f9fcc42be83f04f64559cfa6317bda67 Mon Sep 17 00:00:00 2001 From: Abhishek Koneru Date: Fri, 22 Jun 2012 17:25:32 -0400 Subject: Fix for handling null object value passed to DBAttrMapper as part of Coverity fix for Forward NULL cases in DogTag 10. --- .../com/netscape/cmscore/dbs/BigIntegerMapper.java | 7 +- .../com/netscape/cmscore/dbs/CertRecordMapper.java | 16 ++-- .../com/netscape/cmscore/dbs/DateArrayMapper.java | 5 +- .../src/com/netscape/cmscore/dbs/DateMapper.java | 4 + .../com/netscape/cmscore/dbs/IntegerMapper.java | 4 + .../com/netscape/cmscore/dbs/KeyRecordMapper.java | 4 +- .../com/netscape/cmscore/dbs/KeyStateMapper.java | 4 + .../src/com/netscape/cmscore/dbs/LongMapper.java | 4 + .../com/netscape/cmscore/dbs/MetaInfoMapper.java | 4 + .../netscape/cmscore/dbs/ObjectStreamMapper.java | 7 +- .../netscape/cmscore/dbs/RevocationInfoMapper.java | 3 + .../netscape/cmscore/dbs/StringVectorMapper.java | 4 + .../com/netscape/cmscore/dbs/X500NameMapper.java | 3 + .../netscape/cmscore/dbs/X509CertImplMapper.java | 3 + .../netscape/cmscore/request/RequestRecord.java | 96 +++++++++++++--------- .../com/netscape/cmscore/security/KeyCertUtil.java | 4 +- .../com/netscape/pkisilent/http/HTTPClient.java | 2 +- .../security/extensions/GenericASN1Extension.java | 2 + 18 files changed, 116 insertions(+), 60 deletions(-) (limited to 'base') diff --git a/base/common/src/com/netscape/cmscore/dbs/BigIntegerMapper.java b/base/common/src/com/netscape/cmscore/dbs/BigIntegerMapper.java index d59f081db..7d92c79cd 100644 --- a/base/common/src/com/netscape/cmscore/dbs/BigIntegerMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/BigIntegerMapper.java @@ -24,6 +24,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -62,6 +63,9 @@ public class BigIntegerMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } attrs.add(new LDAPAttribute(mLdapName, BigIntegerToDB((BigInteger) obj))); } @@ -101,9 +105,6 @@ public class BigIntegerMapper implements IDBAttrMapper { } public static String BigIntegerToDB(BigInteger i) { - if (i == null) { - return null; - } int len = i.toString().length(); String ret = null; diff --git a/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java b/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java index 61d823b88..a074b41e6 100644 --- a/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java @@ -59,17 +59,13 @@ public class CertRecordMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { - try { - CertRecord rec = (CertRecord) obj; - - attrs.add(new LDAPAttribute( - CertDBSchema.LDAP_ATTR_CERT_RECORD_ID, - rec.getSerialNumber().toString())); - } catch (Exception e) { - Debug.trace(e.toString()); - throw new EDBException( - CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); } + CertRecord rec = (CertRecord) obj; + attrs.add(new LDAPAttribute( + CertDBSchema.LDAP_ATTR_CERT_RECORD_ID, + rec.getSerialNumber().toString())); } public void mapLDAPAttributeSetToObject(LDAPAttributeSet attrs, diff --git a/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java b/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java index 2b60be4f6..99d54be60 100644 --- a/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java @@ -24,6 +24,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -62,10 +63,10 @@ public class DateArrayMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); Date dates[] = (Date[]) obj; - if (dates == null) - return; LDAPAttribute attr = new LDAPAttribute(mLdapName); for (int i = 0; i < dates.length; i++) { diff --git a/base/common/src/com/netscape/cmscore/dbs/DateMapper.java b/base/common/src/com/netscape/cmscore/dbs/DateMapper.java index ab2b2e225..cb287f05e 100644 --- a/base/common/src/com/netscape/cmscore/dbs/DateMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/DateMapper.java @@ -26,6 +26,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -66,6 +67,9 @@ public class DateMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } attrs.add(new LDAPAttribute(mLdapName, dateToDB((Date) obj))); } diff --git a/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java b/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java index 574030c42..a50ce99d7 100644 --- a/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java @@ -23,6 +23,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -61,6 +62,9 @@ public class IntegerMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } attrs.add(new LDAPAttribute(mLdapName, ((Integer) obj).toString())); } diff --git a/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java b/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java index 15e6935e2..b124857ca 100644 --- a/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java @@ -59,13 +59,15 @@ public class KeyRecordMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } try { KeyRecord rec = (KeyRecord) obj; attrs.add(new LDAPAttribute(KeyDBSchema.LDAP_ATTR_KEY_RECORD_ID, rec.getSerialNumber().toString())); } catch (Exception e) { - /*LogDoc * * @phase Maps object to ldap attribute set diff --git a/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java b/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java index afb88bf66..02b49b1c8 100644 --- a/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java @@ -23,6 +23,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -53,6 +54,9 @@ public class KeyStateMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } attrs.add(new LDAPAttribute(mLdapName, ((KeyState) obj).toString())); } diff --git a/base/common/src/com/netscape/cmscore/dbs/LongMapper.java b/base/common/src/com/netscape/cmscore/dbs/LongMapper.java index 0afa95c72..3c066ca43 100644 --- a/base/common/src/com/netscape/cmscore/dbs/LongMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/LongMapper.java @@ -23,6 +23,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -61,6 +62,9 @@ public class LongMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } attrs.add(new LDAPAttribute(mLdapName, LongToDB((Long) obj))); } diff --git a/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java b/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java index f30d13bf6..f4913b936 100644 --- a/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java @@ -24,6 +24,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.MetaInfo; import com.netscape.certsrv.dbs.IDBAttrMapper; @@ -71,6 +72,9 @@ public class MetaInfoMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } MetaInfo info = (MetaInfo) obj; Enumeration e = info.getElements(); diff --git a/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java b/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java index b6f39818a..5c61d36af 100644 --- a/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/ObjectStreamMapper.java @@ -78,13 +78,12 @@ public class ObjectStreamMapper implements IDBAttrMapper { byte data[] = bos.toByteArray(); if (data == null) { CMS.debug("ObjectStreamMapper:mapObjectToLDAPAttributeSet " + - name + " size=0"); + name + " size=0"); } else { CMS.debug("ObjectStreamMapper:mapObjectToLDAPAttributeSet " + - name + " size=" + data.length); + name + " size=" + data.length); } - attrs.add(new LDAPAttribute(mLdapName, - data)); + attrs.add(new LDAPAttribute(mLdapName, data)); } catch (IOException e) { /*LogDoc diff --git a/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java b/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java index 2b9bca3d5..e033f8154 100644 --- a/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java @@ -64,6 +64,9 @@ public class RevocationInfoMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } try { // in format of ; StringBuffer value = new StringBuffer(); diff --git a/base/common/src/com/netscape/cmscore/dbs/StringVectorMapper.java b/base/common/src/com/netscape/cmscore/dbs/StringVectorMapper.java index 60dec48b7..db2c9ee58 100644 --- a/base/common/src/com/netscape/cmscore/dbs/StringVectorMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/StringVectorMapper.java @@ -23,6 +23,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBAttrMapper; import com.netscape.certsrv.dbs.IDBObj; @@ -61,6 +62,9 @@ public class StringVectorMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } @SuppressWarnings("unchecked") Vector v = (Vector) obj; int s = v.size(); diff --git a/base/common/src/com/netscape/cmscore/dbs/X500NameMapper.java b/base/common/src/com/netscape/cmscore/dbs/X500NameMapper.java index 684f27c22..50d938d81 100644 --- a/base/common/src/com/netscape/cmscore/dbs/X500NameMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/X500NameMapper.java @@ -68,6 +68,9 @@ public class X500NameMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } attrs.add(new LDAPAttribute(mLdapName, ((X500Name) obj).toString())); } diff --git a/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java b/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java index 6fbb2cfca..15fe408dd 100644 --- a/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java +++ b/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java @@ -71,6 +71,9 @@ public class X509CertImplMapper implements IDBAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } try { X509CertImpl cert = (X509CertImpl) obj; // make information searchable diff --git a/base/common/src/com/netscape/cmscore/request/RequestRecord.java b/base/common/src/com/netscape/cmscore/request/RequestRecord.java index fe6320ca6..023dd9478 100644 --- a/base/common/src/com/netscape/cmscore/request/RequestRecord.java +++ b/base/common/src/com/netscape/cmscore/request/RequestRecord.java @@ -33,6 +33,7 @@ import java.util.Vector; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; +import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.EDBException; import com.netscape.certsrv.dbs.IDBAttrMapper; @@ -337,7 +338,10 @@ class RequestStateMapper // public void mapObjectToLDAPAttributeSet(IDBObj parent, - String name, Object obj, LDAPAttributeSet attrs) { + String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } RequestStatus rs = (RequestStatus) obj; attrs.add(new LDAPAttribute(Schema.LDAP_ATTR_REQUEST_STATE, @@ -388,7 +392,10 @@ class RequestIdMapper // public void mapObjectToLDAPAttributeSet(IDBObj parent, - String name, Object obj, LDAPAttributeSet attrs) { + String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } RequestId rid = (RequestId) obj; String v = BigIntegerMapper.BigIntegerToDB(new BigInteger(rid.toString())); @@ -410,7 +417,7 @@ class RequestIdMapper BigIntegerMapper.BigIntegerFromDB(value).toString())); } - public String mapSearchFilter(String name, String op, String value) { + public String mapSearchFilter(String name, String op, String value) throws EBaseException { String v = null; try { @@ -450,14 +457,18 @@ class RequestAttrsMapper // public void mapObjectToLDAPAttributeSet(IDBObj parent, - String name, Object obj, LDAPAttributeSet attrs) { + String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } @SuppressWarnings("unchecked") Hashtable ht = (Hashtable) obj; Enumeration e = ht.keys(); - + ByteArrayOutputStream bos = null; + ObjectOutputStream os = null; try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); + bos = new ByteArrayOutputStream(); + os = new ObjectOutputStream(bos); String key = null; Object value = null; @@ -487,17 +498,33 @@ class RequestAttrsMapper } os.writeObject(null); - os.close(); - attrs.add(new LDAPAttribute(Schema.LDAP_ATTR_REQUEST_ATTRS, - bos.toByteArray())); } catch (Exception x) { - Debug.trace("Output Mapping Error in requeset ID " + - ((RequestRecord) parent).getRequestId().toString() + " : " + x); + if (parent != null) + Debug.trace("Output Mapping Error in requeset ID " + + ((RequestRecord) parent).getRequestId().toString() + " : " + x); //if (Debug.ON) { Debug.printStackTrace(x); //} + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + if (bos != null) { + try { + bos.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } } + attrs.add(new LDAPAttribute(Schema.LDAP_ATTR_REQUEST_ATTRS, + bos.toByteArray())); } private byte[] encode(Object value) @@ -777,38 +804,33 @@ class ExtAttrDynMapper implements IDBDynAttrMapper { public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { + if (obj == null) { + throw new EBaseException(CMS.getUserMessage("CMS_DBS_SERIALIZE_FAILED", name)); + } @SuppressWarnings("unchecked") Hashtable ht = (Hashtable) obj; Enumeration e = ht.keys(); - try { - while (e.hasMoreElements()) { - String key = e.nextElement(); - Object value = ht.get(key); - if (value instanceof String) { - String stringValue = (String) value; + while (e.hasMoreElements()) { + String key = e.nextElement(); + Object value = ht.get(key); + if (value instanceof String) { + String stringValue = (String) value; + attrs.add(new LDAPAttribute( + extAttrPrefix + encodeKey(key), + stringValue)); + } else if (value instanceof Hashtable) { + @SuppressWarnings("unchecked") + Hashtable innerHash = (Hashtable) value; + Enumeration innerHashEnum = innerHash.keys(); + while (innerHashEnum.hasMoreElements()) { + String innerKey = innerHashEnum.nextElement(); + String innerValue = innerHash.get(innerKey); attrs.add(new LDAPAttribute( - extAttrPrefix + encodeKey(key), - stringValue)); - } else if (value instanceof Hashtable) { - @SuppressWarnings("unchecked") - Hashtable innerHash = (Hashtable) value; - Enumeration innerHashEnum = innerHash.keys(); - while (innerHashEnum.hasMoreElements()) { - String innerKey = innerHashEnum.nextElement(); - String innerValue = innerHash.get(innerKey); - attrs.add(new LDAPAttribute( - extAttrPrefix + encodeKey(key) + ";" + encodeKey(innerKey), - innerValue)); - } + extAttrPrefix + encodeKey(key) + ";" + encodeKey(innerKey), + innerValue)); } } - } catch (Exception x) { - Debug.trace("Output Mapping Error in requeset ID " + - ((IRequestRecord) parent).getRequestId().toString() + " : " + x); - //if (Debug.ON) { - Debug.printStackTrace(x); - //} } } diff --git a/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java b/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java index 80ad36c2d..210c04227 100644 --- a/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java +++ b/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java @@ -1052,7 +1052,7 @@ public class KeyCertUtil { } public static BigInteger getSerialNumber(LDAPConnection conn, String baseDN) - throws LDAPException { + throws LDAPException, EBaseException { String dn = "ou=certificateRepository,ou=ca," + baseDN; BigInteger serialno = null; LDAPEntry entry = conn.read(dn); @@ -1077,7 +1077,7 @@ public class KeyCertUtil { public static void setSerialNumber(LDAPConnection conn, String baseDN, BigInteger serial) - throws LDAPException { + throws LDAPException, EBaseException { String dn = "ou=certificateRepository,ou=ca," + baseDN; LDAPAttribute attr = new LDAPAttribute("serialno"); diff --git a/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java b/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java index c98fe2193..49d9e1846 100644 --- a/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java +++ b/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java @@ -657,7 +657,7 @@ public class HTTPClient implements SSLCertificateApprovalCallback { } else { // This should never happen -- an empty response System.out.println("Unable to parse response header -- empty " + - "header"); + "header"); throw new Exception("Unable to create response. Empty header."); } diff --git a/base/util/src/netscape/security/extensions/GenericASN1Extension.java b/base/util/src/netscape/security/extensions/GenericASN1Extension.java index 43b2e0b2b..8b3b03fac 100644 --- a/base/util/src/netscape/security/extensions/GenericASN1Extension.java +++ b/base/util/src/netscape/security/extensions/GenericASN1Extension.java @@ -434,9 +434,11 @@ public class GenericASN1Extension extends Extension fis.close(); } } + if (s == null) { return ""; } + for (i = 0, j = 0; j < s.length(); j++) { int ch = s.charAt(j); if (ch == 10 || ch == 13 || ch == 9) -- cgit