8268873: Unnecessary Vector usage in java.base
Reviewed-by: mullan
This commit is contained in:
parent
0b12e7c82c
commit
b8f79a7ff7
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -284,11 +284,11 @@ public class JarIndex {
|
|||||||
public void read(InputStream is) throws IOException {
|
public void read(InputStream is) throws IOException {
|
||||||
BufferedReader br = new BufferedReader
|
BufferedReader br = new BufferedReader
|
||||||
(new InputStreamReader(is, UTF_8.INSTANCE));
|
(new InputStreamReader(is, UTF_8.INSTANCE));
|
||||||
String line = null;
|
String line;
|
||||||
String currentJar = null;
|
String currentJar = null;
|
||||||
|
|
||||||
/* an ordered list of jar file names */
|
/* an ordered list of jar file names */
|
||||||
Vector<String> jars = new Vector<>();
|
ArrayList<String> jars = new ArrayList<>();
|
||||||
|
|
||||||
/* read until we see a .jar line */
|
/* read until we see a .jar line */
|
||||||
while((line = br.readLine()) != null && !line.endsWith(".jar"));
|
while((line = br.readLine()) != null && !line.endsWith(".jar"));
|
||||||
|
@ -39,12 +39,10 @@ import java.net.InetSocketAddress;
|
|||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
import java.security.cert.*;
|
import java.security.cert.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import javax.security.auth.x500.X500Principal;
|
|
||||||
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import sun.net.www.http.HttpClient;
|
import sun.net.www.http.HttpClient;
|
||||||
@ -148,14 +146,14 @@ final class HttpsClient extends HttpClient
|
|||||||
ciphers = null;
|
ciphers = null;
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer tokenizer;
|
StringTokenizer tokenizer;
|
||||||
Vector<String> v = new Vector<String>();
|
ArrayList<String> v = new ArrayList<>();
|
||||||
|
|
||||||
tokenizer = new StringTokenizer(cipherString, ",");
|
tokenizer = new StringTokenizer(cipherString, ",");
|
||||||
while (tokenizer.hasMoreTokens())
|
while (tokenizer.hasMoreTokens())
|
||||||
v.addElement(tokenizer.nextToken());
|
v.add(tokenizer.nextToken());
|
||||||
ciphers = new String [v.size()];
|
ciphers = new String [v.size()];
|
||||||
for (int i = 0; i < ciphers.length; i++)
|
for (int i = 0; i < ciphers.length; i++)
|
||||||
ciphers [i] = v.elementAt(i);
|
ciphers [i] = v.get(i);
|
||||||
}
|
}
|
||||||
return ciphers;
|
return ciphers;
|
||||||
}
|
}
|
||||||
@ -172,14 +170,14 @@ final class HttpsClient extends HttpClient
|
|||||||
protocols = null;
|
protocols = null;
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer tokenizer;
|
StringTokenizer tokenizer;
|
||||||
Vector<String> v = new Vector<String>();
|
ArrayList<String> v = new ArrayList<>();
|
||||||
|
|
||||||
tokenizer = new StringTokenizer(protocolString, ",");
|
tokenizer = new StringTokenizer(protocolString, ",");
|
||||||
while (tokenizer.hasMoreTokens())
|
while (tokenizer.hasMoreTokens())
|
||||||
v.addElement(tokenizer.nextToken());
|
v.add(tokenizer.nextToken());
|
||||||
protocols = new String [v.size()];
|
protocols = new String [v.size()];
|
||||||
for (int i = 0; i < protocols.length; i++) {
|
for (int i = 0; i < protocols.length; i++) {
|
||||||
protocols [i] = v.elementAt(i);
|
protocols [i] = v.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return protocols;
|
return protocols;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -578,19 +578,18 @@ public class PKCS7 {
|
|||||||
public SignerInfo[] verify(byte[] bytes)
|
public SignerInfo[] verify(byte[] bytes)
|
||||||
throws NoSuchAlgorithmException, SignatureException {
|
throws NoSuchAlgorithmException, SignatureException {
|
||||||
|
|
||||||
Vector<SignerInfo> intResult = new Vector<>();
|
ArrayList<SignerInfo> intResult = new ArrayList<>();
|
||||||
for (int i = 0; i < signerInfos.length; i++) {
|
for (int i = 0; i < signerInfos.length; i++) {
|
||||||
|
|
||||||
SignerInfo signerInfo = verify(signerInfos[i], bytes);
|
SignerInfo signerInfo = verify(signerInfos[i], bytes);
|
||||||
if (signerInfo != null) {
|
if (signerInfo != null) {
|
||||||
intResult.addElement(signerInfo);
|
intResult.add(signerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!intResult.isEmpty()) {
|
if (!intResult.isEmpty()) {
|
||||||
|
|
||||||
SignerInfo[] result = new SignerInfo[intResult.size()];
|
SignerInfo[] result = new SignerInfo[intResult.size()];
|
||||||
intResult.copyInto(result);
|
return intResult.toArray(result);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user