Remove Deprecation Warnings

- Address usage of new Integer
- Address missing deprecation markers

Closes gh-793
This commit is contained in:
Josh Cummings
2023-07-13 09:54:15 -06:00
parent b75f818415
commit 7fd89aa794
15 changed files with 51 additions and 29 deletions

View File

@@ -97,6 +97,7 @@ import org.springframework.util.StringUtils;
* @deprecated As of 2.0 it is recommended to use {@link javax.naming.ldap.LdapName} along
* with utility methods in {@link LdapUtils} instead.
*/
@Deprecated
public class DistinguishedName implements Name {
/**

View File

@@ -54,6 +54,7 @@ public class LdapEntryIdentification {
* {@link #LdapEntryIdentification(javax.naming.ldap.LdapName, javax.naming.ldap.LdapName)}
* instead.
*/
@Deprecated
public LdapEntryIdentification(DistinguishedName absoluteDn, DistinguishedName relativeDn) {
Assert.notNull(absoluteDn, "Absolute DN must not be null");
Assert.notNull(relativeDn, "Relative DN must not be null");
@@ -103,6 +104,7 @@ public class LdapEntryIdentification {
* @deprecated {@link DistinguishedName} and associated classes and methods are
* deprecated as of 2.0. use {@link #getRelativeName()} instead.
*/
@Deprecated
public DistinguishedName getRelativeDn() {
return new DistinguishedName(this.relativeDn);
}
@@ -114,6 +116,7 @@ public class LdapEntryIdentification {
* @deprecated {@link DistinguishedName} and associated classes and methods are
* deprecated as of 2.0. use {@link #getAbsoluteName()} instead.
*/
@Deprecated
public DistinguishedName getAbsoluteDn() {
return new DistinguishedName(this.absoluteDn);
}

View File

@@ -1178,6 +1178,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
*/
@Deprecated
boolean authenticate(Name base, String filter, String password);
/**
@@ -1203,6 +1204,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
*/
@Deprecated
boolean authenticate(String base, String filter, String password);
/**
@@ -1226,6 +1228,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
* @see #authenticate(Name, String, String)
*/
@Deprecated
boolean authenticate(Name base, String filter, String password, AuthenticatedLdapEntryContextCallback callback);
/**
@@ -1249,6 +1252,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
* @see #authenticate(String, String, String)
*/
@Deprecated
boolean authenticate(String base, String filter, String password, AuthenticatedLdapEntryContextCallback callback);
/**
@@ -1276,6 +1280,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
* @see #authenticate(Name, String, String, AuthenticatedLdapEntryContextCallback)
*/
@Deprecated
boolean authenticate(Name base, String filter, String password, AuthenticatedLdapEntryContextCallback callback,
AuthenticationErrorCallback errorCallback);
@@ -1304,6 +1309,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
* @see #authenticate(String, String, String, AuthenticatedLdapEntryContextCallback)
*/
@Deprecated
boolean authenticate(String base, String filter, String password, AuthenticatedLdapEntryContextCallback callback,
AuthenticationErrorCallback errorCallback);
@@ -1328,6 +1334,7 @@ public interface LdapOperations {
* @see #authenticate(Name, String, String, AuthenticatedLdapEntryContextCallback,
* AuthenticationErrorCallback)
*/
@Deprecated
boolean authenticate(Name base, String filter, String password, AuthenticationErrorCallback errorCallback);
/**
@@ -1350,6 +1357,7 @@ public interface LdapOperations {
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
*/
@Deprecated
boolean authenticate(String base, String filter, String password, AuthenticationErrorCallback errorCallback);
/**

View File

@@ -38,6 +38,7 @@ import org.springframework.util.ObjectUtils;
* @author Mattias Hellborg Arthursson
* @deprecated {@link DistinguishedName} and associated classes are deprecated as of 2.0.
*/
@Deprecated
public class LdapRdn implements Serializable, Comparable {
private static final long serialVersionUID = 5681397547245228750L;

View File

@@ -35,6 +35,7 @@ import org.springframework.util.StringUtils;
* @author Mattias Hellborg Arthursson
* @deprecated {@link DistinguishedName} and associated classes are deprecated as of 2.0.
*/
@Deprecated
public class LdapRdnComponent implements Comparable, Serializable {
private static final long serialVersionUID = -3296747972616243038L;
@@ -111,6 +112,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
* @deprecated Using this method changes the internal state of surrounding
* DistinguishedName instance. This should be avoided.
*/
@Deprecated
public void setKey(String key) {
Assert.hasText(key, "Key must not be empty");
this.key = key;
@@ -130,6 +132,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
* @deprecated Using this method changes the internal state of surrounding
* DistinguishedName instance. This should be avoided.
*/
@Deprecated
public void setValue(String value) {
Assert.hasText(value, "Value must not be empty");
this.value = value;

View File

@@ -38,6 +38,7 @@ public interface BaseLdapPathSource {
* @deprecated {@link DistinguishedName} and associated classes and methods are
* deprecated as of 2.0. Use {@link #getBaseLdapName()} instead.
*/
@Deprecated
DistinguishedName getBaseLdapPath();
/**

View File

@@ -38,6 +38,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus;
* probably not such a good idea after all. AbstractPlatformTransactionManager is not
* designed for this usage.
*/
@Deprecated
public class ContextSourceAndDataSourceTransactionManager extends DataSourceTransactionManager {
private static final long serialVersionUID = 6832868697460384648L;

View File

@@ -41,6 +41,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus;
* probably not such a good idea after all. AbstractPlatformTransactionManager is not
* designed for this usage.
*/
@Deprecated
public class ContextSourceAndHibernateTransactionManager extends HibernateTransactionManager {
/**

View File

@@ -39,6 +39,7 @@ import org.springframework.ldap.query.LdapQuery;
* @deprecated This functionality is automatically available in LdapTemplate as of version
* 2.0
*/
@Deprecated
public interface OdmManager {
/**

View File

@@ -42,6 +42,7 @@ import org.springframework.util.StringUtils;
* @deprecated This functionality is automatically available in LdapTemplate as of version
* 2.0
*/
@Deprecated
public final class OdmManagerImpl implements OdmManager {
// The link to the LDAP directory

View File

@@ -45,6 +45,7 @@ import org.springframework.ldap.odm.typeconversion.ConverterManager;
* @deprecated This functionality is automatically available in LdapTemplate as of version
* 2.0
*/
@Deprecated
public final class OdmManagerImplFactoryBean implements FactoryBean {
private LdapOperations ldapOperations = null;

View File

@@ -188,7 +188,7 @@ public final class ConverterManagerTests {
Integer intSource = null;
if (source.getClass() == String.class) {
intSource = new Integer((String) source);
intSource = Integer.valueOf((String) source);
}
else {
if (source.getClass() == Integer.class) {
@@ -213,7 +213,7 @@ public final class ConverterManagerTests {
Integer intSource = null;
if (source.getClass() == String.class) {
intSource = new Integer((String) source);
intSource = Integer.valueOf((String) source);
}
else {
if (source.getClass() == Integer.class) {

View File

@@ -79,7 +79,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
}
OrgPerson person = new OrgPerson();
person.setId(new Integer(1));
person.setId(1);
person.setLastname("Person");
person.setFullname("Some Person");
person.setDescription("Sweden, Company1, Some Person");
@@ -112,7 +112,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
public void testCreateWithException() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setId(2);
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
@@ -148,7 +148,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
public void testCreate() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setId(2);
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
@@ -161,7 +161,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
person = null;
log.debug("Verifying result");
Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2));
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 2);
assertThat(ldapResult).isNotNull();
assertThat(fromDb).isNotNull();
}
@@ -169,7 +169,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
@Test
public void testUpdateWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
originalPerson.setLastname("fooo");
try {
this.dummyDao.updateWithException(originalPerson);
@@ -189,7 +189,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
}
});
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
assertThat(notUpdatedPerson.getLastname()).isEqualTo("Person");
assertThat(notUpdatedPerson.getDescription()).isEqualTo("Sweden, Company1, Some Person");
@@ -200,7 +200,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
@Test
public void testUpdate() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
person.setLastname("Updated Person");
person.setDescription("Updated description");
@@ -215,7 +215,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
}
});
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
assertThat(updatedPerson.getLastname()).isEqualTo("Updated Person");
assertThat(updatedPerson.getDescription()).isEqualTo("Updated description");
assertThat(ldapResult).isNotNull();
@@ -225,7 +225,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
public void testUpdateAndRenameWithException() {
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
person.setLastname("Updated Person");
person.setDescription("Updated description");
@@ -320,7 +320,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
@Test
public void testUnbindWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
try {
// Perform test
@@ -340,7 +340,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
}
});
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); // will
// throw
// exception
// of
@@ -356,7 +356,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
public void testUnbind() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
// Perform test
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
this.dummyDao.unbind(person);
try {
@@ -368,7 +368,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends
assertThat(true).isTrue();
}
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1));
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 1);
assertThat(person).isNull();
}

View File

@@ -61,7 +61,7 @@ public class ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests
public void testCreate() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setId(2);
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");

View File

@@ -80,7 +80,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
}
OrgPerson person = new OrgPerson();
person.setId(new Integer(1));
person.setId(1);
person.setLastname("Person");
person.setFullname("Some Person");
person.setDescription("Sweden, Company1, Some Person");
@@ -113,7 +113,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
public void testCreateWithException() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setId(2);
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
@@ -149,7 +149,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
public void testCreate() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setId(2);
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
@@ -162,7 +162,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
person = null;
log.debug("Verifying result");
Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2));
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 2);
assertThat(ldapResult).isNotNull();
assertThat(fromDb).isNotNull();
}
@@ -170,7 +170,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
@Test
public void testUpdateWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
originalPerson.setLastname("fooo");
try {
this.dummyDao.updateWithException(originalPerson);
@@ -190,7 +190,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
}
});
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
assertThat(notUpdatedPerson.getLastname()).isEqualTo("Person");
assertThat(notUpdatedPerson.getDescription()).isEqualTo("Sweden, Company1, Some Person");
@@ -201,7 +201,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
@Test
public void testUpdate() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
person.setLastname("Updated Person");
person.setDescription("Updated description");
@@ -216,7 +216,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
}
});
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
assertThat(updatedPerson.getLastname()).isEqualTo("Updated Person");
assertThat(updatedPerson.getDescription()).isEqualTo("Updated description");
assertThat(ldapResult).isNotNull();
@@ -226,7 +226,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
public void testUpdateAndRenameWithException() {
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
person.setLastname("Updated Person");
person.setDescription("Updated description");
@@ -321,7 +321,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
@Test
public void testUnbindWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
try {
// Perform test
@@ -341,7 +341,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
}
});
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); // will
// throw
// exception
// of
@@ -357,7 +357,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
public void testUnbind() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
// Perform test
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
this.dummyDao.unbind(person);
try {
@@ -369,7 +369,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends
assertThat(true).isTrue();
}
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1));
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 1);
assertThat(person).isNull();
}