Skip to content

Commit 9af4491

Browse files
committedJun 4, 2019
Added generics in LDAPException
1 parent 4c23680 commit 9af4491

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed
 

‎java-sdk/ietfldap/org/ietf/ldap/LDAPException.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
* ***** END LICENSE BLOCK ***** */
3838
package org.ietf.ldap;
3939

40-
import java.util.*;
41-
import org.ietf.ldap.client.*;
42-
import org.ietf.ldap.client.opers.*;
43-
import java.io.*;
40+
import java.io.IOException;
41+
import java.io.Serializable;
42+
import java.util.Hashtable;
43+
import java.util.Locale;
44+
import java.util.PropertyResourceBundle;
4445

4546
/**
4647
* Indicates that an error has occurred. An <CODE>LDAPException</CODE>
@@ -599,7 +600,7 @@ public class LDAPException extends Exception
599600
private String matchedDN = null;
600601
private Throwable rootException = null;
601602
private Locale m_locale = Locale.getDefault();
602-
private static Hashtable cacheResource = new Hashtable();
603+
private static Hashtable<String, PropertyResourceBundle> cacheResource = new Hashtable<>();
603604
private static final String baseName = "org/ietf/ldap/errors/ErrorCodes";
604605

605606
/**
@@ -1056,7 +1057,7 @@ public synchronized static String resultCodeToString( int code,
10561057
try {
10571058
String localeStr = locale.toString();
10581059
PropertyResourceBundle p =
1059-
(PropertyResourceBundle)cacheResource.get(localeStr);
1060+
cacheResource.get(localeStr);
10601061

10611062
if (p == null) {
10621063
p = LDAPResourceBundle.getBundle(baseName);

‎java-sdk/ldapjdk/netscape/ldap/LDAPException.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
* ***** END LICENSE BLOCK ***** */
3838
package netscape.ldap;
3939

40-
import java.util.*;
41-
import netscape.ldap.client.*;
42-
import netscape.ldap.client.opers.*;
43-
import java.io.*;
40+
import java.io.IOException;
41+
import java.util.Hashtable;
42+
import java.util.Locale;
43+
import java.util.PropertyResourceBundle;
4444

4545
/**
4646
* Indicates that an error has occurred. An <CODE>LDAPException</CODE>
@@ -139,7 +139,7 @@
139139
* 95 <A HREF="#MORE_RESULTS_TO_RETURN">MORE_RESULTS_TO_RETURN</A>
140140
* 96 <A HREF="#CLIENT_LOOP">CLIENT_LOOP</A>
141141
* 97 <A HREF="#REFERRAL_LIMIT_EXCEEDED">REFERRAL_LIMIT_EXCEEDED</A>
142-
* 112 <A HREF="#TLS_NOT_SUPPORTED">TLS_NOT_SUPPORTED</A> (LDAP v3)
142+
* 112 <A HREF="#TLS_NOT_SUPPORTED">TLS_NOT_SUPPORTED</A> (LDAP v3)
143143
* </PRE>
144144
* <P>
145145
*
@@ -590,7 +590,7 @@ public class LDAPException extends java.lang.Exception
590590
private String extraMessage = null;
591591
private String matchedDN = null;
592592
private Locale m_locale = Locale.getDefault();
593-
private static Hashtable cacheResource = new Hashtable();
593+
private static Hashtable<String, PropertyResourceBundle> cacheResource = new Hashtable<>();
594594
private static final String baseName = "netscape/ldap/errors/ErrorCodes";
595595

596596
/**
@@ -760,7 +760,7 @@ public int getLDAPResultCode () {
760760
public String getLDAPErrorMessage () {
761761
return errorMessage;
762762
}
763-
763+
764764

765765
/**
766766
* Adds additional explanation to the error message
@@ -777,7 +777,7 @@ void setExtraMessage (String msg) {
777777
/**
778778
* Returns the maximal subset of a DN which could be matched by the
779779
* server.
780-
*
780+
*
781781
* The method should be used if the server returned one of the
782782
* following errors:
783783
* <UL>
@@ -925,7 +925,7 @@ public synchronized static String errorCodeToString(int code, Locale locale) {
925925
try {
926926
String localeStr = locale.toString();
927927
PropertyResourceBundle p =
928-
(PropertyResourceBundle)cacheResource.get(localeStr);
928+
cacheResource.get(localeStr);
929929

930930
if (p == null) {
931931
p = LDAPResourceBundle.getBundle(baseName);

0 commit comments

Comments
 (0)
Please sign in to comment.