Skip to content

Commit 3111ce6

Browse files
committed
Remove Deprecation Warnings
- Address usage of new Integer - Address missing deprecation markers Closes gh-793
1 parent d4d846a commit 3111ce6

15 files changed

+51
-29
lines changed

Diff for: core/src/main/java/org/springframework/ldap/core/DistinguishedName.java

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
* @deprecated As of 2.0 it is recommended to use {@link javax.naming.ldap.LdapName} along
9898
* with utility methods in {@link LdapUtils} instead.
9999
*/
100+
@Deprecated
100101
public class DistinguishedName implements Name {
101102

102103
/**

Diff for: core/src/main/java/org/springframework/ldap/core/LdapEntryIdentification.java

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class LdapEntryIdentification {
5454
* {@link #LdapEntryIdentification(javax.naming.ldap.LdapName, javax.naming.ldap.LdapName)}
5555
* instead.
5656
*/
57+
@Deprecated
5758
public LdapEntryIdentification(DistinguishedName absoluteDn, DistinguishedName relativeDn) {
5859
Assert.notNull(absoluteDn, "Absolute DN must not be null");
5960
Assert.notNull(relativeDn, "Relative DN must not be null");
@@ -103,6 +104,7 @@ public LdapName getRelativeName() {
103104
* @deprecated {@link DistinguishedName} and associated classes and methods are
104105
* deprecated as of 2.0. use {@link #getRelativeName()} instead.
105106
*/
107+
@Deprecated
106108
public DistinguishedName getRelativeDn() {
107109
return new DistinguishedName(this.relativeDn);
108110
}
@@ -114,6 +116,7 @@ public DistinguishedName getRelativeDn() {
114116
* @deprecated {@link DistinguishedName} and associated classes and methods are
115117
* deprecated as of 2.0. use {@link #getAbsoluteName()} instead.
116118
*/
119+
@Deprecated
117120
public DistinguishedName getAbsoluteDn() {
118121
return new DistinguishedName(this.absoluteDn);
119122
}

Diff for: core/src/main/java/org/springframework/ldap/core/LdapOperations.java

+8
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ <T> List<T> search(Name base, String filter, SearchControls controls, Attributes
11781178
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or
11791179
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
11801180
*/
1181+
@Deprecated
11811182
boolean authenticate(Name base, String filter, String password);
11821183

11831184
/**
@@ -1203,6 +1204,7 @@ <T> List<T> search(Name base, String filter, SearchControls controls, Attributes
12031204
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or
12041205
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
12051206
*/
1207+
@Deprecated
12061208
boolean authenticate(String base, String filter, String password);
12071209

12081210
/**
@@ -1226,6 +1228,7 @@ <T> List<T> search(Name base, String filter, SearchControls controls, Attributes
12261228
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
12271229
* @see #authenticate(Name, String, String)
12281230
*/
1231+
@Deprecated
12291232
boolean authenticate(Name base, String filter, String password, AuthenticatedLdapEntryContextCallback callback);
12301233

12311234
/**
@@ -1249,6 +1252,7 @@ <T> List<T> search(Name base, String filter, SearchControls controls, Attributes
12491252
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
12501253
* @see #authenticate(String, String, String)
12511254
*/
1255+
@Deprecated
12521256
boolean authenticate(String base, String filter, String password, AuthenticatedLdapEntryContextCallback callback);
12531257

12541258
/**
@@ -1276,6 +1280,7 @@ <T> List<T> search(Name base, String filter, SearchControls controls, Attributes
12761280
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
12771281
* @see #authenticate(Name, String, String, AuthenticatedLdapEntryContextCallback)
12781282
*/
1283+
@Deprecated
12791284
boolean authenticate(Name base, String filter, String password, AuthenticatedLdapEntryContextCallback callback,
12801285
AuthenticationErrorCallback errorCallback);
12811286

@@ -1304,6 +1309,7 @@ boolean authenticate(Name base, String filter, String password, AuthenticatedLda
13041309
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
13051310
* @see #authenticate(String, String, String, AuthenticatedLdapEntryContextCallback)
13061311
*/
1312+
@Deprecated
13071313
boolean authenticate(String base, String filter, String password, AuthenticatedLdapEntryContextCallback callback,
13081314
AuthenticationErrorCallback errorCallback);
13091315

@@ -1328,6 +1334,7 @@ boolean authenticate(String base, String filter, String password, AuthenticatedL
13281334
* @see #authenticate(Name, String, String, AuthenticatedLdapEntryContextCallback,
13291335
* AuthenticationErrorCallback)
13301336
*/
1337+
@Deprecated
13311338
boolean authenticate(Name base, String filter, String password, AuthenticationErrorCallback errorCallback);
13321339

13331340
/**
@@ -1350,6 +1357,7 @@ boolean authenticate(String base, String filter, String password, AuthenticatedL
13501357
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or
13511358
* {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)}
13521359
*/
1360+
@Deprecated
13531361
boolean authenticate(String base, String filter, String password, AuthenticationErrorCallback errorCallback);
13541362

13551363
/**

Diff for: core/src/main/java/org/springframework/ldap/core/LdapRdn.java

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* @author Mattias Hellborg Arthursson
3939
* @deprecated {@link DistinguishedName} and associated classes are deprecated as of 2.0.
4040
*/
41+
@Deprecated
4142
public class LdapRdn implements Serializable, Comparable {
4243

4344
private static final long serialVersionUID = 5681397547245228750L;

Diff for: core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* @author Mattias Hellborg Arthursson
3636
* @deprecated {@link DistinguishedName} and associated classes are deprecated as of 2.0.
3737
*/
38+
@Deprecated
3839
public class LdapRdnComponent implements Comparable, Serializable {
3940

4041
private static final long serialVersionUID = -3296747972616243038L;
@@ -111,6 +112,7 @@ public String getKey() {
111112
* @deprecated Using this method changes the internal state of surrounding
112113
* DistinguishedName instance. This should be avoided.
113114
*/
115+
@Deprecated
114116
public void setKey(String key) {
115117
Assert.hasText(key, "Key must not be empty");
116118
this.key = key;
@@ -130,6 +132,7 @@ public String getValue() {
130132
* @deprecated Using this method changes the internal state of surrounding
131133
* DistinguishedName instance. This should be avoided.
132134
*/
135+
@Deprecated
133136
public void setValue(String value) {
134137
Assert.hasText(value, "Value must not be empty");
135138
this.value = value;

Diff for: core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathSource.java

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public interface BaseLdapPathSource {
3838
* @deprecated {@link DistinguishedName} and associated classes and methods are
3939
* deprecated as of 2.0. Use {@link #getBaseLdapName()} instead.
4040
*/
41+
@Deprecated
4142
DistinguishedName getBaseLdapPath();
4243

4344
/**

Diff for: core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManager.java

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* probably not such a good idea after all. AbstractPlatformTransactionManager is not
3939
* designed for this usage.
4040
*/
41+
@Deprecated
4142
public class ContextSourceAndDataSourceTransactionManager extends DataSourceTransactionManager {
4243

4344
private static final long serialVersionUID = 6832868697460384648L;

Diff for: core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* probably not such a good idea after all. AbstractPlatformTransactionManager is not
4242
* designed for this usage.
4343
*/
44+
@Deprecated
4445
public class ContextSourceAndHibernateTransactionManager extends HibernateTransactionManager {
4546

4647
/**

Diff for: odm/src/main/java/org/springframework/ldap/odm/core/OdmManager.java

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* @deprecated This functionality is automatically available in LdapTemplate as of version
4040
* 2.0
4141
*/
42+
@Deprecated
4243
public interface OdmManager {
4344

4445
/**

Diff for: odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* @deprecated This functionality is automatically available in LdapTemplate as of version
4343
* 2.0
4444
*/
45+
@Deprecated
4546
public final class OdmManagerImpl implements OdmManager {
4647

4748
// The link to the LDAP directory

Diff for: odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImplFactoryBean.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
* @deprecated This functionality is automatically available in LdapTemplate as of version
4646
* 2.0
4747
*/
48+
@Deprecated
4849
public final class OdmManagerImplFactoryBean implements FactoryBean {
4950

5051
private LdapOperations ldapOperations = null;

Diff for: odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public <T> T convert(Object source, Class<T> toClass) throws Exception {
188188
Integer intSource = null;
189189

190190
if (source.getClass() == String.class) {
191-
intSource = new Integer((String) source);
191+
intSource = Integer.valueOf((String) source);
192192
}
193193
else {
194194
if (source.getClass() == Integer.class) {
@@ -213,7 +213,7 @@ public <T> T convert(Object source, Class<T> toClass) throws Exception {
213213
Integer intSource = null;
214214

215215
if (source.getClass() == String.class) {
216-
intSource = new Integer((String) source);
216+
intSource = Integer.valueOf((String) source);
217217
}
218218
else {
219219
if (source.getClass() == Integer.class) {

Diff for: test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerIntegrationTests.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void prepareTest() throws Exception {
7979
}
8080

8181
OrgPerson person = new OrgPerson();
82-
person.setId(new Integer(1));
82+
person.setId(1);
8383
person.setLastname("Person");
8484
person.setFullname("Some Person");
8585
person.setDescription("Sweden, Company1, Some Person");
@@ -112,7 +112,7 @@ public void cleanup() throws Exception {
112112
public void testCreateWithException() {
113113
OrgPerson person = new OrgPerson();
114114

115-
person.setId(new Integer(2));
115+
person.setId(2);
116116
person.setDescription("some description");
117117
person.setFullname("Some testperson");
118118
person.setLastname("testperson");
@@ -148,7 +148,7 @@ public void testCreateWithException() {
148148
public void testCreate() {
149149
OrgPerson person = new OrgPerson();
150150

151-
person.setId(new Integer(2));
151+
person.setId(2);
152152
person.setDescription("some description");
153153
person.setFullname("Some testperson");
154154
person.setLastname("testperson");
@@ -161,15 +161,15 @@ public void testCreate() {
161161
person = null;
162162
log.debug("Verifying result");
163163
Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
164-
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2));
164+
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 2);
165165
assertThat(ldapResult).isNotNull();
166166
assertThat(fromDb).isNotNull();
167167
}
168168

169169
@Test
170170
public void testUpdateWithException() {
171171
String dn = "cn=Some Person,ou=company1,ou=Sweden";
172-
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
172+
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
173173
originalPerson.setLastname("fooo");
174174
try {
175175
this.dummyDao.updateWithException(originalPerson);
@@ -189,7 +189,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
189189
}
190190
});
191191

192-
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
192+
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
193193
assertThat(notUpdatedPerson.getLastname()).isEqualTo("Person");
194194
assertThat(notUpdatedPerson.getDescription()).isEqualTo("Sweden, Company1, Some Person");
195195

@@ -200,7 +200,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
200200
@Test
201201
public void testUpdate() {
202202
String dn = "cn=Some Person,ou=company1,ou=Sweden";
203-
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
203+
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
204204
person.setLastname("Updated Person");
205205
person.setDescription("Updated description");
206206

@@ -215,7 +215,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
215215
}
216216
});
217217

218-
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
218+
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
219219
assertThat(updatedPerson.getLastname()).isEqualTo("Updated Person");
220220
assertThat(updatedPerson.getDescription()).isEqualTo("Updated description");
221221
assertThat(ldapResult).isNotNull();
@@ -225,7 +225,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
225225
public void testUpdateAndRenameWithException() {
226226
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
227227
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
228-
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
228+
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
229229
person.setLastname("Updated Person");
230230
person.setDescription("Updated description");
231231

@@ -320,7 +320,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
320320
@Test
321321
public void testUnbindWithException() {
322322
String dn = "cn=Some Person,ou=company1,ou=Sweden";
323-
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
323+
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
324324

325325
try {
326326
// Perform test
@@ -340,7 +340,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
340340
}
341341
});
342342

343-
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will
343+
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); // will
344344
// throw
345345
// exception
346346
// of
@@ -356,7 +356,7 @@ public Object mapFromAttributes(Attributes attributes) throws NamingException {
356356
public void testUnbind() {
357357
String dn = "cn=Some Person,ou=company1,ou=Sweden";
358358
// Perform test
359-
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
359+
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1);
360360
this.dummyDao.unbind(person);
361361

362362
try {
@@ -368,7 +368,7 @@ public void testUnbind() {
368368
assertThat(true).isTrue();
369369
}
370370

371-
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1));
371+
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 1);
372372
assertThat(person).isNull();
373373
}
374374

Diff for: test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void prepareTest() throws Exception {
6161
public void testCreate() {
6262
OrgPerson person = new OrgPerson();
6363

64-
person.setId(new Integer(2));
64+
person.setId(2);
6565
person.setDescription("some description");
6666
person.setFullname("Some testperson");
6767
person.setLastname("testperson");

0 commit comments

Comments
 (0)