summaryrefslogtreecommitdiffstats
path: root/base/silent
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-04-05 15:08:18 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-04-09 10:22:03 -0500
commit3f24e55923fc986af4c6a08b2b8d45704a905627 (patch)
tree716415853b5676b801f6707634305b59b9af8603 /base/silent
parent7c7b9d023cd466c1771068badc020dab36beb553 (diff)
downloadpki-3f24e55923fc986af4c6a08b2b8d45704a905627.tar.gz
pki-3f24e55923fc986af4c6a08b2b8d45704a905627.tar.xz
pki-3f24e55923fc986af4c6a08b2b8d45704a905627.zip
Removed unnecessary type casts.
Unnecessary type casts have been removed using Eclipse Quick Fix. Ticket #134
Diffstat (limited to 'base/silent')
-rwxr-xr-xbase/silent/src/com/netscape/pkisilent/argparser/ArgParser.java12
-rw-r--r--base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java4
-rw-r--r--base/silent/src/com/netscape/pkisilent/common/ComCrypto.java5
-rw-r--r--base/silent/src/com/netscape/pkisilent/common/Con2Agent.java5
-rw-r--r--base/silent/src/com/netscape/pkisilent/common/PostQuery.java2
-rw-r--r--base/silent/src/com/netscape/pkisilent/http/HTTPClient.java2
6 files changed, 14 insertions, 16 deletions
diff --git a/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java b/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java
index ecb6038df..d2791c1e2 100755
--- a/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java
+++ b/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java
@@ -1551,13 +1551,13 @@ public class ArgParser {
}
Record lastMatchRecord() {
- return (Record) matchList.lastElement();
+ return matchList.lastElement();
}
private Record getRecord(String arg, ObjectHolder ndescHolder) {
NameDesc ndesc;
for (int i = 0; i < matchList.size(); i++) {
- Record rec = (Record) matchList.get(i);
+ Record rec = matchList.get(i);
for (ndesc = rec.nameList; ndesc != null; ndesc = ndesc.next) {
if (rec.convertCode != 'v' && ndesc.oneWord) {
if (arg.startsWith(ndesc.name)) {
@@ -1581,7 +1581,7 @@ public class ArgParser {
public void checkRequiredArgs() {
for (int i = 1; i < matchList.size(); i++) {
- Record rec = (Record) matchList.get(i);
+ Record rec = matchList.get(i);
StringHolder myString = (StringHolder) rec.resHolder;
if (((myString.value == null) || (myString.value.equals(""))) && (rec.required)) {
printErrorAndExit("Required parameter " + rec.nameList.name + " is not specified.");
@@ -1702,7 +1702,7 @@ public class ArgParser {
}
String[] result = new String[vec.size() + args.length];
for (i = 0; i < vec.size(); i++) {
- result[i] = (String) vec.get(i);
+ result[i] = vec.get(i);
}
for (k = 0; k < args.length; k++) {
result[i++] = args[k];
@@ -1834,7 +1834,7 @@ public class ArgParser {
if (unmatched.size() == 0) {
return null;
} else {
- return (String[]) unmatched.toArray(new String[0]);
+ return unmatched.toArray(new String[0]);
}
}
@@ -2010,7 +2010,7 @@ public class ArgParser {
s += "Options include:\n\n";
for (int i = 0; i < matchList.size(); i++) {
String optionInfo = "";
- rec = (Record) matchList.get(i);
+ rec = matchList.get(i);
if (rec.convertCode == 'h' && !helpOptionsEnabled) {
continue;
}
diff --git a/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java b/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java
index 89ebcc48a..9f7a32185 100644
--- a/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java
+++ b/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java
@@ -72,7 +72,7 @@ public class ArgParserTest {
}
String[] result = new String[vec.size()];
for (int i = 0; i < vec.size(); i++) {
- result[i] = (String) vec.get(i);
+ result[i] = vec.get(i);
}
return result;
}
@@ -1504,7 +1504,7 @@ public class ArgParserTest {
} catch (Exception e) {
}
}
- unmatched = (String[]) vec.toArray(new String[0]);
+ unmatched = vec.toArray(new String[0]);
test.checkStringArray(
"My unmatched args:", unmatched, unmatchedCheck);
diff --git a/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java b/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
index 482e2ffab..d1941ca30 100644
--- a/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
+++ b/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
@@ -44,7 +44,6 @@ import org.mozilla.jss.crypto.KeyWrapper;
import org.mozilla.jss.crypto.PrivateKey;
import org.mozilla.jss.crypto.SymmetricKey;
import org.mozilla.jss.crypto.X509Certificate;
-import org.mozilla.jss.pkcs11.PK11Token;
import org.mozilla.jss.pkix.crmf.CertReqMsg;
import org.mozilla.jss.pkix.crmf.CertRequest;
import org.mozilla.jss.pkix.crmf.CertTemplate;
@@ -371,7 +370,7 @@ public class ComCrypto {
keys = store.getPrivateKeys();
for (i = 0; i < keys.length; i++) {
- PrivateKey key = (PrivateKey) keys[i];
+ PrivateKey key = keys[i];
store.deletePrivateKey(key);
}
@@ -414,7 +413,7 @@ public class ComCrypto {
}
manager = CryptoManager.getInstance();
- token = (PK11Token) manager.getInternalKeyStorageToken();
+ token = manager.getInternalKeyStorageToken();
pass1 = new Password(tokenpwd.toCharArray());
if (token.isLoggedIn() && debug) {
System.out.println("Already Logged in ");
diff --git a/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java b/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java
index bc419fb02..bfaf1eb34 100644
--- a/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java
+++ b/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java
@@ -29,7 +29,6 @@ import org.mozilla.jss.CryptoManager;
import org.mozilla.jss.crypto.AlreadyInitializedException;
import org.mozilla.jss.crypto.CryptoToken;
import org.mozilla.jss.crypto.X509Certificate;
-import org.mozilla.jss.pkcs11.PK11Token;
import org.mozilla.jss.ssl.SSLCertificateApprovalCallback;
import org.mozilla.jss.ssl.SSLClientCertificateSelectionCallback;
import org.mozilla.jss.ssl.SSLSocket;
@@ -233,7 +232,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
System.out.println("Step 2: Login to Cert Database");
manager = CryptoManager.getInstance();
- CryptoToken token = (PK11Token) manager.getInternalKeyStorageToken();
+ CryptoToken token = manager.getInternalKeyStorageToken();
if (token.isLoggedIn()) {
System.out.println("Con2Agent: Logged in incorrect");
@@ -244,7 +243,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
tokenpwd.getChars(0, tokenpwd.length(), passchar1, 0);
- pass1 = new Password((char[]) passchar1.clone());
+ pass1 = new Password(passchar1.clone());
token.login(pass1);
X509Certificate cert2 = manager.findCertByNickname(certnickname);
diff --git a/base/silent/src/com/netscape/pkisilent/common/PostQuery.java b/base/silent/src/com/netscape/pkisilent/common/PostQuery.java
index 27c9209e8..b7399336f 100644
--- a/base/silent/src/com/netscape/pkisilent/common/PostQuery.java
+++ b/base/silent/src/com/netscape/pkisilent/common/PostQuery.java
@@ -111,7 +111,7 @@ public class PostQuery {
os.flush();
os.close();
- InputStream Content = (InputStream) URLCon.getInputStream();
+ InputStream Content = URLCon.getInputStream();
System.out.println("Configuring Cert Instance : Return Response");
BufferedReader in = new BufferedReader(
diff --git a/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java b/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java
index 6331783b8..428853032 100644
--- a/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java
+++ b/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java
@@ -921,7 +921,7 @@ public class HTTPClient implements SSLCertificateApprovalCallback {
int startPos = 0;
byte[] contentData = new byte[totalBytes];
for (int i = 0; i < bufferList.size(); i++) {
- ByteBuffer byteBuffer = (ByteBuffer) bufferList.get(i);
+ ByteBuffer byteBuffer = bufferList.get(i);
byteBuffer.flip();
byteBuffer.get(contentData, startPos, byteBuffer.limit());
startPos += byteBuffer.limit();