Merge pull request #364 from cconlon/jdk24Warnings
Suppress JDK 24 deprecation/removal warningspull/366/head
commit
0c92ec09c1
|
|
@ -297,6 +297,7 @@
|
|||
classpathref="classpath"
|
||||
includeantruntime="false">
|
||||
<compilerarg value="-Xlint:-options"/>
|
||||
<compilerarg value="-Xlint:-path"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public class WolfCryptEccKey {
|
|||
return EccPrivateKeyToPKCS8(getEccKeyPtr());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2024,7 +2024,7 @@ public class WolfSSL {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -880,7 +880,7 @@ public class WolfSSLCRL implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
this.free();
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ public class WolfSSLCertManager {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -853,7 +853,7 @@ public class WolfSSLCertRequest {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2624,7 +2624,7 @@ public class WolfSSLCertificate implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2546,7 +2546,7 @@ public class WolfSSLContext {
|
|||
flushSessions(getContextPtr(), tm);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ public class WolfSSLDebug {
|
|||
Level level = record.getLevel();
|
||||
String levelStr = (level != null) ? level.toString() : "UNKNOWN";
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
long threadId = record.getThreadID();
|
||||
String message = record.getMessage();
|
||||
if (message == null) {
|
||||
|
|
@ -233,6 +234,7 @@ public class WolfSSLDebug {
|
|||
* JSON formatter for wolfSSL logs
|
||||
*/
|
||||
private static class JSONFormatter extends Formatter {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String format(LogRecord record) {
|
||||
if (record == null) {
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ public class WolfSSLNameConstraints {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
free();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.time.Instant;
|
|||
*/
|
||||
class WolfSSLNativeLoggingCallback implements WolfSSLLoggingCallback
|
||||
{
|
||||
@SuppressWarnings("deprecation")
|
||||
public synchronized void loggingCallback(int logLevel, String logMessage) {
|
||||
|
||||
System.err.println(
|
||||
|
|
|
|||
|
|
@ -5910,7 +5910,7 @@ public class WolfSSLSession {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ public class WolfSSLX509Name {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ public class WolfSSLAuthStore {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected synchronized void finalize() throws Throwable {
|
||||
/* Clear LinkedHashMap and set to null to allow
|
||||
|
|
|
|||
|
|
@ -621,7 +621,7 @@ public class WolfSSLContext extends SSLContextSpi {
|
|||
return this.ctx;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
if (this.ctx != null) {
|
||||
|
|
|
|||
|
|
@ -2835,7 +2835,7 @@ public class WolfSSLEngine extends SSLEngine {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected synchronized void finalize() throws Throwable {
|
||||
if (this.ssl != null) {
|
||||
|
|
|
|||
|
|
@ -1978,7 +1978,7 @@ public class WolfSSLEngineHelper {
|
|||
this.authStore = null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected synchronized void finalize() throws Throwable {
|
||||
|
||||
|
|
|
|||
|
|
@ -613,6 +613,7 @@ public class WolfSSLImplementSSLSession extends ExtendedSSLSession {
|
|||
return km.getCertificateChain(authStore.getCertAlias());
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public synchronized javax.security.cert.X509Certificate[]
|
||||
getPeerCertificateChain() throws SSLPeerUnverifiedException {
|
||||
|
|
@ -1173,7 +1174,7 @@ public class WolfSSLImplementSSLSession extends ExtendedSSLSession {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected synchronized void finalize() throws Throwable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ public class WolfSSLInternalVerifyCb implements WolfSSLVerifyCallback {
|
|||
* SSL/TLS handshake should continue. Otherwise return 0
|
||||
* to mark verification failure and stop/abort handshake.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public int verifyCallback(int preverify_ok, long x509StorePtr) {
|
||||
|
||||
WolfSSLCertificate[] certs = null;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
package com.wolfssl.provider.jsse;
|
||||
|
||||
import java.net.Socket;
|
||||
import java.security.AccessController;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.Principal;
|
||||
|
|
@ -90,9 +89,11 @@ public class WolfSSLKeyX509 extends X509ExtendedKeyManager {
|
|||
() -> "creating new WolfSSLKeyX509 object");
|
||||
|
||||
/* Check Security property once at construction time.
|
||||
* Use doPrivileged for SecurityManager compatibility. */
|
||||
* Use doPrivileged for SecurityManager compatibility.
|
||||
* AccessController used via FQN to avoid import-line removal
|
||||
* warning on JDK 17+. */
|
||||
@SuppressWarnings("removal")
|
||||
String disableCacheValue = AccessController.doPrivileged(
|
||||
String disableCacheValue = java.security.AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return Security.getProperty(DISABLE_CACHE_PROPERTY);
|
||||
|
|
@ -215,6 +216,7 @@ public class WolfSSLKeyX509 extends X509ExtendedKeyManager {
|
|||
* null - if no alias matches found in KeyStore.
|
||||
* String[] - aliases, if found that match type and/or issuers
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private String[] getAliasesFromKeyStore(String type, Principal[] issuers)
|
||||
throws KeyStoreException {
|
||||
|
||||
|
|
@ -286,6 +288,7 @@ public class WolfSSLKeyX509 extends X509ExtendedKeyManager {
|
|||
* null - if no alias matches found.
|
||||
* String[] - aliases, if found that match type and/or issuers
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private String[] getAliases(String type, Principal[] issuers) {
|
||||
|
||||
/* Check if caching is disabled, use direct KeyStore access */
|
||||
|
|
@ -555,6 +558,7 @@ public class WolfSSLKeyX509 extends X509ExtendedKeyManager {
|
|||
/**
|
||||
* Clear sensitive data when object is garbage collected
|
||||
*/
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package com.wolfssl.provider.jsse;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import javax.net.ssl.SSLParameters;
|
||||
import com.wolfssl.provider.jsse.WolfSSLJDK8Helper;
|
||||
|
|
@ -53,7 +52,16 @@ public class WolfSSLParametersHelper
|
|||
* has SSLParameters methods that older versions may not have */
|
||||
static
|
||||
{
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
detectSSLParametersMethods();
|
||||
}
|
||||
|
||||
/* AccessController used via FQN to avoid import-line removal
|
||||
* warning on JDK 17+. */
|
||||
@SuppressWarnings("removal")
|
||||
private static void detectSSLParametersMethods()
|
||||
{
|
||||
java.security.AccessController
|
||||
.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
Class<?> c = SSLParameters.class;
|
||||
Method[] methods = c.getDeclaredMethods();
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public final class WolfSSLProvider extends Provider {
|
|||
/**
|
||||
* wolfSSL JSSE Provider class
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public WolfSSLProvider() {
|
||||
super("wolfJSSE", 1.17, "wolfSSL JSSE Provider");
|
||||
/* super("wolfJSSE", "1.17", "wolfSSL JSSE Provider"); */
|
||||
|
|
|
|||
|
|
@ -1514,6 +1514,7 @@ public class WolfSSLSocket extends SSLSocket {
|
|||
*
|
||||
* @throws IOException if a network error occurs
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public synchronized void startHandshake() throws IOException {
|
||||
int ret;
|
||||
|
|
@ -2319,7 +2320,7 @@ public class WolfSSLSocket extends SSLSocket {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected synchronized void finalize() throws Throwable {
|
||||
if (this.ssl != null) {
|
||||
|
|
|
|||
|
|
@ -1339,7 +1339,7 @@ public final class WolfSSLTrustX509 extends X509ExtendedTrustManager {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
this.store = null;
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ public class WolfSSLX509 extends X509Certificate {
|
|||
return this.cert.getSerial();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public Principal getIssuerDN() {
|
||||
|
||||
|
|
@ -194,6 +195,7 @@ public class WolfSSLX509 extends X509Certificate {
|
|||
return new WolfSSLPrincipal(name);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public Principal getSubjectDN() {
|
||||
|
||||
|
|
@ -678,7 +680,7 @@ public class WolfSSLX509 extends X509Certificate {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import com.wolfssl.WolfSSLException;
|
|||
*
|
||||
* @author wolfSSL
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
public class WolfSSLX509X extends X509Certificate {
|
||||
WolfSSLX509 cert;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import java.util.ArrayList;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import javax.net.ssl.SSLParameters;
|
||||
import javax.net.ssl.SNIServerName;
|
||||
|
|
@ -52,6 +51,7 @@ public class WolfSSLJDK8Helper
|
|||
* @param m Java method to call to set SNI server names
|
||||
* @param in WolfSSLParameters to set SNI names from
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected static void setServerNames(final SSLParameters out,
|
||||
final Method m, WolfSSLParameters in) {
|
||||
|
||||
|
|
@ -69,8 +69,11 @@ public class WolfSSLJDK8Helper
|
|||
sni.add(new SNIHostName(name.getEncoded()));
|
||||
}
|
||||
|
||||
/* call SSLParameters.setServerName() */
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
/* call SSLParameters.setServerNames().
|
||||
* AccessController used via FQN to avoid import-line removal
|
||||
* warning on JDK 17+. */
|
||||
java.security.AccessController
|
||||
.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
try {
|
||||
m.invoke(out, sni);
|
||||
|
|
@ -122,6 +125,7 @@ public class WolfSSLJDK8Helper
|
|||
* @param m method to invoke to set protocols
|
||||
* @param in input WolfSSLParameters to read ALPN protocols from
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected static void setApplicationProtocols(final SSLParameters out,
|
||||
final Method m, WolfSSLParameters in) {
|
||||
|
||||
|
|
@ -134,7 +138,8 @@ public class WolfSSLJDK8Helper
|
|||
final Object[] appProtoArr = {appProtos};
|
||||
if (appProtos != null) {
|
||||
/* call SSLParameters.setApplicationProtocols() */
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
java.security.AccessController
|
||||
.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
try {
|
||||
m.invoke(out, appProtoArr);
|
||||
|
|
@ -190,6 +195,7 @@ public class WolfSSLJDK8Helper
|
|||
* @param m method to invoke to set endpoint ID algo
|
||||
* @param in input WolfSSLParameters to read endpoint ID algo from
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected static void setEndpointIdentificationAlgorithm(
|
||||
final SSLParameters out, final Method m, WolfSSLParameters in) {
|
||||
|
||||
|
|
@ -202,7 +208,8 @@ public class WolfSSLJDK8Helper
|
|||
final String idAlgo = in.getEndpointIdentificationAlgorithm();
|
||||
if (idAlgo != null) {
|
||||
/* call SSLParameters.setEndpointIdentificationAlgorithm() */
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
java.security.AccessController
|
||||
.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
try {
|
||||
m.invoke(out, idAlgo);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class WolfSSLEngineMemoryLeakTest {
|
|||
* The test will fail if JNI global references prevent garbage collection.
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
public void testEngineMemoryLeakWithAbandonedEngines() throws Exception {
|
||||
|
||||
/* Skip on Android due to performance and timeout issues */
|
||||
|
|
|
|||
|
|
@ -2489,6 +2489,7 @@ public class WolfSSLEngineTest {
|
|||
* when no client auth requested, matching SunJSSE/Netty expectations.
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
public void testGetPeerCertificateChainNoClientAuth() throws Exception {
|
||||
|
||||
String protocol = null;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ public class WolfSSLSessionTest {
|
|||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
public void testSessionTimeAndCerts()
|
||||
throws NoSuchAlgorithmException, KeyManagementException,
|
||||
KeyStoreException, CertificateException, IOException,
|
||||
|
|
@ -148,6 +149,7 @@ public class WolfSSLSessionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
public void testNullSession()
|
||||
throws NoSuchAlgorithmException, KeyManagementException,
|
||||
KeyStoreException, CertificateException, IOException,
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ import com.wolfssl.provider.jsse.WolfSSLX509;
|
|||
import com.wolfssl.provider.jsse.WolfSSLX509X;
|
||||
import com.wolfssl.test.TimedTestWatcher;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public class WolfSSLX509Test {
|
||||
|
||||
@Rule
|
||||
|
|
|
|||
Loading…
Reference in New Issue