Skip to content

Commit

Permalink
Convert from Hashtable & Vector to HashMap & ArrayList.
Browse files Browse the repository at this point in the history
  • Loading branch information
norrisjeremy committed Jan 12, 2023
1 parent 9aa1327 commit d77c858
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/jcraft/jsch/KeyPair.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
package com.jcraft.jsch;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class KeyPair{

Expand Down Expand Up @@ -1115,7 +1117,7 @@ static KeyPair loadPPK(JSch jsch, byte[] buf) throws JSchException {
int lines = 0;

Buffer buffer = new Buffer(buf);
Hashtable<String, String> v = new Hashtable<>();
Map<String, String> v = new HashMap<>();

while(true){
if(!parseHeader(buffer, v))
Expand Down Expand Up @@ -1249,7 +1251,7 @@ private static byte[] parseLines(Buffer buffer, int lines){
return data;
}

private static boolean parseHeader(Buffer buffer, Hashtable<String, String> v){
private static boolean parseHeader(Buffer buffer, Map<String, String> v){
byte[] buf = buffer.buffer;
int index = buffer.index;
String key = null;
Expand Down Expand Up @@ -1363,22 +1365,20 @@ ASN1[] getContents() throws ASN1Exception {
return new ASN1[0];
}
int index=indexp[0];
Vector<ASN1> values = new Vector<>();
List<ASN1> values = new ArrayList<>();
while(length>0) {
index++; length--;
int tmp=index;
indexp[0]=index;
int l=getLength(indexp);
index=indexp[0];
length-=(index-tmp);
values.addElement(new ASN1(buf, tmp-1, 1+(index-tmp)+l));
values.add(new ASN1(buf, tmp-1, 1+(index-tmp)+l));
index+=l;
length-=l;
}
ASN1[] result = new ASN1[values.size()];
for(int i = 0; i <values.size(); i++) {
result[i]=values.elementAt(i);
}
values.toArray(result);
return result;
}
}
Expand Down

0 comments on commit d77c858

Please sign in to comment.