summaryrefslogtreecommitdiffstats
path: root/base/util/src
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-06-21 09:44:15 -0400
committerAde Lee <alee@redhat.com>2012-06-29 01:29:03 -0400
commiteb4b46f25ca8dec8ac79c26cfb02e8918000c88e (patch)
tree22223edf9099ac1a3e0c3914d383c373a92950b0 /base/util/src
parent1eba8264adbe42115caac4db655d450a99791ceb (diff)
downloadpki-eb4b46f25ca8dec8ac79c26cfb02e8918000c88e.tar.gz
pki-eb4b46f25ca8dec8ac79c26cfb02e8918000c88e.tar.xz
pki-eb4b46f25ca8dec8ac79c26cfb02e8918000c88e.zip
Fixes for Forward Null Cases in Coverity for DogTag10
Addressed review coments.
Diffstat (limited to 'base/util/src')
-rw-r--r--base/util/src/netscape/security/extensions/GenericASN1Extension.java41
-rwxr-xr-xbase/util/src/netscape/security/x509/X509CRLImpl.java2
2 files changed, 23 insertions, 20 deletions
diff --git a/base/util/src/netscape/security/extensions/GenericASN1Extension.java b/base/util/src/netscape/security/extensions/GenericASN1Extension.java
index b51846498..43b2e0b2b 100644
--- a/base/util/src/netscape/security/extensions/GenericASN1Extension.java
+++ b/base/util/src/netscape/security/extensions/GenericASN1Extension.java
@@ -418,8 +418,9 @@ public class GenericASN1Extension extends Extension
throw new IOException("File name is not provided.");
}
- FileInputStream fis = new FileInputStream(fname);
+ FileInputStream fis = null;
try {
+ fis = new FileInputStream(fname);
int n = 0;
while ((n = fis.available()) > 0) {
buff = new byte[n];
@@ -428,28 +429,30 @@ public class GenericASN1Extension extends Extension
break;
s = new String(buff);
}
-
- for (i = 0, j = 0; j < s.length(); j++) {
- int ch = s.charAt(j);
- if (ch == 10 || ch == 13 || ch == 9)
- continue;
- i++;
- }
- buff = new byte[i];
- for (i = 0, j = 0; j < s.length(); j++) {
- int ch = s.charAt(j);
- if (ch == 10 || ch == 13 || ch == 9)
- continue;
- buff[i++] = (byte) ch;
- }
-
- s = new String(buff);
-
- return s;
} finally {
if (fis != null) {
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)
+ continue;
+ i++;
+ }
+ buff = new byte[i];
+ for (i = 0, j = 0; j < s.length(); j++) {
+ int ch = s.charAt(j);
+ if (ch == 10 || ch == 13 || ch == 9)
+ continue;
+ buff[i++] = (byte) ch;
+ }
+ s = new String(buff);
+
+ return s;
}
+
}
diff --git a/base/util/src/netscape/security/x509/X509CRLImpl.java b/base/util/src/netscape/security/x509/X509CRLImpl.java
index 6c84084c5..46c3edfcf 100755
--- a/base/util/src/netscape/security/x509/X509CRLImpl.java
+++ b/base/util/src/netscape/security/x509/X509CRLImpl.java
@@ -404,7 +404,7 @@ public class X509CRLImpl extends X509CRL {
Signature sigVerf = null;
String sigAlg = sigAlgId.getName();
- if (sigProvider.equals("Mozilla-JSS")) {
+ if (sigProvider != null && sigProvider.equals("Mozilla-JSS")) {
if (sigAlg.equals("MD5withRSA")) {
sigAlg = "MD5/RSA";
} else if (sigAlg.equals("MD2withRSA")) {