summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-06-06 16:55:54 -0400
committerEndi Sukma Dewata <edewata@redhat.com>2012-06-14 17:14:19 -0500
commitc53ca291e21761f1de5417ef596afba395a7f5d1 (patch)
tree47a0cd8ecd9d36d414d9230282704e9f784d0a71 /base/common/src/com/netscape/certsrv
parent084a8cd360c7508febde06415d727d7d247b16ad (diff)
downloadpki-c53ca291e21761f1de5417ef596afba395a7f5d1.tar.gz
pki-c53ca291e21761f1de5417ef596afba395a7f5d1.tar.xz
pki-c53ca291e21761f1de5417ef596afba395a7f5d1.zip
Fixes for NULL_RETURNS Coverity Issues - Part 2
Diffstat (limited to 'base/common/src/com/netscape/certsrv')
-rw-r--r--base/common/src/com/netscape/certsrv/authentication/AuthToken.java48
-rw-r--r--base/common/src/com/netscape/certsrv/authentication/IAuthToken.java18
2 files changed, 29 insertions, 37 deletions
diff --git a/base/common/src/com/netscape/certsrv/authentication/AuthToken.java b/base/common/src/com/netscape/certsrv/authentication/AuthToken.java
index d934f62e8..1b5bf2350 100644
--- a/base/common/src/com/netscape/certsrv/authentication/AuthToken.java
+++ b/base/common/src/com/netscape/certsrv/authentication/AuthToken.java
@@ -291,17 +291,13 @@ public class AuthToken implements IAuthToken {
return set(name, out.toByteArray());
}
- public CertificateExtensions getInCertExts(String name) {
+ public CertificateExtensions getInCertExts(String name) throws IOException {
CertificateExtensions exts = null;
byte[] data = getInByteArray(name);
if (data != null) {
- try {
- exts = new CertificateExtensions();
- // exts.decode() doesn't work for empty CertExts
- exts.decodeEx(new ByteArrayInputStream(data));
- } catch (IOException e) {
- return null;
- }
+ exts = new CertificateExtensions();
+ // exts.decode() doesn't work for empty CertExts
+ exts.decodeEx(new ByteArrayInputStream(data));
}
return exts;
}
@@ -321,7 +317,7 @@ public class AuthToken implements IAuthToken {
return set(name, out.toByteArray());
}
- public Certificates getInCertificates(String name) {
+ public Certificates getInCertificates(String name) throws IOException, CertificateException {
X509CertImpl[] certArray;
byte[] byteValue = getInByteArray(name);
@@ -329,18 +325,12 @@ public class AuthToken implements IAuthToken {
return null;
}
- try {
- DerInputStream in = new DerInputStream(byteValue);
- DerValue[] derValues = in.getSequence(5);
- certArray = new X509CertImpl[derValues.length];
- for (int i = 0; i < derValues.length; i++) {
- byte[] certData = derValues[i].toByteArray();
- certArray[i] = new X509CertImpl(certData);
- }
- } catch (IOException e) {
- return null;
- } catch (CertificateException e) {
- return null;
+ DerInputStream in = new DerInputStream(byteValue);
+ DerValue[] derValues = in.getSequence(5);
+ certArray = new X509CertImpl[derValues.length];
+ for (int i = 0; i < derValues.length; i++) {
+ byte[] certData = derValues[i].toByteArray();
+ certArray[i] = new X509CertImpl(certData);
}
return new Certificates(certArray);
}
@@ -372,22 +362,18 @@ public class AuthToken implements IAuthToken {
}
}
- public byte[][] getInByteArrayArray(String name) {
+ public byte[][] getInByteArrayArray(String name) throws IOException {
byte[][] retval;
byte[] byteValue = getInByteArray(name);
if (byteValue == null) {
return null;
}
- try {
- DerInputStream in = new DerInputStream(byteValue);
- DerValue[] derValues = in.getSequence(5);
- retval = new byte[derValues.length][];
- for (int i = 0; i < derValues.length; i++) {
- retval[i] = derValues[i].getOctetString();
- }
- } catch (IOException e) {
- return null;
+ DerInputStream in = new DerInputStream(byteValue);
+ DerValue[] derValues = in.getSequence(5);
+ retval = new byte[derValues.length][];
+ for (int i = 0; i < derValues.length; i++) {
+ retval[i] = derValues[i].getOctetString();
}
return retval;
}
diff --git a/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java b/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
index 25a73b8f1..e469f3786 100644
--- a/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
+++ b/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
@@ -17,7 +17,9 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.authentication;
+import java.io.IOException;
import java.math.BigInteger;
+import java.security.cert.CertificateException;
import java.util.Date;
import java.util.Enumeration;
@@ -176,9 +178,10 @@ public interface IAuthToken {
* Retrieves the CertificateExtensions value for name.
*
* @param name The attribute name.
- * @return The value or null on error.
+ * @return The value.
+ * @throws IOException
*/
- public CertificateExtensions getInCertExts(String name);
+ public CertificateExtensions getInCertExts(String name) throws IOException;
/**
* Stores the CertificateExtensions with the associated key.
@@ -193,9 +196,11 @@ public interface IAuthToken {
* Retrieves the Certificates value for name.
*
* @param name The attribute name.
- * @return The value or null on error.
+ * @return The value.
+ * @throws IOException
+ * @throws CertificateException
*/
- public Certificates getInCertificates(String name);
+ public Certificates getInCertificates(String name) throws IOException, CertificateException;
/**
* Stores the Certificates with the associated key.
@@ -210,9 +215,10 @@ public interface IAuthToken {
* Retrieves the byte[][] value for name.
*
* @param name The attribute name.
- * @return The value or null on error.
+ * @return The value.
+ * @throws IOException
*/
- public byte[][] getInByteArrayArray(String name);
+ public byte[][] getInByteArrayArray(String name) throws IOException;
/**
* Stores the byte[][] with the associated key.